41#ifdef NEKTAR_USING_PETSC
59 "Full Linear space inverse Preconditioning");
78 const std::shared_ptr<GlobalLinSys> &plinsys,
92 "This type of preconditioning is not implemented "
95 std::shared_ptr<MultiRegions::ExpList> expList =
96 ((
m_linsys.lock())->GetLocMat()).lock();
100 "LinearPreconSolver");
109#ifndef NEKTAR_USING_PETSC
124 m_locToGloMap.lock()->LinearSpaceMap(*expList, linSolveType);
135 (
m_linsys.lock())->GetKey().GetConstFactors());
148#ifdef NEKTAR_USING_PETSC
153 ASSERTL0(
false,
"Nektar++ has not been compiled with "
167 ASSERTL0(isLocal ==
false,
"PreconditionerLinear is only set up for Global"
168 " iteratives sovles");
198 int nDirFull =
m_locToGloMap.lock()->GetNumGlobalDirBndCoeffs();
206 for (i = 0; i < nloc; ++i)
208 val = LocToGloBnd[i];
211 In[LocToGlo[i]] = pInput[val - nDirFull];
219 for (i = 0; i < nloc; ++i)
221 val = LocToGloBnd[i];
224 In[i] = pInput[val - nDirFull] *
m_invMult[i];
237 ASSERTL1(pNonVertOutput.size() >= pOutput.size(),
238 "Non Vert output is not of sufficient length");
239 Vmath::Vcopy(pOutput.size(), pNonVertOutput, 1, pOutput, 1);
253 for (i = 0; i < nloc; ++i)
255 val = LocToGloBnd[i];
258 pOutput[val - nDirFull] = Out[LocToGlo[i]];
260 pVertForce[val - nDirFull] = In[LocToGlo[i]];
267 for (i = 0; i < nloc; ++i)
269 val = LocToGloBnd[i];
272 pOutput[val - nDirFull] = Out[LocToGlo[i]];
281 for (i = 0; i < nloc; ++i)
283 val = LocToGloBnd[i];
286 pOutput[val - nDirFull] = Out[i];
288 pVertForce[val - nDirFull] = In[i];
295 for (i = 0; i < nloc; ++i)
297 val = LocToGloBnd[i];
300 pOutput[val - nDirFull] = Out[i];
308 ASSERTL0(0,
"Unsupported solver type");
318 const std::shared_ptr<AssemblyMap> &pLocToGloMap)
321 unsigned int nGlo = pLocToGloMap->GetNumGlobalCoeffs();
322 unsigned int nEntries = pLocToGloMap->GetNumLocalCoeffs();
327 for (i = 0; i < nEntries; ++i)
329 vCounts[vMap[i]] += 1.0;
333 pLocToGloMap->UniversalAssemble(vCounts);
337 for (i = 0; i < nEntries; ++i)
#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::string RegisterEnumValue(std::string pEnum, std::string pString, int pEnumValue)
Registers an enumeration value.
static std::string RegisterDefaultSolverInfo(const std::string &pName, const std::string &pValue)
Registers the default string value of a solver info property.
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
void v_DoPreconditioner(const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const bool &isLocal=false) override
Apply a preconditioner to the conjugate gradient method.
void v_BuildPreconditioner() override
PreconditionerLinear(const std::shared_ptr< GlobalLinSys > &plinsys, const AssemblyMapSharedPtr &pLocToGloMap)
void SetupInvMult(const std::shared_ptr< AssemblyMap > &pLocToGloMap)
Array< OneD, NekDouble > m_invMult
static std::string solveTypeIds[]
static std::string solveType
static PreconditionerSharedPtr create(const std::shared_ptr< GlobalLinSys > &plinsys, const std::shared_ptr< AssemblyMap > &pLocToGloMap)
Creates an instance of this class.
std::shared_ptr< AssemblyMap > m_vertLocToGloMap
static std::string className1
Name of class.
GlobalLinSysSharedPtr m_vertLinsys
void v_InitObject() override
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
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)