11 #ifndef PANZER_VECTOR_TO_SCALAR_IMPL_HPP
12 #define PANZER_VECTOR_TO_SCALAR_IMPL_HPP
19 template<
typename EvalT,
typename Traits>
30 const std::vector<std::string>& scalar_names =
33 scalar_fields.resize(scalar_names.size());
34 for (std::size_t i=0; i < scalar_names.size(); ++i)
40 (
"Vector Name"), vector_dl);
42 this->addDependentField(vector_field);
44 for (std::size_t i=0; i < scalar_fields.size(); ++i)
45 this->addEvaluatedField(scalar_fields[i]);
47 std::string n =
"VectorToScalar: " + vector_field.fieldTag().name();
53 template<typename EvalT, typename Traits> \
54 VectorToScalar<EvalT,Traits>::
61 scalar_fields.resize(output.size());
62 for(std::size_t i=0;i<output.size();i++)
63 scalar_fields[i] = output[i];
66 this->addDependentField(vector_field);
68 for (std::size_t i=0; i < scalar_fields.size(); ++i)
69 this->addEvaluatedField(scalar_fields[i]);
72 std::string n =
"VectorToScalar: " + vector_field.fieldTag().name();
77 template<
typename EvalT,
typename Traits>
85 const int num_points = vector_field.extent_int(1);
86 const int num_scalars = std::min(static_cast<int>(scalar_fields.size()),
87 vector_field.extent_int(2));
90 auto local_vector_field = vector_field;
93 for (
int sc = 0; sc < num_scalars; ++sc) {
94 auto local_scalar_field = scalar_fields[sc];
95 Kokkos::parallel_for(workset.
num_cells, KOKKOS_LAMBDA (
const int cell) {
96 for (
int pt = 0; pt < num_points; ++pt)
97 local_scalar_field(cell,pt) = local_vector_field(cell,pt,sc);
102 for(
unsigned int sc = num_scalars; sc < scalar_fields.size(); ++sc)
103 Kokkos::deep_copy(scalar_fields[sc].get_static_view(), 0.);
int num_cells
DEPRECATED - use: numCells()
T & get(const std::string &name, T def_value)
VectorToScalar(const Teuchos::ParameterList &p)
void evaluateFields(typename Traits::EvalData d)