59 const std::shared_ptr<AssemblyMap> &pLocToGloMap)
65 "This routine should only be used when using a Full XXT"
84 bool dirForcCalculated = (bool)pDirForcing.size();
85 int nDirDofs = pLocToGloMap->GetNumGlobalDirBndCoeffs();
86 int nGlobDofs = pLocToGloMap->GetNumGlobalCoeffs();
87 int nLocDofs = pLocToGloMap->GetNumLocalCoeffs();
96 if (dirForcCalculated)
100 pDirForcing.size() >= nLocDofs,
101 "DirForcing is not of sufficient size. Is it in local space?");
102 Vmath::Vsub(nLocDofs, pLocInput, 1, pDirForcing, 1, tmp1, 1);
110 Vmath::Vsub(nLocDofs, pLocInput, 1, tmp, 1, tmp1, 1);
117 Vmath::Vadd(nLocDofs, tmp, 1, pLocOutput, 1, pLocOutput, 1);
122 pLocOutput, pLocToGloMap);
132 const std::shared_ptr<AssemblyMap> &pLocToGloMap)
135 unsigned int nElmt = vExp->GetNumElmts();
137 unsigned int iCount = 0;
138 unsigned int rCount = 0;
139 unsigned int nRows = 0;
140 unsigned int nEntries = 0;
141 unsigned int numDirBnd = pLocToGloMap->GetNumGlobalDirBndCoeffs();
142 unsigned int nLocal = pLocToGloMap->GetNumLocalCoeffs();
144 pLocToGloMap->GetLocalToGlobalSign();
145 bool doSign = pLocToGloMap->GetSignChange();
146 unsigned int i = 0, j = 0, k = 0, n = 0;
157 for (n = 0; n < nElmt; ++n)
159 vSizes[n] = vExp->GetExp(n)->GetNverts();
160 nEntries += vSizes[n] * vSizes[n];
165 for (n = 0; n < nElmt; ++n)
167 vSizes[n] = vExp->GetExp(n)->GetNcoeffs();
168 nEntries += vSizes[n] * vSizes[n];
182 for (n = iCount = 0; n < nElmt; ++n)
185 nRows = loc_mat->GetRows();
187 for (i = 0; i < nRows; ++i)
189 gid1 = pLocToGloMap->GetLocalToGlobalMap(iCount + i);
190 for (j = 0; j < nRows; ++j)
192 k = rCount + i * vSizes[n] + j;
193 m_Ai[k] = iCount + i;
194 m_Aj[k] = iCount + j;
195 m_Ar[k] = (*loc_mat)(i, j);
198 m_Ar[k] *= vMapSign[iCount + i] * vMapSign[iCount + j];
204 if (gid1 < numDirBnd)
210 vId[iCount + i] = pLocToGloMap->GetGlobalToUniversalMap(gid1);
214 rCount += vSizes[n] * vSizes[n];
232 boost::ignore_unused(pNumRows, pNumDir);
234 int nLocal = pNumRows;
239 if (pLocToGloMap->GetSignChange())
242 Vmath::Vmul(nLocal, pLocToGloMap->GetLocalToGlobalSign(), 1, pInput, 1,
247 Vmath::Vmul(nLocal, pLocToGloMap->GetLocalToGlobalSign(), 1, pOutput, 1,
#define ASSERTL0(condition, msg)
#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.
const std::weak_ptr< ExpList > m_expList
Local Matrix System.
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.
virtual void v_Solve(const Array< OneD, const NekDouble > &in, Array< OneD, NekDouble > &out, 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 void v_SolveLinearSystem(const int pNumRows, const Array< OneD, const NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const AssemblyMapSharedPtr &locToGloMap, const int pNumDir=0) override
Solve the linear system for given input and output vectors.
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 AssembleMatrixArrays(const std::shared_ptr< AssemblyMap > &pLocToGloMap)
GlobalLinSysXxtFull(const GlobalLinSysKey &pLinSysKey, const std::weak_ptr< ExpList > &pExpList, const std::shared_ptr< AssemblyMap > &pLocToGloMap)
Constructor for full direct matrix solve.
virtual ~GlobalLinSysXxtFull()
static std::string className
Name of class.
Array< OneD, double > m_Ar
Array< OneD, unsigned int > m_Aj
Array< OneD, unsigned int > m_Ai
struct Xxt::crs_data * m_crsData
StdRegions::MatrixType GetMatrixType() const
Return the matrix type.
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
GlobalLinSysFactory & GetGlobalLinSysFactory()
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
std::shared_ptr< AssemblyMap > AssemblyMapSharedPtr
The above copyright notice and this permission notice shall be included.
std::shared_ptr< DNekScalMat > DNekScalMatSharedPtr
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.
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 Zero(int n, T *x, const int incx)
Zero vector.
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.
void nektar_crs_stats(struct crs_data *data)
static struct crs_data * Init(unsigned int pRank, const Nektar::Array< OneD, unsigned long > pId, const Nektar::Array< OneD, unsigned int > pAi, const Nektar::Array< OneD, unsigned int > pAj, const Nektar::Array< OneD, NekDouble > pAr, const LibUtilities::CommSharedPtr &pComm)
Initialise the matrix-solve.
static void Solve(Nektar::Array< OneD, NekDouble > pX, struct crs_data *pCrs, Nektar::Array< OneD, NekDouble > pB)
Solve the matrix system for a given input vector b.