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
46{
47class PreconditionerLowEnergy;
48typedef std::shared_ptr<PreconditionerLowEnergy>
50
52{
53public:
54 /// Creates an instance of this class
56 const std::shared_ptr<GlobalLinSys> &plinsys,
57 const std::shared_ptr<AssemblyMap> &pLocToGloMap)
58 {
61 plinsys, pLocToGloMap);
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 }
77
78protected:
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 void v_InitObject() override;
92
95 const bool &isLocal = false) override;
96
97 void v_BuildPreconditioner() override;
98
100 int n, int offset,
101 const std::shared_ptr<DNekScalMat> &loc_mat) override;
102
104
106 Array<OneD, NekDouble> &pInOut) override;
107
109 const Array<OneD, NekDouble> &pInput,
110 Array<OneD, NekDouble> &pOutput) override;
111
113 const Array<OneD, NekDouble> &pInput,
114 Array<OneD, NekDouble> &pOutput) override;
115
116private:
118
119 typedef std::map<LibUtilities::ShapeType, DNekScalMatSharedPtr>
121 typedef std::map<LibUtilities::ShapeType,
124 typedef std::map<LibUtilities::ShapeType, Array<OneD, unsigned int>>
126 typedef std::map<LibUtilities::ShapeType,
129
131 ShapeToIntArrayMap &vertMapMaxR,
132 ShapeToIntArrayArrayMap &edgeMapMaxR);
133
134 void SetUpPyrMaxRMat(int nummodesmax, LocalRegions::PyrExpSharedPtr &PyrExp,
135 ShapeToDNekMap &maxRmat,
136 ShapeToIntArrayMap &vertMapMaxR,
137 ShapeToIntArrayArrayMap &edgeMapMaxR,
138 ShapeToIntArrayArrayMap &faceMapMaxR);
139
140 void ReSetTetMaxRMat(int nummodesmax, LocalRegions::TetExpSharedPtr &TetExp,
141 ShapeToDNekMap &maxRmat,
142 ShapeToIntArrayMap &vertMapMaxR,
143 ShapeToIntArrayArrayMap &edgeMapMaxR,
144 ShapeToIntArrayArrayMap &faceMapMaxR);
145
146 void ReSetPrismMaxRMat(int nummodesmax,
148 ShapeToDNekMap &maxRmat,
149 ShapeToIntArrayMap &vertMapMaxR,
150 ShapeToIntArrayArrayMap &edgeMapMaxR,
151 ShapeToIntArrayArrayMap &faceMapMaxR,
152 bool UseTetOnly);
153
156 DNekScalMatSharedPtr &maxRmat,
158 Array<OneD, unsigned int> &vertMapMaxR,
159 Array<OneD, Array<OneD, unsigned int>> &edgeMapMaxR);
160
161 void CreateVariablePMask(void);
162
167};
168} // namespace Nektar::MultiRegions
169
170#endif
#define MULTI_REGIONS_EXPORT
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
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
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
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)
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.
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...
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.
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:207
std::shared_ptr< PyrExp > PyrExpSharedPtr
Definition: PyrExp.h:183
std::shared_ptr< Expansion3D > Expansion3DSharedPtr
Definition: Expansion2D.h:47
std::shared_ptr< TetExp > TetExpSharedPtr
Definition: TetExp.h:212
std::shared_ptr< PreconditionerLowEnergy > PreconditionerLowEnergySharedPtr
std::shared_ptr< Preconditioner > PreconditionerSharedPtr
Definition: GlobalLinSys.h:58
std::shared_ptr< AssemblyMap > AssemblyMapSharedPtr
Definition: AssemblyMap.h:50
std::shared_ptr< PrismGeom > PrismGeomSharedPtr
Definition: PrismGeom.h:82
std::shared_ptr< HexGeom > HexGeomSharedPtr
Definition: HexGeom.h:84
std::shared_ptr< PyrGeom > PyrGeomSharedPtr
Definition: PyrGeom.h:75
std::shared_ptr< TetGeom > TetGeomSharedPtr
Definition: TetGeom.h:82
std::shared_ptr< DNekScalMat > DNekScalMatSharedPtr
std::shared_ptr< DNekBlkMat > DNekBlkMatSharedPtr
Definition: NekTypeDefs.hpp:77
std::shared_ptr< DNekMat > DNekMatSharedPtr
Definition: NekTypeDefs.hpp:75