57 const std::shared_ptr<AssemblyMap> &pLocToGloMap)
63 "This routine should only be used when using a Full XXT"
75 const std::shared_ptr<AssemblyMap> &pLocToGloMap)
78 unsigned int nElmt = vExp->GetNumElmts();
80 unsigned int iCount = 0;
81 unsigned int rCount = 0;
82 unsigned int nRows = 0;
83 unsigned int nEntries = 0;
84 unsigned int numDirBnd = pLocToGloMap->GetNumGlobalDirBndCoeffs();
85 unsigned int nLocal = pLocToGloMap->GetNumLocalCoeffs();
87 pLocToGloMap->GetLocalToGlobalSign();
88 bool doSign = pLocToGloMap->GetSignChange();
89 unsigned int i = 0, j = 0, k = 0, n = 0;
100 for (n = 0; n < nElmt; ++n)
102 vSizes[n] = vExp->GetExp(n)->GetNverts();
103 nEntries += vSizes[n] * vSizes[n];
108 for (n = 0; n < nElmt; ++n)
110 vSizes[n] = vExp->GetExp(n)->GetNcoeffs();
111 nEntries += vSizes[n] * vSizes[n];
125 for (n = iCount = 0; n < nElmt; ++n)
128 nRows = loc_mat->GetRows();
130 for (i = 0; i < nRows; ++i)
132 gid1 = pLocToGloMap->GetLocalToGlobalMap(iCount + i);
133 for (j = 0; j < nRows; ++j)
135 k = rCount + i * vSizes[n] + j;
136 m_Ai[k] = iCount + i;
137 m_Aj[k] = iCount + j;
138 m_Ar[k] = (*loc_mat)(i, j);
141 m_Ar[k] *= vMapSign[iCount + i] * vMapSign[iCount + j];
147 if (gid1 < numDirBnd)
153 vId[iCount + i] = pLocToGloMap->GetGlobalToUniversalMap(gid1);
157 rCount += vSizes[n] * vSizes[n];
178 bool dirForcCalculated = (bool)pDirForcing.size();
179 int nDirDofs = pLocToGloMap->GetNumGlobalDirBndCoeffs();
180 int nLocDofs = pLocToGloMap->GetNumLocalCoeffs();
184 std::shared_ptr<MultiRegions::ExpList> expList =
m_expList.lock();
188 if (dirForcCalculated)
192 pDirForcing.size() >= nLocDofs,
193 "DirForcing is not of sufficient size. Is it in local space?");
194 Vmath::Vsub(nLocDofs, pLocInput, 1, pDirForcing, 1, rhs, 1);
200 expList->GeneralMatrixOp(
m_linSysKey, pLocOutput, rhs);
210 int offset = expList->GetCoeff_Offset(n);
214 for (rBC = r.second; rBC; rBC = rBC->next)
216 vExp->AddRobinTraceContribution(
217 rBC->m_robinID, rBC->m_robinPrimitiveCoeffs,
218 pLocOutput + offset, rhsloc = rhs + offset);
221 Vmath::Vsub(nLocDofs, pLocInput, 1, rhs, 1, rhs, 1);
230 Vmath::Vadd(nLocDofs, diff, 1, pLocOutput, 1, pLocOutput, 1);
240 [[maybe_unused]]
const int pNumRows,
243 [[maybe_unused]]
const int pNumDir)
245 int nLocal = pNumRows;
250 if (pLocToGloMap->GetSignChange())
253 Vmath::Vmul(nLocal, pLocToGloMap->GetLocalToGlobalSign(), 1, pInput, 1,
258 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.
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.
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 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.
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.
std::shared_ptr< Expansion > ExpansionSharedPtr
std::shared_ptr< RobinBCInfo > RobinBCInfoSharedPtr
GlobalLinSysFactory & GetGlobalLinSysFactory()
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
std::shared_ptr< AssemblyMap > AssemblyMapSharedPtr
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.