Nektar++
PreconditionerLowEnergy.h
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: PreconditionerLowEnergy.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: PreconditionerLowEnergy header
32//
33///////////////////////////////////////////////////////////////////////////////
34#ifndef NEKTAR_LIB_MULTIREGIONS_PRECONDITIONERLOWENERGY_H
35#define NEKTAR_LIB_MULTIREGIONS_PRECONDITIONERLOWENERGY_H
36#include <LocalRegions/HexExp.h>
38#include <LocalRegions/PyrExp.h>
39#include <LocalRegions/TetExp.h>
44
45namespace Nektar
46{
47namespace MultiRegions
48{
49class PreconditionerLowEnergy;
50typedef std::shared_ptr<PreconditionerLowEnergy>
52
54{
55public:
56 /// Creates an instance of this class
58 const std::shared_ptr<GlobalLinSys> &plinsys,
59 const std::shared_ptr<AssemblyMap> &pLocToGloMap)
60 {
63 plinsys, pLocToGloMap);
64 p->InitObject();
65 return p;
66 }
67
68 /// Name of class
69 static std::string className;
70
72 const std::shared_ptr<GlobalLinSys> &plinsys,
73 const AssemblyMapSharedPtr &pLocToGloMap);
74
77 {
78 }
79
80protected:
84
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 virtual void v_InitObject() override;
94
95 virtual void v_DoPreconditioner(const Array<OneD, NekDouble> &pInput,
97 const bool &isLocal = false) override;
98
99 virtual void v_BuildPreconditioner() override;
100
102 int n, int offset,
103 const std::shared_ptr<DNekScalMat> &loc_mat) override;
104
106 Array<OneD, NekDouble> &pInOut) override;
107
109 Array<OneD, NekDouble> &pInOut) override;
110
112 const Array<OneD, NekDouble> &pInput,
113 Array<OneD, NekDouble> &pOutput) override;
114
116 const Array<OneD, NekDouble> &pInput,
117 Array<OneD, NekDouble> &pOutput) override;
118
119private:
121
122 typedef std::map<LibUtilities::ShapeType, DNekScalMatSharedPtr>
124 typedef std::map<LibUtilities::ShapeType,
127 typedef std::map<LibUtilities::ShapeType, Array<OneD, unsigned int>>
129 typedef std::map<LibUtilities::ShapeType,
132
134 ShapeToIntArrayMap &vertMapMaxR,
135 ShapeToIntArrayArrayMap &edgeMapMaxR);
136
137 void SetUpPyrMaxRMat(int nummodesmax, LocalRegions::PyrExpSharedPtr &PyrExp,
138 ShapeToDNekMap &maxRmat,
139 ShapeToIntArrayMap &vertMapMaxR,
140 ShapeToIntArrayArrayMap &edgeMapMaxR,
141 ShapeToIntArrayArrayMap &faceMapMaxR);
142
143 void ReSetTetMaxRMat(int nummodesmax, LocalRegions::TetExpSharedPtr &TetExp,
144 ShapeToDNekMap &maxRmat,
145 ShapeToIntArrayMap &vertMapMaxR,
146 ShapeToIntArrayArrayMap &edgeMapMaxR,
147 ShapeToIntArrayArrayMap &faceMapMaxR);
148
149 void ReSetPrismMaxRMat(int nummodesmax,
151 ShapeToDNekMap &maxRmat,
152 ShapeToIntArrayMap &vertMapMaxR,
153 ShapeToIntArrayArrayMap &edgeMapMaxR,
154 ShapeToIntArrayArrayMap &faceMapMaxR,
155 bool UseTetOnly);
156
159 DNekScalMatSharedPtr &maxRmat,
161 Array<OneD, unsigned int> &vertMapMaxR,
162 Array<OneD, Array<OneD, unsigned int>> &edgeMapMaxR);
163
164 void CreateVariablePMask(void);
165
170};
171} // namespace MultiRegions
172} // namespace Nektar
173
174#endif
#define MULTI_REGIONS_EXPORT
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
virtual void v_DoTransformCoeffsFromLowEnergy(Array< OneD, NekDouble > &pInOut) override
transform the solution coeffiicents from low energy back to the original coefficient space.
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)
std::vector< std::pair< int, int > > m_sameBlock
virtual void v_DoTransformCoeffsToLowEnergy(const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput) override
Multiply by the block tranposed inverse transformation matrix (R^T)^{-1} which is equivlaent to trans...
std::map< LibUtilities::ShapeType, LocalRegions::Expansion3DSharedPtr > ShapeToExpMap
virtual DNekScalMatSharedPtr v_TransformedSchurCompl(int n, int offset, const std::shared_ptr< DNekScalMat > &loc_mat) override
Set up the transformed block matrix system.
DNekMatSharedPtr ExtractLocMat(LocalRegions::Expansion3DSharedPtr &locExp, DNekScalMatSharedPtr &maxRmat, LocalRegions::Expansion3DSharedPtr &expMax, Array< OneD, unsigned int > &vertMapMaxR, Array< OneD, Array< OneD, unsigned int > > &edgeMapMaxR)
virtual void v_BuildPreconditioner() override
Construct the low energy preconditioner from .
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.
virtual void v_DoTransformBasisFromLowEnergy(const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput) override
Multiply by the block inverse transformation matrix This transforms the bassi from Low Energy to orig...
virtual void v_DoTransformBasisToLowEnergy(Array< OneD, NekDouble > &pInOut) override
Transform the basis vector to low energy space.
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.
virtual void v_DoPreconditioner(const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const bool &isLocal=false) override
std::map< LibUtilities::ShapeType, Array< OneD, unsigned int > > ShapeToIntArrayMap
void SetUpPyrMaxRMat(int nummodesmax, LocalRegions::PyrExpSharedPtr &PyrExp, ShapeToDNekMap &maxRmat, ShapeToIntArrayMap &vertMapMaxR, ShapeToIntArrayArrayMap &edgeMapMaxR, ShapeToIntArrayArrayMap &faceMapMaxR)
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:209
std::shared_ptr< PyrExp > PyrExpSharedPtr
Definition: PyrExp.h:185
std::shared_ptr< Expansion3D > Expansion3DSharedPtr
Definition: Expansion2D.h:51
std::shared_ptr< TetExp > TetExpSharedPtr
Definition: TetExp.h:214
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:85
std::shared_ptr< HexGeom > HexGeomSharedPtr
Definition: HexGeom.h:87
std::shared_ptr< PyrGeom > PyrGeomSharedPtr
Definition: PyrGeom.h:77
std::shared_ptr< TetGeom > TetGeomSharedPtr
Definition: TetGeom.h:85
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:2
std::shared_ptr< DNekScalMat > DNekScalMatSharedPtr
std::shared_ptr< DNekBlkMat > DNekBlkMatSharedPtr
Definition: NekTypeDefs.hpp:77
std::shared_ptr< DNekMat > DNekMatSharedPtr
Definition: NekTypeDefs.hpp:75