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
41
43{
44// Forward declarations
45class ExpList;
46class GlobalLinSysStaticCond;
47
48typedef std::shared_ptr<GlobalLinSysStaticCond> GlobalLinSysStaticCondSharedPtr;
49
50/// A global linear system.
52{
53public:
54 /// Constructor for full direct matrix solve.
56 const std::weak_ptr<ExpList> &pExpList,
57 const std::shared_ptr<AssemblyMap> &locToGloMap);
58
59 ~GlobalLinSysStaticCond() override;
60
61protected:
62 virtual void v_PreSolve([[maybe_unused]] int scLevel,
63 [[maybe_unused]] Array<OneD, NekDouble> &F_bnd)
64 {
65 }
66
67 virtual void v_BasisFwdTransform(
68 [[maybe_unused]] Array<OneD, NekDouble> &pInOut)
69 {
70 }
71
73 [[maybe_unused]] Array<OneD, NekDouble> &pInOut)
74 {
75 }
76
78 [[maybe_unused]] const Array<OneD, NekDouble> &pInput,
79 [[maybe_unused]] Array<OneD, NekDouble> &pOutput)
80 {
81 }
82
84 [[maybe_unused]] std::shared_ptr<AssemblyMap> pLoctoGloMap)
85 {
86 }
87
88 int v_GetNumBlocks() override;
89
91 const GlobalLinSysKey &mkey, const std::weak_ptr<ExpList> &pExpList,
92 const DNekScalBlkMatSharedPtr pSchurCompl,
94 const DNekScalBlkMatSharedPtr pInvD,
95 const std::shared_ptr<AssemblyMap> &locToGloMap) = 0;
96
97 /// Schur complement for Direct Static Condensation.
99 /// Block Schur complement matrix.
101 /// Block \f$ BD^{-1} \f$ matrix.
103 /// Block \f$ C \f$ matrix.
105 /// Block \f$ D^{-1} \f$ matrix.
107 /// Local to global map.
108 std::weak_ptr<AssemblyMap> m_locToGloMap;
109 /// Workspace array for matrix multiplication
111
113
114 /// Solve the linear system for given input and output vectors
115 /// using a specified local to global map.
118 const AssemblyMapSharedPtr &locToGloMap,
119 const Array<OneD, const NekDouble> &dirForcing =
120 NullNekDouble1DArray) override;
121
122 void v_InitObject() override;
123
124 /// Initialise this object
125 void v_Initialise(const std::shared_ptr<AssemblyMap> &locToGloMap) override;
126
127 /// Set up the storage for the Schur complement or the top level
128 /// of the multi-level Schur complement.
129 void SetupTopLevel(const std::shared_ptr<AssemblyMap> &locToGloMap);
130
131 ///
133 const std::shared_ptr<AssemblyMap> &locToGloMap);
134};
135} // namespace Nektar::MultiRegions
136
137#endif
A global linear system.
Definition: GlobalLinSys.h:70
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)
void v_Initialise(const std::shared_ptr< AssemblyMap > &locToGloMap) override
Initialise this object.
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.
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:50
std::shared_ptr< DNekScalBlkMat > DNekScalBlkMatSharedPtr
Definition: NekTypeDefs.hpp:79
static Array< OneD, NekDouble > NullNekDouble1DArray