41#ifdef NEKTAR_USING_PETSC
61 "Full Linear space inverse Preconditioning");
80 const std::shared_ptr<GlobalLinSys> &plinsys,
94 "This type of preconditioning is not implemented "
97 std::shared_ptr<MultiRegions::ExpList> expList =
98 ((
m_linsys.lock())->GetLocMat()).lock();
102 "LinearPreconSolver");
111#ifndef NEKTAR_USING_PETSC
126 m_locToGloMap.lock()->LinearSpaceMap(*expList, linSolveType);
137 (
m_linsys.lock())->GetKey().GetConstFactors());
150#ifdef NEKTAR_USING_PETSC
155 ASSERTL0(
false,
"Nektar++ has not been compiled with "
169 ASSERTL0(isLocal ==
false,
"PreconditionerLinear is only set up for Global"
170 " iteratives sovles");
200 int nDirFull =
m_locToGloMap.lock()->GetNumGlobalDirBndCoeffs();
208 for (i = 0; i < nloc; ++i)
210 val = LocToGloBnd[i];
213 In[LocToGlo[i]] = pInput[val - nDirFull];
221 for (i = 0; i < nloc; ++i)
223 val = LocToGloBnd[i];
226 In[i] = pInput[val - nDirFull] *
m_invMult[i];
239 ASSERTL1(pNonVertOutput.size() >= pOutput.size(),
240 "Non Vert output is not of sufficient length");
241 Vmath::Vcopy(pOutput.size(), pNonVertOutput, 1, pOutput, 1);
255 for (i = 0; i < nloc; ++i)
257 val = LocToGloBnd[i];
260 pOutput[val - nDirFull] = Out[LocToGlo[i]];
262 pVertForce[val - nDirFull] = In[LocToGlo[i]];
269 for (i = 0; i < nloc; ++i)
271 val = LocToGloBnd[i];
274 pOutput[val - nDirFull] = Out[LocToGlo[i]];
283 for (i = 0; i < nloc; ++i)
285 val = LocToGloBnd[i];
288 pOutput[val - nDirFull] = Out[i];
290 pVertForce[val - nDirFull] = In[i];
297 for (i = 0; i < nloc; ++i)
299 val = LocToGloBnd[i];
302 pOutput[val - nDirFull] = Out[i];
310 ASSERTL0(0,
"Unsupported solver type");
319 const std::shared_ptr<AssemblyMap> &pLocToGloMap)
322 unsigned int nGlo = pLocToGloMap->GetNumGlobalCoeffs();
323 unsigned int nEntries = pLocToGloMap->GetNumLocalCoeffs();
328 for (i = 0; i < nEntries; ++i)
330 vCounts[vMap[i]] += 1.0;
334 pLocToGloMap->UniversalAssemble(vCounts);
338 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
virtual 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.
virtual 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
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)