43 namespace MultiRegions
52 string GlobalLinSysXxtFull::className
55 GlobalLinSysXxtFull::create,
60 GlobalLinSysXxtFull::GlobalLinSysXxtFull(
62 const std::weak_ptr<ExpList> &pExp,
63 const std::shared_ptr<AssemblyMap>
70 "This routine should only be used when using a Full XXT"
93 bool dirForcCalculated = (bool) pDirForcing.size();
94 int nDirDofs = pLocToGloMap->GetNumGlobalDirBndCoeffs();
95 int nGlobDofs = pLocToGloMap->GetNumGlobalCoeffs();
96 int nLocDofs = pLocToGloMap->GetNumLocalCoeffs();
105 if(dirForcCalculated)
108 ASSERTL0(pDirForcing.size() >= nLocDofs,
109 "DirForcing is not of sufficient size. Is it in local space?");
111 pDirForcing, 1,tmp1, 1);
120 Vmath::Vsub(nLocDofs, pLocInput, 1, tmp, 1, tmp1, 1);
124 pLocToGloMap->Assemble(tmp1,tmp);
127 tmp, global, pLocToGloMap);
128 pLocToGloMap->GlobalToLocal(global,tmp);
131 Vmath::Vadd(nLocDofs, tmp, 1, pLocOutput, 1, pLocOutput, 1);
135 pLocToGloMap->Assemble(pLocInput,tmp);
137 tmp,global, pLocToGloMap);
138 pLocToGloMap->GlobalToLocal(global,pLocOutput);
148 const std::shared_ptr<AssemblyMap> &pLocToGloMap)
151 = pLocToGloMap->GetLocalToGlobalMap();
152 unsigned int nGlo = pLocToGloMap->GetNumGlobalCoeffs();
153 unsigned int nEntries = pLocToGloMap->GetNumLocalCoeffs();
158 for (i = 0; i < nEntries; ++i)
160 vCounts[vMap[i]] += 1.0;
164 pLocToGloMap->UniversalAssemble(vCounts);
168 for (i = 0; i < nEntries; ++i)
173 m_map = pLocToGloMap->GetLocalToGlobalMap();
183 const std::shared_ptr<AssemblyMap> &pLocToGloMap)
186 unsigned int nElmt = vExp->GetNumElmts();
188 unsigned int iCount = 0;
189 unsigned int rCount = 0;
190 unsigned int nRows = 0;
191 unsigned int nEntries = 0;
192 unsigned int numDirBnd = pLocToGloMap->GetNumGlobalDirBndCoeffs();
193 unsigned int nLocal = pLocToGloMap->GetNumLocalCoeffs();
195 = pLocToGloMap->GetLocalToGlobalSign();
196 bool doSign = pLocToGloMap->GetSignChange();
197 unsigned int i = 0, j = 0, k = 0, n = 0;
208 for (n = 0; n < nElmt; ++n)
210 vSizes[n] = vExp->GetExp(n)->GetNverts();
211 nEntries += vSizes[n]*vSizes[n];
216 for (n = 0; n < nElmt; ++n)
218 vSizes[n] = vExp->GetExp(n)->GetNcoeffs();
219 nEntries += vSizes[n]*vSizes[n];
233 for(n = iCount = 0; n < nElmt; ++n)
236 nRows = loc_mat->GetRows();
238 for(i = 0; i < nRows; ++i)
240 gid1 = pLocToGloMap->GetLocalToGlobalMap(iCount + i);
241 for(j = 0; j < nRows; ++j)
243 k = rCount + i*vSizes[n] + j;
244 m_Ai[k] = iCount + i;
245 m_Aj[k] = iCount + j;
246 m_Ar[k] = (*loc_mat)(i,j);
249 m_Ar[k] *= vMapSign[iCount+i]*vMapSign[iCount+j];
255 if (gid1 < numDirBnd)
262 = pLocToGloMap->GetGlobalToUniversalMap(gid1);
266 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.
void CreateMap(const std::shared_ptr< AssemblyMap > &pLocToGloMap)
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.
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.