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.num_elements();
114 int nDirDofs = pLocToGloMap->GetNumGlobalDirBndCoeffs();
115 int nGlobDofs = pLocToGloMap->GetNumGlobalCoeffs();
121 if(dirForcCalculated)
125 pDirForcing.get(), 1,
130 Vmath::Zero(nGlobDofs-nDirDofs, &pOutput[nDirDofs], 1);
143 Vmath::Vadd(nGlobDofs-nDirDofs, &out [nDirDofs], 1,
144 &pOutput[nDirDofs], 1, &pOutput[nDirDofs], 1);
161 int i,j,n,cnt,gid1,gid2;
163 int totDofs = pLocToGloMap->GetNumGlobalCoeffs();
164 int NumDirBCs = pLocToGloMap->GetNumGlobalDirBndCoeffs();
166 unsigned int rows = totDofs - NumDirBCs;
167 unsigned int cols = totDofs - NumDirBCs;
171 int bwidth = pLocToGloMap->GetFullSystemBandWidth();
182 if( (2*(bwidth+1)) < rows)
219 for(n = cnt = 0; n <
m_expList.lock()->GetNumElmts(); ++n)
222 loc_lda = loc_mat->GetRows();
224 for(i = 0; i < loc_lda; ++i)
226 gid1 = pLocToGloMap->GetLocalToGlobalMap(cnt + i)-NumDirBCs;
227 sign1 = pLocToGloMap->GetLocalToGlobalSign(cnt + i);
230 for(j = 0; j < loc_lda; ++j)
232 gid2 = pLocToGloMap->GetLocalToGlobalMap(cnt + j)
234 sign2 = pLocToGloMap->GetLocalToGlobalSign(cnt + j);
241 if((matStorage ==
eFULL)||(gid2 >= gid1))
243 value = Gmat->GetValue(gid1,gid2)
244 + sign1*sign2*(*loc_mat)(i,j);
245 Gmat->SetValue(gid1,gid2,value);
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
std::shared_ptr< DNekScalMat > DNekScalMatSharedPtr
DNekLinSysSharedPtr m_linSys
Basic linear system object.
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.
void AssembleFullMatrix(const std::shared_ptr< AssemblyMap > &locToGloMap)
std::shared_ptr< DNekMat > DNekMatSharedPtr
std::shared_ptr< AssemblyMap > AssemblyMapSharedPtr
virtual ~GlobalLinSysDirectFull()
DNekScalMatSharedPtr GetBlock(unsigned int n)
StdRegions::MatrixType GetMatrixType() const
Return the matrix type.
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
Describe a linear system.
PointerWrapper
Specifies if the pointer passed to a NekMatrix or NekVector is copied into an internal representation...
const GlobalLinSysKey m_linSysKey
Key associated with this linear system.
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.
const std::weak_ptr< ExpList > m_expList
Local Matrix System.
virtual void v_Solve(const Array< OneD, const NekDouble > &in, Array< OneD, NekDouble > &out, 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...
GlobalSysSolnType GetGlobalSysSolnType() const
Return the associated solution type.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
void Zero(int n, T *x, const int incx)
Zero vector.
GlobalLinSysFactory & GetGlobalLinSysFactory()
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
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.