Nektar++
GlobalLinSysIterativeStaticCond.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File: GlobalLinSysIterativeStaticCond.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: GlobalLinSysIterativeStaticCond header
32 //
33 ///////////////////////////////////////////////////////////////////////////////
34 #ifndef NEKTAR_LIB_MULTIREGIONS_GLOBALLINSYSITERATIVESTATICCOND_H
35 #define NEKTAR_LIB_MULTIREGIONS_GLOBALLINSYSITERATIVESTATICCOND_H
36 
41 
42 namespace Nektar
43 {
44 namespace MultiRegions
45 {
46 // Forward declarations
47 class ExpList;
48 class GlobalLinSysIterativeStaticCond;
49 
50 typedef std::shared_ptr<GlobalLinSysIterativeStaticCond>
52 
54 {
58  eSparse
59 };
60 
61 const char *const LocalMatrixStorageStrategyMap[] = {
62  "Contiguous", "Non-contiguous", "Sparse"};
63 
64 /// A global linear system.
66  virtual public GlobalLinSysStaticCond
67 {
68 public:
71  typedef std::shared_ptr<DNekSmvBsrDiagBlkMat> DNekSmvBsrDiagBlkMatSharedPtr;
72 
73  /// Creates an instance of this class
75  const GlobalLinSysKey &pLinSysKey,
76  const std::weak_ptr<ExpList> &pExpList,
77  const std::shared_ptr<AssemblyMap> &pLocToGloMap)
78  {
81  pLinSysKey, pExpList, pLocToGloMap);
82  p->InitObject();
83  return p;
84  }
85 
86  /// Name of class
87  static std::string className;
88  static std::string className2;
89 
90  /// Constructor for full direct matrix solve.
92  const GlobalLinSysKey &mkey, const std::weak_ptr<ExpList> &pExpList,
93  const std::shared_ptr<AssemblyMap> &locToGloMap);
94 
95  /// Constructor for full direct matrix solve.
97  const GlobalLinSysKey &mkey, const std::weak_ptr<ExpList> &pExpList,
98  const DNekScalBlkMatSharedPtr pSchurCompl,
99  const DNekScalBlkMatSharedPtr pBinvD, const DNekScalBlkMatSharedPtr pC,
100  const DNekScalBlkMatSharedPtr pInvD,
101  const std::shared_ptr<AssemblyMap> &locToGloMap,
102  const PreconditionerSharedPtr pPrecon);
103 
105 
106 protected:
107  virtual DNekScalBlkMatSharedPtr v_GetStaticCondBlock(unsigned int n);
109  const GlobalLinSysKey &mkey, const std::weak_ptr<ExpList> &pExpList,
110  const DNekScalBlkMatSharedPtr pSchurCompl,
111  const DNekScalBlkMatSharedPtr pBinvD, const DNekScalBlkMatSharedPtr pC,
112  const DNekScalBlkMatSharedPtr pInvD,
113  const std::shared_ptr<AssemblyMap> &locToGloMap);
114 
115  void v_PreSolve(int scLevel, Array<OneD, NekDouble> &F_bnd);
116  virtual void v_BasisFwdTransform(Array<OneD, NekDouble> &pInOut);
117  virtual void v_CoeffsBwdTransform(Array<OneD, NekDouble> &pInOut);
118  virtual void v_CoeffsFwdTransform(const Array<OneD, NekDouble> &pInput,
119  Array<OneD, NekDouble> &pOutput);
120 
121 private:
122  /// Dense storage for block Schur complement matrix
123  std::vector<double> m_storage;
124  /// Vector of pointers to local matrix data
125  std::vector<const double *> m_denseBlocks;
126  /// Ranks of local matrices
128  /// Scaling factors for local matrices
130  /// Sparse representation of Schur complement matrix at this level
132  /// Utility strings
133  static std::string storagedef;
134  static std::string storagelookupIds[];
135 
136  virtual void v_InitObject();
137 
138  /// Assemble the Schur complement matrix.
140  const std::shared_ptr<AssemblyMap> locToGloMap);
141 
142  /// Prepares local representation of Schur complement
143  /// stored as a sparse block-diagonal matrix.
145 
146  /// Perform a Shur-complement matrix multiply operation.
147  virtual void v_DoMatrixMultiply(const Array<OneD, NekDouble> &pInput,
148  Array<OneD, NekDouble> &pOutput);
149 
150  virtual void v_UniqueMap();
151 };
152 } // namespace MultiRegions
153 } // namespace Nektar
154 
155 #endif
#define MULTI_REGIONS_EXPORT
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
std::vector< const double * > m_denseBlocks
Vector of pointers to local matrix data.
static GlobalLinSysSharedPtr create(const GlobalLinSysKey &pLinSysKey, const std::weak_ptr< ExpList > &pExpList, const std::shared_ptr< AssemblyMap > &pLocToGloMap)
Creates an instance of this class.
void v_PreSolve(int scLevel, Array< OneD, NekDouble > &F_bnd)
virtual void v_CoeffsBwdTransform(Array< OneD, NekDouble > &pInOut)
virtual GlobalLinSysStaticCondSharedPtr v_Recurse(const GlobalLinSysKey &mkey, const std::weak_ptr< ExpList > &pExpList, const DNekScalBlkMatSharedPtr pSchurCompl, const DNekScalBlkMatSharedPtr pBinvD, const DNekScalBlkMatSharedPtr pC, const DNekScalBlkMatSharedPtr pInvD, const std::shared_ptr< AssemblyMap > &locToGloMap)
virtual void v_DoMatrixMultiply(const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput)
Perform a Shur-complement matrix multiply operation.
std::vector< double > m_storage
Dense storage for block Schur complement matrix.
GlobalLinSysIterativeStaticCond(const GlobalLinSysKey &mkey, const std::weak_ptr< ExpList > &pExpList, const std::shared_ptr< AssemblyMap > &locToGloMap)
Constructor for full direct matrix solve.
void PrepareLocalSchurComplement()
Prepares local representation of Schur complement stored as a sparse block-diagonal matrix.
virtual void v_BasisFwdTransform(Array< OneD, NekDouble > &pInOut)
Array< OneD, unsigned int > m_rows
Ranks of local matrices.
virtual DNekScalBlkMatSharedPtr v_GetStaticCondBlock(unsigned int n)
Retrieves a the static condensation block matrices from n-th expansion using the matrix key provided ...
void v_AssembleSchurComplement(const std::shared_ptr< AssemblyMap > locToGloMap)
Assemble the Schur complement matrix.
Array< OneD, NekDouble > m_scale
Scaling factors for local matrices.
DNekSmvBsrDiagBlkMatSharedPtr m_sparseSchurCompl
Sparse representation of Schur complement matrix at this level.
virtual void v_CoeffsFwdTransform(const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput)
std::shared_ptr< DNekSmvBsrDiagBlkMat > DNekSmvBsrDiagBlkMatSharedPtr
NekSparseDiagBlkMatrix< StorageSmvBsr< NekDouble > > DNekSmvBsrDiagBlkMat
std::shared_ptr< GlobalLinSys > GlobalLinSysSharedPtr
Pointer to a GlobalLinSys object.
Definition: GlobalLinSys.h:50
const char *const LocalMatrixStorageStrategyMap[]
std::shared_ptr< GlobalLinSysStaticCond > GlobalLinSysStaticCondSharedPtr
std::shared_ptr< GlobalLinSysIterativeStaticCond > GlobalLinSysIterativeStaticCondSharedPtr
std::shared_ptr< Preconditioner > PreconditionerSharedPtr
Definition: GlobalLinSys.h:60
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:1
std::shared_ptr< DNekScalBlkMat > DNekScalBlkMatSharedPtr
Definition: NekTypeDefs.hpp:79