DOLFINx 0.10.0.0
DOLFINx C++ interface
Loading...
Searching...
No Matches
Topology Class Reference

Topology stores the topology of a mesh, consisting of mesh entities and connectivity (incidence relations for the mesh entities). More...

#include <Topology.h>

Public Member Functions

 Topology (std::vector< CellType > cell_types, std::shared_ptr< const common::IndexMap > vertex_map, std::vector< std::shared_ptr< const common::IndexMap > > cell_maps, std::vector< std::shared_ptr< graph::AdjacencyList< std::int32_t > > > cells, const std::optional< std::vector< std::vector< std::int64_t > > > &original_cell_index=std::nullopt)
 Create a mesh topology.
 
 Topology (const Topology &topology)=default
 Copy constructor.
 
 Topology (Topology &&topology)=default
 Move constructor.
 
 ~Topology ()=default
 Destructor.
 
Topologyoperator= (const Topology &topology)=delete
 Assignment.
 
Topologyoperator= (Topology &&topology)=default
 Assignment.
 
int dim () const noexcept
 Topological dimension of the mesh.
 
const std::vector< CellType > & entity_types (int dim) const
 Entity types in the topology for a given dimension.
 
CellType cell_type () const
 Cell type.
 
std::vector< std::shared_ptr< const common::IndexMap > > index_maps (int dim) const
 Get the index maps that described the parallel distribution of the mesh entities of a given topological dimension.
 
std::shared_ptr< const common::IndexMapindex_map (int dim) const
 Get the IndexMap that described the parallel distribution of the mesh entities.
 
std::shared_ptr< const graph::AdjacencyList< std::int32_t > > connectivity (std::array< int, 2 > d0, std::array< int, 2 > d1) const
 Get the connectivity from entities of topological dimension d0 to dimension d1.
 
std::shared_ptr< const graph::AdjacencyList< std::int32_t > > connectivity (int d0, int d1) const
 Return connectivity from entities of dimension d0 to entities of dimension d1. Assumes only one entity type per dimension.
 
const std::vector< std::uint32_t > & get_cell_permutation_info () const
 Returns the permutation information.
 
const std::vector< std::uint8_t > & get_facet_permutations () const
 Get the numbers that encode the number of permutations to apply to facets.
 
const std::vector< std::int32_t > & interprocess_facets (int index) const
 List of inter-process facets of a given type.
 
const std::vector< std::int32_t > & interprocess_facets () const
 List of inter-process facets.
 
bool create_entities (int dim)
 Create entities of given topological dimension.
 
void create_connectivity (int d0, int d1)
 Create connectivity between given pair of dimensions, d0 / -> d1.
 
void create_entity_permutations ()
 Compute entity permutations and reflections.
 
MPI_Comm comm () const
 Mesh MPI communicator.
 

Public Attributes

std::vector< std::vector< std::int64_t > > original_cell_index
 Original cell index for each cell type.
 

Detailed Description

Topology stores the topology of a mesh, consisting of mesh entities and connectivity (incidence relations for the mesh entities).

A mesh entity e may be identified globally as a pair e = (dim, i), where dim is the topological dimension and i is the index of the entity within that topological dimension.

Todo
Rework memory management and associated API. Currently, the caching policy is not clear.

Constructor & Destructor Documentation

◆ Topology()

Topology ( std::vector< CellType > cell_types,
std::shared_ptr< const common::IndexMap > vertex_map,
std::vector< std::shared_ptr< const common::IndexMap > > cell_maps,
std::vector< std::shared_ptr< graph::AdjacencyList< std::int32_t > > > cells,
const std::optional< std::vector< std::vector< std::int64_t > > > & original_cell_index = std::nullopt )

Create a mesh topology.

A Topology represents the connectivity of a mesh. Mesh entities, i.e. vertices, edges, faces and cells, are defined in terms of their vertices. Connectivity represents the relationships between entities, e.g. the cells that are connected to a given edge in the mesh.

Parameters
[in]cell_typesTypes of cells.
[in]vertex_mapIndex map describing the distribution of mesh vertices.
[in]cell_mapsIndex maps describing the distribution of mesh cells for each cell type in cell_types.
[in]cellsCell-to-vertex connectivities for each cell type in cell_types.
[in]original_cell_indexOriginal indices for each cell in cells.

Member Function Documentation

◆ cell_type()

mesh::CellType cell_type ( ) const

Cell type.

This function is is for topologies with one cell type only.

Returns
Cell type that the topology is for.

◆ comm()

MPI_Comm comm ( ) const

Mesh MPI communicator.

Returns
Communicator on which the topology is distributed.

◆ connectivity() [1/2]

std::shared_ptr< const graph::AdjacencyList< std::int32_t > > connectivity ( int d0,
int d1 ) const

Return connectivity from entities of dimension d0 to entities of dimension d1. Assumes only one entity type per dimension.

Parameters
[in]d0Topological dimension.
[in]d1Topological dimension.
Returns
The adjacency list that for each entity of dimension d0 gives the list of incident entities of dimension d1. Returns nullptr if connectivity has not been computed.

◆ connectivity() [2/2]

std::shared_ptr< const graph::AdjacencyList< std::int32_t > > connectivity ( std::array< int, 2 > d0,
std::array< int, 2 > d1 ) const

Get the connectivity from entities of topological dimension d0 to dimension d1.

The entity type and incident entity type are each described by a pair (dim, index). The index within a topological dimension dim, is that of the cell type given in entity_types(dim).

Parameters
[in]d0Pair of (topological dimension of entities, index of "entity type" within topological dimension).
[in]d1Pair of (topological dimension of entities, index of incident "entity type" within topological dimension).
Returns
AdjacencyList of connectivity from entity type in d0 to entity types in d1, or nullptr if not yet computed.

◆ create_connectivity()

void create_connectivity ( int d0,
int d1 )

Create connectivity between given pair of dimensions, d0 / -> d1.

Parameters
[in]d0Topological dimension.
[in]d1Topological dimension.

◆ create_entities()

bool create_entities ( int dim)

Create entities of given topological dimension.

Parameters
[in]dimTopological dimension of entities to compute.
Returns
True if entities are created, false if entities already existed.

◆ entity_types()

const std::vector< CellType > & entity_types ( int dim) const

Entity types in the topology for a given dimension.

Parameters
[in]dimTopological dimension.
Returns
Entity types.

◆ get_facet_permutations()

const std::vector< std::uint8_t > & get_facet_permutations ( ) const

Get the numbers that encode the number of permutations to apply to facets.

The permutations are encoded so that:

  • n % 2 gives the number of reflections to apply
  • n // 2 gives the number of rotations to apply

The data is stored in a flattened 2D array, so that data[cell_index * / facets_per_cell + facet_index] contains the facet with index facet_index of the cell with index cell_index.

Returns
The encoded permutation info
Note
An exception is raised if the permutations have not been computed

◆ index_map()

std::shared_ptr< const common::IndexMap > index_map ( int dim) const

Get the IndexMap that described the parallel distribution of the mesh entities.

Parameters
[in]dimTopological dimension
Returns
Index map for the entities of dimension dim. Returns nullptr if index map has not been set.

◆ index_maps()

std::vector< std::shared_ptr< const common::IndexMap > > index_maps ( int dim) const

Get the index maps that described the parallel distribution of the mesh entities of a given topological dimension.

Parameters
[in]dimTopological dimension.
Returns
Index maps, one for each cell type.

◆ interprocess_facets() [1/2]

const std::vector< std::int32_t > & interprocess_facets ( ) const

List of inter-process facets.

"Inter-process" facets are facets that are connected (1) to a cell that is owned by the calling process (rank) and (2) to a cell that is owned by another process.

Precondition
Inter-process facets are available only if facet topology has been computed.

◆ interprocess_facets() [2/2]

const std::vector< std::int32_t > & interprocess_facets ( int index) const

List of inter-process facets of a given type.

"Inter-process" facets are facets that are connected (1) to a cell that is owned by the calling process (rank) and (2) to a cell that is owned by another process.

Facets must have been computed for inter-process facet data to be available.

Parameters
[in]indexIndex of facet type, following the order given by entity_types.
Returns
Indices of the inter-process facets.

The documentation for this class was generated from the following files: