11#ifndef PANZER_CONSTANT_VECTOR_IMPL_HPP
12#define PANZER_CONSTANT_VECTOR_IMPL_HPP
17template<
typename EvalT,
typename Traits>
20 const Teuchos::ParameterList& p) :
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);
31 vals_ = Kokkos::View<double*>(
"ConstantVector::vals",dim);
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();
47template<
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){
63template<
typename EvalT,
typename Traits>
Kokkos::View< typename Sacado::ScalarType< ScalarT >::type **, Kokkos::LayoutRight, PHX::Device > vals
Kokkos::View< double * > vals_
PHX::MDField< ScalarT > vec_
ConstantVector(const Teuchos::ParameterList &p)
Construct from a ParameterList specifying the field name, data layout, and the constant vector compon...
void postRegistrationSetup(typename Traits::SetupData d, PHX::FieldManager< Traits > &fm)
Sets the vector field to the constant components given at construction. Called once before the first ...
void evaluateFields(typename Traits::EvalData d)
No-op; the vector field is already set by postRegistrationSetup().
User-defined data passed to PHX::Evaluator::postRegistrationSetup() during the one-time setup phase.