11 #ifndef __Panzer_SubcellSum_impl_hpp__
12 #define __Panzer_SubcellSum_impl_hpp__
18 #include "Phalanx_DataLayout_MDALayout.hpp"
23 template<
typename EvalT,
typename Traits>
27 : evaluateOnClosure_(false)
32 const std::string inName = p.
get<std::string>(
"Field Name");
33 const std::string outName = p.
get<std::string>(
"Sum Name");
36 if(p.
isType<
bool>(
"Evaluate On Closure"))
42 this->addDependentField(
inField);
43 this->addEvaluatedField(outField);
48 std::string n =
"SubcellSum: " + outField.fieldTag().name();
53 template<
typename EvalT,
typename Traits>
59 std::vector<int> indices;
64 if(evaluateOnClosure_)
65 fieldPattern_->getSubcellClosureIndices(workset.
subcell_dim,this->wda(workset).subcell_index,indices);
67 indices = fieldPattern_->getSubcellIndices(workset.
subcell_dim,this->wda(workset).subcell_index);
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);
86 template<
typename EvalT,
typename TRAITS>
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);
97 p->
set(
"Basis", basis);
SubcellSum(const Teuchos::ParameterList &p)
int num_cells
DEPRECATED - use: numCells()
T & get(const std::string &name, T def_value)
int subcell_dim
DEPRECATED - use: getSubcellDimension()
ParameterList & set(std::string const &name, T &&value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
Teuchos::RCP< const panzer::FieldPattern > fieldPattern_
double multiplier
The scalar multiplier out in front of the integral ( ).
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
PHX::MDField< const ScalarT, Cell, BASIS > inField
void validateParameters(ParameterList const &validParamList, int const depth=1000, EValidateUsed const validateUsed=VALIDATE_USED_ENABLED, EValidateDefaults const validateDefaults=VALIDATE_DEFAULTS_ENABLED) const
PHX::MDField< ScalarT, Cell > outField
bool isType(const std::string &name) const
Teuchos::RCP< Teuchos::ParameterList > getValidParameters() const
void evaluateFields(typename Traits::EvalData d)