Nektar++
AssemblyMapCG.h
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: AssemblyMapCG.h
4//
5// For more information, please see: http://www.nektar.info
6//
7// The MIT License
8//
9// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10// Department of Aeronautics, Imperial College London (UK), and Scientific
11// Computing and Imaging Institute, University of Utah (USA).
12//
13// Permission is hereby granted, free of charge, to any person obtaining a
14// copy of this software and associated documentation files (the "Software"),
15// to deal in the Software without restriction, including without limitation
16// the rights to use, copy, modify, merge, publish, distribute, sublicense,
17// and/or sell copies of the Software, and to permit persons to whom the
18// Software is furnished to do so, subject to the following conditions:
19//
20// The above copyright notice and this permission notice shall be included
21// in all copies or substantial portions of the Software.
22//
23// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29// DEALINGS IN THE SOFTWARE.
30//
31// Description: C0-continuous Local to Global mapping routines, base class
32//
33///////////////////////////////////////////////////////////////////////////////
34
35#ifndef MULTIREGIONS_ASSEMBLYMAPCG_H
36#define MULTIREGIONS_ASSEMBLYMAPCG_H
37
38#include <tuple>
39
43
45{
46static std::map<int, int> NullIntIntMap;
47const static std::vector<std::map<int, int>> NullVecIntIntMap;
48
49class AssemblyMapCG;
50typedef std::shared_ptr<AssemblyMapCG> AssemblyMapCGSharedPtr;
51typedef std::tuple<int, int, NekDouble> ExtraDirDof;
52
53typedef std::vector<std::map<int, int>> DofGraph;
54
56std::pair<int, StdRegions::Orientation> DeterminePeriodicEdgeOrientId(
57 int meshEdgeId, StdRegions::Orientation edgeOrient,
58 const std::vector<PeriodicEntity> &periodicEdges);
59
62 StdRegions::Orientation faceOrient1, StdRegions::Orientation faceOrient2);
63
64/// Constructs mappings for the C0 scalar continuous Galerkin formulation.
66{
69
70public:
71 /// Default constructor.
75 const std::string variable = "DefaultVar");
76
77 /// General constructor for expansions of all dimensions without
78 /// boundary conditions.
81 const int numLocalCoeffs, const ExpList &locExp,
82 const BndCondExp &bndCondExp = NullExpListSharedPtrArray,
83 const BndCond &bndConditions =
85 const bool checkIfSingular = false,
86 const std::string variable = "defaultVar",
87 const PeriodicMap &periodicVerts = NullPeriodicMap,
88 const PeriodicMap &periodicEdges = NullPeriodicMap,
89 const PeriodicMap &periodicFaces = NullPeriodicMap);
90
91 /// Destructor.
93
95 {
96 return m_copyLocalDirDofs;
97 }
98
100 {
102 }
103
104protected:
105 /// Integer map of local coeffs to global space
107 /// Integer sign of local coeffs to global space
109 /// Bandwith of the full matrix system (no static condensation).
111 /// Integer map of process coeffs to universal space
113 /// Integer map of unique process coeffs to universal space (signed)
115 /// Number of non Dirichlet vertex modes
117 /// Number of non Dirichlet edge modes
119 /// Number of non Dirichlet face modes
121 /// Number of Dirichlet edges
123 /// Number of Dirichlet faces
125 /// Number of Dirichlet edges
127 /// Number of Dirichlet faces
129 /// Number of local boundary condition coefficients
131 /// Extra dirichlet edges in parallel
133 /// Number of local boundary condition degrees of freedom.
135 /// Maximum static condensation level.
137 /// Set indicating degrees of freedom which are Dirichlet but whose
138 /// value is stored on another processor.
139 std::set<ExtraDirDof> m_copyLocalDirDofs;
140 /// Set indicating the local coeffs just touching parallel
141 /// dirichlet boundary that have a sign change
142 std::set<int> m_parallelDirBndSign;
143
145 const ExpList &locExp, const BndCondExp &bndCondExp,
146 const Array<OneD, const BndCond> &bndConditions,
147 const bool checkIfSystemSingular, const PeriodicMap &periodicVerts,
148 const PeriodicMap &periodicEdges, const PeriodicMap &periodicFaces,
149 DofGraph &graph, BottomUpSubStructuredGraphSharedPtr &bottomUpGraph,
150 std::set<int> &extraDirVerts, std::set<int> &extraDirEdges,
151 int &firstNonDirGraphVertId, int &nExtraDirichlet, int mdswitch = 1);
152
153 void SetUpUniversalC0ContMap(const ExpList &locExp,
154 const PeriodicMap &perVerts = NullPeriodicMap,
155 const PeriodicMap &perEdges = NullPeriodicMap,
156 const PeriodicMap &perFaces = NullPeriodicMap);
157
158 /// Calculate the bandwith of the full matrix system.
160
161 MULTI_REGIONS_EXPORT int v_GetLocalToGlobalMap(const int i) const override;
162
164 const int i) const override;
165
167 const int i) const override;
168
170 override;
171
173 &v_GetGlobalToUniversalMap() override;
174
177
179 v_GetLocalToGlobalSign(const int i) const override;
180
182 const override;
183
186 bool useComm) const override;
187
189 NekVector<NekDouble> &global,
190 bool useComm) const override;
191
193 const Array<OneD, const NekDouble> &global,
194 Array<OneD, NekDouble> &loc) const override;
195
197 const NekVector<NekDouble> &global,
198 NekVector<NekDouble> &loc) const override;
199
202 Array<OneD, NekDouble> &global) const override;
203
206 NekVector<NekDouble> &global) const override;
207
209 Array<OneD, NekDouble> &pGlobal) const override;
210
212 NekVector<NekDouble> &pGlobal) const override;
213
215 Array<OneD, NekDouble> &pGlobal, int offset) const override;
216
218
220
222
224
225 MULTI_REGIONS_EXPORT int v_GetNumDirEdges() const override;
226
227 MULTI_REGIONS_EXPORT int v_GetNumDirFaces() const override;
228
229 MULTI_REGIONS_EXPORT int v_GetNumNonDirEdges() const override;
230
231 MULTI_REGIONS_EXPORT int v_GetNumNonDirFaces() const override;
232
234 override;
235
237 const ExpList &locexp, GlobalSysSolnType solnType) override;
238};
239
240} // namespace Nektar::MultiRegions
241
242#endif // MULTIREGIONS_ASSEMBLYMAPCG_H
#define MULTI_REGIONS_EXPORT
Constructs mappings for the C0 scalar continuous Galerkin formulation.
Definition: AssemblyMapCG.h:66
std::set< ExtraDirDof > & GetCopyLocalDirDofs()
Definition: AssemblyMapCG.h:94
int v_GetFullSystemBandWidth() const override
int m_maxStaticCondLevel
Maximum static condensation level.
int m_numNonDirVertexModes
Number of non Dirichlet vertex modes.
const Array< OneD, const int > & v_GetLocalToGlobalMap() override
int CreateGraph(const ExpList &locExp, const BndCondExp &bndCondExp, const Array< OneD, const BndCond > &bndConditions, const bool checkIfSystemSingular, const PeriodicMap &periodicVerts, const PeriodicMap &periodicEdges, const PeriodicMap &periodicFaces, DofGraph &graph, BottomUpSubStructuredGraphSharedPtr &bottomUpGraph, std::set< int > &extraDirVerts, std::set< int > &extraDirEdges, int &firstNonDirGraphVertId, int &nExtraDirichlet, int mdswitch=1)
const Array< OneD, const int > & v_GetGlobalToUniversalMap() override
void v_GlobalToLocal(const Array< OneD, const NekDouble > &global, Array< OneD, NekDouble > &loc) const override
const Array< OneD, const int > & v_GetExtraDirEdges() override
const Array< OneD, const int > & v_GetGlobalToUniversalMapUnique() override
int m_numNonDirEdges
Number of Dirichlet edges.
void v_Assemble(const Array< OneD, const NekDouble > &loc, Array< OneD, NekDouble > &global) const override
std::set< int > m_parallelDirBndSign
Set indicating the local coeffs just touching parallel dirichlet boundary that have a sign change.
std::set< int > & GetParallelDirBndSign()
Definition: AssemblyMapCG.h:99
Array< OneD, int > m_globalToUniversalMapUnique
Integer map of unique process coeffs to universal space (signed)
Array< OneD, const ExpListSharedPtr > BndCondExp
Definition: AssemblyMapCG.h:67
Array< OneD, int > m_extraDirEdges
Extra dirichlet edges in parallel.
int v_GetNumNonDirVertexModes() const override
int m_numLocDirBndCondDofs
Number of local boundary condition degrees of freedom.
int m_numNonDirFaceModes
Number of non Dirichlet face modes.
void v_UniversalAssemble(Array< OneD, NekDouble > &pGlobal) const override
int m_numNonDirEdgeModes
Number of non Dirichlet edge modes.
int v_GetNumNonDirFaces() const override
int m_numDirEdges
Number of Dirichlet edges.
AssemblyMapSharedPtr v_LinearSpaceMap(const ExpList &locexp, GlobalSysSolnType solnType) override
Construct an AssemblyMapCG object which corresponds to the linear space of the current object.
int v_GetNumNonDirEdgeModes() const override
int m_fullSystemBandWidth
Bandwith of the full matrix system (no static condensation).
Array< OneD, int > m_localToGlobalMap
Integer map of local coeffs to global space.
AssemblyMapCG(const LibUtilities::SessionReaderSharedPtr &pSession, const LibUtilities::CommSharedPtr &comm, const std::string variable="DefaultVar")
Default constructor.
int m_numDirFaces
Number of Dirichlet faces.
void v_LocalToGlobal(const Array< OneD, const NekDouble > &loc, Array< OneD, NekDouble > &global, bool useComm) const override
void SetUpUniversalC0ContMap(const ExpList &locExp, const PeriodicMap &perVerts=NullPeriodicMap, const PeriodicMap &perEdges=NullPeriodicMap, const PeriodicMap &perFaces=NullPeriodicMap)
Array< OneD, NekDouble > m_localToGlobalSign
Integer sign of local coeffs to global space.
void CalculateFullSystemBandWidth()
Calculate the bandwith of the full matrix system.
std::set< ExtraDirDof > m_copyLocalDirDofs
Set indicating degrees of freedom which are Dirichlet but whose value is stored on another processor.
int m_numNonDirFaces
Number of Dirichlet faces.
Array< OneD, int > m_globalToUniversalMap
Integer map of process coeffs to universal space.
int v_GetNumNonDirFaceModes() const override
int v_GetNumNonDirEdges() const override
const Array< OneD, NekDouble > & v_GetLocalToGlobalSign() const override
Array< OneD, const SpatialDomains::BoundaryConditionShPtr > BndCond
Definition: AssemblyMapCG.h:68
int m_numLocalBndCondCoeffs
Number of local boundary condition coefficients.
Base class for constructing local to global mapping of degrees of freedom.
Definition: AssemblyMap.h:56
Base class for all multi-elemental spectral/hp expansions.
Definition: ExpList.h:98
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
Definition: Comm.h:55
static PeriodicMap NullPeriodicMap
std::shared_ptr< BottomUpSubStructuredGraph > BottomUpSubStructuredGraphSharedPtr
std::shared_ptr< AssemblyMapCG > AssemblyMapCGSharedPtr
Definition: AssemblyMapCG.h:50
std::tuple< int, int, NekDouble > ExtraDirDof
Definition: AssemblyMapCG.h:51
std::vector< std::map< int, int > > DofGraph
Definition: AssemblyMapCG.h:53
static std::map< int, int > NullIntIntMap
Definition: AssemblyMapCG.h:46
pair< int, StdRegions::Orientation > DeterminePeriodicEdgeOrientId(int meshEdgeId, StdRegions::Orientation edgeOrient, const vector< PeriodicEntity > &periodicEdges)
Determine orientation of an edge to its periodic equivalents, as well as the ID of the representative...
static const Array< OneD, ExpListSharedPtr > NullExpListSharedPtrArray
Definition: ExpList.h:2310
std::shared_ptr< AssemblyMap > AssemblyMapSharedPtr
Definition: AssemblyMap.h:50
std::map< int, std::vector< PeriodicEntity > > PeriodicMap
static const std::vector< std::map< int, int > > NullVecIntIntMap
Definition: AssemblyMapCG.h:47
StdRegions::Orientation DeterminePeriodicFaceOrient(StdRegions::Orientation faceOrient, StdRegions::Orientation perFaceOrient)
Determine relative orientation between two faces.
static const Array< OneD, BoundaryConditionShPtr > NullBoundaryConditionShPtrArray
Definition: Conditions.h:222
double NekDouble