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 
42 #include <MultiRegions/ExpList.h>
43 
44 namespace Nektar
45 {
46  namespace MultiRegions
47  {
48  static std::map<int,int> NullIntIntMap;
49  const static std::vector<std::map<int,int> > NullVecIntIntMap;
50 
52  typedef std::shared_ptr<AssemblyMapCG> AssemblyMapCGSharedPtr;
53  typedef std::tuple<int, int, NekDouble> ExtraDirDof;
54 
55  typedef std::vector<std::map<int, int> > DofGraph;
56 
58  std::pair<int, StdRegions::Orientation> DeterminePeriodicEdgeOrientId(
59  int meshEdgeId,
60  StdRegions::Orientation edgeOrient,
61  const std::vector<PeriodicEntity> &periodicEdges);
62 
65  StdRegions::Orientation faceOrient1,
66  StdRegions::Orientation faceOrient2);
67 
68 
69  /// Constructs mappings for the C0 scalar continuous Galerkin formulation.
70  class AssemblyMapCG: public AssemblyMap
71  {
75 
76  public:
77  /// Default constructor.
80  const std::string variable = "DefaultVar");
81 
82  /// General constructor for expansions of all dimensions without
83  /// boundary conditions.
86  const int numLocalCoeffs,
87  const ExpList &locExp,
88  const BndCondExp &bndCondExp
90  const BndCond &bndConditions
92  const bool checkIfSingular
93  = false,
94  const std::string variable
95  = "defaultVar",
96  const PeriodicMap &periodicVerts
98  const PeriodicMap &periodicEdges
100  const PeriodicMap &periodicFaces
101  = NullPeriodicMap);
102 
103  /// Destructor.
105 
106  MULTI_REGIONS_EXPORT std::map<int, std::vector<ExtraDirDof> >
108  {
109  return m_extraDirDofs;
110  }
111 
112  protected:
113  /// Integer map of local coeffs to global space
115  /// Integer sign of local coeffs to global space
117  /// Bandwith of the full matrix system (no static condensation).
119  /// Integer map of process coeffs to universal space
121  /// Integer map of unique process coeffs to universal space (signed)
123  /// Number of non Dirichlet vertex modes
125  /// Number of non Dirichlet edge modes
127  /// Number of non Dirichlet face modes
129  /// Number of Dirichlet edges
131  /// Number of Dirichlet faces
133  /// Number of Dirichlet edges
135  /// Number of Dirichlet faces
137  /// Number of local boundary condition coefficients
139  /// Extra dirichlet edges in parallel
141  /// Number of local boundary condition degrees of freedom.
143  /// Maximum static condensation level.
145  /// Map indicating degrees of freedom which are Dirichlet but whose
146  /// value is stored on another processor.
147  std::map<int, std::vector<ExtraDirDof> > m_extraDirDofs;
148 
150  const ExpList &locExp,
151  const BndCondExp &bndCondExp,
152  const Array<OneD, const BndCond> &bndConditions,
153  const bool checkIfSystemSingular,
154  const PeriodicMap &periodicVerts,
155  const PeriodicMap &periodicEdges,
156  const PeriodicMap &periodicFaces,
157  DofGraph &graph,
159  std::set<int> &extraDirVerts,
160  std::set<int> &extraDirEdges,
161  int &firstNonDirGraphVertId,
162  int &nExtraDirichlet,
163  int mdswitch = 1);
164 
166  const ExpList &locExp,
167  const PeriodicMap &perVerts = NullPeriodicMap,
168  const PeriodicMap &perEdges = NullPeriodicMap,
169  const PeriodicMap &perFaces = NullPeriodicMap);
170 
171  /// Calculate the bandwith of the full matrix system.
173 
174  MULTI_REGIONS_EXPORT virtual int v_GetLocalToGlobalMap(const int i) const;
175 
176  MULTI_REGIONS_EXPORT virtual int v_GetGlobalToUniversalMap(const int i) const;
177 
178  MULTI_REGIONS_EXPORT virtual int v_GetGlobalToUniversalMapUnique(const int i) const;
179 
181 
183 
185 
186  MULTI_REGIONS_EXPORT virtual NekDouble v_GetLocalToGlobalSign(const int i) const;
187 
189 
192  Array<OneD, NekDouble>& global,
193  bool useComm) const;
194 
196  const NekVector<NekDouble>& loc,
197  NekVector< NekDouble>& global,
198  bool useComm) const;
199 
201  const Array<OneD, const NekDouble>& global,
202  Array<OneD, NekDouble>& loc) const;
203 
205  const NekVector<NekDouble>& global,
206  NekVector< NekDouble>& loc) const;
207 
208  MULTI_REGIONS_EXPORT virtual void v_Assemble(
210  Array<OneD, NekDouble> &global) const;
211 
212  MULTI_REGIONS_EXPORT virtual void v_Assemble(
213  const NekVector<NekDouble>& loc,
214  NekVector< NekDouble>& global) const;
215 
217  Array<OneD, NekDouble>& pGlobal) const;
218 
220  NekVector< NekDouble>& pGlobal) const;
221 
223  Array<OneD, NekDouble>& pGlobal,
224  int offset) const;
225 
227 
229 
230  MULTI_REGIONS_EXPORT virtual int v_GetNumNonDirEdgeModes() const;
231 
232  MULTI_REGIONS_EXPORT virtual int v_GetNumNonDirFaceModes() const;
233 
234  MULTI_REGIONS_EXPORT virtual int v_GetNumDirEdges() const;
235 
236  MULTI_REGIONS_EXPORT virtual int v_GetNumDirFaces() const;
237 
238  MULTI_REGIONS_EXPORT virtual int v_GetNumNonDirEdges() const;
239 
240  MULTI_REGIONS_EXPORT virtual int v_GetNumNonDirFaces() const;
241 
243 
245  const ExpList &locexp, GlobalSysSolnType solnType);
246  };
247 
248 
249  } // end of namespace
250 } // end of namespace
251 
252 #endif //MULTIREGIONS_ASSEMBLYMAPCG_H
253 
static std::map< int, int > NullIntIntMap
Definition: AssemblyMapCG.h:48
AssemblyMapCG(const LibUtilities::SessionReaderSharedPtr &pSession, const std::string variable="DefaultVar")
Default constructor.
std::shared_ptr< AssemblyMapCG > AssemblyMapCGSharedPtr
Definition: AssemblyMapCG.h:51
int m_maxStaticCondLevel
Maximum static condensation level.
Array< OneD, int > m_globalToUniversalMapUnique
Integer map of unique process coeffs to universal space (signed)
static const Array< OneD, BoundaryConditionShPtr > NullBoundaryConditionShPtrArray
Definition: Conditions.h:228
Array< OneD, int > m_extraDirEdges
Extra dirichlet edges in parallel.
void SetUpUniversalC0ContMap(const ExpList &locExp, const PeriodicMap &perVerts=NullPeriodicMap, const PeriodicMap &perEdges=NullPeriodicMap, const PeriodicMap &perFaces=NullPeriodicMap)
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)
int m_numLocDirBndCondDofs
Number of local boundary condition degrees of freedom.
int m_numNonDirVertexModes
Number of non Dirichlet vertex modes.
#define MULTI_REGIONS_EXPORT
std::map< int, std::vector< ExtraDirDof > > & GetExtraDirDofs()
std::tuple< int, int, NekDouble > ExtraDirDof
Definition: AssemblyMapCG.h:53
Array< OneD, int > m_globalToUniversalMap
Integer map of process coeffs to universal space.
int m_numNonDirEdges
Number of Dirichlet edges.
virtual void v_GlobalToLocal(const Array< OneD, const NekDouble > &global, Array< OneD, NekDouble > &loc) const
int m_numLocalBndCondCoeffs
Number of local boundary condition coefficients.
std::map< int, std::vector< ExtraDirDof > > m_extraDirDofs
Map indicating degrees of freedom which are Dirichlet but whose value is stored on another processor...
void CalculateFullSystemBandWidth()
Calculate the bandwith of the full matrix system.
std::shared_ptr< AssemblyMap > AssemblyMapSharedPtr
Definition: AssemblyMap.h:52
Array< OneD, int > m_localToGlobalMap
Integer map of local coeffs to global space.
virtual const Array< OneD, const int > & v_GetLocalToGlobalMap()
Base class for constructing local to global mapping of degrees of freedom.
Definition: AssemblyMap.h:58
int m_numNonDirFaceModes
Number of non Dirichlet face modes.
Base class for all multi-elemental spectral/hp expansions.
Definition: ExpList.h:103
virtual AssemblyMapSharedPtr v_LinearSpaceMap(const ExpList &locexp, GlobalSysSolnType solnType)
Construct an AssemblyMapCG object which corresponds to the linear space of the current object...
Array< OneD, const SpatialDomains::BoundaryConditionShPtr > BndCond
Definition: AssemblyMapCG.h:74
Array< OneD, const ExpListSharedPtr > BndCondExp
Definition: AssemblyMapCG.h:72
StdRegions::Orientation DeterminePeriodicFaceOrient(StdRegions::Orientation faceOrient, StdRegions::Orientation perFaceOrient)
Determine relative orientation between two faces.
int m_numDirFaces
Number of Dirichlet faces.
static PeriodicMap NullPeriodicMap
virtual int v_GetFullSystemBandWidth() const
double NekDouble
std::map< int, std::vector< PeriodicEntity > > PeriodicMap
virtual const Array< OneD, const int > & v_GetExtraDirEdges()
virtual void v_UniversalAssemble(Array< OneD, NekDouble > &pGlobal) const
std::vector< std::map< int, int > > DofGraph
Definition: AssemblyMapCG.h:55
int m_numDirEdges
Number of Dirichlet edges.
static const Array< OneD, ExpListSharedPtr > NullExpListSharedPtrArray
Definition: ExpList.h:2449
Array< OneD, NekDouble > m_localToGlobalSign
Integer sign of local coeffs to global space.
int m_numNonDirEdgeModes
Number of non Dirichlet edge modes.
virtual int v_GetNumNonDirVertexModes() const
static const std::vector< std::map< int, int > > NullVecIntIntMap
Definition: AssemblyMapCG.h:49
virtual int v_GetNumNonDirFaceModes() const
virtual int v_GetNumNonDirEdgeModes() const
Constructs mappings for the C0 scalar continuous Galerkin formulation.
Definition: AssemblyMapCG.h:70
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...
int m_numNonDirFaces
Number of Dirichlet faces.
virtual const Array< OneD, const int > & v_GetGlobalToUniversalMapUnique()
virtual const Array< OneD, const int > & v_GetGlobalToUniversalMap()
int m_fullSystemBandWidth
Bandwith of the full matrix system (no static condensation).
std::shared_ptr< BottomUpSubStructuredGraph > BottomUpSubStructuredGraphSharedPtr
std::shared_ptr< SessionReader > SessionReaderSharedPtr
virtual void v_LocalToGlobal(const Array< OneD, const NekDouble > &loc, Array< OneD, NekDouble > &global, bool useComm) const
virtual const Array< OneD, NekDouble > & v_GetLocalToGlobalSign() const
virtual void v_Assemble(const Array< OneD, const NekDouble > &loc, Array< OneD, NekDouble > &global) const