42 namespace MultiRegions
72 string GlobalLinSysDirectFull::className
75 GlobalLinSysDirectFull::create,
80 GlobalLinSysDirectFull::GlobalLinSysDirectFull(
82 const std::weak_ptr<ExpList> &pExp,
83 const std::shared_ptr<AssemblyMap> &pLocToGloMap)
89 "This routine should only be used when using a Full Direct"
91 ASSERTL1(pExp.lock()->GetComm()->GetSize() == 1,
92 "Direct full matrix solve can only be used in serial.");
113 bool dirForcCalculated = (bool) pDirForcing.size();
115 int nDirDofs = pLocToGloMap->GetNumGlobalDirBndCoeffs();
116 int nGlobDofs = pLocToGloMap->GetNumGlobalCoeffs();
117 int nLocDofs = pLocToGloMap->GetNumLocalCoeffs();
125 std::shared_ptr<MultiRegions::ExpList> expList =
m_expList.lock();
128 if(dirForcCalculated)
131 ASSERTL0(pDirForcing.size() >= nLocDofs,
132 "DirForcing is not of sufficient size. Is it in local space?");
134 pDirForcing, 1, tmp1, 1);
140 expList->GeneralMatrixOp(
m_linSysKey, pLocOutput, tmp);
150 int offset = expList->GetCoeff_Offset(n);
154 for(rBC = r.second;rBC; rBC = rBC->next)
156 vExp->AddRobinTraceContribution(rBC->m_robinID,
157 rBC->m_robinPrimitiveCoeffs,
159 tmploc = tmp + offset);
162 Vmath::Vsub(nLocDofs, pLocInput, 1, tmp, 1, tmp1, 1);
165 pLocToGloMap->Assemble(tmp1,tmp);
168 pLocToGloMap->GlobalToLocal(global,tmp);
171 Vmath::Vadd(nLocDofs, tmp, 1, pLocOutput, 1, pLocOutput, 1);
175 pLocToGloMap->Assemble(pLocInput,tmp);
177 pLocToGloMap->GlobalToLocal(global,pLocOutput);
190 int i,j,n,cnt,gid1,gid2;
192 int totDofs = pLocToGloMap->GetNumGlobalCoeffs();
193 int NumDirBCs = pLocToGloMap->GetNumGlobalDirBndCoeffs();
195 unsigned int rows = totDofs - NumDirBCs;
196 unsigned int cols = totDofs - NumDirBCs;
200 int bwidth = pLocToGloMap->GetFullSystemBandWidth();
211 if( (2*(bwidth+1)) < rows)
248 for(n = cnt = 0; n <
m_expList.lock()->GetNumElmts(); ++n)
251 loc_lda = loc_mat->GetRows();
253 for(i = 0; i < loc_lda; ++i)
255 gid1 = pLocToGloMap->GetLocalToGlobalMap(cnt + i)-NumDirBCs;
256 sign1 = pLocToGloMap->GetLocalToGlobalSign(cnt + i);
259 for(j = 0; j < loc_lda; ++j)
261 gid2 = pLocToGloMap->GetLocalToGlobalMap(cnt + j)
263 sign2 = pLocToGloMap->GetLocalToGlobalSign(cnt + j);
270 if((matStorage ==
eFULL)||(gid2 >= gid1))
272 value = Gmat->GetValue(gid1,gid2)
273 + sign1*sign2*(*loc_mat)(i,j);
274 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 ~GlobalLinSysDirectFull()
void AssembleFullMatrix(const std::shared_ptr< AssemblyMap > &locToGloMap)
virtual void v_Solve(const Array< OneD, const NekDouble > &pLocInput, Array< OneD, NekDouble > &pLocalOutput, const AssemblyMapSharedPtr &locToGloMap, const Array< OneD, const NekDouble > &dirForcing=NullNekDouble1DArray)
Solve the linear system for given input and output vectors using a specified local to global map.
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.