11 #ifndef PANZER_PRODUCT_IMPL_HPP
12 #define PANZER_PRODUCT_IMPL_HPP
21 template<
typename EvalT,
typename Traits>
27 std::string product_name = p.
get<std::string>(
"Product Name");
33 if(p.
isType<
double>(
"Scaling"))
38 this->addEvaluatedField(
product);
40 values.resize(value_names->size());
41 for (std::size_t i=0; i < value_names->size(); ++i) {
43 this->addDependentField(
values[i]);
46 std::string n =
"Product Evaluator";
51 template<
int RANK,
typename Scalar>
60 KOKKOS_INLINE_FUNCTION
63 using idx_t = PHX::index_t;
69 for (idx_t ind2=0; ind2 < static_cast<idx_t>(
base_.extent(1)); ind2++)
73 for (idx_t ind2=0; ind2 < static_cast<idx_t>(
base_.extent(1)); ind2++)
74 for (idx_t ind3=0; ind3 < static_cast<idx_t>(
base_.extent(2)); ind3++)
78 for (idx_t ind2=0; ind2 < static_cast<idx_t>(
base_.extent(1)); ind2++)
79 for (idx_t ind3=0; ind3 < static_cast<idx_t>(
base_.extent(2)); ind3++)
80 for (idx_t ind4=0; ind4 < static_cast<idx_t>(
base_.extent(3)); ind4++)
81 base_(ind1,ind2,ind3,ind4) =
base_(ind1,ind2,ind3,ind4)*
source_(ind1,ind2,ind3,ind4);
84 for (idx_t ind2=0; ind2 < static_cast<idx_t>(
base_.extent(1)); ind2++)
85 for (idx_t ind3=0; ind3 < static_cast<idx_t>(
base_.extent(2)); ind3++)
86 for (idx_t ind4=0; ind4 < static_cast<idx_t>(
base_.extent(3)); ind4++)
87 for (idx_t ind5=0; ind5 < static_cast<idx_t>(
base_.extent(4)); ind5++)
88 base_(ind1,ind2,ind3,ind4,ind5) =
base_(ind1,ind2,ind3,ind4,ind5)*
source_(ind1,ind2,ind3,ind4,ind5);
91 for (idx_t ind2=0; ind2 < static_cast<idx_t>(
base_.extent(1)); ind2++)
92 for (idx_t ind3=0; ind3 < static_cast<idx_t>(
base_.extent(2)); ind3++)
93 for (idx_t ind4=0; ind4 < static_cast<idx_t>(
base_.extent(3)); ind4++)
94 for (idx_t ind5=0; ind5 < static_cast<idx_t>(
base_.extent(4)); ind5++)
95 for (idx_t ind6=0; ind6 < static_cast<idx_t>(
base_.extent(5)); ind6++)
96 base_(ind1,ind2,ind3,ind4,ind5,ind6) =
base_(ind1,ind2,ind3,ind4,ind5,ind6)*
source_(ind1,ind2,ind3,ind4,ind5,ind6);
99 for (idx_t ind2=0; ind2 < static_cast<idx_t>(
base_.extent(1)); ind2++)
100 for (idx_t ind3=0; ind3 < static_cast<idx_t>(
base_.extent(2)); ind3++)
101 for (idx_t ind4=0; ind4 < static_cast<idx_t>(
base_.extent(3)); ind4++)
102 for (idx_t ind5=0; ind5 < static_cast<idx_t>(
base_.extent(4)); ind5++)
103 for (idx_t ind6=0; ind6 < static_cast<idx_t>(
base_.extent(5)); ind6++)
104 for (idx_t ind7=0; ind7 < static_cast<idx_t>(
base_.extent(6)); ind7++)
105 base_(ind1,ind2,ind3,ind4,ind5,ind6,ind7) =
base_(ind1,ind2,ind3,ind4,ind5,ind6,ind7)*
source_(ind1,ind2,ind3,ind4,ind5,ind6,ind7);
111 template<
typename EvalT,
typename Traits>
117 product.deep_copy(
ScalarT(scaling));
119 for (std::size_t i = 0; i < values.size(); ++i) {
120 const auto length = product.extent(0);
121 if (product.rank() == 1){
124 else if (product.rank() == 2){
127 else if (product.rank() == 3){
130 else if (product.rank() == 4){
133 else if (product.rank() == 5){
136 else if (product.rank() == 6){
139 else if (product.rank() == 7){
KOKKOS_INLINE_FUNCTION void operator()(const PHX::index_t &ind1) const
T & get(const std::string &name, T def_value)
const PHX::MDField< Scalar > base_
Product(const Teuchos::ParameterList &p)
V_MultiplyFunctor(PHX::MDField< Scalar > &base, const PHX::MDField< const Scalar > &source)
const PHX::MDField< const Scalar > source_
PHX::MDField< ScalarT > product
bool isType(const std::string &name) const
std::vector< PHX::MDField< const ScalarT > > values
typename EvalT::ScalarT ScalarT
void evaluateFields(typename Traits::EvalData d)