43 #ifndef PANZER_VECTOR_TO_SCALAR_IMPL_HPP
44 #define PANZER_VECTOR_TO_SCALAR_IMPL_HPP
51 template<
typename EvalT,
typename Traits>
62 const std::vector<std::string>& scalar_names =
65 scalar_fields.resize(scalar_names.size());
66 for (std::size_t i=0; i < scalar_names.size(); ++i)
68 PHX::MDField<ScalarT,Cell,Point>(scalar_names[i], scalar_dl);
71 PHX::MDField<const ScalarT,Cell,Point,Dim>(p.
get<std::string>
72 (
"Vector Name"), vector_dl);
74 this->addDependentField(vector_field);
76 for (std::size_t i=0; i < scalar_fields.size(); ++i)
77 this->addEvaluatedField(scalar_fields[i]);
79 std::string n =
"VectorToScalar: " + vector_field.fieldTag().name();
85 template<typename EvalT, typename Traits> \
86 VectorToScalar<EvalT,Traits>::
87 VectorToScalar(
const PHX::FieldTag & input,
88 const std::vector<PHX::Tag<ScalarT>> & output)
93 scalar_fields.resize(output.size());
94 for(std::size_t i=0;i<output.size();i++)
95 scalar_fields[i] = output[i];
98 this->addDependentField(vector_field);
100 for (std::size_t i=0; i < scalar_fields.size(); ++i)
101 this->addEvaluatedField(scalar_fields[i]);
104 std::string n =
"VectorToScalar: " + vector_field.fieldTag().name();
109 template<
typename EvalT,
typename Traits>
116 for (std::size_t i=0; i < scalar_fields.size(); ++i)
117 this->utils.setFieldData(scalar_fields[i],fm);
119 this->utils.setFieldData(vector_field,fm);
123 template<
typename EvalT,
typename Traits>
130 typedef typename PHX::MDField<ScalarT,Cell,Point>::size_type size_type;
133 auto local_vector_field = vector_field;
135 for (std::size_t sc = 0; sc < scalar_fields.size(); ++sc) {
136 auto local_scalar_field = scalar_fields[sc];
138 Kokkos::parallel_for(workset.
num_cells, KOKKOS_LAMBDA (
const index_t cell) {
140 for (size_type pt = 0; pt < local_vector_field.extent(1); ++pt) {
141 local_scalar_field(cell,pt) = local_vector_field(cell,pt,sc);
void postRegistrationSetup(typename Traits::SetupData d, PHX::FieldManager< Traits > &fm)
T & get(const std::string &name, T def_value)
VectorToScalar(const Teuchos::ParameterList &p)
void evaluateFields(typename Traits::EvalData d)