79 const std::shared_ptr<AssemblyMap> &pLocToGloMap)
85 "This routine should only be used when using a Full Direct"
87 ASSERTL1(pExp.lock()->GetComm()->GetSize() == 1,
88 "Direct full matrix solve can only be used in serial.");
106 bool dirForcCalculated = (bool)pDirForcing.size();
108 int nDirDofs = pLocToGloMap->GetNumGlobalDirBndCoeffs();
109 int nGlobDofs = pLocToGloMap->GetNumGlobalCoeffs();
110 int nLocDofs = pLocToGloMap->GetNumLocalCoeffs();
117 std::shared_ptr<MultiRegions::ExpList> expList =
m_expList.lock();
120 if (dirForcCalculated)
124 pDirForcing.size() >= nLocDofs,
125 "DirForcing is not of sufficient size. Is it in local space?");
126 Vmath::Vsub(nLocDofs, pLocInput, 1, pDirForcing, 1, tmp1, 1);
132 expList->GeneralMatrixOp(
m_linSysKey, pLocOutput, tmp);
142 int offset = expList->GetCoeff_Offset(n);
146 for (rBC = r.second; rBC; rBC = rBC->next)
148 vExp->AddRobinTraceContribution(
149 rBC->m_robinID, rBC->m_robinPrimitiveCoeffs,
150 pLocOutput + offset, tmploc = tmp + offset);
153 Vmath::Vsub(nLocDofs, pLocInput, 1, tmp, 1, tmp1, 1);
159 Vmath::Vadd(nLocDofs, tmp, 1, pLocOutput, 1, pLocOutput, 1);
176 int i, j, n, cnt, gid1, gid2;
178 int totDofs = pLocToGloMap->GetNumGlobalCoeffs();
179 int NumDirBCs = pLocToGloMap->GetNumGlobalDirBndCoeffs();
181 unsigned int rows = totDofs - NumDirBCs;
182 unsigned int cols = totDofs - NumDirBCs;
186 int bwidth = pLocToGloMap->GetFullSystemBandWidth();
197 if ((2 * (bwidth + 1)) < rows)
201 rows, cols, zero, matStorage, bwidth, bwidth);
207 rows, cols, zero, matStorage);
230 for (n = cnt = 0; n <
m_expList.lock()->GetNumElmts(); ++n)
233 loc_lda = loc_mat->GetRows();
235 for (i = 0; i < loc_lda; ++i)
237 gid1 = pLocToGloMap->GetLocalToGlobalMap(cnt + i) - NumDirBCs;
238 sign1 = pLocToGloMap->GetLocalToGlobalSign(cnt + i);
241 for (j = 0; j < loc_lda; ++j)
244 pLocToGloMap->GetLocalToGlobalMap(cnt + j) - NumDirBCs;
245 sign2 = pLocToGloMap->GetLocalToGlobalSign(cnt + j);
252 if ((matStorage ==
eFULL) || (gid2 >= gid1))
254 value = Gmat->GetValue(gid1, gid2) +
255 sign1 * sign2 * (*loc_mat)(i, j);
256 Gmat->SetValue(gid1, gid2, value);
281 pLocToGloMap->Assemble(pInput, tmp);
283 const int nHomDofs = pNumRows - pNumDir;
284 DNekVec Vin(nHomDofs, tmp + pNumDir);
291 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.
virtual 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.
virtual ~GlobalLinSysDirectFull()
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.
virtual 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)
The above copyright notice and this permission notice shall be included.
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.