43 #ifndef __Panzer_SubcellSum_impl_hpp__
44 #define __Panzer_SubcellSum_impl_hpp__
50 #include "Phalanx_DataLayout_MDALayout.hpp"
55 template<
typename EvalT,
typename Traits>
59 : evaluateOnClosure_(false)
64 const std::string inName = p.
get<std::string>(
"Field Name");
65 const std::string outName = p.
get<std::string>(
"Sum Name");
68 if(p.
isType<
bool>(
"Evaluate On Closure"))
71 inField = PHX::MDField<const ScalarT,Cell,BASIS>( inName, basis->functional);
72 outField = PHX::MDField<ScalarT,Cell>( outName, basis->cell_data);
74 this->addDependentField(
inField);
75 this->addEvaluatedField(outField);
80 std::string n =
"SubcellSum: " + outField.fieldTag().name();
85 template<
typename EvalT,
typename Traits>
91 std::vector<int> indices;
96 if(evaluateOnClosure_)
97 fieldPattern_->getSubcellClosureIndices(workset.
subcell_dim,this->wda(workset).subcell_index,indices);
99 indices = fieldPattern_->getSubcellIndices(workset.
subcell_dim,this->wda(workset).subcell_index);
101 for(index_t c=0;c<workset.
num_cells;c++) {
105 for(std::size_t i=0;i<indices.size();i++)
106 outField(c) += inField(c,indices[i]);
114 template<
typename EvalT,
typename TRAITS>
119 p->
set<std::string>(
"Sum Name",
"?");
120 p->
set<std::string>(
"Field Name",
"?");
121 p->
set<
double>(
"Multiplier",1.0);
122 p->
set<
bool>(
"Evaluate On Closure",
false);
125 p->
set(
"Basis", basis);
SubcellSum(const Teuchos::ParameterList &p)
T & get(const std::string &name, T def_value)
ParameterList & set(std::string const &name, T const &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)