36#ifndef NEKTAR_LIB_UTILITIES_LINEAR_ALGEBRA_NEK_NekSys_H
37#define NEKTAR_LIB_UTILITIES_LINEAR_ALGEBRA_NEK_NekSys_H
98 template <
typename FuncPo
interT,
typename ObjectPo
interT>
102 std::bind(
func, obj, std::placeholders::_1, std::placeholders::_2,
103 std::placeholders::_3);
105 template <
typename FuncPo
interT,
typename ObjectPo
interT>
109 std::bind(
func, obj, std::placeholders::_1, std::placeholders::_2,
110 std::placeholders::_3);
112 template <
typename FuncPo
interT,
typename ObjectPo
interT>
116 std::bind(
func, obj, std::placeholders::_1, std::placeholders::_2,
117 std::placeholders::_3);
119 template <
typename FuncPo
interT,
typename ObjectPo
interT>
123 std::bind(
func, obj, std::placeholders::_1, std::placeholders::_2,
124 std::placeholders::_3);
126 template <
typename FuncPo
interT,
typename ObjectPo
interT>
130 std::bind(
func, obj, std::placeholders::_1, std::placeholders::_2,
131 std::placeholders::_3, std::placeholders::_4);
135 const bool &flag =
false)
const
142 const bool &flag =
false)
const
149 const bool &flag =
false)
const
162 const bool &flag =
false)
const
170 const bool &flag =
false)
const
232class NekSys :
public std::enable_shared_from_this<NekSys>
244 pSession, vRowComm, nDimen, pKey);
272 return v_SolveSystem(nGlobal, pInput, pOutput, nDir, tol, factor);
316 [[maybe_unused]]
const int nGlobal,
319 [[maybe_unused]]
const int nDir, [[maybe_unused]]
const NekDouble tol,
322 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)
virtual ~NekSys()=default
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)
virtual void v_SetSysOperators(const NekSysOperators &in)
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
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
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)