Nektar++
GlobalLinSysStaticCond.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File: GlobalLinSysStaticCond.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: A collection of routines common to statically condensed systems.
32 //
33 ///////////////////////////////////////////////////////////////////////////////
34 
35 #ifndef NEKTAR_LIB_MULTIREGIONS_GLOBALLINSYSSTATICCOND_H
36 #define NEKTAR_LIB_MULTIREGIONS_GLOBALLINSYSSTATICCOND_H
37 
38 #include <boost/core/ignore_unused.hpp>
39 
43 
44 namespace Nektar
45 {
46 namespace MultiRegions
47 {
48 // Forward declarations
49 class ExpList;
50 class GlobalLinSysStaticCond;
51 
52 typedef std::shared_ptr<GlobalLinSysStaticCond> GlobalLinSysStaticCondSharedPtr;
53 
54 /// A global linear system.
55 class GlobalLinSysStaticCond : virtual public GlobalLinSys
56 {
57 public:
58  /// Constructor for full direct matrix solve.
60  const std::weak_ptr<ExpList> &pExpList,
61  const std::shared_ptr<AssemblyMap> &locToGloMap);
62 
63  virtual ~GlobalLinSysStaticCond();
64 
65 protected:
66  virtual void v_PreSolve(int scLevel, Array<OneD, NekDouble> &F_bnd)
67  {
68  boost::ignore_unused(scLevel, F_bnd);
69  }
70 
72  {
73  boost::ignore_unused(pInOut);
74  }
75 
77  {
78  boost::ignore_unused(pInOut);
79  }
80 
81  virtual void v_CoeffsFwdTransform(const Array<OneD, NekDouble> &pInput,
82  Array<OneD, NekDouble> &pOutput)
83  {
84  boost::ignore_unused(pInput, pOutput);
85  }
86 
88  std::shared_ptr<AssemblyMap> pLoctoGloMap)
89  {
90  boost::ignore_unused(pLoctoGloMap);
91  }
92 
93  virtual int v_GetNumBlocks() override;
94 
96  const GlobalLinSysKey &mkey, const std::weak_ptr<ExpList> &pExpList,
97  const DNekScalBlkMatSharedPtr pSchurCompl,
98  const DNekScalBlkMatSharedPtr pBinvD, const DNekScalBlkMatSharedPtr pC,
99  const DNekScalBlkMatSharedPtr pInvD,
100  const std::shared_ptr<AssemblyMap> &locToGloMap) = 0;
101 
102  /// Schur complement for Direct Static Condensation.
104  /// Block Schur complement matrix.
106  /// Block \f$ BD^{-1} \f$ matrix.
108  /// Block \f$ C \f$ matrix.
110  /// Block \f$ D^{-1} \f$ matrix.
112  /// Local to global map.
113  std::weak_ptr<AssemblyMap> m_locToGloMap;
114  /// Workspace array for matrix multiplication
116 
117  /// Solve the linear system for given input and output vectors
118  /// using a specified local to global map.
119  virtual void v_Solve(const Array<OneD, const NekDouble> &in,
121  const AssemblyMapSharedPtr &locToGloMap,
122  const Array<OneD, const NekDouble> &dirForcing =
123  NullNekDouble1DArray) override;
124 
125  virtual void v_InitObject() override;
126 
127  /// Initialise this object
128  virtual void v_Initialise(
129  const std::shared_ptr<AssemblyMap> &locToGloMap) override;
130 
131  /// Set up the storage for the Schur complement or the top level
132  /// of the multi-level Schur complement.
133  void SetupTopLevel(const std::shared_ptr<AssemblyMap> &locToGloMap);
134 
135  ///
137  const std::shared_ptr<AssemblyMap> &locToGloMap);
138 };
139 } // namespace MultiRegions
140 } // namespace Nektar
141 
142 #endif
A global linear system.
Definition: GlobalLinSys.h:72
DNekScalBlkMatSharedPtr m_schurCompl
Block Schur complement matrix.
virtual void v_CoeffsFwdTransform(const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput)
std::weak_ptr< AssemblyMap > m_locToGloMap
Local to global map.
void SetupTopLevel(const std::shared_ptr< AssemblyMap > &locToGloMap)
Set up the storage for the Schur complement or the top level of the multi-level Schur complement.
Array< OneD, NekDouble > m_wsp
Workspace array for matrix multiplication.
virtual void v_AssembleSchurComplement(std::shared_ptr< AssemblyMap > pLoctoGloMap)
GlobalLinSysStaticCond(const GlobalLinSysKey &mkey, const std::weak_ptr< ExpList > &pExpList, const std::shared_ptr< AssemblyMap > &locToGloMap)
Constructor for full direct matrix solve.
virtual void v_PreSolve(int scLevel, Array< OneD, NekDouble > &F_bnd)
virtual void v_BasisFwdTransform(Array< OneD, NekDouble > &pInOut)
GlobalLinSysStaticCondSharedPtr m_recursiveSchurCompl
Schur complement for Direct Static Condensation.
virtual void v_CoeffsBwdTransform(Array< OneD, NekDouble > &pInOut)
virtual void v_Initialise(const std::shared_ptr< AssemblyMap > &locToGloMap) override
Initialise this object.
virtual void v_Solve(const Array< OneD, const NekDouble > &in, Array< OneD, NekDouble > &out, const AssemblyMapSharedPtr &locToGloMap, const Array< OneD, const NekDouble > &dirForcing=NullNekDouble1DArray) override
Solve the linear system for given input and output vectors using a specified local to global map.
DNekScalBlkMatSharedPtr m_BinvD
Block matrix.
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)=0
void ConstructNextLevelCondensedSystem(const std::shared_ptr< AssemblyMap > &locToGloMap)
DNekScalBlkMatSharedPtr m_C
Block matrix.
virtual int v_GetNumBlocks() override
Get the number of blocks in this system.
DNekScalBlkMatSharedPtr m_invD
Block matrix.
std::shared_ptr< GlobalLinSysStaticCond > GlobalLinSysStaticCondSharedPtr
std::shared_ptr< AssemblyMap > AssemblyMapSharedPtr
Definition: AssemblyMap.h:51
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:2
std::shared_ptr< DNekScalBlkMat > DNekScalBlkMatSharedPtr
Definition: NekTypeDefs.hpp:79
static Array< OneD, NekDouble > NullNekDouble1DArray