Nektar++
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
51  class AssemblyMapCG;
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::set<ExtraDirDof> &GetCopyLocalDirDofs()
107  {
108  return m_copyLocalDirDofs;
109  }
110 
112  {
113  return m_parallelDirBndSign;
114  }
115 
116  protected:
117  /// Integer map of local coeffs to global space
119  /// Integer sign of local coeffs to global space
121  /// Bandwith of the full matrix system (no static condensation).
123  /// Integer map of process coeffs to universal space
125  /// Integer map of unique process coeffs to universal space (signed)
127  /// Number of non Dirichlet vertex modes
129  /// Number of non Dirichlet edge modes
131  /// Number of non Dirichlet face modes
133  /// Number of Dirichlet edges
135  /// Number of Dirichlet faces
137  /// Number of Dirichlet edges
139  /// Number of Dirichlet faces
141  /// Number of local boundary condition coefficients
143  /// Extra dirichlet edges in parallel
145  /// Number of local boundary condition degrees of freedom.
147  /// Maximum static condensation level.
149  /// Set indicating degrees of freedom which are Dirichlet but whose
150  /// value is stored on another processor.
151  std::set<ExtraDirDof> m_copyLocalDirDofs;
152  /// Set indicating the local coeffs just touching parallel
153  /// dirichlet boundary that have a sign change
154  std::set<int> m_parallelDirBndSign;
155 
157  const ExpList &locExp,
158  const BndCondExp &bndCondExp,
159  const Array<OneD, const BndCond> &bndConditions,
160  const bool checkIfSystemSingular,
161  const PeriodicMap &periodicVerts,
162  const PeriodicMap &periodicEdges,
163  const PeriodicMap &periodicFaces,
164  DofGraph &graph,
166  std::set<int> &extraDirVerts,
167  std::set<int> &extraDirEdges,
168  int &firstNonDirGraphVertId,
169  int &nExtraDirichlet,
170  int mdswitch = 1);
171 
173  const ExpList &locExp,
174  const PeriodicMap &perVerts = NullPeriodicMap,
175  const PeriodicMap &perEdges = NullPeriodicMap,
176  const PeriodicMap &perFaces = NullPeriodicMap);
177 
178  /// Calculate the bandwith of the full matrix system.
180 
181  MULTI_REGIONS_EXPORT virtual int v_GetLocalToGlobalMap(const int i) const;
182 
183  MULTI_REGIONS_EXPORT virtual int v_GetGlobalToUniversalMap(const int i) const;
184 
185  MULTI_REGIONS_EXPORT virtual int v_GetGlobalToUniversalMapUnique(const int i) const;
186 
188 
190 
192 
193  MULTI_REGIONS_EXPORT virtual NekDouble v_GetLocalToGlobalSign(const int i) const;
194 
196 
199  Array<OneD, NekDouble>& global,
200  bool useComm) const;
201 
203  const NekVector<NekDouble>& loc,
204  NekVector< NekDouble>& global,
205  bool useComm) const;
206 
208  const Array<OneD, const NekDouble>& global,
209  Array<OneD, NekDouble>& loc) const;
210 
212  const NekVector<NekDouble>& global,
213  NekVector< NekDouble>& loc) const;
214 
215  MULTI_REGIONS_EXPORT virtual void v_Assemble(
217  Array<OneD, NekDouble> &global) const;
218 
219  MULTI_REGIONS_EXPORT virtual void v_Assemble(
220  const NekVector<NekDouble>& loc,
221  NekVector< NekDouble>& global) const;
222 
224  Array<OneD, NekDouble>& pGlobal) const;
225 
227  NekVector< NekDouble>& pGlobal) const;
228 
230  Array<OneD, NekDouble>& pGlobal,
231  int offset) const;
232 
234 
236 
237  MULTI_REGIONS_EXPORT virtual int v_GetNumNonDirEdgeModes() const;
238 
239  MULTI_REGIONS_EXPORT virtual int v_GetNumNonDirFaceModes() const;
240 
241  MULTI_REGIONS_EXPORT virtual int v_GetNumDirEdges() const;
242 
243  MULTI_REGIONS_EXPORT virtual int v_GetNumDirFaces() const;
244 
245  MULTI_REGIONS_EXPORT virtual int v_GetNumNonDirEdges() const;
246 
247  MULTI_REGIONS_EXPORT virtual int v_GetNumNonDirFaces() const;
248 
250 
252  const ExpList &locexp, GlobalSysSolnType solnType);
253  };
254 
255 
256  } // end of namespace
257 } // end of namespace
258 
259 #endif //MULTIREGIONS_ASSEMBLYMAPCG_H
260 
#define MULTI_REGIONS_EXPORT
Constructs mappings for the C0 scalar continuous Galerkin formulation.
Definition: AssemblyMapCG.h:71
int m_maxStaticCondLevel
Maximum static condensation level.
int m_numNonDirVertexModes
Number of non Dirichlet vertex modes.
virtual const Array< OneD, const int > & v_GetGlobalToUniversalMap()
virtual int v_GetFullSystemBandWidth() const
Array< OneD, int > m_globalToUniversalMapUnique
Integer map of unique process coeffs to universal space (signed)
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)
virtual int v_GetNumNonDirFaceModes() const
virtual const Array< OneD, const int > & v_GetLocalToGlobalMap()
virtual int v_GetNumNonDirEdgeModes() const
int m_numNonDirEdges
Number of Dirichlet edges.
std::set< int > m_parallelDirBndSign
Set indicating the local coeffs just touching parallel dirichlet boundary that have a sign change.
Array< OneD, int > m_globalToUniversalMap
Integer map of process coeffs to universal space.
virtual const Array< OneD, const int > & v_GetGlobalToUniversalMapUnique()
Array< OneD, NekDouble > m_localToGlobalSign
Integer sign of local coeffs to global space.
virtual void v_LocalToGlobal(const Array< OneD, const NekDouble > &loc, Array< OneD, NekDouble > &global, bool useComm) const
virtual int v_GetNumNonDirVertexModes() const
Array< OneD, const ExpListSharedPtr > BndCondExp
Definition: AssemblyMapCG.h:72
Array< OneD, int > m_extraDirEdges
Extra dirichlet edges in parallel.
int m_numLocDirBndCondDofs
Number of local boundary condition degrees of freedom.
virtual void v_Assemble(const Array< OneD, const NekDouble > &loc, Array< OneD, NekDouble > &global) const
int m_numNonDirFaceModes
Number of non Dirichlet face modes.
std::set< ExtraDirDof > & GetCopyLocalDirDofs()
int m_numNonDirEdgeModes
Number of non Dirichlet edge modes.
virtual void v_UniversalAssemble(Array< OneD, NekDouble > &pGlobal) const
int m_numDirEdges
Number of Dirichlet edges.
virtual const Array< OneD, NekDouble > & v_GetLocalToGlobalSign() const
AssemblyMapCG(const LibUtilities::SessionReaderSharedPtr &pSession, const std::string variable="DefaultVar")
Default constructor.
virtual const Array< OneD, const int > & v_GetExtraDirEdges()
int m_fullSystemBandWidth
Bandwith of the full matrix system (no static condensation).
int m_numDirFaces
Number of Dirichlet faces.
void SetUpUniversalC0ContMap(const ExpList &locExp, const PeriodicMap &perVerts=NullPeriodicMap, const PeriodicMap &perEdges=NullPeriodicMap, const PeriodicMap &perFaces=NullPeriodicMap)
virtual void v_GlobalToLocal(const Array< OneD, const NekDouble > &global, Array< OneD, NekDouble > &loc) const
std::set< int > & GetParallelDirBndSign()
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_localToGlobalMap
Integer map of local coeffs to global space.
Array< OneD, const SpatialDomains::BoundaryConditionShPtr > BndCond
Definition: AssemblyMapCG.h:74
virtual AssemblyMapSharedPtr v_LinearSpaceMap(const ExpList &locexp, GlobalSysSolnType solnType)
Construct an AssemblyMapCG object which corresponds to the linear space of the current object.
int m_numLocalBndCondCoeffs
Number of local boundary condition coefficients.
Base class for constructing local to global mapping of degrees of freedom.
Definition: AssemblyMap.h:59
Base class for all multi-elemental spectral/hp expansions.
Definition: ExpList.h:107
std::shared_ptr< SessionReader > SessionReaderSharedPtr
static PeriodicMap NullPeriodicMap
std::shared_ptr< BottomUpSubStructuredGraph > BottomUpSubStructuredGraphSharedPtr
std::shared_ptr< AssemblyMapCG > AssemblyMapCGSharedPtr
Definition: AssemblyMapCG.h:51
std::tuple< int, int, NekDouble > ExtraDirDof
Definition: AssemblyMapCG.h:53
std::vector< std::map< int, int > > DofGraph
Definition: AssemblyMapCG.h:55
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:2749
std::shared_ptr< AssemblyMap > AssemblyMapSharedPtr
Definition: AssemblyMap.h:52
std::map< int, std::vector< PeriodicEntity > > PeriodicMap
static std::map< int, int > NullIntIntMap
Definition: AssemblyMapCG.h:48
static const std::vector< std::map< int, int > > NullVecIntIntMap
Definition: AssemblyMapCG.h:49
StdRegions::Orientation DeterminePeriodicFaceOrient(StdRegions::Orientation faceOrient, StdRegions::Orientation perFaceOrient)
Determine relative orientation between two faces.
static const Array< OneD, BoundaryConditionShPtr > NullBoundaryConditionShPtrArray
Definition: Conditions.h:228
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:1
double NekDouble