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"
29 IntegrationDescriptor::setup(in_cubature_degree, IntegrationDescriptor::SIDE, cell_data.side());
31 IntegrationDescriptor::setup(in_cubature_degree, IntegrationDescriptor::VOLUME);
33 setup(in_cubature_degree,cell_data);
42 if(in_cv_type ==
"volume"){
43 TEUCHOS_TEST_FOR_EXCEPT_MSG(cell_data.
isSide(),
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"){
49 TEUCHOS_TEST_FOR_EXCEPT_MSG(not cell_data.
isSide(),
50 "IntegrationRule::IntegrationRule : Control Volume 'boundary' type requested, but CellData is not setup for sides.");
53 TEUCHOS_ASSERT(
false);
60 const Teuchos::RCP<const shards::CellTopology> & cell_topology,
83 TEUCHOS_ASSERT(num_faces!=-1);
92 TEUCHOS_ASSERT(
false);
103 std::stringstream ss;
109 if(cell_data.
isSide() && spatialDimension==1) {
117 Teuchos::RCP<shards::CellTopology> sideTopo =
getSideTopology(cell_data);
119 Intrepid2::DefaultCubatureFactory cubature_factory;
120 Teuchos::RCP<Intrepid2::Cubature<PHX::Device,double,double>> intrepid_cubature;
123 if (Teuchos::is_null(sideTopo)) {
125 intrepid_cubature = cubature_factory.create<PHX::Device,double,
double>(topo,
cubature_degree);
129 intrepid_cubature = cubature_factory.create<PHX::Device,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);
163 Intrepid2::DefaultCubatureFactory cubature_factory;
166 int test_face_size = -1;
167 for(
int subcell_index=0; subcell_index<num_faces_per_cell; ++subcell_index){
168 Teuchos::RCP<shards::CellTopology> face_topology = Teuchos::rcp(
new shards::CellTopology(cell_topology->getCellTopologyData(subcell_dim,subcell_index)));
169 const auto & intrepid_cubature = cubature_factory.create<PHX::Device,double,
double>(*face_topology,
getOrder());
170 const int num_face_points = intrepid_cubature->getNumPoints();
174 if(test_face_size==-1){
175 test_face_size = num_face_points;
177 TEUCHOS_ASSERT(num_face_points == test_face_size);
184 PointRule::setup(point_rule_name, num_cells, num_points_per_cell, num_faces, num_points_per_face, cell_topology);
205 std::stringstream ss;
210 Teuchos::RCP<Intrepid2::Cubature<PHX::Device,double,double> > intrepid_cubature;
212 int tmp_num_points = 0;
215 intrepid_cubature = Teuchos::rcp(
new Intrepid2::CubatureControlVolume<PHX::Device,double,double>(topo));
216 tmp_num_points = intrepid_cubature->getNumPoints();
220 intrepid_cubature = Teuchos::rcp(
new Intrepid2::CubatureControlVolumeSide<PHX::Device,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,double,double>(topo,cell_data.
side()));
226 tmp_num_points = intrepid_cubature->getNumPoints();
246 os <<
"IntegrationRule ( "
252 <<
", Side = " <<
side
259 Teuchos::RCP< Intrepid2::Cubature<PHX::Device,double,double> > intrepid_cubature;
260 Intrepid2::DefaultCubatureFactory cubature_factory;
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);
Data for determining cell topology and dimensionality.
int baseCellDimension() const
Dimension of the base cell. NOT the dimension of the local side, even if the side() method returns tr...
Teuchos::RCP< const shards::CellTopology > getCellTopology() const
Get CellTopology for the base cell.
@ VOLUME
No integral specified - default state.
@ CV_VOLUME
Integral over a specific side of cells (side must be set).
@ CV_SIDE
Control volume integral.
@ CV_BOUNDARY
Control volume side integral.
@ SIDE
Integral over all sides of cells (closed surface integral).
@ SURFACE
Integral over volume.
const int & getOrder() const
Get order of integrator.
const int & getSide() const
Get side associated with integration - this is for backward compatibility.
const int & getType() const
Get type of integrator.
IntegrationDescriptor()
Constructor for empty integrator.
void setup(const int cubature_order, const int integration_type, const int side=-1)
Setup function.
IntegrationRule(int cubature_degree, const panzer::CellData &cell_data)
if side = -1 then we use the cell volume integration rule.
void setup_cv(const panzer::CellData &cell_data, std::string cv_type)
int getPointOffset(const int subcell_index) const
Returns the integration point offset for a given subcell_index (i.e. local face index).
void setup_surface(const Teuchos::RCP< const shards::CellTopology > &cell_topology, const int num_cells, const int num_faces)
Setup a surface integration.
virtual void print(std::ostream &os)
print information about the integration rule
void setup(int cubature_degree, const panzer::CellData &cell_data)
void referenceCoordinates(Kokkos::DynRankView< double, PHX::Device > &container)
Construct an array containing the reference coordinates.
int order() const
Returns the order of integration (cubature degree in intrepid lingo).
std::vector< int > _point_offsets
PointRule(const std::string &ptName, int np, const panzer::CellData &cell_data)
static Teuchos::RCP< shards::CellTopology > getSideTopology(const CellData &cell_data)
Teuchos::RCP< shards::CellTopology > side_topology
int side
Defaults to -1 if this is volume and not sideset.
void setup(const std::string &ptName, int np, const panzer::CellData &cell_data)
Teuchos::RCP< const shards::CellTopology > topology
const std::string & getName() const