Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator 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 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  {
66  typedef Array<OneD, const ExpListSharedPtr> BndCondExp;
67  typedef Array<OneD, const SpatialDomains::BoundaryConditionShPtr>
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
108  Array<OneD,int> m_localToGlobalMap;
109  /// Integer sign of local coeffs to global space
110  Array<OneD,NekDouble> m_localToGlobalSign;
111  /// Bandwith of the full matrix system (no static condensation).
113  /// Integer map of process coeffs to universal space
114  Array<OneD,int> m_globalToUniversalMap;
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
134  Array<OneD, int> m_extraDirEdges;
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 
174  MULTI_REGIONS_EXPORT virtual const Array<OneD,const int>& v_GetLocalToGlobalMap();
175 
176  MULTI_REGIONS_EXPORT virtual const Array<OneD, const int>& v_GetGlobalToUniversalMap();
177 
178  MULTI_REGIONS_EXPORT virtual const Array<OneD, const int>& v_GetGlobalToUniversalMapUnique();
179 
180  MULTI_REGIONS_EXPORT virtual NekDouble v_GetLocalToGlobalSign(const int i) const;
181 
182  MULTI_REGIONS_EXPORT virtual const Array<OneD, NekDouble>& v_GetLocalToGlobalSign() const;
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 
234  MULTI_REGIONS_EXPORT virtual const Array<OneD, const int>& v_GetExtraDirEdges();
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