Mesh¶
- class tfv.geometry.Mesh(node_x, node_y, cell_node)¶
Creates object which handles common 2D polygonal mesh based geometry operations
- Parameters:
node_x (1D np.ndarray) – X coordinate of mesh vertices
node_y (1D np.ndarray) – Y coordinate of mesh vertices
cell_node (2D np.ndarray) – A (n, 4) array defining each mesh cell/element by four node indices
- nc2¶
Number of 2D mesh cells
- Type:
int
- nv2¶
Number of 2D mesh vertices
- Type:
int
- is_tri¶
Logical index of triangular elements
- Type:
1D np.ndarray
- is_quad¶
Logical index of quadrilateral elements
- Type:
1D np.ndarray
- edge_node¶
Tuple defining start node, end node and cell for each mesh half edge
- Type:
tuple
- weights¶
A (n, 4) array defining weighting of each cell gives to each mesh vertex
- Type:
2D np.ndarray
- tri_cell_node¶
A (n, 3) array defining each mesh cell/element by three node indices
- Type:
2D np.ndarray
- tri_cell_index¶
A (n,) array mapping triangular mesh elements to base mesh elements
- Type:
1D np.ndarray
- get_cell_index(xp, yp)¶
Query to extract the mesh cell indices of scatter points
- Parameters:
xp (1D np.ndarray) – X coordinate of scatter data
yp (1D np.ndarray) – Y coordinate of scatter data
- Returns:
index – Mesh cell index for each scatter point
- Return type:
1D np.ndarray
- get_grid_index(grid_x, grid_y)¶
Query to extract the mesh cell indices of each point in a grid
- Parameters:
grid_x (1D np.ndarray) – Horizontal grid point values
grid_y (1D np.ndarray) – Vertical grid point values
- Returns:
grid_index – Mesh cell index for each point in grid
- Return type:
2D np.ndarray
- get_intersection_data(polyline)¶
Query to extract data for intersections(x) of a polyline and the mesh half-edges
- Parameters:
polyline (2D np.ndarray) – Polyline as [x, y] which intersects mesh half-edges.
- Returns:
x – Intersection(x) data defined by coordinates & mesh cell index (x, y, ii)
- Return type:
tuple