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 // 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 std::map<int,int> NullIntIntMap;
50  const static std::vector<std::map<int,int> > NullVecIntIntMap;
51 
53  typedef boost::shared_ptr<AssemblyMapCG> AssemblyMapCGSharedPtr;
54  typedef boost::tuple<int, int, NekDouble> ExtraDirDof;
55 
56  typedef std::vector<std::map<int, int> > DofGraph;
57 
59  std::pair<int, StdRegions::Orientation> DeterminePeriodicEdgeOrientId(
60  int meshEdgeId,
61  StdRegions::Orientation edgeOrient,
62  const std::vector<PeriodicEntity> &periodicEdges);
63 
66  StdRegions::Orientation faceOrient1,
67  StdRegions::Orientation faceOrient2);
68 
69 
70  /// Constructs mappings for the C0 scalar continuous Galerkin formulation.
71  class AssemblyMapCG: public AssemblyMap
72  {
76 
77  public:
78  /// Default constructor.
81  const std::string variable = "DefaultVar");
82 
83  /// General constructor for expansions of all dimensions without
84  /// boundary conditions.
87  const int numLocalCoeffs,
88  const ExpList &locExp,
89  const BndCondExp &bndCondExp
91  const BndCond &bndConditions
93  const bool checkIfSingular
94  = false,
95  const std::string variable
96  = "defaultVar",
97  const PeriodicMap &periodicVerts
99  const PeriodicMap &periodicEdges
100  = NullPeriodicMap,
101  const PeriodicMap &periodicFaces
102  = NullPeriodicMap);
103 
104  /// Destructor.
106 
107  MULTI_REGIONS_EXPORT std::map<int, std::vector<ExtraDirDof> >
109  {
110  return m_extraDirDofs;
111  }
112 
113  protected:
114  /// Integer map of local coeffs to global space
116  /// Integer sign of local coeffs to global space
118  /// Bandwith of the full matrix system (no static condensation).
120  /// Integer map of process coeffs to universal space
122  /// Integer map of unique process coeffs to universal space (signed)
124  /// Number of non Dirichlet vertex modes
126  /// Number of non Dirichlet edge modes
128  /// Number of non Dirichlet face modes
130  /// Number of Dirichlet edges
132  /// Number of Dirichlet faces
134  /// Number of Dirichlet edges
136  /// Number of Dirichlet faces
138  /// Number of local boundary condition coefficients
140  /// Extra dirichlet edges in parallel
142  /// Number of local boundary condition degrees of freedom.
144  /// Maximum static condensation level.
146  /// Map indicating degrees of freedom which are Dirichlet but whose
147  /// value is stored on another processor.
148  std::map<int, std::vector<ExtraDirDof> > m_extraDirDofs;
149 
151  const ExpList &locExp,
152  const BndCondExp &bndCondExp,
153  const Array<OneD, const BndCond> &bndConditions,
154  const bool checkIfSystemSingular,
155  const PeriodicMap &periodicVerts,
156  const PeriodicMap &periodicEdges,
157  const PeriodicMap &periodicFaces,
158  DofGraph &graph,
160  std::set<int> &extraDirVerts,
161  std::set<int> &extraDirEdges,
162  int &firstNonDirGraphVertId,
163  int &nExtraDirichlet,
164  int mdswitch = 1);
165 
167  const ExpList &locExp,
168  const PeriodicMap &perVerts = NullPeriodicMap,
169  const PeriodicMap &perEdges = NullPeriodicMap,
170  const PeriodicMap &perFaces = NullPeriodicMap);
171 
172  /// Calculate the bandwith of the full matrix system.
174 
175  MULTI_REGIONS_EXPORT virtual int v_GetLocalToGlobalMap(const int i) const;
176 
177  MULTI_REGIONS_EXPORT virtual int v_GetGlobalToUniversalMap(const int i) const;
178 
179  MULTI_REGIONS_EXPORT virtual int v_GetGlobalToUniversalMapUnique(const int i) const;
180 
182 
184 
186 
187  MULTI_REGIONS_EXPORT virtual NekDouble v_GetLocalToGlobalSign(const int i) const;
188 
190 
192  const Array<OneD, const NekDouble>& loc,
193  Array<OneD, NekDouble>& global,
194  bool useComm) const;
195 
197  const NekVector<NekDouble>& loc,
198  NekVector< NekDouble>& global,
199  bool useComm) const;
200 
202  const Array<OneD, const NekDouble>& global,
203  Array<OneD, NekDouble>& loc) const;
204 
206  const NekVector<NekDouble>& global,
207  NekVector< NekDouble>& loc) const;
208 
209  MULTI_REGIONS_EXPORT virtual void v_Assemble(
210  const Array<OneD, const NekDouble> &loc,
211  Array<OneD, NekDouble> &global) const;
212 
213  MULTI_REGIONS_EXPORT virtual void v_Assemble(
214  const NekVector<NekDouble>& loc,
215  NekVector< NekDouble>& global) const;
216 
218  Array<OneD, NekDouble>& pGlobal) const;
219 
221  NekVector< NekDouble>& pGlobal) const;
222 
224  Array<OneD, NekDouble>& pGlobal,
225  int offset) const;
226 
228 
230 
231  MULTI_REGIONS_EXPORT virtual int v_GetNumNonDirEdgeModes() const;
232 
233  MULTI_REGIONS_EXPORT virtual int v_GetNumNonDirFaceModes() const;
234 
235  MULTI_REGIONS_EXPORT virtual int v_GetNumDirEdges() const;
236 
237  MULTI_REGIONS_EXPORT virtual int v_GetNumDirFaces() const;
238 
239  MULTI_REGIONS_EXPORT virtual int v_GetNumNonDirEdges() const;
240 
241  MULTI_REGIONS_EXPORT virtual int v_GetNumNonDirFaces() const;
242 
244 
246  const ExpList &locexp, GlobalSysSolnType solnType);
247  };
248 
249 
250  } // end of namespace
251 } // end of namespace
252 
253 #endif //MULTIREGIONS_ASSEMBLYMAPCG_H
254 
static std::map< int, int > NullIntIntMap
Definition: AssemblyMapCG.h:49
AssemblyMapCG(const LibUtilities::SessionReaderSharedPtr &pSession, const std::string variable="DefaultVar")
Default constructor.
int m_maxStaticCondLevel
Maximum static condensation level.
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 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)
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
std::map< int, std::vector< ExtraDirDof > > & GetExtraDirDofs()
Array< OneD, int > m_globalToUniversalMap
Integer map of process coeffs to universal space.
int m_numNonDirEdges
Number of Dirichlet edges.
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
std::map< int, std::vector< ExtraDirDof > > m_extraDirDofs
Map indicating degrees of freedom which are Dirichlet but whose value is stored on another processor...
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
Definition: MeshPartition.h:51
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.
virtual void v_LocalToGlobal(const Array< OneD, const NekDouble > &loc, Array< OneD, NekDouble > &global, bool useComm) const
Base class for all multi-elemental spectral/hp expansions.
Definition: ExpList.h:101
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:75
Array< OneD, const ExpListSharedPtr > BndCondExp
Definition: AssemblyMapCG.h:73
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
std::map< int, std::vector< PeriodicEntity > > PeriodicMap
virtual void v_UniversalAssemble(Array< OneD, NekDouble > &pGlobal) const
virtual const Array< OneD, const int > & v_GetExtraDirEdges()
std::vector< std::map< int, int > > DofGraph
Definition: AssemblyMapCG.h:56
int m_numDirEdges
Number of Dirichlet edges.
static const Array< OneD, ExpListSharedPtr > NullExpListSharedPtrArray
Definition: ExpList.h:2326
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:50
Constructs mappings for the C0 scalar continuous Galerkin formulation.
Definition: AssemblyMapCG.h:71
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, 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).