43 #ifndef PANZER_SCALAR_TO_VECTOR_IMPL_HPP
44 #define PANZER_SCALAR_TO_VECTOR_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<const ScalarT,Cell,Point>(scalar_names[i], scalar_dl);
71 PHX::MDField<ScalarT,Cell,Point,Dim>(p.
get<std::string>
72 (
"Vector Name"), vector_dl);
74 for (std::size_t i=0; i < scalar_fields.size(); ++i)
75 this->addDependentField(scalar_fields[i]);
77 this->addEvaluatedField(vector_field);
79 std::string n =
"ScalarToVector: " + vector_field.fieldTag().name();
85 template<typename EvalT, typename Traits> \
86 ScalarToVector<EvalT,Traits>::
87 ScalarToVector(
const std::vector<PHX::Tag<ScalarT>> & input,
88 const PHX::FieldTag & output)
91 vector_field = output;
93 scalar_fields.resize(input.size());
94 for(std::size_t i=0;i<input.size();i++)
95 scalar_fields[i] = input[i];
98 this->addEvaluatedField(vector_field);
100 for (std::size_t i=0; i < scalar_fields.size(); ++i)
101 this->addDependentField(scalar_fields[i]);
104 std::string n =
"ScalarToVector: " + vector_field.fieldTag().name();
109 template<
typename EvalT,
typename Traits>
116 internal_scalar_fields = Kokkos::View<KokkosScalarFields_t*>(
"ScalarToVector::internal_scalar_fields", scalar_fields.size());
117 for (std::size_t i=0; i < scalar_fields.size(); ++i) {
118 this->utils.setFieldData(scalar_fields[i],fm);
119 internal_scalar_fields(i) = scalar_fields[i].get_static_view();
122 this->utils.setFieldData(vector_field,fm);
127 template<
typename EvalT,
typename TRAITS>
128 KOKKOS_INLINE_FUNCTION
130 typedef typename PHX::MDField<ScalarT,Cell,Point>::size_type size_type;
132 for (size_type pt = 0; pt < vector_field.extent(1); ++pt) {
134 for (std::size_t sc = 0; sc < internal_scalar_fields.extent(0); ++sc) {
135 vector_field(cell,pt,sc) = internal_scalar_fields(sc)(cell,pt);
142 template<
typename EvalT,
typename Traits>
150 Kokkos::parallel_for (workset.
num_cells, (*
this));
T & get(const std::string &name, T def_value)
void postRegistrationSetup(typename Traits::SetupData d, PHX::FieldManager< Traits > &fm)
void evaluateFields(typename Traits::EvalData d)
ScalarToVector(const Teuchos::ParameterList &p)
void operator()(const size_t &cell) const