40 namespace MultiRegions
51 const boost::weak_ptr<ExpList> &pExpList,
52 const boost::shared_ptr<AssemblyMap>
58 m_useProjection(false),
62 = pExpList.lock()->GetSession();
64 m_tolerance = pLocToGloMap->GetIterativeTolerance();
67 m_root = (vComm->GetRank())?
false :
true;
68 m_verbose = (vSession->DefinesCmdLineArgument(
"verbose"))?
true :
false;
72 if((successiveRHS = pLocToGloMap->GetSuccessiveRHS()))
125 =
m_expList.lock()->GetComm()->GetRowComm();
128 int nNonDir = nGlobal - nDir;
200 pInput.get() + nDir, 1,
201 pb_s.get() + nDir, 1);
232 =
m_expList.lock()->GetComm()->GetRowComm();
235 int nNonDir = nGlobal - nDir;
247 return std::sqrt(anorm_sq);
260 int nNonDir = nGlobal - nDir;
264 =
m_expList.lock()->GetComm()->GetRowComm();
292 tmp1 = newX + nDir, 1,
293 tmp2 = px_s + nDir, 1);
333 Vmath::Smul(nNonDir, 1.0/anorm, px_s.get() + nDir, 1, px_s.get() + nDir, 1);
365 = plocToGloMap->GetPreconType();
366 std::string PreconType
376 =
m_expList.lock()->GetComm()->GetRowComm();
379 int nNonDir = nGlobal - nDir;
399 NekDouble alpha, beta, rho, rho_new, mu, eps, min_resid;
432 <<
" (error = " << sqrt(eps/m_rhs_magnitude) <<
")" << endl;
439 m_precon->DoPreconditioner(r_A, tmp = w_A + nDir);
467 "Exceeded maximum number of iterations (5000)");
470 Vmath::Svtvp(nNonDir, beta, &p_A[0], 1, &w_A[nDir], 1, &p_A[0], 1);
471 Vmath::Svtvp(nNonDir, beta, &q_A[0], 1, &s_A[nDir], 1, &q_A[0], 1);
474 Vmath::Svtvp(nNonDir, alpha, &p_A[0], 1, &pOutput[nDir], 1, &pOutput[nDir], 1);
477 Vmath::Svtvp(nNonDir, -alpha, &q_A[0], 1, &r_A[0], 1, &r_A[0], 1);
480 m_precon->DoPreconditioner(r_A, tmp = w_A + nDir);
505 rho_new = vExchange[0];
517 <<
" (error = " << sqrt(eps/m_rhs_magnitude) <<
")"
524 min_resid = min(min_resid, eps);
528 alpha = rho_new/(mu - rho_new*beta/alpha);
#define ASSERTL0(condition, msg)
tBaseSharedPtr CreateInstance(tKey idKey BOOST_PP_COMMA_IF(MAX_PARAM) BOOST_PP_ENUM_BINARY_PARAMS(MAX_PARAM, tParam, x))
Create an instance of the class referred to by idKey.
boost::shared_ptr< AssemblyMap > AssemblyMapSharedPtr
void Set_Rhs_Magnitude(const NekVector< NekDouble > &pIn)
void UpdateKnownSolutions(const int pGlobalBndDofs, const Array< OneD, const NekDouble > &pSolution, const int pNumDirBndDofs)
bool m_root
Provide verbose output and root if parallel.
void Svtvp(int n, const T alpha, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
svtvp (scalar times vector plus vector): z = alpha*x + y
bool m_useProjection
Whether to apply projection technique.
PreconFactory & GetPreconFactory()
boost::circular_buffer< Array< OneD, NekDouble > > m_prevLinSol
Storage for solutions to previous linear problems.
virtual void v_DoMatrixMultiply(const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput)=0
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
NekDouble CalculateAnorm(const int nGlobal, const Array< OneD, const NekDouble > &in, const int nDir)
PreconditionerSharedPtr m_precon
boost::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
static const NekDouble kNekZeroTol
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*y.
static PreconditionerSharedPtr NullPreconditionerSharedPtr
NekDouble m_tolerance
Tolerance of iterative solver.
int m_numPrevSols
Total counter of previous solutions.
Array< OneD, int > m_map
Global to universal unique map.
boost::shared_ptr< GlobalLinSys > GetSharedThisPtr()
Returns a shared pointer to the current object.
GlobalLinSysIterative(const GlobalLinSysKey &pKey, const boost::weak_ptr< ExpList > &pExpList, const boost::shared_ptr< AssemblyMap > &pLocToGloMap)
Constructor for full direct matrix solve.
static const NekDouble kNekUnsetDouble
Describe a linear system.
T Dot(int n, const T *w, const T *x)
vvtvp (vector times vector times vector): z = w*x*y
unsigned int GetDimension() const
Returns the number of dimensions for the point.
void DoAconjugateProjection(const int pNumRows, const Array< OneD, const NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const AssemblyMapSharedPtr &locToGloMap, const int pNumDir)
A-conjugate projection technique.
NekDouble m_rhs_magnitude
dot product of rhs to normalise stopping criterion
T Dot2(int n, const T *w, const T *x, const int *y)
vvtvp (vector times vector times vector): z = w*x*y
virtual void v_SolveLinearSystem(const int pNumRows, const Array< OneD, const NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const AssemblyMapSharedPtr &locToGloMap, const int pNumDir)
Solve the matrix system.
void Zero(int n, T *x, const int incx)
Zero vector.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
const char *const PreconditionerTypeMap[]
void DoConjugateGradient(const int pNumRows, const Array< OneD, const NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const AssemblyMapSharedPtr &locToGloMap, const int pNumDir)
Actual iterative solve.
virtual ~GlobalLinSysIterative()
virtual void v_UniqueMap()=0
const boost::weak_ptr< ExpList > m_expList
Local Matrix System.