DOLFIN-X
DOLFIN-X C++ interface
Namespaces | Classes | Enumerations | Functions
dolfinx::mesh Namespace Reference

Mesh data structures. More...

Namespaces

 GraphBuilder
 Tools to build a Graph corresponding to various objects.
 
 Partitioning
 Tools for partitioning meshes.
 
 PermutationComputation
 Tools for computing mesh entity permutations.
 
 TopologyComputation
 This class implements a set of basic algorithms that automate the computation of mesh entities and connectivity.
 

Classes

class  Geometry
 Geometry stores the geometry imposed on a mesh. More...
 
class  Mesh
 A Mesh consists of a set of connected and numbered mesh topological entities, and geometry data. More...
 
class  MeshTags
 A MeshTags are used to associate mesh entities with values. The entity index (local to process) identifies the entity. MeshTags is a sparse data storage class; it allows tags to be associated with an arbitrary subset of mesh entities. An entity can have only one associated tag. More...
 
class  Topology
 Topology stores the topology of a mesh, consisting of mesh entities and connectivity (incidence relations for the mesh entities). More...
 

Enumerations

enum  CellType : int {
  point = 1, interval = 2, triangle = 3, tetrahedron = 4,
  quadrilateral = -4, hexahedron = -8
}
 Cell type identifier.
 
enum  GhostMode : int { none, shared_facet, shared_vertex }
 Enum for different partitioning ghost modes.
 

Functions

std::string to_string (CellType type)
 Get the cell string type for a cell type. More...
 
CellType to_type (const std::string &cell)
 Get the cell type from a cell string. More...
 
CellType cell_entity_type (CellType type, int d)
 Return type of cell for entity of dimension d.
 
CellType cell_facet_type (CellType type)
 Return facet type of cell. More...
 
Eigen::Array< int, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > get_entity_vertices (CellType type, int dim)
 Return array entities(num entities, num vertices per entity), where entities(e, k) is the local vertex index for the kth vertex of entity e of dimension dim.
 
Eigen::Array< int, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > get_sub_entities (CellType type, int dim0, int dim1)
 Get entities of dimsion dim1 and that make up entities of dimension dim0.
 
int cell_dim (CellType type)
 Return topological dimension of cell type.
 
int cell_num_entities (mesh::CellType type, int dim)
 Number of entities of dimension dim. More...
 
bool is_simplex (CellType type)
 Check if cell is a simplex. More...
 
int num_cell_vertices (CellType type)
 Number vertices for a cell type. More...
 
std::map< std::array< int, 2 >, std::vector< std::set< int > > > cell_entity_closure (mesh::CellType cell_type)
 Closure entities for a cell, i.e., all lower-dimensional entities attached to a cell entity. Map from entity {dim_e, entity_e} to closure{sub_dim, (sub_entities)}.
 
mesh::Geometry create_geometry (MPI_Comm comm, const Topology &topology, const fem::CoordinateElement &coordinate_element, const graph::AdjacencyList< std::int64_t > &cells, const Eigen::Ref< const Eigen::Array< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor >> &x)
 Build Geometry FIXME: document.
 
Mesh create_mesh (MPI_Comm comm, const graph::AdjacencyList< std::int64_t > &cells, const fem::CoordinateElement &element, const Eigen::Array< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > &x, GhostMode ghost_mode)
 Create a mesh.
 
template<typename T >
mesh::MeshTags< T > create_meshtags (const std::shared_ptr< const mesh::Mesh > &mesh, const int dim, const graph::AdjacencyList< std::int32_t > &entities, const std::vector< T > &values)
 Create MeshTags from arrays. More...
 
std::vector< bool > compute_boundary_facets (const Topology &topology)
 Compute marker for owned facets that are on the exterior of the domain, i.e. are connected to only one cell. The function does not require parallel communication. More...
 
Topology create_topology (MPI_Comm comm, const graph::AdjacencyList< std::int64_t > &cells, const std::vector< std::int64_t > &original_cell_index, const std::vector< int > &ghost_owners, const CellType &cell_type, mesh::GhostMode ghost_mode)
 Create distributed topology. More...
 
graph::AdjacencyList< std::int64_t > extract_topology (const CellType &cell_type, const fem::ElementDofLayout &layout, const graph::AdjacencyList< std::int64_t > &cells)
 Extract topology from cell data, i.e. extract cell vertices. More...
 
Eigen::ArrayXd volume_entities (const Mesh &mesh, const Eigen::Ref< const Eigen::ArrayXi > &entities, int dim)
 Compute (generalized) volume of mesh entities of given dimension.
 
Eigen::ArrayXd circumradius (const Mesh &mesh, const Eigen::Ref< const Eigen::ArrayXi > &entities, int dim)
 Compute circumradius of mesh entities.
 
Eigen::ArrayXd h (const Mesh &mesh, const Eigen::Ref< const Eigen::ArrayXi > &entities, int dim)
 Compute greatest distance between any two vertices.
 
Eigen::ArrayXd inradius (const Mesh &mesh, const Eigen::Ref< const Eigen::ArrayXi > &entities)
 Compute inradius of cells.
 
Eigen::ArrayXd radius_ratio (const Mesh &mesh, const Eigen::Ref< const Eigen::ArrayXi > &entities)
 Compute dim*inradius/circumradius for given cells.
 
Eigen::Array< double, Eigen::Dynamic, 3, Eigen::RowMajor > cell_normals (const Mesh &mesh, int dim)
 Compute normal to given cell (viewed as embedded in 3D)
 
Eigen::Array< double, Eigen::Dynamic, 3, Eigen::RowMajor > midpoints (const mesh::Mesh &mesh, int dim, const Eigen::Ref< const Eigen::Array< int, Eigen::Dynamic, 1 >> &entities)
 Compute midpoints or mesh entities of a given dimension.
 
Eigen::Array< std::int32_t, Eigen::Dynamic, 1 > locate_entities (const mesh::Mesh &mesh, const int dim, const std::function< Eigen::Array< bool, Eigen::Dynamic, 1 >(const Eigen::Ref< const Eigen::Array< double, 3, Eigen::Dynamic, Eigen::RowMajor >> &)> &marker)
 Compute indicies of all mesh entities that evaluate to true for the provided geometric marking function. An entity is considered marked if the marker function evaluates true for all of its vertices. More...
 
Eigen::Array< std::int32_t, Eigen::Dynamic, 1 > locate_entities_boundary (const mesh::Mesh &mesh, const int dim, const std::function< Eigen::Array< bool, Eigen::Dynamic, 1 >(const Eigen::Ref< const Eigen::Array< double, 3, Eigen::Dynamic, Eigen::RowMajor >> &)> &marker)
 Compute indicies of all mesh entities that are attached to an owned boundary facet and evaluate to true for the provided geometric marking function. An entity is considered marked if the marker function evaluates true for all of its vertices. More...
 
Eigen::Array< std::int32_t, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > entities_to_geometry (const mesh::Mesh &mesh, const int dim, const Eigen::Array< std::int32_t, Eigen::Dynamic, 1 > &entity_list, bool orient)
 Compute the geometry indices of vertices of the given entities from the mesh geometry. More...
 
Eigen::Array< std::int32_t, Eigen::Dynamic, 1 > exterior_facet_indices (const Mesh &mesh)
 Compute the indices (local) of all exterior facets. An exterior facet (co-dimension 1) is one that is connected globally to only one cell of co-dimension 0). More...
 

Detailed Description

Mesh data structures.

Representations of meshes and support for operations on meshes.

Function Documentation

◆ cell_facet_type()

mesh::CellType dolfinx::mesh::cell_facet_type ( mesh::CellType  type)

Return facet type of cell.

Parameters
[in]typeThe cell type
Returns
The type of the cell's facets

◆ cell_num_entities()

int dolfinx::mesh::cell_num_entities ( mesh::CellType  type,
int  dim 
)

Number of entities of dimension dim.

Parameters
[in]dimEntity dimension
[in]typeCell type
Returns
Number of entities in cell

◆ compute_boundary_facets()

std::vector< bool > dolfinx::mesh::compute_boundary_facets ( const Topology topology)

Compute marker for owned facets that are on the exterior of the domain, i.e. are connected to only one cell. The function does not require parallel communication.

Parameters
[in]topologyThe topology
Returns
Vector with length equal to the number of owned facets on this this process. True if the ith facet (local index) is on the exterior of the domain.

◆ create_meshtags()

template<typename T >
mesh::MeshTags<T> dolfinx::mesh::create_meshtags ( const std::shared_ptr< const mesh::Mesh > &  mesh,
const int  dim,
const graph::AdjacencyList< std::int32_t > &  entities,
const std::vector< T > &  values 
)

Create MeshTags from arrays.

Parameters
[in]meshThe Mesh that the tags are associated with
[in]dimTopological dimension of tagged entities
[in]entitiesLocal vertex indices for tagged entities.
[in]valuesTag values for each entity in @ entities. The length of @ values must be equal to number of rows in @ entities.

◆ create_topology()

Topology dolfinx::mesh::create_topology ( MPI_Comm  comm,
const graph::AdjacencyList< std::int64_t > &  cells,
const std::vector< std::int64_t > &  original_cell_index,
const std::vector< int > &  ghost_owners,
const CellType cell_type,
mesh::GhostMode  ghost_mode 
)

Create distributed topology.

Parameters
[in]commMPI communicator across which the topology is distributed
[in]cellsThe cell topology (list of cell vertices) using global indices for the vertices. It contains cells that have been distributed to this rank, e.g. via a graph partitioner. It must also contain all ghost cells via facet, i.e. cells which are on a neighboring process and share a facet with a local cell.
[in]original_cell_indexThe original global index associated with each cell.
[in]ghost_ownersThe ownership of the ghost cells (ghost cells are always at the end of the list of cells, above)
[in]cell_typeThe cell shape
[in]ghost_modeHow to partition the cell overlap: none, shared_facet or shared_vertex.
Returns
A distributed Topology.

◆ entities_to_geometry()

Eigen::Array< std::int32_t, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > dolfinx::mesh::entities_to_geometry ( const mesh::Mesh mesh,
const int  dim,
const Eigen::Array< std::int32_t, Eigen::Dynamic, 1 > &  entity_list,
bool  orient 
)

Compute the geometry indices of vertices of the given entities from the mesh geometry.

Parameters
[in]meshMesh
[in]dimTopological dimension of the entities of interest
[in]entity_listList of entity indices (local)
[in]orientIf true, in 3D, reorients facets to have consistent normal direction
Returns
Indices in the geometry array for the mesh entity vertices, i.e. indices(i, j) is the position in the geometry array of the j-th vertex of the entity entity_list[i].

◆ exterior_facet_indices()

Eigen::Array< std::int32_t, Eigen::Dynamic, 1 > dolfinx::mesh::exterior_facet_indices ( const Mesh mesh)

Compute the indices (local) of all exterior facets. An exterior facet (co-dimension 1) is one that is connected globally to only one cell of co-dimension 0).

Parameters
[in]meshMesh
Returns
List of facet indices of exterior facets of the mesh

◆ extract_topology()

graph::AdjacencyList< std::int64_t > dolfinx::mesh::extract_topology ( const CellType cell_type,
const fem::ElementDofLayout layout,
const graph::AdjacencyList< std::int64_t > &  cells 
)

Extract topology from cell data, i.e. extract cell vertices.

Parameters
[in]cell_typeThe cell shape
[in]layoutThe layout of geometry 'degrees-of-freedom' on the reference cell
[in]cellsList of 'nodes' for each cell using global indices. The layout must be consistent with layout.
Returns
Cell topology. The global indices will, in general, have 'gaps' due to mid-side and other higher-order nodes being removed from the input cell.

◆ is_simplex()

bool dolfinx::mesh::is_simplex ( mesh::CellType  type)

Check if cell is a simplex.

Parameters
[in]typeCell type
Returns
True is the cell type is a simplex

◆ locate_entities()

Eigen::Array< std::int32_t, Eigen::Dynamic, 1 > dolfinx::mesh::locate_entities ( const mesh::Mesh mesh,
const int  dim,
const std::function< Eigen::Array< bool, Eigen::Dynamic, 1 >(const Eigen::Ref< const Eigen::Array< double, 3, Eigen::Dynamic, Eigen::RowMajor >> &)> &  marker 
)

Compute indicies of all mesh entities that evaluate to true for the provided geometric marking function. An entity is considered marked if the marker function evaluates true for all of its vertices.

Parameters
[in]meshThe mesh
[in]dimThe topological dimension of the entities to be considered
[in]markerThe marking function
Returns
List of marked entity indices, including any ghost indices (indices local to the process)

◆ locate_entities_boundary()

Eigen::Array< std::int32_t, Eigen::Dynamic, 1 > dolfinx::mesh::locate_entities_boundary ( const mesh::Mesh mesh,
const int  dim,
const std::function< Eigen::Array< bool, Eigen::Dynamic, 1 >(const Eigen::Ref< const Eigen::Array< double, 3, Eigen::Dynamic, Eigen::RowMajor >> &)> &  marker 
)

Compute indicies of all mesh entities that are attached to an owned boundary facet and evaluate to true for the provided geometric marking function. An entity is considered marked if the marker function evaluates true for all of its vertices.

Note
For vertices and edges, in parallel this function will not necessarily mark all entities that are on the exterior boundary. For example, it is possible for a process to have a vertex that lies on the boundary without any of the attached facets being a boundary facet. When used to find degrees-of-freedom, e.g. using fem::locate_dofs_topological, the function that uses the data returned by this function must typically perform some parallel communication.
Parameters
[in]meshThe mesh
[in]dimThe topological dimension of the entities to be considered. Must be less than the topological dimension of the mesh.
[in]markerThe marking function
Returns
List of marked entity indices (indices local to the process)

◆ num_cell_vertices()

int dolfinx::mesh::num_cell_vertices ( mesh::CellType  type)

Number vertices for a cell type.

Parameters
[in]typeCell type
Returns
The number of cell vertices

◆ to_string()

std::string dolfinx::mesh::to_string ( mesh::CellType  type)

Get the cell string type for a cell type.

Parameters
[in]typeThe cell type
Returns
The cell type string

◆ to_type()

mesh::CellType dolfinx::mesh::to_type ( const std::string &  cell)

Get the cell type from a cell string.

Parameters
[in]cellCell shape string
Returns
The cell type