49 #ifndef __INTREPID2_CUBATURE_CONTROLVOLUME_HPP__
50 #define __INTREPID2_CUBATURE_CONTROLVOLUME_HPP__
52 #include "Intrepid2_ConfigDefs.hpp"
55 #include "Shards_CellTopology.hpp"
67 template<
typename ExecSpaceType = void,
68 typename pointValueType = double,
69 typename weightValueType =
double>
71 :
public Cubature<ExecSpaceType,pointValueType,weightValueType> {
74 template<
typename cubPointViewType,
75 typename cubWeightViewType,
76 typename subcvCoordViewType,
77 typename subcvWeightViewType,
78 typename jacDetViewType>
80 cubPointViewType _cubPoints;
81 cubWeightViewType _cubWeights;
82 const subcvCoordViewType _subcvCoords;
83 const subcvWeightViewType _subcvWeights;
84 const jacDetViewType _jacDets;
86 KOKKOS_INLINE_FUNCTION
87 Functor( cubPointViewType cubPoints_,
88 cubWeightViewType cubWeights_,
89 subcvCoordViewType subcvCoords_,
90 subcvWeightViewType subcvWeights_,
91 jacDetViewType jacDets_ )
92 : _cubPoints(cubPoints_), _cubWeights(cubWeights_),
93 _subcvCoords(subcvCoords_), _subcvWeights(subcvWeights_), _jacDets(jacDets_) {}
95 KOKKOS_INLINE_FUNCTION
96 void operator()(
const ordinal_type cell)
const {
97 const ordinal_type numNodesPerCell = _subcvCoords.extent(1);
98 const ordinal_type numNodesPerSubcv = _subcvCoords.extent(2);
99 const ordinal_type spaceDim = _subcvCoords.extent(3);
100 const ordinal_type numSubcvPoints = _subcvWeights.extent(0);
103 for (ordinal_type node=0;node<numNodesPerCell;++node) {
104 typename cubPointViewType::value_type val[3] = {};
105 for (ordinal_type subcv=0;subcv<numNodesPerSubcv;++subcv) {
106 for (ordinal_type i=0;i<spaceDim;++i)
107 val[i] += _subcvCoords(cell, node, subcv, i);
109 for (ordinal_type i=0;i<spaceDim;++i)
110 _cubPoints(cell, node, i) = (val[i]/numNodesPerSubcv);
114 for (ordinal_type node=0;node<numNodesPerCell;++node) {
115 typename cubWeightViewType::value_type val = 0;
116 for (ordinal_type pt=0;pt<numSubcvPoints;++pt)
117 val += _subcvWeights(pt)*_jacDets(cell, node, pt);
118 _cubWeights(cell, node) = val;
138 Kokkos::DynRankView<pointValueType, ExecSpaceType> subcvCubaturePoints_;
139 Kokkos::DynRankView<weightValueType,ExecSpaceType> subcvCubatureWeights_;
142 typedef typename Cubature<ExecSpaceType,pointValueType,weightValueType>::pointViewType pointViewType;
143 typedef typename Cubature<ExecSpaceType,pointValueType,weightValueType>::weightViewType weightViewType;
157 weightViewType cubWeights,
158 pointViewType cellCoords)
const;
181 return "CubatureControlVolume";
Header file for the abstract base class Intrepid2::DefaultCubatureFactory.
Defines the base class for cubature (integration) rules in Intrepid.
Header file for the Intrepid2::CubatureControlVolume class.
ordinal_type degree_
The degree of the polynomials that are integrated exactly.
Header file for the Intrepid2::Cubature class.
Defines cubature (integration) rules over control volumes.
virtual ordinal_type getNumPoints() const
Returns the number of cubature points.
shards::CellTopology primaryCellTopo_
The topology of the primary cell.
virtual void getCubature(pointViewType cubPoints, weightViewType cubWeights, pointViewType cellCoords) const
Returns cubature points and weights (return arrays must be pre-sized/pre-allocated).
virtual const char * getName() const
Returns cubature name.
shards::CellTopology subcvCellTopo_
The topology of the sub-control volume.
CubatureControlVolume(const shards::CellTopology cellTopology)
virtual ordinal_type getDimension() const
Returns dimension of integration domain.