11#ifndef __Panzer_SubcellSum_impl_hpp__
12#define __Panzer_SubcellSum_impl_hpp__
18#include "Phalanx_DataLayout_MDALayout.hpp"
23template<
typename EvalT,
typename Traits>
26 const Teuchos::ParameterList& p)
30 p.validateParameters(*valid_params);
32 const std::string inName = p.get<std::string>(
"Field Name");
33 const std::string outName = p.get<std::string>(
"Sum Name");
34 Teuchos::RCP<const PureBasis> basis = p.get< Teuchos::RCP<const PureBasis> >(
"Basis");
36 if(p.isType<
bool>(
"Evaluate On Closure"))
39 inField = PHX::MDField<const ScalarT,Cell,BASIS>( inName, basis->functional);
40 outField = PHX::MDField<ScalarT,Cell>( outName, basis->cell_data);
42 this->addDependentField(
inField);
48 std::string n =
"SubcellSum: " +
outField.fieldTag().name();
53template<
typename EvalT,
typename Traits>
59 std::vector<int> indices;
69 auto outField_h = Kokkos::create_mirror_view(
outField.get_static_view());
70 auto inField_h = Kokkos::create_mirror_view(
inField.get_static_view());
71 Kokkos::deep_copy(inField_h,
inField.get_static_view());
72 for(index_t c=0;c<workset.
num_cells;c++) {
76 for(std::size_t i=0;i<indices.size();i++)
77 outField_h(c) += inField_h(c,indices[i]);
82 Kokkos::deep_copy(
outField.get_static_view(), outField_h);
86template<
typename EvalT,
typename TRAITS>
87Teuchos::RCP<Teuchos::ParameterList>
90 Teuchos::RCP<Teuchos::ParameterList> p = Teuchos::rcp(
new Teuchos::ParameterList);
91 p->set<std::string>(
"Sum Name",
"?");
92 p->set<std::string>(
"Field Name",
"?");
93 p->set<
double>(
"Multiplier",1.0);
94 p->set<
bool>(
"Evaluate On Closure",
false);
96 Teuchos::RCP<const panzer::PureBasis> basis;
97 p->set(
"Basis", basis);
SubcellSum(const Teuchos::ParameterList &p)
Construct from a ParameterList as documented in the class description.
PHX::MDField< ScalarT, Cell > outField
Teuchos::RCP< Teuchos::ParameterList > getValidParameters() const
Returns the ParameterList of valid parameters/defaults for this evaluator's constructor.
Teuchos::RCP< const panzer::FieldPattern > fieldPattern_
void evaluateFields(typename Traits::EvalData d)
Computes the "Sum Name" field for this workset per the class description.
PHX::MDField< const ScalarT, Cell, BASIS > inField
int subcell_dim
DEPRECATED - use: getSubcellDimension().
int num_cells
DEPRECATED - use: numCells().
const panzer::Workset & EvalData
Data type passed to PHX::Evaluator::evaluateFields(): a single workset holding the cell data for one ...