Skip to content

Mesh Preprocessing

preprocessing

Test mesh creation and preparation for Eikonax solver runs.

Info

The creation of test meshes can be done with any other tool. The format of the required adjacency data for Eikonax is strict, however.

Functions:

Name Description
create_test_mesh

Create a simple test mesh with Scipy's Delauny functionality.

get_adjacent_vertex_data

Preprocess mesh data for a vertex-centered evaluation.

eikonax.preprocessing.create_test_mesh

create_test_mesh(mesh_bounds_x: Annotated[Iterable[float], Is[lambda x: len(x) == 2]], mesh_bounds_y: Annotated[Iterable[float], Is[lambda x: len(x) == 2]], num_points_x: Annotated[int, Is[lambda x: x >= 2]], num_points_y: Annotated[int, Is[lambda x: x >= 2]]) -> tuple[jtFloat[npt.NDArray, 'num_vertices dim'], jtInt[npt.NDArray, 'num_simplices 3']]

Create a simple test mesh with Scipy's Delaunay functionality.

This methods creates a simple square mesh with Scipy's Delaunay triangulation.

Parameters:

Name Type Description Default
mesh_bounds_x Iterable[float, float]

Mesh bounds for x-direction

required
mesh_bounds_y Iterable[float, float]

Mesh bounds for y-direction

required
num_points_x int

Number of vertices for x-direction

required
num_points_y int

Number of vertices for y-direction

required

Raises:

Type Description
ValueError

Checks that mesh bounds have correct dimension

ValueError

Checks that mesh bounds are provided correctly

ValueError

Checks that at least two mesh points are chosen

Returns:

Type Description
tuple[jtFloat[npt.NDArray, 'num_vertices dim'], jtInt[npt.NDArray, 'num_simplices 3']]

tuple[npt.NDArray, npt.NDArray]: Array of vertex coordinates and array of simplex indices

eikonax.preprocessing.get_adjacent_vertex_data

get_adjacent_vertex_data(simplices: jtInt[npt.NDArray, 'num_simplices 3'], num_vertices: Annotated[int, Is[lambda x: x > 0]]) -> jtInt[npt.NDArray, 'num_vertices max_num_adjacent_simplices 4']

Preprocess mesh data for a vertex-centered evaluation.

Standard mesh tools provide vertex coordinates and the vertex indices for each simplex. For the vertex-centered solution of the Eikonal equation, however, we need the adjacent simplices/vertices for each vertex. This method performs the necessary transformation.

Parameters:

Name Type Description Default
simplices npt.NDArray

Vertex indices for all simplices

required
num_vertices int

Number of vertices in the mesh

required

Returns:

Type Description
jtInt[npt.NDArray, 'num_vertices max_num_adjacent_simplices 4']

npt.NDArray: Array containing for each vertex the vertex and simplex indices of all adjacent simplices. Dimension is (num_vertices, max_num_adjacent_simplices, 4), where the 4 entries contain the index of an adjacent simplex and the associated vertices. To ensure homogeneous arrays, all vertices have the same (maximum) number of adjacent simplices. Non-existing simplices are buffered with the value -1.