WARPXM v1.10.0
Loading...
Searching...
No Matches
wmbasisarrayset.h
Go to the documentation of this file.
1#ifndef WMBASISARRAYSET_H
2#define WMBASISARRAYSET_H
3
4// Wm includes
5#include "lib/wxexcept.h"
6#include "warpxm/warpxm_config.h"
7
8// std includes
9#include <vector>
10#include <string>
11
13{
14public:
16
17 void loadBasis(const int primitiveID,
18 const std::string& basisArraySetName,
19 const std::string& vspace_basisName,
20 const size_t vspace_ndims);
21 void loadFile(const std::string& filename);
22
24 {
26 }
27 int getNumFaceNodes() const
28 {
29 return _numFaceNodes;
30 }
32 {
33 return _numTotalFaceNodes;
34 }
40 {
42 }
43 int getNumDims() const
44 {
45 return _numDims;
46 }
47 int getNumTotalNodes() const
48 {
49 return _numTotalNodes;
50 }
52 {
53 return _numGaussQuadNodes;
54 }
56 {
57 return _numInternalNodes;
58 }
59 int getSpatialOrder() const
60 {
61 return _spatialOrder;
62 }
63
65 {
66 return _cfl;
67 }
68
70 {
72 }
74 {
76 }
78 {
80 }
81
83 {
85 }
86
88 {
90 }
92 {
94 }
96 {
98 }
99
101 {
103 }
104
106 {
108 }
109
111 {
113 }
114
116 {
118 }
119
121 {
122 return _numSubElements;
123 }
125 {
127 }
128 const int* getSubElementConnectivity() const
129 {
130 return &(_subElementConnectivity[0]);
131 }
132
137 const std::vector<int>& getFaceNodesDeduplicated() const
138 {
140 }
141
142 const std::vector<real>& getNodePositions() const
143 {
144 return _nodePositions;
145 }
146
147 const std::vector<real>& getNodePositionsGaussQuad() const
148 {
150 }
151
152 const std::vector<real>& getNodePositions_PositivityPreservingQuad() const
153 {
154 if (getNumDims() == 1)
155 {
156 return _nodePositions;
157 }
158 else
159 {
160 WxExcept wxe("WmBasisArraySet.h : ");
161 wxe << "Positivity-preserving quadrature node positions only defined for "
162 "1-dimensional elements"
163 << std::endl;
164 throw wxe;
165 }
166 }
167
169 {
170 if (getNumDims() == 1)
171 {
172 return _numTotalNodes;
173 }
174 else if (getNumDims() == 2)
175 {
178 }
179 else
180 {
181 WxExcept wxe("WmBasisArraySet.h : ");
182 wxe << "Positivity-preserving quadrature node positions only defined for "
183 "1 and 2-dimensional elements"
184 << std::endl;
185 throw wxe;
186 }
187 }
188
190 {
191 if (getNumDims() == 1)
192 {
193 return 0;
194 }
195 else if (getNumDims() == 2)
196 {
198 }
199 else
200 {
201 WxExcept wxe("WmBasisArraySet.h : ");
202 wxe << "Positivity-preserving quadrature node positions only defined for "
203 "1 and 2-dimensional elements"
204 << std::endl;
205 throw wxe;
206 }
207 }
208
210 {
212 }
213
215 {
216 return &(_basisArray_NumericalFlux[0]);
217 }
219 {
221 }
223 {
224 return &(_basisArray_InternalFlux[0]);
225 }
227 {
228 return &(_basisArray_GaussQuad[0]);
229 }
230
231 const std::vector<real>& getBasisArray_PositivityPreservingQuadWeights() const
232 {
233 if (getNumDims() == 1)
234 {
236 }
237 else
238 {
239 WxExcept wxe("WmBasisArraySet.h : ");
240 wxe << "Positivity-preserving quadrature weights only defined for "
241 "1-dimensional elements"
242 << std::endl;
243 throw wxe;
244 }
245 }
246
247 const std::vector<real>&
249 {
251 }
252
254 {
256 }
257
258 const std::vector<real>& getBasisArray_LinearAverage() const
259 {
261 }
263 {
264 return &(_basisArray_LinearCenter[0]);
265 }
267 {
269 }
270
271 const int* getOrientations(const int index) const
272 {
273 return &(_orientations[index][0]);
274 }
275 const int* getFaceNodes(const int face_index) const
276 {
277 return &(_faceNodes[face_index][0]);
278 }
279
285 {
286 return _vol_multiplier;
287 }
288
289 // stuff for element with different types of faces
290 int getNumFaceTypes() const
291 {
292 return _num_face_types;
293 }
294
295 int getNumFaceNodes(int face_index) const
296 {
297 return _num_face_nodes_per_face[face_index];
298 }
299
301 {
302 return _numOrientations;
303 }
304
305 int getNumFaceNodesForFaceType(int face_type) const
306 {
307 return _num_face_nodes_per_face_type[face_type];
308 }
309
310 const std::vector<int>& getNumFaceNodesVector() const
311 {
313 }
314
315 // CSR Array Getters
316 bool has_csr() const
317 {
318 return _has_csr;
319 }
320
321 // Internal Flux Matrix
322 const std::vector<real>& getBasisArrayInternalFluxCSRVal(const int dim) const
323 {
324 return _ups2csr_val[dim];
325 }
326
327 const std::vector<int>& getBasisArrayInternalFluxCSRCol(const int dim) const
328 {
329 return _ups2csr_col[dim];
330 }
331
332 const std::vector<int>& getBasisArrayInternalFluxCSRRowPtr(const int dim) const
333 {
334 return _ups2csr_rowptr[dim];
335 }
336
337 // Derivative Matrix
338 const std::vector<real>& getBasisArrayDerivativeMatrixCSRVal(const int dim) const
339 {
340 return _Drcsr_val[dim];
341 }
342
343 const std::vector<int>& getBasisArrayDerivativeMatrixCSRCol(const int dim) const
344 {
345 return _Drcsr_col[dim];
346 }
347
348 const std::vector<int>& getBasisArrayDerivativeCSRRowPtr(const int dim) const
349 {
350 return _Drcsr_rowptr[dim];
351 }
352
353 // Numerical Flux Matrix
354 const std::vector<real>& getBasisArrayNumericalFluxCSRVal(const int face) const
355 {
356 return _ups1csr_val[face];
357 }
358
359 const std::vector<int>& getBasisArrayNumericalFluxCSRCol(const int face) const
360 {
361 return _ups1csr_col[face];
362 }
363
364 const std::vector<int>& getBasisArrayNumericalFluxCSRRowPtr(const int face) const
365 {
366 return _ups1csr_rowptr[face];
367 }
368
369protected:
370 void clear();
371
373
374 // Convention here is that unstructured (simplex) parts have original names
375 // and the structured parts (squares, for velocity space) have "Squares" after name
385 int _numDims; // Actual dimensionality of elements
386 int _numDimsUnstruct; // Number of unstructured dimensions (only specified in mixed
387 // case)
391
393
394 // Sub element deconstruction of basis
397 std::vector<int> _subElementConnectivity;
398
406
408
409 // Used of faces can be different i.e. phase space element where not all the faces are
410 // the same
412 // sets the number of faces for each face type
413 std::vector<int> _num_faces_per_face_type;
415 std::vector<int> _num_face_nodes_per_face;
416 std::vector<int> _faceNodesDeduplicated;
417
418 std::vector<real> _nodePositionsGaussQuad;
419 std::vector<real> _basisArray_GaussQuad;
421
422 std::vector<real> _nodePositions;
423 std::vector<real> _basisArray_NumericalFlux;
424 std::vector<real> _basisArray_NumericalFlux_altFace; // Alternate num. flux for
425 // structured velocity space
426 std::vector<real> _basisArray_InternalFlux;
427 std::vector<real> _basisArray_LinearAverage;
428 std::vector<real> _basisArray_LinearCenter;
431
433
434 std::vector<std::vector<int>> _orientations;
435 std::vector<std::vector<int>> _faceNodes;
436
437 // csr data
439 // ups2
440 std::vector<int> _ups2csr_val_lengths;
441 std::vector<std::vector<real>> _ups2csr_val;
442 std::vector<std::vector<int>> _ups2csr_col;
443 std::vector<std::vector<int>> _ups2csr_rowptr;
444 // Dr
445 std::vector<int> _Drcsr_val_lengths;
446 std::vector<std::vector<real>> _Drcsr_val;
447 std::vector<std::vector<int>> _Drcsr_col;
448 std::vector<std::vector<int>> _Drcsr_rowptr;
449 // ups1
450 std::vector<int> _ups1csr_val_lengths;
451 std::vector<std::vector<real>> _ups1csr_val;
452 std::vector<std::vector<int>> _ups1csr_col;
453 std::vector<std::vector<int>> _ups1csr_rowptr;
454
455private:
456};
457
458#endif // WMBASISARRAYSET_H
Definition: wmbasisarrayset.h:13
size_t getBasisArrayBlockSize_InternalFlux() const
Definition: wmbasisarrayset.h:77
int getNumDims() const
Definition: wmbasisarrayset.h:43
std::vector< std::vector< int > > _Drcsr_col
Definition: wmbasisarrayset.h:447
const std::vector< real > & getBasisArray_LinearAverage() const
Definition: wmbasisarrayset.h:258
size_t getNumPositivityPreservingQuadNodes()
Definition: wmbasisarrayset.h:168
int getNumFaceNodes(int face_index) const
Definition: wmbasisarrayset.h:295
const real * getBasisArray_NumericalFlux() const
Definition: wmbasisarrayset.h:214
size_t getBasisArraySize_InternalFlux() const
Definition: wmbasisarrayset.h:95
int _numInteriorPositivityPreservingQuadNodes
Definition: wmbasisarrayset.h:390
std::vector< int > _subElementConnectivity
Definition: wmbasisarrayset.h:397
int _basisArray_NumericalFlux_Size
Definition: wmbasisarrayset.h:399
std::vector< std::vector< int > > _ups1csr_rowptr
Definition: wmbasisarrayset.h:453
std::vector< real > _basisArray_NumericalFlux_altFace
Definition: wmbasisarrayset.h:424
std::vector< int > _num_face_nodes_per_face
Definition: wmbasisarrayset.h:415
int getNumOrientations() const
Definition: wmbasisarrayset.h:300
std::vector< std::vector< int > > _faceNodes
Definition: wmbasisarrayset.h:435
int _numTotalFaceNodesDeduplicated
Definition: wmbasisarrayset.h:381
int _numDims
Definition: wmbasisarrayset.h:385
std::vector< real > _nodePositions
Definition: wmbasisarrayset.h:422
const std::vector< real > & getBasisArray_evaluateAtInteriorPositivityPreservingQuadNodes() const
Definition: wmbasisarrayset.h:248
std::vector< std::vector< int > > _Drcsr_rowptr
Definition: wmbasisarrayset.h:448
const std::vector< int > & getBasisArrayDerivativeMatrixCSRCol(const int dim) const
Definition: wmbasisarrayset.h:343
int _numFacesPerElement
Definition: wmbasisarrayset.h:376
std::vector< std::vector< real > > _ups2csr_val
Definition: wmbasisarrayset.h:441
int getNumFaceTypes() const
Definition: wmbasisarrayset.h:290
std::vector< std::vector< real > > _Drcsr_val
Definition: wmbasisarrayset.h:446
std::vector< real > _basisArray_InternalFlux
Definition: wmbasisarrayset.h:426
std::vector< std::vector< int > > _ups2csr_col
Definition: wmbasisarrayset.h:442
const real * getBasisArray_GaussQuad() const
Definition: wmbasisarrayset.h:226
size_t getNumInteriorPositivityPreservingQuadNodes() const
Definition: wmbasisarrayset.h:189
std::vector< real > _basisArray_evaluateAtInteriorPositivityPreservingQuadNodes
Definition: wmbasisarrayset.h:432
int _numFacesPerElementSquares
Definition: wmbasisarrayset.h:377
int _numTotalNodes
Definition: wmbasisarrayset.h:383
int _numInternalNodes
Definition: wmbasisarrayset.h:382
int getNumSubElements() const
Definition: wmbasisarrayset.h:120
int _basisArray_LinearCenter_Size
Definition: wmbasisarrayset.h:403
bool _has_csr
Definition: wmbasisarrayset.h:438
int _num_face_types
Definition: wmbasisarrayset.h:411
std::vector< std::vector< int > > _ups2csr_rowptr
Definition: wmbasisarrayset.h:443
const int * getFaceNodes(const int face_index) const
Definition: wmbasisarrayset.h:275
const int * getSubElementConnectivity() const
Definition: wmbasisarrayset.h:128
int _basisArray_Derivative_Approximation_Size
Definition: wmbasisarrayset.h:405
size_t getBasisArraySize_NumericalFlux() const
Definition: wmbasisarrayset.h:87
const real * getBasisArray_MonomialConversion() const
Definition: wmbasisarrayset.h:266
int _numFaceNodes
Definition: wmbasisarrayset.h:378
size_t getBasisArraySize_NumericalFlux_altFace() const
Definition: wmbasisarrayset.h:91
int getNumFaceNodesForFaceType(int face_type) const
Definition: wmbasisarrayset.h:305
std::vector< real > _basisArray_GaussQuad
Definition: wmbasisarrayset.h:419
const std::vector< real > & getNodePositions() const
Definition: wmbasisarrayset.h:142
int _two_num_flux_arrays_flag
Definition: wmbasisarrayset.h:372
real getInverseElementVolume() const
1/element volume, in the local coordinate system useful for turning volume averages into volume integ...
Definition: wmbasisarrayset.h:284
int getNumTotalNodes() const
Definition: wmbasisarrayset.h:47
real getCFLLimit() const
Definition: wmbasisarrayset.h:64
int _numFaceNodesSquares
Definition: wmbasisarrayset.h:379
std::vector< int > _faceNodesDeduplicated
Definition: wmbasisarrayset.h:416
int getNumInternalNodes() const
Definition: wmbasisarrayset.h:55
int getNumFacesPerElement() const
Definition: wmbasisarrayset.h:23
int _numTotalFaceNodes
Definition: wmbasisarrayset.h:380
std::vector< std::vector< int > > _orientations
Definition: wmbasisarrayset.h:434
size_t getBasisArraySize_LinearAverage() const
Definition: wmbasisarrayset.h:105
const real * getBasisArray_LinearCenter() const
Definition: wmbasisarrayset.h:262
std::vector< std::vector< real > > _ups1csr_val
Definition: wmbasisarrayset.h:451
const std::vector< real > & getBasisArrayDerivativeMatrixCSRVal(const int dim) const
Definition: wmbasisarrayset.h:338
const real * getBasisArray_DerivativeApproximation() const
Definition: wmbasisarrayset.h:253
int _numGaussQuadNodes
Definition: wmbasisarrayset.h:384
const std::vector< real > & getBasisArrayNumericalFluxCSRVal(const int face) const
Definition: wmbasisarrayset.h:354
int _spatialOrder
Definition: wmbasisarrayset.h:389
const std::vector< int > & getNumFaceNodesVector() const
Definition: wmbasisarrayset.h:310
const real * getBasisArray_InternalFlux() const
Definition: wmbasisarrayset.h:222
int _basisArray_NumericalFlux_altFace_Size
Definition: wmbasisarrayset.h:400
const std::vector< int > & getBasisArrayInternalFluxCSRRowPtr(const int dim) const
Definition: wmbasisarrayset.h:332
std::vector< real > _basisArray_NumericalFlux
Definition: wmbasisarrayset.h:423
size_t getBasisArraySize_DerivativeApproximation() const
Definition: wmbasisarrayset.h:100
size_t getBasisArrayBlockSize_NumericalFlux() const
Definition: wmbasisarrayset.h:73
const std::vector< real > & getNodePositions_PositivityPreservingQuad() const
Definition: wmbasisarrayset.h:152
int getNumTotalFaceNodesDeduplicated() const
Get the total number of face nodes on the element, not double-counting nodes that live on more than o...
Definition: wmbasisarrayset.h:39
std::vector< int > _num_faces_per_face_type
Definition: wmbasisarrayset.h:413
int _numOrientations
Definition: wmbasisarrayset.h:388
bool has_csr() const
Definition: wmbasisarrayset.h:316
int _numNodesPerSubElement
Definition: wmbasisarrayset.h:396
int _numDimsUnstruct
Definition: wmbasisarrayset.h:386
int _basisArray_InternalFlux_Size
Definition: wmbasisarrayset.h:401
size_t getBasisArraySize_MonomialConversion() const
Definition: wmbasisarrayset.h:115
const std::vector< real > & getNodePositionsGaussQuad() const
Definition: wmbasisarrayset.h:147
std::vector< real > _basisArray_LagrangeOnGQnodes
Definition: wmbasisarrayset.h:420
size_t getBasisArraySize_LinearCenter() const
Definition: wmbasisarrayset.h:110
int _numSubElements
Definition: wmbasisarrayset.h:395
const real * getBasisArray_LagrangeOnGQnodes() const
Definition: wmbasisarrayset.h:209
int getSpatialOrder() const
Definition: wmbasisarrayset.h:59
const std::vector< int > & getBasisArrayDerivativeCSRRowPtr(const int dim) const
Definition: wmbasisarrayset.h:348
std::vector< real > _basisArray_MonomialConversion
Definition: wmbasisarrayset.h:429
int getNumTotalFaceNodes() const
Definition: wmbasisarrayset.h:31
size_t getBasisArrayBlockSize_DerivativeApproximation() const
Definition: wmbasisarrayset.h:82
int getNumNodesPerSubElement() const
Definition: wmbasisarrayset.h:124
real _cfl
Definition: wmbasisarrayset.h:407
std::vector< int > _ups2csr_val_lengths
Definition: wmbasisarrayset.h:440
const std::vector< real > & getBasisArrayInternalFluxCSRVal(const int dim) const
Definition: wmbasisarrayset.h:322
int getNumFaceNodes() const
Definition: wmbasisarrayset.h:27
int _basisArray_LinearAverage_Size
Definition: wmbasisarrayset.h:402
void loadBasis(const int primitiveID, const std::string &basisArraySetName, const std::string &vspace_basisName, const size_t vspace_ndims)
std::vector< int > _ups1csr_val_lengths
Definition: wmbasisarrayset.h:450
std::vector< std::vector< int > > _ups1csr_col
Definition: wmbasisarrayset.h:452
std::vector< real > _basisArray_LinearCenter
Definition: wmbasisarrayset.h:428
std::vector< int > _num_face_nodes_per_face_type
Definition: wmbasisarrayset.h:414
const std::vector< int > & getBasisArrayInternalFluxCSRCol(const int dim) const
Definition: wmbasisarrayset.h:327
const int * getOrientations(const int index) const
Definition: wmbasisarrayset.h:271
std::vector< int > _Drcsr_val_lengths
Definition: wmbasisarrayset.h:445
size_t getBasisArrayBlockSize_Source() const
Definition: wmbasisarrayset.h:69
std::vector< real > _nodePositionsGaussQuad
Definition: wmbasisarrayset.h:418
void loadFile(const std::string &filename)
real _vol_multiplier
Definition: wmbasisarrayset.h:392
const std::vector< int > & getFaceNodesDeduplicated() const
Return the list of all face node indices, with duplicates (e.g.
Definition: wmbasisarrayset.h:137
std::vector< real > _basisArray_LinearAverage
Definition: wmbasisarrayset.h:427
const std::vector< int > & getBasisArrayNumericalFluxCSRCol(const int face) const
Definition: wmbasisarrayset.h:359
const std::vector< int > & getBasisArrayNumericalFluxCSRRowPtr(const int face) const
Definition: wmbasisarrayset.h:364
std::vector< real > _basisArray_Derivative_Approximation
Definition: wmbasisarrayset.h:430
const std::vector< real > & getBasisArray_PositivityPreservingQuadWeights() const
Definition: wmbasisarrayset.h:231
const real * getBasisArray_NumericalFlux_altFace() const
Definition: wmbasisarrayset.h:218
int getNumGaussQuadNodes() const
Definition: wmbasisarrayset.h:51
int _basisArray_MonomialConversion_Size
Definition: wmbasisarrayset.h:404
wxm::lib::Except is the class to use for creating and throwing exceptions.
Definition: wxexcept.h:31
#define real
Definition: wmoclunstructuredreconstruction.h:11