Intrepid2
Intrepid2_ProjectionStruct.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Intrepid2 Package
4//
5// Copyright 2007 NTESS and the Intrepid2 contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
14#ifndef __INTREPID2_PROJECTIONSTRUCT_HPP__
15#define __INTREPID2_PROJECTIONSTRUCT_HPP__
16
17#include "Intrepid2_ConfigDefs.hpp"
18#include "Intrepid2_Types.hpp"
19
21
22#include <array>
23
24namespace Intrepid2 {
25
47ordinal_type
48KOKKOS_INLINE_FUNCTION
49range_size(const Kokkos::pair<ordinal_type, ordinal_type>& range) {
50 return range.second - range.first;
51}
52
53template<typename DeviceType, typename ValueType>
55public:
56
57 enum EvalPointsType {BASIS, TARGET};
58
59 using range_type = Kokkos::pair<ordinal_type,ordinal_type>;
60 using HostExecutionSpaceType = Kokkos::DefaultHostExecutionSpace;
61 using HostMemorySpaceType = Kokkos::HostSpace;
62 using MemSpaceType = typename DeviceType::memory_space;
63 using HostDeviceType = Kokkos::Device<HostExecutionSpaceType,HostMemorySpaceType>;
64 using view_type = Kokkos::DynRankView<ValueType,DeviceType >;
65 using host_view_type = Kokkos::DynRankView<ValueType,HostDeviceType >;
66 using range_tag = Kokkos::View<range_type**,HostDeviceType>;
67 static constexpr int numberSubCellDims = 4; //{0 for vertex, 1 for edges, 2 for faces, 3 for volumes}
68 //max of numVertices, numEdges, numFaces for a reference cell.
69 //12 is the number of edges in a Hexahderon.
70 //We'll need to change this if we consider generic polyhedra
71 static constexpr int maxSubCellsCount = 12;
72 using view_tag = std::array<std::array<host_view_type, maxSubCellsCount>, numberSubCellDims>;
73 using key_tag = Kokkos::View<unsigned**,HostDeviceType >;
74
75
78 ordinal_type getNumBasisEvalPoints() {
79 return numBasisEvalPoints;
80 }
81
85 return numBasisDerivEvalPoints;
86 }
87
90 ordinal_type getNumTargetEvalPoints() {
91 return numTargetEvalPoints;
92 }
93
97 return numTargetDerivEvalPoints;
98 }
99
106 ordinal_type getMaxNumDerivPoints(const EvalPointsType type) const {
107 if(type == BASIS)
108 return maxNumBasisDerivEvalPoints;
109 else
110 return maxNumTargetDerivEvalPoints;
111 }
112
119 ordinal_type getMaxNumEvalPoints(const EvalPointsType type) const {
120 if(type == BASIS)
121 return maxNumBasisEvalPoints;
122 else
123 return maxNumTargetEvalPoints;
124 }
125
138 host_view_type getBasisEvalPoints(const ordinal_type subCellDim, const ordinal_type subCellId) {
139 return basisCubPoints[subCellDim][subCellId];
140 }
141
142
155 host_view_type getBasisDerivEvalPoints(const ordinal_type subCellDim, const ordinal_type subCellId) {
156 return basisDerivCubPoints[subCellDim][subCellId];
157 }
158
159
172 host_view_type getTargetEvalPoints(const ordinal_type subCellDim, const ordinal_type subCellId) {
173 return targetCubPoints[subCellDim][subCellId];
174 }
175
176
189 host_view_type getTargetDerivEvalPoints(const ordinal_type subCellDim, const ordinal_type subCellId) {
190 return targetDerivCubPoints[subCellDim][subCellId];
191 }
192
193
208 host_view_type getEvalPoints(const ordinal_type subCellDim, const ordinal_type subCellId, EvalPointsType type) const{
209 if(type == BASIS)
210 return basisCubPoints[subCellDim][subCellId];
211 else
212 return targetCubPoints[subCellDim][subCellId];
213 }
214
227 view_type getAllEvalPoints(EvalPointsType type = TARGET) const{
228 if(type == BASIS)
229 return allBasisEPoints;
230 else
231 return allTargetEPoints;
232 }
233
248 host_view_type getDerivEvalPoints(const ordinal_type subCellDim, const ordinal_type subCellId, EvalPointsType type) const{
249 if(type == BASIS)
250 return basisDerivCubPoints[subCellDim][subCellId];
251 else
252 return targetDerivCubPoints[subCellDim][subCellId];
253 }
254
267 view_type getAllDerivEvalPoints(EvalPointsType type = TARGET) const{
268 if(type == BASIS)
269 return allBasisDerivEPoints;
270 else
271 return allTargetDerivEPoints;
272 }
273
274
286 host_view_type getBasisEvalWeights(const ordinal_type subCellDim, const ordinal_type subCellId) {
287 return basisCubWeights[subCellDim][subCellId];
288 }
289
290
302 host_view_type getBasisDerivEvalWeights(const ordinal_type subCellDim, const ordinal_type subCellId) {
303 return basisDerivCubWeights[subCellDim][subCellId];
304 }
305
306
318 host_view_type getTargetEvalWeights(const ordinal_type subCellDim, const ordinal_type subCellId) {
319 return targetCubWeights[subCellDim][subCellId];
320 }
321
322
334 host_view_type getTargetDerivEvalWeights(const ordinal_type subCellDim, const ordinal_type subCellId) {
335 return targetDerivCubWeights[subCellDim][subCellId];
336 }
337
338
343 const range_tag getBasisPointsRange() const {
344 return basisPointsRange;
345 }
346
347
353 const range_tag getPointsRange(const EvalPointsType type) const {
354 if(type == BASIS)
355 return basisPointsRange;
356 else
357 return targetPointsRange;
358 }
359
360
365 const range_tag getBasisDerivPointsRange() const {
366 return basisDerivPointsRange;
367 }
368
375 const range_tag getDerivPointsRange(const EvalPointsType type) const {
376 if(type == BASIS)
377 return basisDerivPointsRange;
378 else
379 return targetDerivPointsRange;
380 }
381
382
387 const range_tag getTargetPointsRange() const {
388 return targetPointsRange;
389 }
390
391
396 const range_tag getTargetDerivPointsRange() const {
397 return targetDerivPointsRange;
398 }
399
404 const key_tag getTopologyKey() const {
405 return subCellTopologyKey;
406 }
407
412 template<typename BasisPtrType>
413 void createL2ProjectionStruct(const BasisPtrType cellBasis,
414 const ordinal_type targetCubDegree);
415
416
421 template<typename BasisPtrType>
422 void createL2DGProjectionStruct(const BasisPtrType cellBasis,
423 const ordinal_type targetCubDegree) {
424 createHVolProjectionStruct(cellBasis, targetCubDegree);
425 }
426
427
433 template<typename BasisPtrType>
434 void createHGradProjectionStruct(const BasisPtrType cellBasis,
435 const ordinal_type targetCubDegree,
436 const ordinal_type targetGradCubDegre);
437
438
444 template<typename BasisPtrType>
445 void createHCurlProjectionStruct(const BasisPtrType cellBasis,
446 const ordinal_type targetCubDegree,
447 const ordinal_type targetCurlCubDegre);
448
449
455 template<typename BasisPtrType>
456 void createHDivProjectionStruct(const BasisPtrType cellBasis,
457 const ordinal_type targetCubDegree,
458 const ordinal_type targetDivCubDegre);
459
464 template<typename BasisPtrType>
465 void createHVolProjectionStruct(const BasisPtrType cellBasis,
466 const ordinal_type targetCubDegree);
467
468 key_tag subCellTopologyKey;
469 range_tag basisPointsRange;
470 range_tag basisDerivPointsRange;
471 range_tag targetPointsRange;
472 range_tag targetDerivPointsRange;
473 view_tag basisCubPoints;
474 view_tag basisCubWeights;
475 view_tag basisDerivCubPoints;
476 view_tag basisDerivCubWeights;
477 view_tag targetCubPoints;
478 view_tag targetCubWeights;
479 view_tag targetDerivCubPoints;
480 view_tag targetDerivCubWeights;
481 view_type allBasisEPoints;
482 view_type allBasisDerivEPoints;
483 view_type allTargetEPoints;
484 view_type allTargetDerivEPoints;
485 ordinal_type numBasisEvalPoints;
486 ordinal_type numBasisDerivEvalPoints;
487 ordinal_type numTargetEvalPoints;
488 ordinal_type numTargetDerivEvalPoints;
489 ordinal_type maxNumBasisEvalPoints;
490 ordinal_type maxNumTargetEvalPoints;
491 ordinal_type maxNumBasisDerivEvalPoints;
492 ordinal_type maxNumTargetDerivEvalPoints;
493};
494
495} // Intrepid2 namespace
497#endif
498
499
500
501
502
Stateless class that acts as a factory for a family of nodal bases (hypercube topologies only at this...
Header file for the Intrepid2::ProjectionStruct containing definitions.
Contains definitions of custom data types in Intrepid2.
An helper class to compute the evaluation points and weights needed for performing projections.
void createL2DGProjectionStruct(const BasisPtrType cellBasis, const ordinal_type targetCubDegree)
Initialize the ProjectionStruct for (discontinuous local-L2) projection.
void createHVolProjectionStruct(const BasisPtrType cellBasis, const ordinal_type targetCubDegree)
Initialize the ProjectionStruct for HVOL (local-L2) projection.
const range_tag getTargetDerivPointsRange() const
Returns the range tag of the target function derivative evaluation points on subcells.
ordinal_type getNumBasisDerivEvalPoints()
Returns number of evaluation points for basis derivatives.
host_view_type getTargetEvalPoints(const ordinal_type subCellDim, const ordinal_type subCellId)
Returns the points where to evaluate the target function on a subcell.
const key_tag getTopologyKey() const
Returns the key tag for subcells.
host_view_type getBasisEvalPoints(const ordinal_type subCellDim, const ordinal_type subCellId)
Returns the basis evaluation points on a subcell.
ordinal_type getNumTargetDerivEvalPoints()
Returns number of points where to evaluate the derivatives of the target function.
host_view_type getTargetDerivEvalWeights(const ordinal_type subCellDim, const ordinal_type subCellId)
Returns the function derivatives evaluation weights on a subcell.
const range_tag getBasisPointsRange() const
Returns the range tag of the basis evaluation points subcells.
host_view_type getBasisDerivEvalWeights(const ordinal_type subCellDim, const ordinal_type subCellId)
Returns the basis derivatives evaluation weights on a subcell.
host_view_type getTargetDerivEvalPoints(const ordinal_type subCellDim, const ordinal_type subCellId)
Returns the points where to evaluate the derivatives of the target function on a subcell.
void createHCurlProjectionStruct(const BasisPtrType cellBasis, const ordinal_type targetCubDegree, const ordinal_type targetCurlCubDegre)
Initialize the ProjectionStruct for HCURL projections.
void createHGradProjectionStruct(const BasisPtrType cellBasis, const ordinal_type targetCubDegree, const ordinal_type targetGradCubDegre)
Initialize the ProjectionStruct for HGRAD projections.
host_view_type getBasisDerivEvalPoints(const ordinal_type subCellDim, const ordinal_type subCellId)
Returns the evaluation points for basis derivatives on a subcell.
ordinal_type getMaxNumEvalPoints(const EvalPointsType type) const
Returns the maximum number of evaluation points across all the subcells.
host_view_type getEvalPoints(const ordinal_type subCellDim, const ordinal_type subCellId, EvalPointsType type) const
Returns the basis/target evaluation points on a subcell.
ordinal_type getNumBasisEvalPoints()
Returns number of basis evaluation points.
host_view_type getTargetEvalWeights(const ordinal_type subCellDim, const ordinal_type subCellId)
Returns the function evaluation weights on a subcell.
host_view_type getBasisEvalWeights(const ordinal_type subCellDim, const ordinal_type subCellId)
Returns the basis evaluation weights on a subcell.
const range_tag getDerivPointsRange(const EvalPointsType type) const
Returns the range tag of the basis/target derivative evaluation points on subcells.
void createHDivProjectionStruct(const BasisPtrType cellBasis, const ordinal_type targetCubDegree, const ordinal_type targetDivCubDegre)
Initialize the ProjectionStruct for HDIV projections.
const range_tag getBasisDerivPointsRange() const
Returns the range tag of the derivative evaluation points on subcell.
const range_tag getTargetPointsRange() const
Returns the range of the target function evaluation points on subcells.
void createL2ProjectionStruct(const BasisPtrType cellBasis, const ordinal_type targetCubDegree)
Initialize the ProjectionStruct for L2 projections.
ordinal_type getMaxNumDerivPoints(const EvalPointsType type) const
Returns the maximum number of derivative evaluation points across all the subcells.
view_type getAllDerivEvalPoints(EvalPointsType type=TARGET) const
Returns all the evaluation points for basis/target derivatives in the cell.
ordinal_type getNumTargetEvalPoints()
Returns number of points where to evaluate the target function.
view_type getAllEvalPoints(EvalPointsType type=TARGET) const
Returns the basis/target evaluation points in the cell.
host_view_type getDerivEvalPoints(const ordinal_type subCellDim, const ordinal_type subCellId, EvalPointsType type) const
Returns the evaluation points for basis/target derivatives on a subcell.
const range_tag getPointsRange(const EvalPointsType type) const
Returns the range tag of the basis/target evaluation points in subcells.