13 #include "Teuchos_ArrayRCP.hpp"
14 #include "Teuchos_Assert.hpp"
15 #include "Phalanx_DataLayout_MDALayout.hpp"
16 #include "Intrepid2_DefaultCubatureFactory.hpp"
17 #include "Intrepid2_CubatureControlVolume.hpp"
18 #include "Intrepid2_CubatureControlVolumeSide.hpp"
19 #include "Intrepid2_CubatureControlVolumeBoundary.hpp"
33 setup(in_cubature_degree,cell_data);
42 if(in_cv_type ==
"volume"){
44 "IntegrationRule::IntegrationRule : Control Volume 'volume' type requested, but CellData is setup for sides.");
46 }
else if(in_cv_type ==
"side"){
48 }
else if(in_cv_type ==
"boundary"){
50 "IntegrationRule::IntegrationRule : Control Volume 'boundary' type requested, but CellData is not setup for sides.");
99 cubature_degree = in_cubature_degree;
103 std::stringstream ss;
104 ss <<
"CubaturePoints (Degree=" << cubature_degree;
109 if(cell_data.
isSide() && spatialDimension==1) {
119 Intrepid2::DefaultCubatureFactory cubature_factory;
125 intrepid_cubature = cubature_factory.create<PHX::Device::execution_space,double,
double>(topo, cubature_degree);
129 intrepid_cubature = cubature_factory.create<PHX::Device::execution_space,double,
double>(*sideTopo, cubature_degree);
138 const int cell_dim = cell_topology->getDimension();
139 const int subcell_dim = cell_dim-1;
140 const int num_faces_per_cell = cell_topology->getSubcellCount(subcell_dim);
144 std::string point_rule_name;
146 std::stringstream ss;
147 ss <<
"CubaturePoints (Degree=" << getOrder() <<
",surface)";
148 point_rule_name = ss.str();
153 const int num_points_per_cell = num_faces_per_cell;
154 const int num_points_per_face = 1;
155 PointRule::setup(point_rule_name, num_cells, num_points_per_cell, num_faces, num_points_per_face, cell_topology);
156 _point_offsets.resize(3,0);
157 _point_offsets[0] = 0;
158 _point_offsets[1] = num_points_per_face;
159 _point_offsets[2] = _point_offsets[1]+num_points_per_face;
163 Intrepid2::DefaultCubatureFactory cubature_factory;
165 _point_offsets.resize(num_faces_per_cell+1,0);
166 int test_face_size = -1;
167 for(
int subcell_index=0; subcell_index<num_faces_per_cell; ++subcell_index){
169 const auto & intrepid_cubature = cubature_factory.create<PHX::Device::execution_space,double,
double>(*face_topology, getOrder());
170 const int num_face_points = intrepid_cubature->getNumPoints();
171 _point_offsets[subcell_index+1] = _point_offsets[subcell_index] + num_face_points;
174 if(test_face_size==-1){
175 test_face_size = num_face_points;
181 const int num_points_per_cell = _point_offsets.back();
182 const int num_points_per_face = _point_offsets[1];
184 PointRule::setup(point_rule_name, num_cells, num_points_per_cell, num_faces, num_points_per_face, cell_topology);
192 cv_type = in_cv_type;
193 if (cv_type ==
"volume") {
194 cubature_degree = 75;
196 if (cv_type ==
"side") {
197 cubature_degree = 85;
199 if (cv_type ==
"boundary") {
200 cubature_degree = 95;
205 std::stringstream ss;
206 ss <<
"CubaturePoints ControlVol (Index=" << cubature_degree;
212 int tmp_num_points = 0;
213 if (cv_type ==
"volume") {
215 intrepid_cubature =
Teuchos::rcp(
new Intrepid2::CubatureControlVolume<PHX::Device::execution_space,double,double>(topo));
216 tmp_num_points = intrepid_cubature->getNumPoints();
218 else if (cv_type ==
"side") {
220 intrepid_cubature =
Teuchos::rcp(
new Intrepid2::CubatureControlVolumeSide<PHX::Device::execution_space,double,double>(topo));
221 tmp_num_points = intrepid_cubature->getNumPoints();
223 else if (cv_type ==
"boundary") {
225 intrepid_cubature =
Teuchos::rcp(
new Intrepid2::CubatureControlVolumeBoundary<PHX::Device::execution_space,double,double>(topo,cell_data.
side()));
226 tmp_num_points = intrepid_cubature->getNumPoints();
233 {
return cubature_degree; }
240 return _point_offsets[subcell_index];
246 os <<
"IntegrationRule ( "
247 <<
"Name = " << getName()
248 <<
", Degree = " << cubature_degree
249 <<
", Dimension = " << spatial_dimension
250 <<
", Workset Size = " << workset_size
251 <<
", Num Points = " << num_points
252 <<
", Side = " << side
260 Intrepid2::DefaultCubatureFactory cubature_factory;
263 intrepid_cubature = cubature_factory.create<PHX::Device::execution_space,double,
double>(*(topology),cubature_degree);
265 intrepid_cubature = cubature_factory.create<PHX::Device::execution_space,double,
double>(*(side_topology),cubature_degree);
267 int num_ip = intrepid_cubature->getNumPoints();
268 Kokkos::DynRankView<double,PHX::Device> cub_weights(
"cub_weights",num_ip);
272 cub_points = Kokkos::DynRankView<double,PHX::Device>(
"cub_points", num_ip, topology->getDimension());
273 intrepid_cubature->getCubature(cub_points, cub_weights);
276 cub_points = Kokkos::DynRankView<double,PHX::Device>(
"cub_points", num_ip, side_topology->getDimension());
277 intrepid_cubature->getCubature(cub_points, cub_weights);
Control volume side integral.
int baseCellDimension() const
Dimension of the base cell. NOT the dimension of the local side, even if the side() method returns tr...
void setup(const std::string &ptName, int np, const panzer::CellData &cell_data)
bool is_null(const std::shared_ptr< T > &p)
Integral over a specific side of cells (side must be set)
Teuchos::RCP< const shards::CellTopology > getCellTopology() const
Get CellTopology for the base cell.
No integral specified - default state.
const int & getType() const
Get type of integrator.
void referenceCoordinates(Kokkos::DynRankView< double, PHX::Device > &container)
Construct an array containing the reference coordinates.
void setup(int cubature_degree, const panzer::CellData &cell_data)
int getPointOffset(const int subcell_index) const
Returns the integration point offset for a given subcell_index (i.e. local face index) ...
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
void setup(const int cubature_order, const int integration_type, const int side=-1)
Setup function.
#define TEUCHOS_TEST_FOR_EXCEPT_MSG(throw_exception_test, msg)
Data for determining cell topology and dimensionality.
void setup_cv(const panzer::CellData &cell_data, std::string cv_type)
void setup_surface(const Teuchos::RCP< const shards::CellTopology > &cell_topology, const int num_cells, const int num_faces)
Setup a surface integration.
const int & getSide() const
Get side associated with integration - this is for backward compatibility.
Integral over all sides of cells (closed surface integral)
virtual void print(std::ostream &os)
print information about the integration rule
IntegrationRule(int cubature_degree, const panzer::CellData &cell_data)
if side = -1 then we use the cell volume integration rule.
int order() const
Returns the order of integration (cubature degree in intrepid lingo)
#define TEUCHOS_ASSERT(assertion_test)
const int & getOrder() const
Get order of integrator.