43 namespace Collections {
45 CoalescedGeomData::CoalescedGeomData(
void)
49 CoalescedGeomData::~CoalescedGeomData(
void)
54 vector<StdRegions::StdExpansionSharedPtr> &pCollExp)
57 if(m_oneDGeomData.count(
eJac) == 0)
61 int nElmts = pCollExp.size();
65 for (
int i = 0; i < ptsKeys.size(); ++i)
67 npts *= ptsKeys[i].GetNumPoints();
70 if(IsDeformed(pCollExp))
76 for(
int i = 0; i < nElmts; ++i)
90 m_oneDGeomData[
eJac] = newjac;
96 for(
int i = 0; i < nElmts; ++i)
108 m_oneDGeomData[
eJac] = newjac;
112 return m_oneDGeomData[
eJac];
115 const std::shared_ptr<VecVec_t> CoalescedGeomData::GetJacInterLeave(
116 vector<StdRegions::StdExpansionSharedPtr> &pCollExp,
120 if(m_oneDGeomDataInterLeave.count(
eJac) == 0)
123 int jacsize = jac.size();
126 "Number of elements not divisible by vector "
127 "width, padding not yet implemented.");
128 int nBlocks = nElmt / vec_t::width;
136 for (
int i = 0; i < ptsKeys.size(); ++i)
138 nq *= ptsKeys[i].GetNumPoints();
141 if(IsDeformed(pCollExp))
144 newjac.resize(nBlocks*nq);
146 alignas(vec_t::alignment)
NekDouble tmp[vec_t::width];
148 for (
size_t block = 0; block < nBlocks; ++block)
150 size_t nblock_width = block*nq*vec_t::width;
151 for(
size_t q = 0; q < nq; q++)
153 for (
int j = 0; j < vec_t::width; ++j)
155 if(nblock_width+ nq*j + q < jacsize)
157 tmp[j] = jac[nblock_width + nq*j + q];
166 newjac[block*nq + q].load(&tmp[0]);
172 newjac.resize(nBlocks);
174 alignas(vec_t::alignment)
NekDouble tmp[vec_t::width];
175 for (
size_t i = 0; i < nBlocks; ++i)
177 for (
int j = 0; j < vec_t::width; ++j)
179 if(vec_t::width*i+j < jacsize)
181 tmp[j] = jac[vec_t::width*i+j];
189 newjac[i].load(&tmp[0]);
193 m_oneDGeomDataInterLeave[
eJac] =
197 return m_oneDGeomDataInterLeave[
eJac];
204 vector<StdRegions::StdExpansionSharedPtr> &pCollExp)
209 int nElmts = pCollExp.size();
213 for (
int i = 0; i < ptsKeys.size(); ++i)
215 npts *= ptsKeys[i].GetNumPoints();
223 for(
int i = 0; i < nElmts; ++i)
239 pCollExp[0]->MultiplyByStdQuadratureMetric(newjac + cnt,
252 vector<StdRegions::StdExpansionSharedPtr> &pCollExp)
258 int nElmts = pCollExp.size();
259 const int coordim = pCollExp[0]->GetCoordim();
260 int dim = ptsKeys.size();
264 for (
int i = 0; i < dim; ++i)
266 npts *= ptsKeys[i].GetNumPoints();
272 if(IsDeformed(pCollExp))
283 for(
int i = 0; i < nElmts; ++i)
292 if(IsDeformed(pCollExp))
294 for (
int j = 0; j < dim*coordim; ++j)
296 Vmath::Vcopy(npts, &Dfac[j][0], 1, &newDFac[j][cnt], 1);
301 for (
int j = 0; j < dim*coordim; ++j)
303 newDFac[j][i] = Dfac[j][0];
315 const std::shared_ptr<VecVec_t> CoalescedGeomData::GetDerivFactorsInterLeave(
316 vector<StdRegions::StdExpansionSharedPtr> &pCollExp,
322 "Number of elements not divisible by vector "
323 "width, padding not yet implemented.");
325 int nBlocks = nElmt / vec_t::width;
328 const int coordim = pCollExp[0]->GetCoordim();
329 int dim = ptsKeys.size();
332 unsigned int n_df = coordim*dim;
333 alignas(vec_t::alignment)
NekDouble vec[vec_t::width];
336 int dfsize = df.GetColumns();
341 for (
int i = 0; i < dim; ++i)
343 nq *= ptsKeys[i].GetNumPoints();
346 if(IsDeformed(pCollExp))
348 newdf.resize(nBlocks * n_df *nq);
349 auto *df_ptr = &newdf[0];
350 for (
int e = 0; e < nBlocks; ++e)
352 for (
int q = 0; q < nq; q++)
354 for (
int dir = 0; dir < n_df; ++dir, ++df_ptr)
356 for (
int j = 0; j < vec_t::width; ++j)
359 if((vec_t::width*e + j)*nq + q < dfsize)
361 vec[j] = df[dir][(vec_t::width*e + j)*nq + q];
368 (*df_ptr).load(&vec[0]);
375 newdf.resize(nBlocks * n_df);
376 for (
int e = 0; e < nBlocks; ++e)
378 for (
int dir = 0; dir < n_df; ++dir)
380 for (
int j = 0; j < vec_t::width; ++j)
383 if(vec_t::width*e + j < dfsize)
385 vec[j] = df[dir][vec_t::width*e + j];
393 newdf[e*n_df + dir].load(&vec[0]);
406 bool CoalescedGeomData::IsDeformed(
407 vector<StdRegions::StdExpansionSharedPtr> &pCollExp)
409 if (!m_isDeformedSet)
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
const SpatialDomains::GeomFactorsSharedPtr & GetMetricInfo() const
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
The base class for all shapes.
std::vector< vec_t, tinysimd::allocator< vec_t > > VecVec_t
std::vector< PointsKey > PointsKeyVector
@ eDeformed
Geometry is curved or has non-constant factors.
The above copyright notice and this permission notice shall be included.
void Fill(int n, const T alpha, T *x, const int incx)
Fill a vector with a constant value.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)