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 // License for the specific language governing rights and limitations under
14 // Permission is hereby granted, free of charge, to any person obtaining a
15 // copy of this software and associated documentation files (the "Software"),
16 // to deal in the Software without restriction, including without limitation
17 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
18 // and/or sell copies of the Software, and to permit persons to whom the
19 // Software is furnished to do so, subject to the following conditions:
20 //
21 // The above copyright notice and this permission notice shall be included
22 // in all copies or substantial portions of the Software.
23 //
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30 // DEALINGS IN THE SOFTWARE.
31 //
32 // Description: C0-continuous Local to Global mapping routines, base class
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
36 #ifndef MULTIREGIONS_ASSEMBLYMAPCG_H
37 #define MULTIREGIONS_ASSEMBLYMAPCG_H
38 
39 #include <boost/tuple/tuple.hpp>
40 
43 #include <MultiRegions/ExpList.h>
44 
45 namespace Nektar
46 {
47  namespace MultiRegions
48  {
49  static map<int,int> NullIntIntMap;
50  const static vector<map<int,int> > NullVecIntIntMap;
51 
53  typedef boost::shared_ptr<AssemblyMapCG> AssemblyMapCGSharedPtr;
54  typedef boost::tuple<int, int, NekDouble> ExtraDirDof;
55 
56  typedef vector<map<int, int> > DofGraph;
57 
59  StdRegions::Orientation faceOrient1,
60  StdRegions::Orientation faceOrient2);
61 
62 
63  /// Constructs mappings for the C0 scalar continuous Galerkin formulation.
64  class AssemblyMapCG: public AssemblyMap
65  {
69 
70  public:
71  /// Default constructor.
74  const std::string variable = "DefaultVar");
75 
76  /// General constructor for expansions of all dimensions without
77  /// boundary conditions.
80  const int numLocalCoeffs,
81  const ExpList &locExp,
82  const BndCondExp &bndCondExp
84  const BndCond &bndConditions
86  const bool checkIfSingular
87  = false,
88  const std::string variable
89  = "defaultVar",
90  const PeriodicMap &periodicVerts
92  const PeriodicMap &periodicEdges
94  const PeriodicMap &periodicFaces
95  = NullPeriodicMap);
96 
97  /// Destructor.
99 
100  MULTI_REGIONS_EXPORT map<int, vector<ExtraDirDof> >
102  {
103  return m_extraDirDofs;
104  }
105 
106  protected:
107  /// Integer map of local coeffs to global space
109  /// Integer sign of local coeffs to global space
111  /// Bandwith of the full matrix system (no static condensation).
113  /// Integer map of process coeffs to universal space
115  /// Integer map of unique process coeffs to universal space (signed)
117  /// Number of non Dirichlet vertex modes
119  /// Number of non Dirichlet edge modes
121  /// Number of non Dirichlet face modes
123  /// Number of Dirichlet edges
125  /// Number of Dirichlet faces
127  /// Number of Dirichlet edges
129  /// Number of Dirichlet faces
131  /// Number of local boundary condition coefficients
133  /// Extra dirichlet edges in parallel
135  /// Number of local boundary condition degrees of freedom.
137  /// Maximum static condensation level.
139  /// Map indicating degrees of freedom which are Dirichlet but whose
140  /// value is stored on another processor.
141  map<int, vector<ExtraDirDof> > m_extraDirDofs;
142 
144  const ExpList &locExp,
145  const BndCondExp &bndCondExp,
146  const Array<OneD, const BndCond> &bndConditions,
147  const bool checkIfSystemSingular,
148  const PeriodicMap &periodicVerts,
149  const PeriodicMap &periodicEdges,
150  const PeriodicMap &periodicFaces,
151  DofGraph &graph,
153  set<int> &extraDirVerts,
154  set<int> &extraDirEdges,
155  int &firstNonDirGraphVertId,
156  int &nExtraDirichlet,
157  int mdswitch = 1);
158 
160  const ExpList &locExp,
161  const PeriodicMap &perVerts = NullPeriodicMap,
162  const PeriodicMap &perEdges = NullPeriodicMap,
163  const PeriodicMap &perFaces = NullPeriodicMap);
164 
165  /// Calculate the bandwith of the full matrix system.
167 
168  MULTI_REGIONS_EXPORT virtual int v_GetLocalToGlobalMap(const int i) const;
169 
170  MULTI_REGIONS_EXPORT virtual int v_GetGlobalToUniversalMap(const int i) const;
171 
172  MULTI_REGIONS_EXPORT virtual int v_GetGlobalToUniversalMapUnique(const int i) const;
173 
175 
177 
179 
180  MULTI_REGIONS_EXPORT virtual NekDouble v_GetLocalToGlobalSign(const int i) const;
181 
183 
185  const Array<OneD, const NekDouble>& loc,
186  Array<OneD, NekDouble>& global) const;
187 
189  const NekVector<NekDouble>& loc,
190  NekVector< NekDouble>& global) const;
191 
193  const Array<OneD, const NekDouble>& global,
194  Array<OneD, NekDouble>& loc) const;
195 
197  const NekVector<NekDouble>& global,
198  NekVector< NekDouble>& loc) const;
199 
200  MULTI_REGIONS_EXPORT virtual void v_Assemble(
201  const Array<OneD, const NekDouble> &loc,
202  Array<OneD, NekDouble> &global) const;
203 
204  MULTI_REGIONS_EXPORT virtual void v_Assemble(
205  const NekVector<NekDouble>& loc,
206  NekVector< NekDouble>& global) const;
207 
209  Array<OneD, NekDouble>& pGlobal) const;
210 
212  NekVector< NekDouble>& pGlobal) const;
213 
215  Array<OneD, NekDouble>& pGlobal,
216  int offset) const;
217 
219 
221 
222  MULTI_REGIONS_EXPORT virtual int v_GetNumNonDirEdgeModes() const;
223 
224  MULTI_REGIONS_EXPORT virtual int v_GetNumNonDirFaceModes() const;
225 
226  MULTI_REGIONS_EXPORT virtual int v_GetNumDirEdges() const;
227 
228  MULTI_REGIONS_EXPORT virtual int v_GetNumDirFaces() const;
229 
230  MULTI_REGIONS_EXPORT virtual int v_GetNumNonDirEdges() const;
231 
232  MULTI_REGIONS_EXPORT virtual int v_GetNumNonDirFaces() const;
233 
235 
237  const ExpList &locexp, GlobalSysSolnType solnType);
238  };
239 
240 
241  } // end of namespace
242 } // end of namespace
243 
244 #endif //MULTIREGIONS_ASSEMBLYMAPCG_H
245 
AssemblyMapCG(const LibUtilities::SessionReaderSharedPtr &pSession, const std::string variable="DefaultVar")
Default constructor.
virtual void v_LocalToGlobal(const Array< OneD, const NekDouble > &loc, Array< OneD, NekDouble > &global) const
int m_maxStaticCondLevel
Maximum static condensation level.
std::map< int, vector< PeriodicEntity > > PeriodicMap
boost::shared_ptr< AssemblyMap > AssemblyMapSharedPtr
Definition: AssemblyMap.h:53
virtual int v_GetNumNonDirEdgeModes() const
Array< OneD, int > m_globalToUniversalMapUnique
Integer map of unique process coeffs to universal space (signed)
static map< int, int > NullIntIntMap
Definition: AssemblyMapCG.h:49
static const Array< OneD, BoundaryConditionShPtr > NullBoundaryConditionShPtrArray
Definition: Conditions.h:215
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)
virtual int v_GetNumNonDirFaceModes() const
int m_numLocDirBndCondDofs
Number of local boundary condition degrees of freedom.
int m_numNonDirVertexModes
Number of non Dirichlet vertex modes.
boost::shared_ptr< BottomUpSubStructuredGraph > BottomUpSubStructuredGraphSharedPtr
#define MULTI_REGIONS_EXPORT
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, set< int > &extraDirVerts, set< int > &extraDirEdges, int &firstNonDirGraphVertId, int &nExtraDirichlet, int mdswitch=1)
Array< OneD, int > m_globalToUniversalMap
Integer map of process coeffs to universal space.
int m_numNonDirEdges
Number of Dirichlet edges.
map< int, vector< ExtraDirDof > > & GetExtraDirDofs()
vector< map< int, int > > DofGraph
Definition: AssemblyMapCG.h:56
int m_numLocalBndCondCoeffs
Number of local boundary condition coefficients.
virtual void v_Assemble(const Array< OneD, const NekDouble > &loc, Array< OneD, NekDouble > &global) const
virtual void v_GlobalToLocal(const Array< OneD, const NekDouble > &global, Array< OneD, NekDouble > &loc) const
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
Definition: MeshPartition.h:50
void CalculateFullSystemBandWidth()
Calculate the bandwith of the full matrix system.
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:59
int m_numNonDirFaceModes
Number of non Dirichlet face modes.
Base class for all multi-elemental spectral/hp expansions.
Definition: ExpList.h:101
map< int, vector< ExtraDirDof > > m_extraDirDofs
Map indicating degrees of freedom which are Dirichlet but whose value is stored on another processor...
boost::tuple< int, int, NekDouble > ExtraDirDof
Definition: AssemblyMapCG.h:54
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:68
Array< OneD, const ExpListSharedPtr > BndCondExp
Definition: AssemblyMapCG.h:66
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_GetNumNonDirFaces() const
double NekDouble
virtual int v_GetFullSystemBandWidth() const
virtual void v_UniversalAssemble(Array< OneD, NekDouble > &pGlobal) const
virtual const Array< OneD, const int > & v_GetExtraDirEdges()
int m_numDirEdges
Number of Dirichlet edges.
static const Array< OneD, ExpListSharedPtr > NullExpListSharedPtrArray
Definition: ExpList.h:2086
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 vector< map< int, int > > NullVecIntIntMap
Definition: AssemblyMapCG.h:50
Constructs mappings for the C0 scalar continuous Galerkin formulation.
Definition: AssemblyMapCG.h:64
int m_numNonDirFaces
Number of Dirichlet faces.
virtual const Array< OneD, NekDouble > & v_GetLocalToGlobalSign() const
virtual const Array< OneD, const int > & v_GetGlobalToUniversalMapUnique()
virtual int v_GetNumNonDirEdges() const
boost::shared_ptr< AssemblyMapCG > AssemblyMapCGSharedPtr
Definition: AssemblyMapCG.h:52
virtual const Array< OneD, const int > & v_GetGlobalToUniversalMap()
int m_fullSystemBandWidth
Bandwith of the full matrix system (no static condensation).