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>
54 
55  /// A global linear system.
56  class GlobalLinSysStaticCond : virtual public GlobalLinSys
57  {
58  public:
59  /// Constructor for full direct matrix solve.
61  const GlobalLinSysKey &mkey,
62  const std::weak_ptr<ExpList> &pExpList,
63  const std::shared_ptr<AssemblyMap> &locToGloMap);
64 
65  virtual ~GlobalLinSysStaticCond();
66 
67  protected:
68  virtual void v_PreSolve(int scLevel,
69  Array<OneD,NekDouble> &F_bnd)
70  {
71  boost::ignore_unused(scLevel, F_bnd);
72  }
73 
74  virtual void v_BasisFwdTransform(
75  Array<OneD, NekDouble>& pInOut)
76  {
77  boost::ignore_unused(pInOut);
78  }
79 
80  virtual void v_CoeffsBwdTransform(
81  Array<OneD, NekDouble>& pInOut)
82  {
83  boost::ignore_unused(pInOut);
84  }
85 
86  virtual void v_CoeffsFwdTransform(
87  const Array<OneD, NekDouble>& pInput,
88  Array<OneD, NekDouble>& pOutput)
89  {
90  boost::ignore_unused(pInput,pOutput);
91  }
92 
94  std::shared_ptr<AssemblyMap> pLoctoGloMap)
95  {
96  boost::ignore_unused(pLoctoGloMap);
97  }
98 
99  virtual int v_GetNumBlocks();
100 
102  const GlobalLinSysKey &mkey,
103  const std::weak_ptr<ExpList> &pExpList,
104  const DNekScalBlkMatSharedPtr pSchurCompl,
105  const DNekScalBlkMatSharedPtr pBinvD,
106  const DNekScalBlkMatSharedPtr pC,
107  const DNekScalBlkMatSharedPtr pInvD,
108  const std::shared_ptr<AssemblyMap> &locToGloMap) = 0;
109 
110  /// Schur complement for Direct Static Condensation.
112  /// Block Schur complement matrix.
114  /// Block \f$ BD^{-1} \f$ matrix.
116  /// Block \f$ C \f$ matrix.
118  /// Block \f$ D^{-1} \f$ matrix.
120  /// Local to global map.
121  std::weak_ptr<AssemblyMap> m_locToGloMap;
122  /// Workspace array for matrix multiplication
124 
125  /// Solve the linear system for given input and output vectors
126  /// using a specified local to global map.
127  virtual void v_Solve(
130  const AssemblyMapSharedPtr &locToGloMap,
131  const Array<OneD, const NekDouble> &dirForcing
133 
134  virtual void v_InitObject();
135 
136  /// Initialise this object
137  virtual void v_Initialise(
138  const std::shared_ptr<AssemblyMap>& locToGloMap);
139 
140  /// Set up the storage for the Schur complement or the top level
141  /// of the multi-level Schur complement.
142  void SetupTopLevel(
143  const std::shared_ptr<AssemblyMap>& locToGloMap);
144 
145  ///
147  const std::shared_ptr<AssemblyMap>& locToGloMap);
148  };
149  }
150 }
151 
152 #endif
A global linear system.
Definition: GlobalLinSys.h:73
DNekScalBlkMatSharedPtr m_schurCompl
Block Schur complement matrix.
virtual void v_CoeffsFwdTransform(const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput)
virtual int v_GetNumBlocks()
Get the number of blocks in this system.
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)
DNekScalBlkMatSharedPtr m_BinvD
Block matrix.
virtual void v_Initialise(const std::shared_ptr< AssemblyMap > &locToGloMap)
Initialise this object.
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 void v_Solve(const Array< OneD, const NekDouble > &in, Array< OneD, NekDouble > &out, const AssemblyMapSharedPtr &locToGloMap, const Array< OneD, const NekDouble > &dirForcing=NullNekDouble1DArray)
Solve the linear system for given input and output vectors using a specified local to global map.
DNekScalBlkMatSharedPtr m_invD
Block matrix.
std::shared_ptr< GlobalLinSysStaticCond > GlobalLinSysStaticCondSharedPtr
std::shared_ptr< AssemblyMap > AssemblyMapSharedPtr
Definition: AssemblyMap.h:52
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:1
std::shared_ptr< DNekScalBlkMat > DNekScalBlkMatSharedPtr
Definition: NekTypeDefs.hpp:73
static Array< OneD, NekDouble > NullNekDouble1DArray