16#ifndef __INTREPID2_CUBATURE_DIRECT_HPP__
17#define __INTREPID2_CUBATURE_DIRECT_HPP__
19#include "Intrepid2_ConfigDefs.hpp"
40 template<
typename DeviceType = void,
41 typename pointValueType = double,
42 typename weightValueType =
double>
44 :
public Cubature<DeviceType,pointValueType,weightValueType> {
76 Kokkos::DynRankView<pointValueType,DeviceType>
points_;
80 Kokkos::DynRankView<weightValueType,DeviceType>
weights_;
103 template<
typename cubPointValueType,
class ...cubPointProperties,
104 typename cubWeightValueType,
class ...cubWeightProperties>
107 Kokkos::DynRankView<cubWeightValueType,cubWeightProperties...> cubWeights,
109#ifdef HAVE_INTREPID2_DEBUG
111 INTREPID2_TEST_FOR_EXCEPTION( rank(cubPoints) != 2, std::invalid_argument,
112 ">>> ERROR (CubatureDirect): cubPoints must be rank 2." );
114 INTREPID2_TEST_FOR_EXCEPTION( rank(cubWeights) != 1, std::invalid_argument,
115 ">>> ERROR (CubatureDirect): cubPoints must be rank 1." );
117 INTREPID2_TEST_FOR_EXCEPTION(
static_cast<ordinal_type
>(cubPoints.extent(0)) < this->getNumPoints() ||
118 static_cast<ordinal_type
>(cubPoints.extent(1)) < this->getDimension(), std::out_of_range,
119 ">>> ERROR (CubatureDirect): Insufficient space allocated for cubature points.");
121 INTREPID2_TEST_FOR_EXCEPTION(
static_cast<ordinal_type
>(cubWeights.extent(0)) < this->getNumPoints(), std::out_of_range,
122 ">>> ERROR (CubatureDirect): Insufficient space allocated for cubature weights.");
125 typedef Kokkos::pair<ordinal_type,ordinal_type> range_type;
130 const auto src = Kokkos::subdynrankview(cubData.
points_, pointRange, dimRange);
131 auto dst = Kokkos::subdynrankview(cubPoints, pointRange, dimRange);
133 Kokkos::deep_copy( dst, src );
136 const auto src = Kokkos::subdynrankview(cubData.
weights_, pointRange);
137 auto dst = Kokkos::subdynrankview(cubWeights, pointRange);
139 Kokkos::deep_copy(dst ,src);
148 typedef typename Cubature<DeviceType,pointValueType,weightValueType>::PointViewType PointViewType;
149 typedef typename Cubature<DeviceType,pointValueType,weightValueType>::weightViewType weightViewType;
156 weightViewType cubWeights )
const override {
181 return "CubatureDirect";
198 CubatureDirect(
const CubatureDirect &b)
203 CubatureDirect& operator=(
const CubatureDirect &b) {
204 this->degree_ = b.degree_;
205 this->dimension_ = b.dimension_;
206 this->cubatureData_ = b.cubatureData_;
210 CubatureDirect(
const ordinal_type degree,
211 const ordinal_type dimension)
Header file for the Intrepid2::Cubature class.
Defines direct cubature (integration) rules in Intrepid.
void getCubatureFromData(Kokkos::DynRankView< cubPointValueType, cubPointProperties... > cubPoints, Kokkos::DynRankView< cubWeightValueType, cubWeightProperties... > cubWeights, const CubatureData cubData) const
Returns cubature points and weights.
virtual ordinal_type getAccuracy() const override
Returns max. degree of polynomials that are integrated exactly. The return vector has size 1.
ordinal_type dimension_
Dimension of integration domain.
CubatureData cubatureData_
Cubature data on device.
virtual void getCubature(PointViewType cubPoints, weightViewType cubWeights) const override
Returns cubature points and weights (return arrays must be pre-sized/pre-allocated).
virtual const char * getName() const override
Returns cubature name.
ordinal_type degree_
The degree of polynomials that are integrated exactly by this cubature rule.
virtual ordinal_type getDimension() const override
Returns dimension of integration domain.
virtual ordinal_type getNumPoints() const override
Returns the number of cubature points.
Defines the base class for cubature (integration) rules in Intrepid.
static constexpr ordinal_type MaxIntegrationPoints
The maximum number of integration points for direct cubature rules.
static constexpr ordinal_type MaxDimension
The maximum ambient space dimension.
Cubature data is defined on the host space and is static.
weightValueType weights_[Parameters::MaxIntegrationPoints]
Array with the associated cubature weights.
ordinal_type numPoints_
Number of cubature points stored in the template.
pointValueType points_[Parameters::MaxIntegrationPoints][Parameters::MaxDimension]
Array with the (X,Y,Z) coordinates of the cubature points.
Cubature data is defined on exec space and deep-copied when an object is created.
Kokkos::DynRankView< pointValueType, DeviceType > points_
Array with the (X,Y,Z) coordinates of the cubature points.
ordinal_type numPoints_
Number of cubature points stored in the template.
Kokkos::DynRankView< weightValueType, DeviceType > weights_
Array with the associated cubature weights.