11 #ifndef PANZER_CONSTANT_VECTOR_IMPL_HPP
12 #define PANZER_CONSTANT_VECTOR_IMPL_HPP
17 template<
typename EvalT,
typename Traits>
21 vec_(p.get<std::string>(
"Name"),
22 p.get< Teuchos::
RCP<PHX::DataLayout> >(
"Data Layout") )
24 this->addEvaluatedField(
vec_);
27 this->addUnsharedField(
vec_.fieldTag().clone());
29 const int dim =
vec_.fieldTag().dataLayout().extent(2);
32 auto vals_host = Kokkos::create_mirror_view(Kokkos::HostSpace(),
vals_);
34 vals_host(0) = p.
get<
double>(
"Value X");
36 vals_host(1) = p.
get<
double>(
"Value Y");
38 vals_host(2) = p.
get<
double>(
"Value Z");
40 Kokkos::deep_copy(
vals_,vals_host);
42 std::string n =
"ConstantVector: " +
vec_.fieldTag().name();
47 template<
typename EvalT,
typename Traits>
53 auto vals = this->vals_;
54 auto vec = this->vec_;
55 Kokkos::MDRangePolicy<PHX::Device,Kokkos::Rank<3>> policy({0,0,0},{
static_cast<int64_t
>(vec.extent(0)),
56 static_cast<int64_t>(vec.extent(1)),static_cast<int64_t>(vec.extent(2))});
57 Kokkos::parallel_for(
"panzer::ConstantVector",policy,KOKKOS_LAMBDA(
const int c,
const int p,
const int d){
63 template<
typename EvalT,
typename Traits>
ConstantVector(const Teuchos::ParameterList &p)
T & get(const std::string &name, T def_value)
PHX::MDField< ScalarT > vec_
Kokkos::View< typename Sacado::ScalarType< ScalarT >::type **, Kokkos::LayoutRight, PHX::Device > vals
Kokkos::View< double * > vals_
void evaluateFields(typename Traits::EvalData d)
void postRegistrationSetup(typename Traits::SetupData d, PHX::FieldManager< Traits > &fm)