Nektar++
PreconCfs.h
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: PreconCfs.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: PreconCfs header
32//
33///////////////////////////////////////////////////////////////////////////////
34
35#ifndef NEKTAR_SOLVERS_COMPRESSIBLEFLOWSOLVER_PRECONCFS
36#define NEKTAR_SOLVERS_COMPRESSIBLEFLOWSOLVER_PRECONCFS
37
43
44namespace Nektar
45{
47{
48 eNull, ///< No Solution type specified
51};
52
53// Forward declaration
54class PreconCfs;
55
56/// Declaration of the boundary condition factory
57typedef LibUtilities::NekFactory<
58 std::string, PreconCfs, const Array<OneD, MultiRegions::ExpListSharedPtr> &,
62
63/// Declaration of the boundary condition factory singleton
65
67{
68public:
71 const LibUtilities::CommSharedPtr &vComm);
72
73 virtual ~PreconCfs()
74 {
75 }
76
77 inline void InitObject();
78
80 const Array<OneD, NekDouble> &pInput,
81 Array<OneD, NekDouble> &pOutput, const bool &flag);
82
83 inline void BuildPreconCfs(
85 const Array<OneD, const Array<OneD, NekDouble>> &intmp,
86 const NekDouble time, const NekDouble lambda);
87
89 const NekDouble dtLambda);
90
91 inline void SetOperators(const NekPreconCfsOperators &in)
92 {
93 m_operator = in;
94 }
95
96protected:
100
102
105
108
110
111 virtual void v_InitObject() = 0;
112
113 virtual void v_DoPreconCfs(
115 const Array<OneD, NekDouble> &pInput, Array<OneD, NekDouble> &pOutput,
116 const bool &flag) = 0;
117
118 virtual void v_BuildPreconCfs(
120 const Array<OneD, const Array<OneD, NekDouble>> &intmp,
121 const NekDouble time, const NekDouble lambda) = 0;
122
124 const NekDouble dtLambda) = 0;
125};
126typedef std::shared_ptr<PreconCfs> PreconCfsSharedPtr;
127
128/**
129 *
130 */
132{
133 v_InitObject();
134}
135
136/**
137 *
138 */
141 const Array<OneD, NekDouble> &pInput, Array<OneD, NekDouble> &pOutput,
142 const bool &flag)
143{
144 ASSERTL0(pInput.size() == pOutput.size(),
145 "In and Out not the same size in DoPreconCfs");
146 v_DoPreconCfs(pFields, pInput, pOutput, flag);
148}
149
150/**
151 *
152 */
155 const Array<OneD, const Array<OneD, NekDouble>> &intmp,
156 const NekDouble time, const NekDouble lambda)
157{
158 v_BuildPreconCfs(pFields, intmp, time, lambda);
159}
160
161/**
162 *
163 */
165 const Array<OneD, const NekDouble> &res, const NekDouble dtLambda)
166{
167 return v_UpdatePreconMatCheck(res, dtLambda);
168}
169} // namespace Nektar
170
171#endif
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:215
Provides a generic Factory class.
Definition: NekFactory.hpp:105
NekPreconCfsOperators m_operator
Definition: PreconCfs.h:101
virtual ~PreconCfs()
Definition: PreconCfs.h:73
bool UpdatePreconMatCheck(const Array< OneD, const NekDouble > &res, const NekDouble dtLambda)
Definition: PreconCfs.h:164
void SetOperators(const NekPreconCfsOperators &in)
Definition: PreconCfs.h:91
int m_PreconTimesCounter
Definition: PreconCfs.h:104
int m_PreconMatFreezNumb
Definition: PreconCfs.h:103
NekDouble m_DtLambdaPreconMat
Definition: PreconCfs.h:106
bool m_CalcPreconMatFlag
Definition: PreconCfs.h:109
virtual void v_BuildPreconCfs(const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const Array< OneD, const Array< OneD, NekDouble > > &intmp, const NekDouble time, const NekDouble lambda)=0
NekDouble m_BndEvaluateTime
Definition: PreconCfs.h:107
PreconCfs(const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const LibUtilities::SessionReaderSharedPtr &pSession, const LibUtilities::CommSharedPtr &vComm)
Definition: PreconCfs.cpp:48
virtual bool v_UpdatePreconMatCheck(const Array< OneD, const NekDouble > &res, const NekDouble dtLambda)=0
virtual void v_DoPreconCfs(const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const bool &flag)=0
void DoPreconCfs(const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const bool &flag)
Definition: PreconCfs.h:139
void BuildPreconCfs(const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const Array< OneD, const Array< OneD, NekDouble > > &intmp, const NekDouble time, const NekDouble lambda)
Definition: PreconCfs.h:153
LibUtilities::CommSharedPtr m_Comm
Definition: PreconCfs.h:97
virtual void v_InitObject()=0
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
Definition: Comm.h:57
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:2
LibUtilities::NekFactory< std::string, PreconCfs, const Array< OneD, MultiRegions::ExpListSharedPtr > &, const LibUtilities::SessionReaderSharedPtr &, const LibUtilities::CommSharedPtr & > PreconCfsFactory
Declaration of the boundary condition factory.
Definition: PreconCfs.h:61
PreconCfsFactory & GetPreconCfsFactory()
Declaration of the boundary condition factory singleton.
Definition: PreconCfs.cpp:42
PrecType
Definition: PreconCfs.h:47
@ eNull
No Solution type specified.
Definition: PreconCfs.h:48
@ eDiagonal
Definition: PreconCfs.h:49
@ eSparse
Definition: PreconCfs.h:50
std::shared_ptr< PreconCfs > PreconCfsSharedPtr
Definition: PreconCfs.h:126
double NekDouble