36#ifndef NEKTAR_LIB_UTILITIES_LINEAR_ALGEBRA_NEK_NekSys_H
37#define NEKTAR_LIB_UTILITIES_LINEAR_ALGEBRA_NEK_NekSys_H
100 template <
typename FuncPo
interT,
typename ObjectPo
interT>
104 std::bind(
func, obj, std::placeholders::_1, std::placeholders::_2,
105 std::placeholders::_3);
107 template <
typename FuncPo
interT,
typename ObjectPo
interT>
111 std::bind(
func, obj, std::placeholders::_1, std::placeholders::_2,
112 std::placeholders::_3);
114 template <
typename FuncPo
interT,
typename ObjectPo
interT>
118 std::bind(
func, obj, std::placeholders::_1, std::placeholders::_2,
119 std::placeholders::_3);
121 template <
typename FuncPo
interT,
typename ObjectPo
interT>
125 std::bind(
func, obj, std::placeholders::_1, std::placeholders::_2,
126 std::placeholders::_3);
128 template <
typename FuncPo
interT,
typename ObjectPo
interT>
132 std::bind(
func, obj, std::placeholders::_1, std::placeholders::_2,
133 std::placeholders::_3, std::placeholders::_4);
137 const bool &flag =
false)
const
144 const bool &flag =
false)
const
151 const bool &flag =
false)
const
164 const bool &flag =
false)
const
172 const bool &flag =
false)
const
241class NekSys :
public std::enable_shared_from_this<NekSys>
253 pSession, vRowComm, nDimen, pKey);
281 return v_SolveSystem(nGlobal, pInput, pOutput, nDir, tol, factor);
324 boost::ignore_unused(nGlobal, pInput, pOutput, nDir, tol, factor);
325 ASSERTL0(
false,
"LinSysIterSolver NOT CORRECT.");
#define ASSERTL0(condition, msg)
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
#define LIB_UTILITIES_EXPORT
void SetFlagWarnings(bool in)
bool m_root
Root if parallel.
const NekSysOperators & GetSysOperators()
static NekSysSharedPtr CreateInstance(const LibUtilities::SessionReaderSharedPtr &pSession, const LibUtilities::CommSharedPtr &vRowComm, const int nDimen, const NekSysKey &pKey)
virtual void v_NekSysInitialGuess(const Array< OneD, const NekDouble > &pInput, Array< OneD, NekDouble > &pguess)
void SetSysOperators(const NekSysOperators &in)
LibUtilities::CommSharedPtr m_rowComm
Communicate.
virtual void v_InitObject()
bool ConvergenceCheck(const int nIteration, const Array< OneD, const NekDouble > &Residual, const NekDouble tol=1.0E-7)
NekDouble m_tolerance
Tolerance of iterative solver.
NekSysOperators m_operator
Operators.
int m_SysDimen
The dimension of the system.
virtual int v_SolveSystem(const int nGlobal, const Array< OneD, const NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const int nDir, const NekDouble tol, const NekDouble factor)
NekSys(const LibUtilities::SessionReaderSharedPtr &pSession, const LibUtilities::CommSharedPtr &vRowComm, const int nDimen, const NekSysKey &pKey)
virtual bool v_ConvergenceCheck(const int nIteration, const Array< OneD, const NekDouble > &Residual, const NekDouble tol)
int SolveSystem(const int nGlobal, const Array< OneD, const NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const int nDir, const NekDouble tol=1.0E-7, const NekDouble factor=1.0)
bool m_converged
Whether the iteration has been converged.
int m_maxiter
Maximum iterations.
NekDouble m_NonlinIterTolRelativeL2
int m_NekNonlinSysMaxIterations
NekDouble m_NekLinSysTolerance
bool m_NekLinSysLeftPrecon
NekDouble m_LinSysRelativeTolInNonlin
std::string m_LinSysIterSolverTypeInNonlin
NekDouble m_NekNonlinSysTolerance
bool m_NekLinSysRightPrecon
int m_KrylovMaxHessMatBand
int m_NekLinSysMaxIterations
void DefineAssembleLoc(FuncPointerT func, ObjectPointerT obj)
void DefineNekSysFixPointIte(FuncPointerT func, ObjectPointerT obj)
Array< OneD, FunctorType2 > FunctorType2Array
static const int nfunctor2
void DoNekSysResEval(InArrayType &inarray, OutArrayType &outarray, const bool &flag=false) const
void DefineNekSysResEval(FuncPointerT func, ObjectPointerT obj)
static const int nfunctor1
void DefineNekSysLhsEval(FuncPointerT func, ObjectPointerT obj)
const Array< OneD, const NekDouble > InArrayType
FunctorType2Array m_functors2
NekSysOperators & operator=(const NekSysOperators &in)
std::function< void(InArrayType &, InArrayType &, OutArrayType &, const bool &)> FunctorType2
Array< OneD, NekDouble > OutArrayType
std::function< void(InArrayType &, OutArrayType &, const bool &)> FunctorType1
NekSysOperators(const NekSysOperators &in)
FunctorType1Array m_functors1
void DoNekSysFixPointIte(InArrayType &rhs, InArrayType &xn, OutArrayType &xn1, const bool &flag=false) const
void DoAssembleLoc(InArrayType &xn, OutArrayType &xn1, const bool &flag=false) const
void DoNekSysPrecon(InArrayType &inarray, OutArrayType &outarray, const bool &flag=false) const
Array< OneD, FunctorType1 > FunctorType1Array
void DefineNekSysPrecon(FuncPointerT func, ObjectPointerT obj)
void DoNekSysLhsEval(InArrayType &inarray, OutArrayType &outarray, const bool &flag=false) const
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< NekSys > NekSysSharedPtr
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
static const NekDouble kNekIterativeTol
The above copyright notice and this permission notice shall be included.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)