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  {
50  class PreconditionerLowEnergy;
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 
84 
86 
87  // store how many consecutive similar blocks there
88  // are in R and Rinv
89  std::vector<std::pair<int,int> > m_sameBlock;
90 
91  virtual void v_DoTransformBasisToLowEnergy(
92  Array<OneD, NekDouble>& pInOut);
93 
95  Array<OneD, NekDouble>& pInOut);
96 
98  const Array<OneD, NekDouble>& pInput,
99  Array<OneD, NekDouble>& pOutput);
100 
101  virtual void v_DoTransformCoeffsToLowEnergy(
102  const Array<OneD, NekDouble>& pInput,
103  Array<OneD, NekDouble>& pOutput);
104 
105  private:
106 
108 
109  typedef std::map<LibUtilities::ShapeType, DNekScalMatSharedPtr>
111  typedef std::map<LibUtilities::ShapeType,
113  typedef std::map<LibUtilities::ShapeType,
115  typedef std::map<LibUtilities::ShapeType,
118 
120  ShapeToExpMap &maxElmt,
121  ShapeToIntArrayMap &vertMapMaxR,
122  ShapeToIntArrayArrayMap &edgeMapMaxR);
123 
124  void SetUpPyrMaxRMat(int nummodesmax,
126  ShapeToDNekMap &maxRmat,
127  ShapeToIntArrayMap &vertMapMaxR,
128  ShapeToIntArrayArrayMap &edgeMapMaxR,
129  ShapeToIntArrayArrayMap &faceMapMaxR);
130 
131  void ReSetTetMaxRMat(int nummodesmax,
133  ShapeToDNekMap &maxRmat,
134  ShapeToIntArrayMap &vertMapMaxR,
135  ShapeToIntArrayArrayMap &edgeMapMaxR,
136  ShapeToIntArrayArrayMap &faceMapMaxR);
137 
138 
139  void ReSetPrismMaxRMat(int nummodesmax,
141  ShapeToDNekMap &maxRmat,
142  ShapeToIntArrayMap &vertMapMaxR,
143  ShapeToIntArrayArrayMap &edgeMapMaxR,
144  ShapeToIntArrayArrayMap &faceMapMaxR,
145  bool UseTetOnly);
146 
149  DNekScalMatSharedPtr &maxRmat,
151  Array<OneD, unsigned int> &vertMapMaxR,
152  Array<OneD, Array<OneD, unsigned int> > &edgeMapMaxR);
153 
154  void CreateVariablePMask(void);
155 
160 
161  virtual void v_InitObject();
162 
163  virtual void v_DoPreconditioner(
164  const Array<OneD, NekDouble>& pInput,
165  Array<OneD, NekDouble>& pOutput);
166 
167  virtual void v_BuildPreconditioner();
168 
169  virtual DNekScalMatSharedPtr
170  v_TransformedSchurCompl(int n, int offset,
171  const std::shared_ptr<DNekScalMat > &loc_mat);
172  };
173  }
174 }
175 
176 #endif
#define MULTI_REGIONS_EXPORT
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
SpatialDomains::HexGeomSharedPtr CreateRefHexGeom(void)
Sets up the reference hexahedral element needed to construct a low energy basis.
void ReSetPrismMaxRMat(int nummodesmax, LocalRegions::PrismExpSharedPtr &PirsmExp, ShapeToDNekMap &maxRmat, ShapeToIntArrayMap &vertMapMaxR, ShapeToIntArrayArrayMap &edgeMapMaxR, ShapeToIntArrayArrayMap &faceMapMaxR, bool UseTetOnly)
virtual void v_DoTransformBasisFromLowEnergy(const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput)
Multiply by the block inverse transformation matrix This transforms the bassi from Low Energy to orig...
virtual void v_DoPreconditioner(const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput)
std::map< LibUtilities::ShapeType, LocalRegions::Expansion3DSharedPtr > ShapeToExpMap
virtual void v_DoTransformCoeffsFromLowEnergy(Array< OneD, NekDouble > &pInOut)
transform the solution coeffiicents from low energy back to the original coefficient space.
virtual void v_DoTransformBasisToLowEnergy(Array< OneD, NekDouble > &pInOut)
Transform the basis vector to low energy space.
DNekMatSharedPtr ExtractLocMat(LocalRegions::Expansion3DSharedPtr &locExp, DNekScalMatSharedPtr &maxRmat, LocalRegions::Expansion3DSharedPtr &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)
std::map< LibUtilities::ShapeType, DNekScalMatSharedPtr > ShapeToDNekMap
static PreconditionerSharedPtr create(const std::shared_ptr< GlobalLinSys > &plinsys, const std::shared_ptr< AssemblyMap > &pLocToGloMap)
Creates an instance of this class.
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::vector< std::pair< int, int > > m_sameBlock
virtual void v_BuildPreconditioner()
Construct the low energy preconditioner from .
std::map< LibUtilities::ShapeType, Array< OneD, Array< OneD, unsigned int > > > ShapeToIntArrayArrayMap
SpatialDomains::PrismGeomSharedPtr CreateRefPrismGeom(void)
Sets up the reference prismatic element needed to construct a low energy basis.
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, unsigned int > > ShapeToIntArrayMap
void SetUpPyrMaxRMat(int nummodesmax, LocalRegions::PyrExpSharedPtr &PyrExp, ShapeToDNekMap &maxRmat, ShapeToIntArrayMap &vertMapMaxR, ShapeToIntArrayArrayMap &edgeMapMaxR, ShapeToIntArrayArrayMap &faceMapMaxR)
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_DoTransformCoeffsToLowEnergy(const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput)
Multiply by the block tranposed inverse transformation matrix (R^T)^{-1} which is equivlaent to trans...
SpatialDomains::PyrGeomSharedPtr CreateRefPyrGeom(void)
Sets up the reference prismatic element needed to construct a low energy basis mapping arrays.
std::shared_ptr< PrismExp > PrismExpSharedPtr
Definition: PrismExp.h:223
std::shared_ptr< PyrExp > PyrExpSharedPtr
Definition: PyrExp.h:195
std::shared_ptr< Expansion3D > Expansion3DSharedPtr
Definition: Expansion2D.h:49
std::shared_ptr< TetExp > TetExpSharedPtr
Definition: TetExp.h:230
std::shared_ptr< PreconditionerLowEnergy > PreconditionerLowEnergySharedPtr
std::shared_ptr< Preconditioner > PreconditionerSharedPtr
Definition: GlobalLinSys.h:60
std::shared_ptr< AssemblyMap > AssemblyMapSharedPtr
Definition: AssemblyMap.h:52
std::shared_ptr< PrismGeom > PrismGeomSharedPtr
Definition: PrismGeom.h:82
std::shared_ptr< PyrGeom > PyrGeomSharedPtr
Definition: PyrGeom.h:74
std::shared_ptr< TetGeom > TetGeomSharedPtr
Definition: TetGeom.h:82
std::shared_ptr< HexGeom > HexGeomSharedPtr
Definition: HexGeom.h:84
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:1
std::shared_ptr< DNekScalMat > DNekScalMatSharedPtr
std::shared_ptr< DNekBlkMat > DNekBlkMatSharedPtr
Definition: NekTypeDefs.hpp:71
std::shared_ptr< DNekMat > DNekMatSharedPtr
Definition: NekTypeDefs.hpp:69