UGrid¶
A class to contain grid geometry.
-
class
xms.grid.ugrid.
UGrid
(points=None, cellstream=None, **kwargs)¶ Class for representing unstructured grid geometries
-
xms.grid.ugrid.UGrid.
cell_type_enum
¶ -
Represent the vtk type of a cell
-
property
cell_count
¶ Get the number of cells in the UGrid
-
property
cellstream
¶ Get cell stream vector for the entire UGrid
-
property
dimension_counts
¶ Count all number of the cells with each dimension (0, 1, 2, 3)
-
property
extents
¶ Get extents of the entire UGrid
-
get_cell_2d_edge_adjacent_cell
(cell_idx, edge_idx)¶ Get the index of the adjacent cells (that shares the same cell edge)
- Parameters
cell_idx (int) – The index of the cell containing the edge
edge_idx (int) – The edge index in the cell
- Returns
List of cell indices of the cells adjacent to the edge
-
get_cell_3d_face_adjacent_cell
(cell_idx, face_idx)¶ Get the cell face neighbors for given cell and face index
- Parameters
cell_idx (int) – The index of the cell containing the face
face_idx (int) – The index of the face in the cell
- Returns
The cell index of the cell adjacent to the face_idx face of cell_idx
- Return type
int
-
get_cell_3d_face_count
(cell_idx)¶ Get the number of cell faces for given cell
- Parameters
cell_idx (int) – The index of the cell
- Returns
The number of cell faces in the cell
- Return type
int
-
get_cell_3d_face_orientation
(cell_idx, face_idx)¶ Get the orientation of the face of a vertically prismatic cell
- Parameters
cell_idx (int) – The index of the cell containing the face
face_idx (int) – The index of the face in the cell
- Returns
The face orientation enum of the face
-
get_cell_3d_face_point_count
(cell_idx, face_idx)¶ Get the number of face points for a given cell and face
- Parameters
cell_idx (int) – The index of the cell containing the face
face_idx (int) – The index of the face in the cell
- Returns
The number of points in the cell face
- Return type
int
-
get_cell_3d_face_points
(cell_idx, face_idx)¶ Get the cell face for given cell and face index
- Parameters
cell_idx (int) – The index of the cell containing the face
face_idx (int) – The index of the face in the cell
- Returns
List of point indices of the points that define the cell face
-
get_cell_3d_faces_points
(cell_idx)¶ Get the faces of a cell
- Parameters
cell_idx (int) – The index of the cell
- Returns
List of lists of point indices of the points that define the cell’s faces
-
get_cell_adjacent_cells
(cell_idx)¶ Get the cells neighboring a cell (cells associated with any of it’s points)
- Parameters
cell_idx (int) – The index of the cell to find neighboring cells of
- Returns
List of integer cell indices of the cells adjacent to cell_idx
-
get_cell_cellstream
(cell_idx)¶ Get cell stream list for a single cell
- Parameters
cell_idx (int) – The index of the cell
- Returns
List of integers representing the cell - [cell type, number of points, pt_index_1, …, pt_index_n]
-
get_cell_centroid
(cell_idx)¶ Get the centroid location of a cell
- Parameters
cell_idx (int) – The index of the cell
- Returns
Tuple point location of the cell’s center
-
get_cell_dimension
(cell_idx)¶ Get the dimension of the specified cell
- Parameters
cell_idx (int) – The index of the cell
- Returns
The number of dimensions of the cell
- Return type
int
-
get_cell_edge
(cell_idx, edge_idx)¶ Get a specified edge of a cell
- Parameters
cell_idx (int) – The index of the cell containing the edge
edge_idx (int) – The edge index in the cell
- Returns
Tuple of point indices of the points that define the edge
-
get_cell_edge_adjacent_cells
(cell_idx, edge_idx)¶ Get the indices of the adjacent cells (that shares the same cell edge)
- Parameters
cell_idx (int) – The index of the cell containing the edge
edge_idx (int) – The edge index in the cell
- Returns
List of cell indices of the cells adjacent to the edge
-
get_cell_edge_count
(cell_idx)¶ Get the number of edges for a cell
- Parameters
cell_idx (int) – The index of the cell
- Returns
The number of edges in the cell
- Return type
int
-
get_cell_edges
(cell_idx)¶ Get the edges of a cell
- Parameters
cell_idx (int) – The index of the cell
- Returns
List of 2-tuple of point indices that define the cell’s edges
-
get_cell_extents
(cell_idx)¶ Get the extents of the given cell
- Parameters
cell_idx (int) – The index of the cell
- Returns
Tuple of point locations of the minimum and maximum extents of the UGrid
-
get_cell_locations
(cell_idx)¶ Get locations of cell points
- Parameters
cell_idx (int) – The index of the cell
- Returns
List of tuple point locations of the points that define the cell
-
get_cell_plan_view_polygon
(cell_idx)¶ Get the plan view polygon of a specified cell
- Parameters
cell_idx (int) – The index of the cell to get plan view polygon for
- Returns
- Tuple of bool (False if plan view polygon could not be created) and a list of tuple point locations
defining the plan view polygon.
-
get_cell_point_count
(cell_idx)¶ Get the number of cell points (including polyhedron)
- Parameters
cell_idx (int) – The index of the cell
- Returns
Number of points in the cell
-
get_cell_points
(cell_idx)¶ Get the points of a cell (including polyhedron)
- Parameters
cell_idx (int) – The index of the cell
- Returns
List of point indices of the points that define the cell
-
get_cell_type
(cell_idx)¶ Get a cell’s type
- Parameters
cell_idx (int) – The index of the cell
- Returns
The cell’s type enum
-
get_cells_adjacent_to_edge
(point1, point2)¶ Get cells adjacent to both points
- Parameters
point1 (int) – The index of the edge’s first point
point2 (int) – The index of the edge’s second point
- Returns
List of cell indices of cells adjacent to the edge defined by point1 and point2
-
get_edge_adjacent_cells
(edge)¶ Get the indices of the adjacent cells (that shares the same cell edge)
- Parameters
edge – Tuple of two point locations that define an edge
- Returns
List of cell indices that are adjacent to the edge
-
get_point_adjacent_cells
(point_idx)¶ Get cells adjacent to a point
- Parameters
point_idx (int) – The index of the point to find adjacent cells of
- Returns
List of cell indices of cells adjacent to point_idx
-
get_point_adjacent_locations
(point_idx)¶ Given a point gets point locations attached to the point by an edges
- Parameters
point_idx (int) – The index of the point to find adjacent point locations for
- Returns
List of tuple point locations of points that are attached to point_idx by an edge
-
get_point_adjacent_points
(point_idx)¶ Given a point gets point indices attached to the point by an edge
- Parameters
point_idx (int) – The index of the point to find adjacent point indices for
- Returns
List of point indices that are attached to point_idx by an edge
-
get_point_location
(point_idx)¶ Get location of a single point
- Parameters
point_idx (int) – The index of the point
- Returns
A tuple point location of the point at point_idx
-
get_point_xy0
(point_idx)¶ Get x, y location of a single point with z set to 0.0
- Parameters
point_idx (int) – The index of the point
- Returns
A tuple point location of point_idx
-
get_points_adjacent_cells
(point_indices)¶ Get adjacent cells common to a set of points
- Parameters
point_indices – The indices of the points to find adjacent cells of
- Returns
List of cell indices of cells adjacent to point_indices
-
get_points_locations
(point_indices)¶ Get locations of multiple points
- Parameters
point_indices – The indices of the points
- Returns
List of tuple point locations of the point_indices
-
is_valid_point_change
(point_idx, new_position)¶ Determine whether adjacent cells are valid after a point is moved.
- Parameters
point_idx (int) – The index of the point to check change
new_position – Tuple location of the point’s new location
- Returns
True if the point change is valid, False otherwise
-
property
locations
¶ Point locations for ugrid
-
property
modified
¶ Flag if grid is modified
-
property
point_count
¶ Point count for ugrid
-
set_point_location
(point_idx, location)¶ Set location of a single point
- Parameters
point_idx (int) – The index of the point
location –
- Returns
True if successful
- Return type
bool
-
set_unmodified
()¶ Set grid as unmodified
-
use_cache
(use_cache)¶ Flag if cache is being used
- Parameters
use_cache (bool) – flag if cache is being used
-