Peano
Loading...
Searching...
No Matches
petsc::LocalToGlobalMap Class Reference

#include <LocalToGlobalMap.h>

Collaboration diagram for petsc::LocalToGlobalMap:

Public Types

enum class  Type : int { Vertex =0 , Cell =1 , Face =2 }
 

Public Member Functions

 LocalToGlobalMap (int treeNumber=RankGlobalTreeNumber)
 Creates an empty map for tree treeNumber.
 
void setTreeNumber (int treeNumber)
 
int getTreeNumber () const
 
int reserveIndex (int cardinality)
 Reserve some indices for unknowns and return the first one.
 
void merge (const LocalToGlobalMap &otherMap, Type type)
 Merge two maps.
 
int getGlobalIndex (const std::pair< int, int > &index, Type type)
 Maps the local index onto a global index.
 
void computeLocalToGlobalMap ()
 Compute global to local map.
 
void increaseCountOfFacetType (Type type, int count)
 
int getTotalNumberOfIndices () const
 
int getTotalNumberOfCells () const
 
int getIndicesPerSubtree (int treeNumber) const
 should only be called from main tree, ie with treenumber = -1
 

Static Public Attributes

static constexpr int RankGlobalTreeNumber = -1
 
static constexpr int NoDegreeOfFreedom = -1
 Is used by enumeration such that boundary Dirichlet points, for example, have a properly initialised number, even though they do not carry an unknown.
 

Private Attributes

int _treeNumber
 
int _numberOfVertices
 
int _numberOfCells
 
int _numberOfFaces
 
int _totalNumberOfIndices
 
int _numberOfSubtrees
 
std::map< int, int > _indicesPerSubtree
 keeps track of the number of indices per subtree.
 

Static Private Attributes

static tarch::logging::Log _log
 

Detailed Description

Definition at line 20 of file LocalToGlobalMap.h.

Member Enumeration Documentation

◆ Type

enum class petsc::LocalToGlobalMap::Type : int
strong
Enumerator
Vertex 
Cell 
Face 

Definition at line 23 of file LocalToGlobalMap.h.

Constructor & Destructor Documentation

◆ LocalToGlobalMap()

petsc::LocalToGlobalMap::LocalToGlobalMap ( int  treeNumber = RankGlobalTreeNumber)

Creates an empty map for tree treeNumber.

The code creates one global map per rank. This one has the tree number -1 tied to it. Afterwards, the code runs through its local subdomains. For this, each observer/sweep creates an instance of this object, builds up its local map. After that, they merge() this local map into the global one.

Parameters
treeNumberNumber of tree where this map is constructed or RankGlobalTreeNumber if it is the global map on this rank

Member Function Documentation

◆ computeLocalToGlobalMap()

void petsc::LocalToGlobalMap::computeLocalToGlobalMap ( )

Compute global to local map.

This operation is called once after all the indices are handed out.

◆ getGlobalIndex()

int petsc::LocalToGlobalMap::getGlobalIndex ( const std::pair< int, int > &  index,
Type  type 
)

Maps the local index onto a global index.

Pass in the combination of tree number and local index and return the global index according to the map.

◆ getIndicesPerSubtree()

int petsc::LocalToGlobalMap::getIndicesPerSubtree ( int  treeNumber) const

should only be called from main tree, ie with treenumber = -1

Parameters
Numberof tree where this map is constructed.
Returns
the number of vertices within the tree labelled treeNumber

◆ getTotalNumberOfCells()

int petsc::LocalToGlobalMap::getTotalNumberOfCells ( ) const

◆ getTotalNumberOfIndices()

int petsc::LocalToGlobalMap::getTotalNumberOfIndices ( ) const

◆ getTreeNumber()

int petsc::LocalToGlobalMap::getTreeNumber ( ) const

◆ increaseCountOfFacetType()

void petsc::LocalToGlobalMap::increaseCountOfFacetType ( Type  type,
int  count 
)

◆ merge()

void petsc::LocalToGlobalMap::merge ( const LocalToGlobalMap &  otherMap,
Type  type 
)

Merge two maps.

This operation accepts a second map, and merges otherMap into the local map. Usually, the method is called for map -1, i.e. the map that is held for the rank as a whole and is given the map of a subdomain.

We add an argument of "Type", an enum that denotes which kind of L2GM we are merging in. So, in the global map, we keep a count of how many vertices, cells and faces we saw.

This will allow us to later enumerate the facets one after another.

◆ reserveIndex()

int petsc::LocalToGlobalMap::reserveIndex ( int  cardinality)

Reserve some indices for unknowns and return the first one.

◆ setTreeNumber()

void petsc::LocalToGlobalMap::setTreeNumber ( int  treeNumber)

Field Documentation

◆ _indicesPerSubtree

std::map<int,int> petsc::LocalToGlobalMap::_indicesPerSubtree
private

keeps track of the number of indices per subtree.

used for computing local to global map.

Definition at line 133 of file LocalToGlobalMap.h.

◆ _log

tarch::logging::Log petsc::LocalToGlobalMap::_log
staticprivate

Definition at line 135 of file LocalToGlobalMap.h.

◆ _numberOfCells

int petsc::LocalToGlobalMap::_numberOfCells
private

Definition at line 119 of file LocalToGlobalMap.h.

◆ _numberOfFaces

int petsc::LocalToGlobalMap::_numberOfFaces
private

Definition at line 120 of file LocalToGlobalMap.h.

◆ _numberOfSubtrees

int petsc::LocalToGlobalMap::_numberOfSubtrees
private

Definition at line 127 of file LocalToGlobalMap.h.

◆ _numberOfVertices

int petsc::LocalToGlobalMap::_numberOfVertices
private

Definition at line 118 of file LocalToGlobalMap.h.

◆ _totalNumberOfIndices

int petsc::LocalToGlobalMap::_totalNumberOfIndices
private

Definition at line 124 of file LocalToGlobalMap.h.

◆ _treeNumber

int petsc::LocalToGlobalMap::_treeNumber
private

Definition at line 112 of file LocalToGlobalMap.h.

◆ NoDegreeOfFreedom

constexpr int petsc::LocalToGlobalMap::NoDegreeOfFreedom = -1
staticconstexpr

Is used by enumeration such that boundary Dirichlet points, for example, have a properly initialised number, even though they do not carry an unknown.

Definition at line 34 of file LocalToGlobalMap.h.

◆ RankGlobalTreeNumber

constexpr int petsc::LocalToGlobalMap::RankGlobalTreeNumber = -1
staticconstexpr

Definition at line 27 of file LocalToGlobalMap.h.


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