Peano
Loading...
Searching...
No Matches
LocalToGlobalMap.h
Go to the documentation of this file.
1// This file is part of the Peano's PETSc extension. For conditions of
2// distribution and use, please see the copyright notice at
3// www.peano-framework.org
4#pragma once
5
6
7#include <utility>
8#include <map>
9
10#include "tarch/logging/Log.h"
14
15namespace petsc {
16 class LocalToGlobalMap;
17}
18
19
21 public:
22
23 enum class Type: int{
24 Vertex=0, Cell=1, Face=2
25 };
26
27 static constexpr int RankGlobalTreeNumber = -1;
28
34 static constexpr int NoDegreeOfFreedom = -1;
35
49
50 void setTreeNumber( int treeNumber );
51
52 int getTreeNumber() const;
53
57 int reserveIndex(int cardinality);
58
74 void merge( const LocalToGlobalMap& otherMap, Type type );
75
82 int getGlobalIndex( const std::pair<int,int>& index, Type type );
83
91
92 /*
93 Increase count of indices we reserve for a particular facet type
94 (currently support vertices, faces, cells). Pass in the type and
95 the integer
96 */
97 void increaseCountOfFacetType(Type type, int count);
98
100
102
108 int getIndicesPerSubtree( int treeNumber ) const;
109
110
111 private:
113
114 /*
115 these three should sum to the same
116 as _totalNumberOfIndices
117 */
121
122 // let's make this total number of indices in this tree specifically.
123 // later, we use this to make sure the merge was successful
125
126 // std::vector<petsc::LocalToGlobalMap> _subTrees;
128
133 std::map<int,int> _indicesPerSubtree;
134
136
137};
138
139
int getGlobalIndex(const std::pair< int, int > &index, Type type)
Maps the local index onto a global index.
void merge(const LocalToGlobalMap &otherMap, Type type)
Merge two maps.
void computeLocalToGlobalMap()
Compute global to local map.
std::map< int, int > _indicesPerSubtree
keeps track of the number of indices per subtree.
static constexpr int NoDegreeOfFreedom
Is used by enumeration such that boundary Dirichlet points, for example, have a properly initialised ...
LocalToGlobalMap(int treeNumber=RankGlobalTreeNumber)
Creates an empty map for tree treeNumber.
int getTotalNumberOfIndices() const
static constexpr int RankGlobalTreeNumber
void increaseCountOfFacetType(Type type, int count)
static tarch::logging::Log _log
void setTreeNumber(int treeNumber)
int getTotalNumberOfCells() const
int getIndicesPerSubtree(int treeNumber) const
should only be called from main tree, ie with treenumber = -1
int reserveIndex(int cardinality)
Reserve some indices for unknowns and return the first one.
Log Device.
Definition Log.h:517