35 #ifndef NEKTAR_SOLVERS_COMPRESSIBLEFLOWSOLVER_PRECONCFSBRJ
36 #define NEKTAR_SOLVERS_COMPRESSIBLEFLOWSOLVER_PRECONCFSBRJ
61 pFields, pSession, vComm);
97 virtual void v_InitObject()
override;
100 virtual void v_DoPreconCfs(
103 const bool &flag)
override;
105 virtual void v_BuildPreconCfs(
115 template <
typename DataType>
116 void MinusOffDiag2Rhs(
118 const size_t nvariables,
const size_t nCoeffs,
131 template <
typename TypeNekBlkMatSharedPtr>
132 void AllocatePreconBlkDiagCoeff(
135 const int &nscale = 1);
150 const auto nTotElmt = pFields[0]->GetNumElmts();
151 const auto nvariables = pFields.size();
152 const auto vecwidth = vec_t::width;
157 for (
int ne = 0; ne < nTotElmt; ne++)
159 const auto nElmtDof = pFields[0]->GetNcoeffs(ne) * nvariables;
160 const auto nblocks = nElmtDof / vecwidth;
161 unsigned int totblocks =
162 (nElmtDof % vecwidth) ? nblocks + 1 : nblocks;
165 (m_max_nblocks > totblocks) ? m_max_nblocks : totblocks;
167 (m_max_nElmtDof > nElmtDof) ? m_max_nElmtDof : nElmtDof;
169 TotLen += totblocks * vecwidth;
170 TotMatLen += nElmtDof * totblocks;
173 m_sBlkDiagMat.resize(TotMatLen);
174 m_inputIdx.resize(TotLen);
179 unsigned int ncoeffs = pFields[0]->GetNcoeffs();
180 for (
int ne = 0, cnt1 = 0; ne < nTotElmt; ne++)
182 const auto nElmtCoeff = pFields[0]->GetNcoeffs(ne);
183 const auto nElmtDof = nElmtCoeff * nvariables;
184 const auto nblocks = nElmtDof / vecwidth;
185 const auto nCoefOffset = pFields[0]->GetCoeff_Offset(ne);
190 for (
int m = 0; m < nvariables; m++)
192 inOffset = m * ncoeffs + nCoefOffset;
194 if (m && (vecwidth - i0 < nElmtCoeff))
200 for (i = 0; i0 < vecwidth; ++i, ++i0)
202 m_inputIdx[cnt1++] = inOffset + i;
212 for (j = 0; (j + 1) * vecwidth < nElmtCoeff - i; ++j)
214 for (i0 = 0; i0 < vecwidth; ++i0)
216 m_inputIdx[cnt1++] = inOffset + i + j * vecwidth + i0;
221 for (i0 = 0, j = j * vecwidth; j < nElmtCoeff - i; ++j, ++i0)
223 m_inputIdx[cnt1++] = inOffset + i + j;
227 const auto endwidth = nElmtDof - nblocks * vecwidth;
232 for (i0 = endwidth; i0 < vecwidth; ++i0)
234 m_inputIdx[cnt1++] = inOffset + i + j - 1;
237 ASSERTL1(cnt1 <= TotLen,
"m_inputIdx over extended");
248 for (
size_t nelm = 0; nelm < nrow.size(); ++nelm)
250 int nrowsVars = nrow[nelm];
251 int ncolsVars = ncol[nelm];
254 nrowsVars, ncolsVars, 0.0);
255 mat->SetBlock(nelm, nelm, loc_matNvar);
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
Array< OneD, SNekBlkMatSharedPtr > m_TraceJacSingle
TensorOfArray4D< NekSingle > m_TraceJacArraySingle
Array< OneD, Array< OneD, SNekBlkMatSharedPtr > > m_PreconMatVarsSingle
static std::string className
Name of the class.
Array< OneD, SNekBlkMatSharedPtr > m_TraceJacDerivSingle
unsigned int m_max_nblocks
Array< OneD, Array< OneD, NekSingle > > m_TraceJacDerivSignSingle
PrecType m_PreconMatStorage
TensorOfArray4D< NekSingle > m_TraceJacDerivArraySingle
static PreconCfsOpSharedPtr create(const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const LibUtilities::SessionReaderSharedPtr &pSession, const LibUtilities::CommSharedPtr &vComm)
Creates an instance of this class.
unsigned int m_max_nElmtDof
TensorOfArray5D< NekSingle > m_TraceIPSymJacArraySingle
std::vector< int > m_inputIdx
void AllocateNekBlkMatDig(SNekBlkMatSharedPtr &mat, const Array< OneD, unsigned int > nrow, const Array< OneD, unsigned int > ncol)
void AllocateSIMDPreconBlkMatDiag(const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields)
This function creates the matrix structure for the block diagonal operator. It organizes the way that...
std::vector< simd< NekSingle >, tinysimd::allocator< simd< NekSingle > > > m_sBlkDiagMat
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
The above copyright notice and this permission notice shall be included.
std::shared_ptr< SNekBlkMat > SNekBlkMatSharedPtr
std::shared_ptr< SNekMat > SNekMatSharedPtr
tinysimd::simd< NekDouble > vec_t
std::shared_ptr< PreconCfsOp > PreconCfsOpSharedPtr
typename abi< ScalarType, width >::type simd
boost::alignment::aligned_allocator< T, T::alignment > allocator