43 namespace MultiRegions
52 string GlobalLinSysXxtFull::className =
54 "XxtFull", GlobalLinSysXxtFull::create,
"Xxt Full Matrix.");
57 GlobalLinSysXxtFull::GlobalLinSysXxtFull(
59 const std::shared_ptr<AssemblyMap> &pLocToGloMap)
65 "This routine should only be used when using a Full XXT"
85 bool dirForcCalculated = (bool)pDirForcing.size();
86 int nDirDofs = pLocToGloMap->GetNumGlobalDirBndCoeffs();
87 int nGlobDofs = pLocToGloMap->GetNumGlobalCoeffs();
88 int nLocDofs = pLocToGloMap->GetNumLocalCoeffs();
97 if (dirForcCalculated)
101 pDirForcing.size() >= nLocDofs,
102 "DirForcing is not of sufficient size. Is it in local space?");
103 Vmath::Vsub(nLocDofs, pLocInput, 1, pDirForcing, 1, tmp1, 1);
111 Vmath::Vsub(nLocDofs, pLocInput, 1, tmp, 1, tmp1, 1);
114 pLocToGloMap->Assemble(tmp1, tmp);
118 pLocToGloMap->GlobalToLocal(global, tmp);
121 Vmath::Vadd(nLocDofs, tmp, 1, pLocOutput, 1, pLocOutput, 1);
125 pLocToGloMap->Assemble(pLocInput, tmp);
128 pLocToGloMap->GlobalToLocal(global, pLocOutput);
137 const std::shared_ptr<AssemblyMap> &pLocToGloMap)
140 unsigned int nGlo = pLocToGloMap->GetNumGlobalCoeffs();
141 unsigned int nEntries = pLocToGloMap->GetNumLocalCoeffs();
146 for (i = 0; i < nEntries; ++i)
148 vCounts[vMap[i]] += 1.0;
152 pLocToGloMap->UniversalAssemble(vCounts);
156 for (i = 0; i < nEntries; ++i)
161 m_map = pLocToGloMap->GetLocalToGlobalMap();
170 const std::shared_ptr<AssemblyMap> &pLocToGloMap)
173 unsigned int nElmt = vExp->GetNumElmts();
175 unsigned int iCount = 0;
176 unsigned int rCount = 0;
177 unsigned int nRows = 0;
178 unsigned int nEntries = 0;
179 unsigned int numDirBnd = pLocToGloMap->GetNumGlobalDirBndCoeffs();
180 unsigned int nLocal = pLocToGloMap->GetNumLocalCoeffs();
182 pLocToGloMap->GetLocalToGlobalSign();
183 bool doSign = pLocToGloMap->GetSignChange();
184 unsigned int i = 0, j = 0, k = 0, n = 0;
195 for (n = 0; n < nElmt; ++n)
197 vSizes[n] = vExp->GetExp(n)->GetNverts();
198 nEntries += vSizes[n] * vSizes[n];
203 for (n = 0; n < nElmt; ++n)
205 vSizes[n] = vExp->GetExp(n)->GetNcoeffs();
206 nEntries += vSizes[n] * vSizes[n];
220 for (n = iCount = 0; n < nElmt; ++n)
223 nRows = loc_mat->GetRows();
225 for (i = 0; i < nRows; ++i)
227 gid1 = pLocToGloMap->GetLocalToGlobalMap(iCount + i);
228 for (j = 0; j < nRows; ++j)
230 k = rCount + i * vSizes[n] + j;
231 m_Ai[k] = iCount + i;
232 m_Aj[k] = iCount + j;
233 m_Ar[k] = (*loc_mat)(i, j);
236 m_Ar[k] *= vMapSign[iCount + i] * vMapSign[iCount + j];
242 if (gid1 < numDirBnd)
248 vId[iCount + i] = pLocToGloMap->GetGlobalToUniversalMap(gid1);
252 rCount += vSizes[n] * vSizes[n];
#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.
void CreateMap(const std::shared_ptr< AssemblyMap > &pLocToGloMap)
void AssembleMatrixArrays(const std::shared_ptr< AssemblyMap > &pLocToGloMap)
virtual ~GlobalLinSysXxtFull()
Array< OneD, NekDouble > m_locToGloSignMult
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 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.
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.