16 #ifndef __INTREPID2_CUBATURE_CONTROLVOLUME_HPP__
17 #define __INTREPID2_CUBATURE_CONTROLVOLUME_HPP__
19 #include "Intrepid2_ConfigDefs.hpp"
22 #include "Shards_CellTopology.hpp"
34 template<
typename DeviceType = void,
35 typename pointValueType = double,
36 typename weightValueType =
double>
38 :
public Cubature<DeviceType,pointValueType,weightValueType> {
41 template<
typename cubPointViewType,
42 typename cubWeightViewType,
43 typename subcvCoordViewType,
44 typename subcvWeightViewType,
45 typename jacDetViewType>
47 cubPointViewType _cubPoints;
48 cubWeightViewType _cubWeights;
49 const subcvCoordViewType _subcvCoords;
50 const subcvWeightViewType _subcvWeights;
51 const jacDetViewType _jacDets;
53 KOKKOS_INLINE_FUNCTION
54 Functor( cubPointViewType cubPoints_,
55 cubWeightViewType cubWeights_,
56 subcvCoordViewType subcvCoords_,
57 subcvWeightViewType subcvWeights_,
58 jacDetViewType jacDets_ )
59 : _cubPoints(cubPoints_), _cubWeights(cubWeights_),
60 _subcvCoords(subcvCoords_), _subcvWeights(subcvWeights_), _jacDets(jacDets_) {}
62 KOKKOS_INLINE_FUNCTION
63 void operator()(
const ordinal_type cell)
const {
64 const ordinal_type numNodesPerCell = _subcvCoords.extent(1);
65 const ordinal_type numNodesPerSubcv = _subcvCoords.extent(2);
66 const ordinal_type spaceDim = _subcvCoords.extent(3);
67 const ordinal_type numSubcvPoints = _subcvWeights.extent(0);
70 for (ordinal_type node=0;node<numNodesPerCell;++node) {
71 typename cubPointViewType::value_type val[3] = {};
72 for (ordinal_type subcv=0;subcv<numNodesPerSubcv;++subcv) {
73 for (ordinal_type i=0;i<spaceDim;++i)
74 val[i] += _subcvCoords(cell, node, subcv, i);
76 for (ordinal_type i=0;i<spaceDim;++i)
77 _cubPoints(cell, node, i) = (val[i]/numNodesPerSubcv);
81 for (ordinal_type node=0;node<numNodesPerCell;++node) {
82 typename cubWeightViewType::value_type val = 0;
83 for (ordinal_type pt=0;pt<numSubcvPoints;++pt)
84 val += _subcvWeights(pt)*_jacDets(cell, node, pt);
85 _cubWeights(cell, node) = val;
105 Kokkos::DynRankView<pointValueType, DeviceType> subcvCubaturePoints_;
106 Kokkos::DynRankView<weightValueType,DeviceType> subcvCubatureWeights_;
109 typedef typename Cubature<DeviceType,pointValueType,weightValueType>::PointViewType PointViewType;
110 typedef typename Cubature<DeviceType,pointValueType,weightValueType>::weightViewType weightViewType;
124 weightViewType cubWeights,
125 PointViewType cellCoords)
const override;
148 return "CubatureControlVolume";
Header file for the abstract base class Intrepid2::DefaultCubatureFactory.
Defines the base class for cubature (integration) rules in Intrepid.
virtual const char * getName() const override
Returns cubature name.
Header file for the Intrepid2::CubatureControlVolume class.
virtual void getCubature(PointViewType cubPoints, weightViewType cubWeights, PointViewType cellCoords) const override
Returns cubature points and weights (return arrays must be pre-sized/pre-allocated).
virtual ordinal_type getDimension() const override
Returns dimension of integration domain.
Header file for the Intrepid2::Cubature class.
ordinal_type degree_
The degree of the polynomials that are integrated exactly.
shards::CellTopology primaryCellTopo_
The topology of the primary cell.
CubatureControlVolume(const shards::CellTopology cellTopology)
shards::CellTopology subcvCellTopo_
The topology of the sub-control volume.
Defines cubature (integration) rules over control volumes.
virtual ordinal_type getNumPoints() const override
Returns the number of cubature points.