53 std::dynamic_pointer_cast<MultiRegions::ExpListHomogeneous1D>(
56 std::dynamic_pointer_cast<MultiRegions::ExpListHomogeneous2D>(
60 tmp = explistHomo1D->GetPlane(0);
62 else if (explistHomo2D)
64 tmp = explistHomo2D->GetLine(0);
71 return tmp->GetCollections()[block_idx];
79 std::dynamic_pointer_cast<MultiRegions::ExpListHomogeneous1D>(
82 std::dynamic_pointer_cast<MultiRegions::ExpListHomogeneous2D>(
86 return explistHomo1D->GetPlane(0)->GetCollections();
88 else if (explistHomo2D)
90 return explistHomo2D->GetLine(0)->GetCollections();
94 return expansionList->GetCollections();
114template <
typename TPadding, FieldState TState>
117 const std::vector<unsigned int> &interleave_widths)
121 static_assert(std::is_floating_point_v<TPadding>,
122 "GetBlockAttributes: Data type must be float or double.");
127 const std::vector<unsigned int> widths =
128 interleave_widths.empty()
133 ASSERTL0(widths.size() == colls.size(),
134 "GetBlockAttributes: " + std::to_string(widths.size()) +
135 " interleave widths given for " +
136 std::to_string(colls.size()) +
" blocks.");
138 std::vector<BlockAttributes<TState>> blockAttr;
139 for (
size_t blk = 0; blk < colls.size(); ++blk)
141 auto expPtr = colls[blk].GetExpVector()[0];
142 const size_t num_elements = colls[blk].GetExpVector().size();
144 ? expPtr->GetTotPoints()
145 : expPtr->GetNcoeffs();
146 size_t num_elements_with_padding =
147 ((num_elements + vector_width - 1) / vector_width) * vector_width;
149 {num_elements, num_elements_with_padding, ndata, widths[blk]});
158 const std::vector<unsigned int> &interleave_widths);
162 const std::vector<unsigned int> &interleave_widths);
166 const std::vector<unsigned int> &interleave_widths);
170 const std::vector<unsigned int> &interleave_widths);
172template <
typename TPadding, FieldState TState>
175 const unsigned interleave_width,
const bool useGLLTracePoints)
179 static_assert(std::is_floating_point_v<TPadding>,
180 "GetBlockAttributes: Data type must be float or double.");
185 std::vector<BlockAttributes<TState>> blockAttr;
188 for (
auto &coll : colls)
190 auto expPtr = coll.GetExpVector()[0];
191 const size_t num_elements = coll.GetExpVector().size();
192 auto shapetype = expPtr->DetShapeType();
193 unsigned dimension = expPtr->GetNumBases();
194 unsigned ndatatot = 0;
195 for (
unsigned d = 0; d < dimension; ++d)
198 for (
unsigned d1 = 0, cnt = 0; d1 < dimension; ++d1)
205 ->GetTraceBasisKey(dimension - 1 - d, cnt++,
213 size_t num_elements_with_padding =
214 ((num_elements + vector_width - 1) / vector_width) * vector_width;
215 blockAttr.push_back({num_elements, num_elements_with_padding, ndatatot,
224 const unsigned interleave_width,
225 const bool useGLLTracePoints);
228 const unsigned interleave_width,
229 const bool useGLLTracePoints);
244template <
typename TPadding, FieldState TState>
247 const unsigned interleave_width)
251 static_assert(std::is_floating_point_v<TPadding>,
252 "GetScaledBlockAttributes: Data type must be float or "
256 "GetScaledBlockAttributes: only a quadrature grid is "
262 std::vector<BlockAttributes<TState>> blockAttr;
265 for (
auto &coll : colls)
267 auto expPtr = coll.GetExpVector()[0];
268 const size_t num_elements = coll.GetExpVector().size();
270 const unsigned int npts0 = expPtr->GetNumPoints(0);
271 unsigned int ndata = 1;
272 for (
unsigned int d = 0; d < expPtr->GetNumBases(); ++d)
274 const unsigned int npts = expPtr->GetNumPoints(d);
275 ndata *= (d != 0 && npts0 - npts == 1)
276 ?
static_cast<unsigned int>(scale * npts0) - 1
277 :
static_cast<unsigned int>(scale * npts);
280 size_t num_elements_with_padding =
281 ((num_elements + vector_width - 1) / vector_width) * vector_width;
283 {num_elements, num_elements_with_padding, ndata, interleave_width});
292 const unsigned interleave_width);
296 const unsigned interleave_width);
#define ASSERTL0(condition, msg)
Whole-field operator base class and factory machinery shared by every operator family in the MultiReg...
static std::vector< unsigned int > GetDefaultInterleaveWidths(const MultiRegions::ExpListSharedPtr &expansionList)
Return the default interleave widths, one per block of expansionList, that persistent Fields (e....
std::vector< Collection > CollectionVector
constexpr unsigned int ShapeTypeNumTraceInDir[SIZE_ShapeType][3]
Collections::CollectionVector GetCollections(MultiRegions::ExpListSharedPtr expansionList)
std::vector< BlockAttributes< TState > > GetLocTraceBlockAttributes(const MultiRegions::ExpListSharedPtr explist, const unsigned interleave_width, const bool useGLLTracePoints)
std::vector< BlockAttributes< TState > > GetScaledBlockAttributes(const MultiRegions::ExpListSharedPtr explist, const NekDouble scale, const unsigned interleave_width)
As GetBlockAttributes(), but on the scale over-integrated grid.
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
Collections::Collection GetCollection(MultiRegions::ExpListSharedPtr expansionList, unsigned int block_idx)
std::vector< BlockAttributes< TState > > GetBlockAttributes(const MultiRegions::ExpListSharedPtr explist, const std::vector< unsigned int > &interleave_widths)
Get the BlockAttributes for a given field state from an ExpList. This method basically captures ident...