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
42
43namespace Nektar
44{
45
46// Forward declaration
47class PreconCfs;
48
49/// Declaration of the boundary condition factory
50typedef LibUtilities::NekFactory<
51 std::string, PreconCfs, const Array<OneD, MultiRegions::ExpListSharedPtr> &,
55
56/// Declaration of the boundary condition factory singleton
58
60{
61public:
64 const LibUtilities::CommSharedPtr &vComm);
65
66 virtual ~PreconCfs() = default;
67
68 inline void InitObject();
69
71 const Array<OneD, NekDouble> &pInput,
72 Array<OneD, NekDouble> &pOutput, const bool &flag);
73
74 inline void BuildPreconCfs(
76 const Array<OneD, const Array<OneD, NekDouble>> &intmp,
77 const NekDouble time, const NekDouble lambda);
78
80 const NekDouble dtLambda);
81
82 inline void SetOperators(const NekPreconCfsOperators &in)
83 {
84 m_operator = in;
85 }
86
87protected:
95 bool m_CalcPreconMatFlag = false;
96
97 virtual void v_InitObject() = 0;
98
99 virtual void v_DoPreconCfs(
101 const Array<OneD, NekDouble> &pInput, Array<OneD, NekDouble> &pOutput,
102 const bool &flag) = 0;
103
104 virtual void v_BuildPreconCfs(
106 const Array<OneD, const Array<OneD, NekDouble>> &intmp,
107 const NekDouble time, const NekDouble lambda) = 0;
108
110 const NekDouble dtLambda) = 0;
111};
112typedef std::shared_ptr<PreconCfs> PreconCfsSharedPtr;
113
114/**
115 *
116 */
118{
119 v_InitObject();
120}
121
122/**
123 *
124 */
127 const Array<OneD, NekDouble> &pInput, Array<OneD, NekDouble> &pOutput,
128 const bool &flag)
129{
130 ASSERTL0(pInput.size() == pOutput.size(),
131 "In and Out not the same size in DoPreconCfs");
132 v_DoPreconCfs(pFields, pInput, pOutput, flag);
134}
135
136/**
137 *
138 */
141 const Array<OneD, const Array<OneD, NekDouble>> &intmp,
142 const NekDouble time, const NekDouble lambda)
143{
144 v_BuildPreconCfs(pFields, intmp, time, lambda);
145}
146
147/**
148 *
149 */
151 const Array<OneD, const NekDouble> &res, const NekDouble dtLambda)
152{
153 return v_UpdatePreconMatCheck(res, dtLambda);
154}
155
156} // namespace Nektar
157
158#endif
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:208
Provides a generic Factory class.
NekPreconCfsOperators m_operator
Definition: PreconCfs.h:91
bool UpdatePreconMatCheck(const Array< OneD, const NekDouble > &res, const NekDouble dtLambda)
Definition: PreconCfs.h:150
void SetOperators(const NekPreconCfsOperators &in)
Definition: PreconCfs.h:82
int m_PreconTimesCounter
Definition: PreconCfs.h:93
int m_PreconMatFreezNumb
Definition: PreconCfs.h:92
NekDouble m_DtLambdaPreconMat
Definition: PreconCfs.h:94
bool m_CalcPreconMatFlag
Definition: PreconCfs.h:95
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
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:125
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:139
virtual ~PreconCfs()=default
LibUtilities::CommSharedPtr m_Comm
Definition: PreconCfs.h:88
virtual void v_InitObject()=0
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
Definition: Comm.h:55
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:54
PreconCfsFactory & GetPreconCfsFactory()
Declaration of the boundary condition factory singleton.
Definition: PreconCfs.cpp:42
std::shared_ptr< PreconCfs > PreconCfsSharedPtr
Definition: PreconCfs.h:112
double NekDouble