Nektar++
PreconditionerLowEnergy.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File Preconditioner.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: Preconditioner header
32 //
33 ///////////////////////////////////////////////////////////////////////////////
34 #ifndef NEKTAR_LIB_MULTIREGIONS_PRECONDITIONERLOWENERGY_H
35 #define NEKTAR_LIB_MULTIREGIONS_PRECONDITIONERLOWENERGY_H
40 #include <LocalRegions/TetExp.h>
41 #include <LocalRegions/PyrExp.h>
42 #include <LocalRegions/PrismExp.h>
43 #include <LocalRegions/HexExp.h>
44 
45 
46 namespace Nektar
47 {
48  namespace MultiRegions
49  {
51  typedef std::shared_ptr<PreconditionerLowEnergy> PreconditionerLowEnergySharedPtr;
52 
54  {
55  public:
56  /// Creates an instance of this class
58  const std::shared_ptr<GlobalLinSys> &plinsys,
59  const std::shared_ptr<AssemblyMap> &pLocToGloMap)
60  {
62  p->InitObject();
63  return p;
64  }
65 
66  /// Name of class
67  static std::string className;
68 
70  const std::shared_ptr<GlobalLinSys> &plinsys,
71  const AssemblyMapSharedPtr &pLocToGloMap);
72 
75 
76  protected:
77 
81 
82 
86 
88 
89  // store how many consecutive similar blocks there
90  // are in R and Rinv
91  std::vector<std::pair<int,int> > m_sameBlock;
92 
93  private:
94 
96 
97  typedef std::map<LibUtilities::ShapeType, DNekScalMatSharedPtr>
99  typedef std::map<LibUtilities::ShapeType,
101  typedef std::map<LibUtilities::ShapeType,
103  typedef std::map<LibUtilities::ShapeType,
106 
108  ShapeToExpMap &maxElmt,
109  ShapeToIntArrayMap &vertMapMaxR,
110  ShapeToIntArrayArrayMap &edgeMapMaxR);
111 
112  void SetUpPyrMaxRMat(int nummodesmax,
114  ShapeToDNekMap &maxRmat,
115  ShapeToIntArrayMap &vertMapMaxR,
116  ShapeToIntArrayArrayMap &edgeMapMaxR,
117  ShapeToIntArrayArrayMap &faceMapMaxR);
118 
119  void ReSetTetMaxRMat(int nummodesmax,
121  ShapeToDNekMap &maxRmat,
122  ShapeToIntArrayMap &vertMapMaxR,
123  ShapeToIntArrayArrayMap &edgeMapMaxR,
124  ShapeToIntArrayArrayMap &faceMapMaxR);
125 
126 
127  void ReSetPrismMaxRMat(int nummodesmax,
129  ShapeToDNekMap &maxRmat,
130  ShapeToIntArrayMap &vertMapMaxR,
131  ShapeToIntArrayArrayMap &edgeMapMaxR,
132  ShapeToIntArrayArrayMap &faceMapMaxR,
133  bool UseTetOnly);
134 
137  DNekScalMatSharedPtr &maxRmat,
139  Array<OneD, unsigned int> &vertMapMaxR,
140  Array<OneD, Array<OneD, unsigned int> > &edgeMapMaxR);
141 
142  void CreateMultiplicityMap(void);
143 
148 
149  virtual void v_InitObject();
150 
151  virtual void v_DoPreconditioner(
152  const Array<OneD, NekDouble>& pInput,
153  Array<OneD, NekDouble>& pOutput);
154 
155  virtual void v_DoTransformToLowEnergy(
156  Array<OneD, NekDouble>& pInOut,
157  int offset);
158 
159  virtual void v_DoTransformToLowEnergy(
160  const Array<OneD, NekDouble>& pInput,
161  Array<OneD, NekDouble>& pOutput);
162 
163  virtual void v_DoTransformFromLowEnergy(
164  Array<OneD, NekDouble>& pInOut);
165 
167  const Array<OneD, NekDouble>& pInput,
168  Array<OneD, NekDouble>& pOutput);
169 
171  const Array<OneD, NekDouble>& pInput,
172  Array<OneD, NekDouble>& pOutput);
173 
174  virtual void v_BuildPreconditioner();
175 
176  virtual DNekScalMatSharedPtr
177  v_TransformedSchurCompl(int n, int offset,
178  const std::shared_ptr<DNekScalMat > &loc_mat);
179  };
180  }
181 }
182 
183 #endif
virtual void v_DoPreconditioner(const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput)
std::vector< std::pair< int, int > > m_sameBlock
virtual DNekScalMatSharedPtr v_TransformedSchurCompl(int n, int offset, const std::shared_ptr< DNekScalMat > &loc_mat)
Set up the transformed block matrix system.
virtual void v_DoMultiplybyInverseTransposedTransformationMatrix(const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput)
Multiply by the block tranposed inverse transformation matrix.
std::shared_ptr< DNekScalMat > DNekScalMatSharedPtr
std::shared_ptr< TetGeom > TetGeomSharedPtr
Definition: TetGeom.h:88
DNekMatSharedPtr ExtractLocMat(StdRegions::StdExpansionSharedPtr &locExp, DNekScalMatSharedPtr &maxRmat, LocalRegions::ExpansionSharedPtr &expMax, Array< OneD, unsigned int > &vertMapMaxR, Array< OneD, Array< OneD, unsigned int > > &edgeMapMaxR)
void ReSetTetMaxRMat(int nummodesmax, LocalRegions::TetExpSharedPtr &TetExp, ShapeToDNekMap &maxRmat, ShapeToIntArrayMap &vertMapMaxR, ShapeToIntArrayArrayMap &edgeMapMaxR, ShapeToIntArrayArrayMap &faceMapMaxR)
#define MULTI_REGIONS_EXPORT
std::shared_ptr< TetExp > TetExpSharedPtr
Definition: TetExp.h:226
std::shared_ptr< DNekMat > DNekMatSharedPtr
Definition: NekTypeDefs.hpp:69
std::map< LibUtilities::ShapeType, LocalRegions::ExpansionSharedPtr > ShapeToExpMap
std::map< LibUtilities::ShapeType, Array< OneD, unsigned int > > ShapeToIntArrayMap
std::shared_ptr< DNekBlkMat > DNekBlkMatSharedPtr
Definition: NekTypeDefs.hpp:71
std::map< LibUtilities::ShapeType, DNekScalMatSharedPtr > ShapeToDNekMap
SpatialDomains::HexGeomSharedPtr CreateRefHexGeom(void)
Sets up the reference hexahedral element needed to construct a low energy basis.
std::shared_ptr< AssemblyMap > AssemblyMapSharedPtr
Definition: AssemblyMap.h:52
static PreconditionerSharedPtr create(const std::shared_ptr< GlobalLinSys > &plinsys, const std::shared_ptr< AssemblyMap > &pLocToGloMap)
Creates an instance of this class.
std::shared_ptr< StdExpansion > StdExpansionSharedPtr
virtual void v_BuildPreconditioner()
Construct the low energy preconditioner from .
void SetUpPyrMaxRMat(int nummodesmax, LocalRegions::PyrExpSharedPtr &PyrExp, ShapeToDNekMap &maxRmat, ShapeToIntArrayMap &vertMapMaxR, ShapeToIntArrayArrayMap &edgeMapMaxR, ShapeToIntArrayArrayMap &faceMapMaxR)
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
virtual void v_DoTransformToLowEnergy(Array< OneD, NekDouble > &pInOut, int offset)
Transform the solution vector vector to low energy.
SpatialDomains::PyrGeomSharedPtr CreateRefPyrGeom(void)
Sets up the reference prismatic element needed to construct a low energy basis mapping arrays...
void SetUpReferenceElements(ShapeToDNekMap &maxRmat, ShapeToExpMap &maxElmt, ShapeToIntArrayMap &vertMapMaxR, ShapeToIntArrayArrayMap &edgeMapMaxR)
Loop expansion and determine different variants of the transformation matrix.
std::map< LibUtilities::ShapeType, Array< OneD, Array< OneD, unsigned int > > > ShapeToIntArrayArrayMap
virtual void v_DoMultiplybyInverseTransformationMatrix(const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput)
Multiply by the block inverse transformation matrix.
virtual void v_DoTransformFromLowEnergy(Array< OneD, NekDouble > &pInOut)
transform the solution vector from low energy back to the original basis.
std::shared_ptr< PyrExp > PyrExpSharedPtr
Definition: PyrExp.h:191
PreconditionerLowEnergy(const std::shared_ptr< GlobalLinSys > &plinsys, const AssemblyMapSharedPtr &pLocToGloMap)
SpatialDomains::TetGeomSharedPtr CreateRefTetGeom(void)
Sets up the reference tretrahedral element needed to construct a low energy basis.
std::shared_ptr< Expansion > ExpansionSharedPtr
Definition: Expansion.h:65
std::shared_ptr< PyrGeom > PyrGeomSharedPtr
Definition: PyrGeom.h:80
std::shared_ptr< PrismExp > PrismExpSharedPtr
Definition: PrismExp.h:220
std::shared_ptr< HexGeom > HexGeomSharedPtr
Definition: HexGeom.h:90
SpatialDomains::PrismGeomSharedPtr CreateRefPrismGeom(void)
Sets up the reference prismatic element needed to construct a low energy basis.
std::shared_ptr< Preconditioner > PreconditionerSharedPtr
Definition: GlobalLinSys.h:60
std::shared_ptr< PrismGeom > PrismGeomSharedPtr
Definition: PrismGeom.h:88
std::shared_ptr< PreconditionerLowEnergy > PreconditionerLowEnergySharedPtr
void ReSetPrismMaxRMat(int nummodesmax, LocalRegions::PrismExpSharedPtr &PirsmExp, ShapeToDNekMap &maxRmat, ShapeToIntArrayMap &vertMapMaxR, ShapeToIntArrayArrayMap &edgeMapMaxR, ShapeToIntArrayArrayMap &faceMapMaxR, bool UseTetOnly)