42 namespace MultiRegions
72 string GlobalLinSysDirectFull::className =
74 "DirectFull", GlobalLinSysDirectFull::create,
"Direct Full.");
77 GlobalLinSysDirectFull::GlobalLinSysDirectFull(
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();
118 std::shared_ptr<MultiRegions::ExpList> expList =
m_expList.lock();
121 if (dirForcCalculated)
125 pDirForcing.size() >= nLocDofs,
126 "DirForcing is not of sufficient size. Is it in local space?");
127 Vmath::Vsub(nLocDofs, pLocInput, 1, pDirForcing, 1, tmp1, 1);
133 expList->GeneralMatrixOp(
m_linSysKey, pLocOutput, tmp);
143 int offset = expList->GetCoeff_Offset(n);
147 for (rBC = r.second; rBC; rBC = rBC->next)
149 vExp->AddRobinTraceContribution(
150 rBC->m_robinID, rBC->m_robinPrimitiveCoeffs,
151 pLocOutput + offset, tmploc = tmp + offset);
154 Vmath::Vsub(nLocDofs, pLocInput, 1, tmp, 1, tmp1, 1);
157 pLocToGloMap->Assemble(tmp1, tmp);
160 pLocToGloMap->GlobalToLocal(global, tmp);
163 Vmath::Vadd(nLocDofs, tmp, 1, pLocOutput, 1, pLocOutput, 1);
167 pLocToGloMap->Assemble(pLocInput, tmp);
169 pLocToGloMap->GlobalToLocal(global, pLocOutput);
181 int i, j, n, cnt, gid1, gid2;
183 int totDofs = pLocToGloMap->GetNumGlobalCoeffs();
184 int NumDirBCs = pLocToGloMap->GetNumGlobalDirBndCoeffs();
186 unsigned int rows = totDofs - NumDirBCs;
187 unsigned int cols = totDofs - NumDirBCs;
191 int bwidth = pLocToGloMap->GetFullSystemBandWidth();
202 if ((2 * (bwidth + 1)) < rows)
206 rows, cols, zero, matStorage, bwidth, bwidth);
212 rows, cols, zero, matStorage);
235 for (n = cnt = 0; n <
m_expList.lock()->GetNumElmts(); ++n)
238 loc_lda = loc_mat->GetRows();
240 for (i = 0; i < loc_lda; ++i)
242 gid1 = pLocToGloMap->GetLocalToGlobalMap(cnt + i) - NumDirBCs;
243 sign1 = pLocToGloMap->GetLocalToGlobalSign(cnt + i);
246 for (j = 0; j < loc_lda; ++j)
249 pLocToGloMap->GetLocalToGlobalMap(cnt + j) - NumDirBCs;
250 sign2 = pLocToGloMap->GetLocalToGlobalSign(cnt + j);
257 if ((matStorage ==
eFULL) || (gid2 >= gid1))
259 value = Gmat->GetValue(gid1, gid2) +
260 sign1 * sign2 * (*loc_mat)(i, j);
261 Gmat->SetValue(gid1, gid2, value);
#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.
virtual ~GlobalLinSysDirectFull()
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
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.