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;
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:
69  int scLevel,
70  NekVector<NekDouble> &F_GlobBnd)
71  {
72  boost::ignore_unused(scLevel, F_GlobBnd);
73  return m_schurCompl;
74  }
75 
76  virtual void v_BasisFwdTransform(
77  Array<OneD, NekDouble>& pInOut,
78  int offset)
79  {
80  boost::ignore_unused(pInOut, offset);
81  }
82 
83  virtual void v_BasisBwdTransform(
84  Array<OneD, NekDouble>& pInOut)
85  {
86  boost::ignore_unused(pInOut);
87  }
88 
90  std::shared_ptr<AssemblyMap> pLoctoGloMap)
91  {
92  boost::ignore_unused(pLoctoGloMap);
93  }
94 
95  virtual int v_GetNumBlocks();
96 
97  virtual GlobalLinSysStaticCondSharedPtr v_Recurse(
98  const GlobalLinSysKey &mkey,
99  const std::weak_ptr<ExpList> &pExpList,
100  const DNekScalBlkMatSharedPtr pSchurCompl,
101  const DNekScalBlkMatSharedPtr pBinvD,
102  const DNekScalBlkMatSharedPtr pC,
103  const DNekScalBlkMatSharedPtr pInvD,
104  const std::shared_ptr<AssemblyMap> &locToGloMap) = 0;
105 
106  /// Schur complement for Direct Static Condensation.
107  GlobalLinSysStaticCondSharedPtr m_recursiveSchurCompl;
108  /// Block Schur complement matrix.
110  /// Block \f$ BD^{-1} \f$ matrix.
112  /// Block \f$ C \f$ matrix.
114  /// Block \f$ D^{-1} \f$ matrix.
116  /// Local to global map.
117  std::weak_ptr<AssemblyMap> m_locToGloMap;
118  /// Workspace array for matrix multiplication
120 
121  /// Solve the linear system for given input and output vectors
122  /// using a specified local to global map.
123  virtual void v_Solve(
126  const AssemblyMapSharedPtr &locToGloMap,
127  const Array<OneD, const NekDouble> &dirForcing
129 
130  virtual void v_InitObject();
131 
132  /// Initialise this object
133  virtual void v_Initialise(
134  const std::shared_ptr<AssemblyMap>& locToGloMap);
135 
136  /// Set up the storage for the Schur complement or the top level
137  /// of the multi-level Schur complement.
138  void SetupTopLevel(
139  const std::shared_ptr<AssemblyMap>& locToGloMap);
140 
141  ///
143  const std::shared_ptr<AssemblyMap>& locToGloMap);
144  };
145  }
146 }
147 
148 #endif
std::shared_ptr< GlobalLinSysStaticCond > GlobalLinSysStaticCondSharedPtr
Array< OneD, NekDouble > m_wsp
Workspace array for matrix multiplication.
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
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...
static Array< OneD, NekDouble > NullNekDouble1DArray
std::weak_ptr< AssemblyMap > m_locToGloMap
Local to global map.
DNekScalBlkMatSharedPtr m_schurCompl
Block Schur complement matrix.
std::shared_ptr< DNekScalBlkMat > DNekScalBlkMatSharedPtr
Definition: NekTypeDefs.hpp:73
GlobalLinSysStaticCondSharedPtr m_recursiveSchurCompl
Schur complement for Direct Static Condensation.
DNekScalBlkMatSharedPtr m_C
Block matrix.
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...
DNekScalBlkMatSharedPtr m_invD
Block matrix.
std::shared_ptr< AssemblyMap > AssemblyMapSharedPtr
Definition: AssemblyMap.h:52
GlobalLinSysStaticCond(const GlobalLinSysKey &mkey, const std::weak_ptr< ExpList > &pExpList, const std::shared_ptr< AssemblyMap > &locToGloMap)
Constructor for full direct matrix solve.
virtual DNekScalBlkMatSharedPtr v_PreSolve(int scLevel, NekVector< NekDouble > &F_GlobBnd)
void ConstructNextLevelCondensedSystem(const std::shared_ptr< AssemblyMap > &locToGloMap)
virtual void v_AssembleSchurComplement(std::shared_ptr< AssemblyMap > pLoctoGloMap)
Describe a linear system.
virtual void v_Initialise(const std::shared_ptr< AssemblyMap > &locToGloMap)
Initialise this object.
virtual void v_BasisFwdTransform(Array< OneD, NekDouble > &pInOut, int offset)
virtual void v_BasisBwdTransform(Array< OneD, NekDouble > &pInOut)
virtual int v_GetNumBlocks()
Get the number of blocks in this system.
A global linear system.
Definition: GlobalLinSys.h:72
DNekScalBlkMatSharedPtr m_BinvD
Block matrix.