42 #ifdef NEKTAR_USING_PETSC
53 namespace MultiRegions
59 string PreconditionerLinear::className1 =
61 "FullLinearSpace", PreconditionerLinear::create,
62 "Full Linear space inverse Preconditioning");
64 std::string PreconditionerLinear::solveType =
65 LibUtilities::SessionReader::RegisterDefaultSolverInfo(
"LinearPreconSolver",
67 std::string PreconditionerLinear::solveTypeIds[] = {
68 LibUtilities::SessionReader::RegisterEnumValue(
70 LibUtilities::SessionReader::RegisterEnumValue(
80 PreconditionerLinear::PreconditionerLinear(
81 const std::shared_ptr<GlobalLinSys> &plinsys,
95 "This type of preconditioning is not implemented "
98 std::shared_ptr<MultiRegions::ExpList> expList =
99 ((
m_linsys.lock())->GetLocMat()).lock();
103 "LinearPreconSolver");
112 #ifndef NEKTAR_USING_PETSC
127 m_locToGloMap.lock()->LinearSpaceMap(*expList, linSolveType);
136 (
m_linsys.lock())->GetKey().GetConstFactors());
149 #ifdef NEKTAR_USING_PETSC
154 ASSERTL0(
false,
"Nektar++ has not been compiled with "
197 int nDirFull =
m_locToGloMap.lock()->GetNumGlobalDirBndCoeffs();
203 for (i = 0; i < nloc; ++i)
205 val = LocToGloBnd[i];
208 In[LocToGlo[i]] = pInput[val - nDirFull];
220 ASSERTL1(pNonVertOutput.size() >= pOutput.size(),
221 "Non Vert output is not of sufficient length");
222 Vmath::Vcopy(pOutput.size(), pNonVertOutput, 1, pOutput, 1);
235 for (i = 0; i < nloc; ++i)
237 val = LocToGloBnd[i];
240 pOutput[val - nDirFull] = Out[LocToGlo[i]];
242 pVertForce[val - nDirFull] = In[LocToGlo[i]];
249 for (i = 0; i < nloc; ++i)
251 val = LocToGloBnd[i];
254 pOutput[val - nDirFull] = Out[LocToGlo[i]];
261 ASSERTL0(0,
"Unsupported solver type");
#define ASSERTL0(condition, msg)
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
Describe a linear system.
const std::weak_ptr< GlobalLinSys > m_linsys
std::weak_ptr< AssemblyMap > m_locToGloMap
virtual void v_BuildPreconditioner() override
virtual void v_DoPreconditioner(const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput) override
Apply a preconditioner to the conjugate gradient method.
static std::string solveType
std::shared_ptr< AssemblyMap > m_vertLocToGloMap
GlobalLinSysSharedPtr m_vertLinsys
virtual void v_InitObject() override
virtual void v_DoPreconditionerWithNonVertOutput(const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const Array< OneD, NekDouble > &pNonVertOutput, Array< OneD, NekDouble > &pVertForce) override
Apply a preconditioner to the conjugate gradient method with an output for non-vertex degrees of free...
PreconFactory & GetPreconFactory()
std::shared_ptr< AssemblyMap > AssemblyMapSharedPtr
The above copyright notice and this permission notice shall be included.
static Array< OneD, NekDouble > NullNekDouble1DArray
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)