46 namespace MultiRegions
51 string PreconditionerDiagonal::className
54 PreconditionerDiagonal::create,
55 "Diagonal Preconditioning");
63 PreconditionerDiagonal::PreconditionerDiagonal(
64 const boost::shared_ptr<GlobalLinSys> &plinsys,
67 m_preconType(pLocToGloMap->GetPreconType())
92 ASSERTL0(0,
"Unsupported solver type");
102 boost::shared_ptr<MultiRegions::ExpList> expList =
103 ((
m_linsys.lock())->GetLocMat()).lock();
107 int i,j,n,cnt,gid1,gid2;
111 int nInt = nGlobal - nDir;
118 int nElmt = expList->GetNumElmts();
119 for(n = cnt = 0; n < nElmt; ++n)
121 loc_mat = (
m_linsys.lock())->GetBlock(n);
122 loc_row = loc_mat->GetRows();
124 for(i = 0; i < loc_row; ++i)
130 for(j = 0; j < loc_row; ++j)
141 value = vOutput[gid1 + nDir]
142 + sign1*sign2*(*loc_mat)(i,j);
143 vOutput[gid1 + nDir] = value;
167 int rows = nGlobalBnd - nDirBnd;
173 for (
unsigned int i = 0; i < rows; ++i)
175 vOutput[nDirBnd + i] = diagonals[i];
199 int nNonDir = nGlobal-nDir;
207 "No Preconditioning");
216 const boost::shared_ptr<GlobalLinSys> &plinsys,
219 m_preconType(pLocToGloMap->GetPreconType())
244 Vmath::Vcopy(pInput.num_elements(), pInput, 1, pOutput, 1);
boost::shared_ptr< AssemblyMap > m_locToGloMap
#define ASSERTL0(condition, msg)
boost::shared_ptr< AssemblyMap > AssemblyMapSharedPtr
virtual void v_DoPreconditioner(const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput)
Apply a preconditioner to the conjugate gradient method.
virtual void v_DoPreconditioner(const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput)
Apply a preconditioner to the conjugate gradient method.
PreconFactory & GetPreconFactory()
void StaticCondDiagonalPreconditionerSum(void)
void Sdiv(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha/y.
virtual void v_BuildPreconditioner()
boost::shared_ptr< DNekScalMat > DNekScalMatSharedPtr
const boost::weak_ptr< GlobalLinSys > m_linsys
virtual void v_InitObject()
virtual void v_InitObject()
Array< OneD, NekDouble > AssembleStaticCondGlobalDiagonals()
Performs global assembly of diagonal entries to global Schur complement matrix.
PreconditionerNull(const boost::shared_ptr< GlobalLinSys > &plinsys, const AssemblyMapSharedPtr &pLocToGloMap)
Array< OneD, NekDouble > m_diagonals
void DiagonalPreconditionerSum(void)
static std::string className
Name of class.
static PreconditionerSharedPtr create(const boost::shared_ptr< GlobalLinSys > &plinsys, const boost::shared_ptr< AssemblyMap > &pLocToGloMap)
Creates an instance of this class.
boost::shared_ptr< StdExpansion > StdExpansionSharedPtr
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.
virtual void v_BuildPreconditioner()
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.