11#ifndef PANZER_CONSTANT_FLUX_IMPL_HPP
12#define PANZER_CONSTANT_FLUX_IMPL_HPP
17template<
typename EvalT,
typename Traits>
20 const Teuchos::ParameterList& p) :
21 flux( p.get<
std::string>(
"Flux Field Name"),
22 p.get<
Teuchos::RCP<
PHX::DataLayout> >(
"Data Layout") )
24 const Teuchos::ParameterList& flux_values = p.sublist(
"Flux Values");
26 for (Teuchos::ParameterList::ConstIterator i = flux_values.begin(); i != flux_values.end(); ++i)
27 values.push_back(Teuchos::getValue<double>(i->second));
29 this->addEvaluatedField(
flux);
31 std::string n =
"ConstantFlux: " +
flux.fieldTag().name();
36template<
typename EvalT,
typename Traits>
44 this->utils.setFieldData(
flux,fm);
46 TEUCHOS_ASSERT(
static_cast<std::size_t
>(
flux.extent(2)) ==
values.size());
48 auto flux_v =
flux.get_static_view();
50 for (
int dim = 0; dim < flux_v.extent_int(2); ++dim) {
52 Kokkos::parallel_for (
"ConstantFlux",
flux.extent_int(0), KOKKOS_LAMBDA(
const int cell) {
53 for (
int ip = 0; ip < flux_v.extent_int(1); ++ip)
54 flux_v(cell,ip,dim) = val;
61template<
typename EvalT,
typename Traits>
ConstantFlux(const Teuchos::ParameterList &p)
Construct from a ParameterList specifying the flux field name, data layout, and constant per-dimensio...
PHX::MDField< ScalarT > flux
void postRegistrationSetup(typename Traits::SetupData d, PHX::FieldManager< Traits > &fm)
Sets the flux field to the constant values given at construction. Called once before the first evalua...
void evaluateFields(typename Traits::EvalData d)
No-op; the flux field is already set by postRegistrationSetup().
std::vector< ScalarT > values
const panzer::Workset & EvalData
Data type passed to PHX::Evaluator::evaluateFields(): a single workset holding the cell data for one ...
const SD & SetupData
Data type passed to PHX::Evaluator::postRegistrationSetup().