26 const Teuchos::ParameterList& p) : quad_index(0)
29 p.validateParameters(*valid_params);
31 Teuchos::RCP<panzer::IntegrationRule> ir = p.get< Teuchos::RCP<panzer::IntegrationRule> >(
"IR");
34 Teuchos::RCP<PHX::DataLayout> dl_cell = Teuchos::rcp(
new PHX::MDALayout<Cell>(ir->dl_scalar->extent(0)));
35 integral = PHX::MDField<ScalarT>( p.get<std::string>(
"Integral Name"), dl_cell);
36 scalar = PHX::MDField<const ScalarT,Cell,IP>( p.get<std::string>(
"Integrand Name"), ir->dl_scalar);
39 this->addDependentField(
scalar);
42 if(p.isType<
double>(
"Multiplier"))
45 if (p.isType<Teuchos::RCP<
const std::vector<std::string> > >(
"Field Multipliers")) {
46 const std::vector<std::string>& field_multiplier_names =
47 *(p.get<Teuchos::RCP<const std::vector<std::string> > >(
"Field Multipliers"));
49 field_multipliers_h =
typename PHX::View<PHX::UnmanagedView<const ScalarT**>* >::host_mirror_type(
"FieldMultipliersHost", field_multiplier_names.size());
50 field_multipliers = PHX::View<PHX::UnmanagedView<const ScalarT**>* >(
"FieldMultipliersDevice", field_multiplier_names.size());
53 for (std::vector<std::string>::const_iterator name =
54 field_multiplier_names.begin();
55 name != field_multiplier_names.end(); ++name, ++cnt) {
56 PHX::MDField<const ScalarT,Cell,IP> tmp_field(*name, p.get< Teuchos::RCP<panzer::IntegrationRule> >(
"IR")->dl_scalar);
61 std::string n =
"Integrator_Scalar: " +
integral.fieldTag().name();
89 const auto wm = this->wda(workset).int_rules[quad_index]->weighted_measure;
93 auto l_scalar = scalar;
94 auto l_field_multipliers = field_multipliers;
95 auto l_num_qp = num_qp;
96 auto l_integral = integral.get_static_view();
98 Kokkos::parallel_for(
"IntegratorScalar", workset.
num_cells, KOKKOS_LAMBDA (
int cell) {
99 for (std::size_t qp = 0; qp < l_num_qp; ++qp) {
100 l_tmp(cell,qp) = l_multiplier * l_scalar(cell,qp);
101 for (
size_t f=0;f<l_field_multipliers.extent(0); ++f)
102 l_tmp(cell,qp) *= l_field_multipliers(f)(cell,qp);
104 l_integral(cell) = 0.0;
105 for (std::size_t qp = 0; qp < l_num_qp; ++qp) {
106 l_integral(cell) += l_tmp(cell, qp)*wm(cell, qp);