77 const std::shared_ptr<AssemblyMap> &pLocToGloMap)
83 "This routine should only be used when using a Full Direct"
85 ASSERTL1(pExp.lock()->GetComm()->GetSize() == 1,
86 "Direct full matrix solve can only be used in serial.");
100 bool dirForcCalculated = (bool)pDirForcing.size();
101 int nDirDofs = pLocToGloMap->GetNumGlobalDirBndCoeffs();
102 int nGlobDofs = pLocToGloMap->GetNumGlobalCoeffs();
103 int nLocDofs = pLocToGloMap->GetNumLocalCoeffs();
107 std::shared_ptr<MultiRegions::ExpList> expList =
m_expList.lock();
111 if (dirForcCalculated)
115 pDirForcing.size() >= nLocDofs,
116 "DirForcing is not of sufficient size. Is it in local space?");
117 Vmath::Vsub(nLocDofs, pLocInput, 1, pDirForcing, 1, rhs, 1);
123 expList->GeneralMatrixOp(
m_linSysKey, pLocOutput, rhs);
133 int offset = expList->GetCoeff_Offset(n);
137 for (rBC = r.second; rBC; rBC = rBC->next)
139 vExp->AddRobinTraceContribution(
140 rBC->m_robinID, rBC->m_robinPrimitiveCoeffs,
141 pLocOutput + offset, rhsloc = rhs + offset);
144 Vmath::Vsub(nLocDofs, pLocInput, 1, rhs, 1, rhs, 1);
153 Vmath::Vadd(nLocDofs, diff, 1, pLocOutput, 1, pLocOutput, 1);
170 int i, j, n, cnt, gid1, gid2;
172 int totDofs = pLocToGloMap->GetNumGlobalCoeffs();
173 int NumDirBCs = pLocToGloMap->GetNumGlobalDirBndCoeffs();
175 unsigned int rows = totDofs - NumDirBCs;
176 unsigned int cols = totDofs - NumDirBCs;
180 int bwidth = pLocToGloMap->GetFullSystemBandWidth();
191 if ((2 * (bwidth + 1)) < rows)
195 rows, cols, zero, matStorage, bwidth, bwidth);
201 rows, cols, zero, matStorage);
224 for (n = cnt = 0; n <
m_expList.lock()->GetNumElmts(); ++n)
227 loc_lda = loc_mat->GetRows();
229 for (i = 0; i < loc_lda; ++i)
231 gid1 = pLocToGloMap->GetLocalToGlobalMap(cnt + i) - NumDirBCs;
232 sign1 = pLocToGloMap->GetLocalToGlobalSign(cnt + i);
235 for (j = 0; j < loc_lda; ++j)
238 pLocToGloMap->GetLocalToGlobalMap(cnt + j) - NumDirBCs;
239 sign2 = pLocToGloMap->GetLocalToGlobalSign(cnt + j);
246 if ((matStorage ==
eFULL) || (gid2 >= gid1))
248 value = Gmat->GetValue(gid1, gid2) +
249 sign1 * sign2 * (*loc_mat)(i, j);
250 Gmat->SetValue(gid1, gid2, value);
275 pLocToGloMap->Assemble(pInput, tmp);
277 const int nHomDofs = pNumRows - pNumDir;
278 DNekVec Vin(nHomDofs, tmp + pNumDir);
285 pLocToGloMap->GlobalToLocal(global, pOutput);
#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.
void v_Solve(const Array< OneD, const NekDouble > &pLocInput, Array< OneD, NekDouble > &pLocalOutput, const AssemblyMapSharedPtr &locToGloMap, const Array< OneD, const NekDouble > &dirForcing=NullNekDouble1DArray) override
Solve the linear system for given input and output vectors using a specified local to global map.
static std::string className
Name of class.
GlobalLinSysDirectFull(const GlobalLinSysKey &pLinSysKey, const std::weak_ptr< ExpList > &pExpList, const std::shared_ptr< AssemblyMap > &pLocToGloMap)
Constructor for full direct matrix solve.
static GlobalLinSysSharedPtr create(const GlobalLinSysKey &pLinSysKey, const std::weak_ptr< ExpList > &pExpList, const std::shared_ptr< AssemblyMap > &pLocToGloMap)
Creates an instance of this class.
void v_SolveLinearSystem(const int pNumRows, const Array< OneD, const NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const AssemblyMapSharedPtr &locToGloMap, const int pNumDir) override
Solve the linear system for given input and output vectors.
void AssembleFullMatrix(const std::shared_ptr< AssemblyMap > &locToGloMap)
DNekLinSysSharedPtr m_linSys
Basic linear system object.
const std::weak_ptr< ExpList > m_expList
Local Matrix System.
const std::map< int, RobinBCInfoSharedPtr > m_robinBCInfo
Robin boundary info.
void SolveLinearSystem(const int pNumRows, const Array< OneD, const NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const AssemblyMapSharedPtr &locToGloMap, const int pNumDir=0)
Solve the linear system for given input and output vectors.
const GlobalLinSysKey m_linSysKey
Key associated with this linear system.
DNekScalMatSharedPtr GetBlock(unsigned int n)
Describe a linear system.
GlobalSysSolnType GetGlobalSysSolnType() const
Return the associated solution type.
StdRegions::MatrixType GetMatrixType() const
Return the matrix type.
std::shared_ptr< Expansion > ExpansionSharedPtr
std::shared_ptr< RobinBCInfo > RobinBCInfoSharedPtr
GlobalLinSysFactory & GetGlobalLinSysFactory()
std::shared_ptr< AssemblyMap > AssemblyMapSharedPtr
@ eLinearAdvectionReaction
@ eLinearAdvectionDiffusionReaction
std::vector< double > w(NPUPPER)
std::shared_ptr< DNekScalMat > DNekScalMatSharedPtr
@ ePOSITIVE_DEFINITE_SYMMETRIC_BANDED
@ ePOSITIVE_DEFINITE_SYMMETRIC
std::shared_ptr< DNekMat > DNekMatSharedPtr
PointerWrapper
Specifies if the pointer passed to a NekMatrix or NekVector is copied into an internal representation...
void Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y.
void Vsub(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Subtract vector z = x-y.