58 const Teuchos::ParameterList& p) : quad_index(0)
61 p.validateParameters(*valid_params);
63 Teuchos::RCP<panzer::IntegrationRule> ir = p.get< Teuchos::RCP<panzer::IntegrationRule> >(
"IR");
66 Teuchos::RCP<PHX::DataLayout> dl_cell = Teuchos::rcp(
new PHX::MDALayout<Cell>(ir->dl_scalar->extent(0)));
67 integral = PHX::MDField<ScalarT>( p.get<std::string>(
"Integral Name"), dl_cell);
68 scalar = PHX::MDField<const ScalarT,Cell,IP>( p.get<std::string>(
"Integrand Name"), ir->dl_scalar);
71 this->addDependentField(
scalar);
74 if(p.isType<
double>(
"Multiplier"))
77 if (p.isType<Teuchos::RCP<
const std::vector<std::string> > >(
"Field Multipliers")) {
78 const std::vector<std::string>& field_multiplier_names =
79 *(p.get<Teuchos::RCP<const std::vector<std::string> > >(
"Field Multipliers"));
81 field_multipliers_h =
typename PHX::View<PHX::UnmanagedView<const ScalarT**>* >::HostMirror(
"FieldMultipliersHost", field_multiplier_names.size());
82 field_multipliers = PHX::View<PHX::UnmanagedView<const ScalarT**>* >(
"FieldMultipliersDevice", field_multiplier_names.size());
85 for (std::vector<std::string>::const_iterator name =
86 field_multiplier_names.begin();
87 name != field_multiplier_names.end(); ++name, ++cnt) {
88 PHX::MDField<const ScalarT,Cell,IP> tmp_field(*name, p.get< Teuchos::RCP<panzer::IntegrationRule> >(
"IR")->dl_scalar);
93 std::string n =
"Integrator_Scalar: " +
integral.fieldTag().name();
121 const auto wm = this->wda(workset).int_rules[quad_index]->weighted_measure;
125 auto l_scalar = scalar;
126 auto l_field_multipliers = field_multipliers;
127 auto l_num_qp = num_qp;
128 auto l_integral = integral.get_static_view();
130 Kokkos::parallel_for(
"IntegratorScalar", workset.
num_cells, KOKKOS_LAMBDA (
int cell) {
131 for (std::size_t qp = 0; qp < l_num_qp; ++qp) {
132 l_tmp(cell,qp) = l_multiplier * l_scalar(cell,qp);
133 for (
size_t f=0;f<l_field_multipliers.extent(0); ++f)
134 l_tmp(cell,qp) *= l_field_multipliers(f)(cell,qp);
136 l_integral(cell) = 0.0;
137 for (std::size_t qp = 0; qp < l_num_qp; ++qp) {
138 l_integral(cell) += l_tmp(cell, qp)*wm(cell, qp);