UnstructuredMesh
-
class UnstructuredMesh : public godzilla::Mesh
Unstructured mesh (wrapper around DMPLEX + extra stuff)
Public Functions
-
Label get_depth_label() const
Get the
Label
recording the depth of each point.- Returns:
The
Label
recording point depth
-
Int get_num_vertices() const
Return the number of mesh vertices.
-
Range get_vertex_range() const
Get range of vertex indices.
- Returns:
Range of vertex indices
-
Int get_num_faces() const
Return the number of mesh faces.
-
Range get_face_range() const
Get range of face indices.
- Returns:
Range of face indices
-
Int get_num_cells() const
Return the number of mesh cells (interior)
- Returns:
Number of mesh cells (interior)
-
Int get_num_all_cells() const
Return the number of all mesh cells (interior + ghosted)
- Returns:
Number of all mesh cells (interior + ghosted)
-
Range get_cell_range() const
Get range of cell indices (interior only)
- Returns:
Range of cell indices
-
Range get_all_cell_range() const
Get range of all cell indices (interior + ghosted)
- Parameters:
Range – of all cell indices (interior + ghosted)
-
Range get_my_cell_range() const
Get range of cell indices owned by this processor (must call
create_my_cells_label
first)- Returns:
Range of cell indices
-
Range get_ghost_cell_range() const
Get range of ghost cell indices.
- Parameters:
Range – of ghost cell indices
-
IndexSet get_all_cells() const
Get index set with all cells.
- Returns:
Index set with all cells
-
IndexSet get_facets() const
Get index set with facets.
- Returns:
Index set with facets
-
Range get_chart() const
Return the interval for all mesh points [start, end)
- Returns:
Range of mesh points
-
void set_chart(Int start, Int end)
Set the interval for all mesh points
[start, end)
- Parameters:
start – The first mesh point
end – The upper bound for mesh points
-
PolytopeType get_cell_type(Int cell) const
Get cell type.
- Parameters:
cell – Cell index
- Returns:
Cell type
-
void create_closure_index()
Calculate an index for the default section.
-
void create_closure_index(const Section §ion)
Calculate an index for the given Section for the closure operation.
- Parameters:
section – The section describing the layout in the local vector
-
std::vector<Int> get_connectivity(Int point) const
Get connectivity.
- Parameters:
point – Point with must lie in the chart
- Returns:
Point connectivity
-
std::vector<Int> get_support(Int point) const
Return the points on the out-edges for this point.
- Parameters:
point – Point with must lie in the chart
- Returns:
Points which are on the out-edges for point
p
-
Int get_support_size(Int point) const
Return the number of out-edges for this point in the DAG.
- Parameters:
point – Point with must lie in the chart
- Returns:
The support size for
point
-
std::vector<Int> get_cone(Int point) const
Return the points on the in-edges for this point.
- Parameters:
point – Point with must lie in the chart
- Returns:
Points which are on the out-edges for point
p
-
Int get_cone_size(Int point) const
Return the number of in-edges for this point in the DAG.
- Parameters:
point – The point, which must lie in the chart set with
set_chart
- Returns:
The cone size for
point
-
IndexSet get_cone_recursive_vertices(IndexSet points) const
Expand each given point into its cone points and do that recursively until we end up just with vertices.
- Parameters:
points – IndexSet of points with must lie in the chart
- Returns:
Vertices recursively expanded from input points
-
void set_cone_size(Int point, Int size)
Set the number of in-edges for this point in the DAG.
- Parameters:
point – The point, which must lie in the chart set with
set_chart
size – The cone size for point
p
-
void set_cone(Int point, const std::vector<Int> &cone)
Set the points on the in-edges for this point in the DAG; that is these are the points that cover the specific point.
- Parameters:
point – The point, which must lie in the chart set with
set_chart
cone – An array of points which are on the in-edges for point
p
-
Int get_point_depth(Int point) const
Get the depth of a given point.
- Parameters:
point – The point @retrun The depth of the point
-
bool is_simplex() const
Is the first cell in the mesh a simplex?
- Returns:
true if cell is a simplex, otherwise false
-
const std::string &get_cell_set_name(Int id) const
Get cell set name.
- Parameters:
id – The ID of the cell set
- Returns:
Cell set name
-
Int get_cell_set_id(const std::string &name) const
Get cell set ID.
- Parameters:
name – The name of a cell sel
- Returns:
Cell set ID
-
Int get_num_cell_sets() const
Get number of cell sets.
- Returns:
Number of cell sets
-
const std::map<Int, std::string> &get_cell_sets() const
Get cell sets.
- Returns:
Cell sets
-
void create_cell_set(Int id, const std::string &name)
Create cell set.
Takes the ID and creates a label with
name
corresponding to the ID.- Parameters:
id – Cell set ID
name – Name of the cell set to create
-
void set_cell_set_name(Int id, const std::string &name)
Create an entry in cell set name map.
- Parameters:
id – Cell set ID
name – Cell set name
-
void set_cell_type(Int cell, PolytopeType cell_type)
Set the polytope type of a given cell.
- Parameters:
cell – The cell
cell_type – The polytope type of the cell
-
const std::string &get_face_set_name(Int id) const
Get face set name.
- Parameters:
id – The ID of the face set
- Returns:
Facet name
-
Int get_num_face_sets() const
Get number of face sets.
- Returns:
Number of face sets
-
const std::map<Int, std::string> &get_face_sets() const
Get face sets.
- Returns:
Face sets
-
bool has_face_set(const std::string &name) const
Check if mesh has a label corresponding to a face set name.
- Parameters:
name – The name of the face set
- Returns:
true if label exists, false otherwise
-
Label get_face_set_label(const std::string &name) const
Get label corresponding to a face set name.
- Parameters:
name – The name of the face set
- Returns:
Label associated with face set name
-
void create_face_set(Int id, const std::string &name)
Create face set.
Takes the ID and creates a label with
name
corresponding to the ID.- Parameters:
id – Face set ID
name – Name of the face set to create
-
void set_face_set_name(Int id, const std::string &name)
Create an entry in face set name map.
- Parameters:
id – Face set ID
name – Face set name
-
Int get_num_vertex_sets() const
Get number of vertex sets.
- Returns:
Number of vertex sets
-
void set_partitioner(const Partitioner &part)
Set the mesh partitioner.
- Parameters:
part – The partitioner
-
void distribute(Int overlap)
Distributes the mesh and any associated sections.
- Parameters:
overlap – The overlap of partitions
-
bool is_distributed() const
Find out whether this mesh is distributed.
- Returns:
true
if the mesh is distributed,false
otherwise
-
void construct_ghost_cells()
Construct ghost cells which connect to every boundary face.
-
void compute_cell_geometry(Int cell, Real *vol, Real centroid[], Real normal[]) const
Compute the volume for a given cell.
- Parameters:
cell – The cell
vol – The cell volume
centroid – The cell centroid
normal – The cell normal, if appropriate
-
Real compute_cell_volume(Int cell) const
Compute the volume for a given cell.
- Parameters:
cell – The cell
- Returns:
The cell volume
-
const std::map<Int, std::vector<Int>> &common_cells_by_vertex()
Compute a map of cells common to a vertex.
- Returns:
A mapping [vertex index -> list of cell indices]
-
void mark_boundary_faces(Int val, Label &label)
Mark all faces on the boundary.
- Parameters:
val – The marker value
label – The
Label
marking boundary faces with the given value
-
StarForest get_point_star_forest() const
Get the encoding of the parallel section point overlap.
-
void interpolate()
Take in a cell-vertex mesh and return one with all intermediate faces, edges, etc.
-
void symmetrize()
Create support (out-edge) information from cone (in-edge) information.
-
void stratify()
Computes the strata for all points in the mesh.
-
std::vector<Int> get_full_join(const std::vector<Int> &points)
Get an array for the join of the set of points.
- Parameters:
points – The input points
- Returns:
The points in the join
-
std::vector<Real> get_vertex_coordinates(Int pt) const
Get coordinates of a mesh vertex.
- Returns:
Vector with dimension components containing vertex coordinates
-
IndexSet get_cell_numbering() const
Get a global cell numbering for all cells on this process.
- Returns:
Global cell numbers on this process
-
void create_my_cells_label()
Create a label named “my_cells” that marks all cells owned by this processor with 1 and cells owned by other processors with 0.
-
void create_my_facets_label()
Create a label named “my_facets” that marks all facets owned by this processor with 1 and facets owned by other processors with 0.
-
bool is_my_cell(Int cell) const
Check if cell is owned by this process.
- Parameters:
cell – The cell to check
- Returns:
true
if the cell is owned by this process,false
otherwise
Public Static Functions
-
static UnstructuredMesh *build_from_cell_list(const mpi::Communicator &comm, Int dim, Int n_corners, const std::vector<Int> &cells, Int space_dim, const std::vector<Real> &vertices, bool interpolate)
Build from a list of vertices for each cell (common mesh generator output)
NOTES:
only process 0 takes in the input
- Parameters:
comm – MPI communicator
dim – The topological dimension of the mesh
n_corners – The number of vertices for each cell
cells – An array of the vertices for each cell - must be a multiple of
n_corners
space_dim – The spatial dimension used for coordinates
vertices – An array of the coordinates of each vertex - must be a multiple of
space_dim
interpolate – Flag indicating that intermediate mesh entities (faces, edges) should be created automatically
-
static Int get_polytope_dim(PolytopeType type)
Get polytope dimension.
- Parameters:
type – Cell type
-
static void invert_cell(PolytopeType type, std::vector<Int> &cone)
Flips cell orientations since DMPLEX stores some of them internally with outward normals.
- Parameters:
type – Cell type
cone – Cone to invert
-
Label get_depth_label() const