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

Mesh data structures. More...

Classes

class  Geometry
 Geometry stores the geometry imposed on a mesh. More...
 
class  GraphBuilder
 This class builds a Graph corresponding to various objects. More...
 
class  Mesh
 A Mesh consists of a set of connected and numbered mesh topological entities, and geometry data. More...
 
class  MeshEntity
 A MeshEntity represents a mesh entity associated with a specific topological dimension of some Mesh. A MeshEntity object is left in an undefined state if the Mesh that it is constructed with is destroyed. More...
 
class  MeshQuality
 The class provides functions to quantify mesh quality. 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  Partitioning
 Tools for partitioning meshes. More...
 
class  PermutationComputation
 Tools for computing mesh entity permutations. More...
 
class  Topology
 Topology stores the topology of a mesh, consisting of mesh entities and connectivity (incidence relations for the mesh entities). Note that the mesh entities don't need to be stored, only the number of entities and the connectivity. More...
 
class  TopologyComputation
 This class implements a set of basic algorithms that automate the computation of mesh entities and connectivity. 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)
 Convert from cell type to string.
 
CellType to_type (const std::string &type)
 Convert from string to cell type.
 
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.
 
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)}.
 
int cell_degree (CellType type, int num_nodes)
 
std::vector< int > cell_vertex_indices (mesh::CellType type, int num_nodes)
 
int num_cell_nodes (mesh::CellType type, int degree)
 
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 (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 (MPI_Comm comm, const std::shared_ptr< const mesh::Mesh > &mesh, const mesh::CellType &tag_cell_type, const Eigen::Array< std::int64_t, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > &entities, const std::vector< T > &values)
 
std::vector< bool > compute_interior_facets (const Topology &topology)
 Compute marker for owned facets that are interior, i.e. are connected to two cells, one of which might be on a remote process. 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::Vector3d normal (const MeshEntity &cell, int facet_local)
 Compute of given facet with respect to the cell.
 
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_geometrical (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, const bool boundary_only)
 Compute indicies (local to the process) of all mesh entities that evaluate to true for the provided marking function. An entity is considered marked if the marker function evaluates true for all of the entities vertices.
 

Detailed Description

Mesh data structures.

Representations of meshes and support for operations on meshes.

Function Documentation

◆ cell_degree()

int dolfinx::mesh::cell_degree ( mesh::CellType  type,
int  num_nodes 
)
Todo:
Remove

Find the order of a cell given the number of nodes in the element

◆ 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

◆ cell_vertex_indices()

std::vector< int > dolfinx::mesh::cell_vertex_indices ( mesh::CellType  type,
int  num_nodes 
)
Todo:
Remove

Return the indices of the nodes corresponding to the vertices of a cell. For higher order cells, a cell is defined by more nodes than the vertices.

Parameters
[in]typeThe cell shape
[in]num_nodesThe number of nodes defining the cell
Returns
List of vertex indices

◆ compute_interior_facets()

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

Compute marker for owned facets that are interior, i.e. are connected to two cells, one of which might be on a remote process.

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

◆ create_meshtags()

template<typename T >
mesh::MeshTags<T> dolfinx::mesh::create_meshtags ( MPI_Comm  comm,
const std::shared_ptr< const mesh::Mesh > &  mesh,
const mesh::CellType tag_cell_type,
const Eigen::Array< std::int64_t, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > &  entities,
const std::vector< T > &  values 
)
Todo:
Generalise to create multiple MeshTags as some of the data sent (expensively) via MPI re-used.

Create MeshTags from arrays

Parameters
[in]commThe MPI communicator
[in]meshThe Mesh that the tags are associated with
[in]tag_cell_typeCell type of entities which are being tagged
[in]entities'Node' indices (using the of entities input_global_indices from the Mesh) for vertices of for each entity that is tagged. The numbers of rows is equal to the number of 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.
[in]original_cell_indexThe original global index associated with each cell.
[in]ghost_ownersThe ownership of any 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.

◆ 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

◆ num_cell_nodes()

int dolfinx::mesh::num_cell_nodes ( mesh::CellType  type,
int  degree 
)
Todo:
Remove

Number of nodes of a given cell type and order

◆ 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