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

A bidirectional map relating entities in one topology to another. More...

#include <EntityMap.h>

Public Member Functions

template<typename U>
requires std::is_convertible_v<std::remove_cvref_t<U>, std::vector<std::int32_t>>
 EntityMap (std::shared_ptr< const Topology > topology, std::shared_ptr< const Topology > sub_topology, int dim, U &&sub_topology_to_topology)
 Constructor of a bidirectional map relating entities of dimension dim in topology and sub_topology.
 EntityMap (const EntityMap &map)=default
 Copy constructor.
 EntityMap (EntityMap &&map)=default
 Move constructor.
std::size_t dim () const
 Get the topological dimension of the entities related by this EntityMap.
std::shared_ptr< const Topologytopology () const
 Get the (parent) topology.
std::shared_ptr< const Topologysub_topology () const
 Get the sub-topology.
std::vector< std::int32_t > sub_topology_to_topology (std::span< const std::int32_t > entities, bool inverse) const
 Map entities between the sub-topology and the parent topology.

Detailed Description

A bidirectional map relating entities in one topology to another.

Constructor & Destructor Documentation

◆ EntityMap()

template<typename U>
requires std::is_convertible_v<std::remove_cvref_t<U>, std::vector<std::int32_t>>
EntityMap ( std::shared_ptr< const Topology > topology,
std::shared_ptr< const Topology > sub_topology,
int dim,
U && sub_topology_to_topology )
inline

Constructor of a bidirectional map relating entities of dimension dim in topology and sub_topology.

Template Parameters
U
Parameters
topologyA mesh topology.
sub_topologyTopology of another mesh. This must be a "sub-topology" of topology, i.e. every entity in sub_topology must also exist in topology.
dimTopological dimension of the entities.
sub_topology_to_topologyList of entities in topology where sub_topology_to_topology[i] is the index in topology corresponding to entity i in sub_topology.

Member Function Documentation

◆ dim()

std::size_t dim ( ) const

Get the topological dimension of the entities related by this EntityMap.

Returns
The topological dimension.

◆ sub_topology()

std::shared_ptr< const Topology > sub_topology ( ) const

Get the sub-topology.

Returns
The sub-topology.

◆ sub_topology_to_topology()

std::vector< std::int32_t > sub_topology_to_topology ( std::span< const std::int32_t > entities,
bool inverse ) const

Map entities between the sub-topology and the parent topology.

If inverse is false, this function maps a list of this->dim()-dimensional entities from this->sub_topology() to the corresponding entities in this->topology(). If inverse is true, it performs the inverse mapping: from this->topology() to this->sub_topology(). Entities that do not exist in the sub-topology are marked as -1.

Note
If inverse is true, this function recomputes the inverse map on every call (it is not cached), which may be expensive if called repeatedly.
Parameters
entitiesList of entity indices in the source topology.
inverseIf false, maps from this->sub_topology() to this->topology(). If true, maps from this->topology() to this->sub_topology().
Returns
A list of mapped entity indices. Entities that do not exist in the target topology are marked as -1.

◆ topology()

std::shared_ptr< const Topology > topology ( ) const

Get the (parent) topology.

Returns
The parent topology.

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