11 #ifndef __Panzer_CellAverage_impl_hpp__
12 #define __Panzer_CellAverage_impl_hpp__
16 #include "Intrepid2_FunctionSpaceTools.hpp"
19 #include "Phalanx_DataLayout_MDALayout.hpp"
24 template<
typename EvalT,
typename Traits>
39 this->addEvaluatedField(
average);
40 this->addDependentField(
scalar);
43 if(p.
isType<
double>(
"Multiplier"))
47 const std::vector<std::string>& field_multiplier_names =
50 for (std::vector<std::string>::const_iterator name =
51 field_multiplier_names.begin();
52 name != field_multiplier_names.end(); ++name) {
60 this->addDependentField(*
field);
62 std::string n =
"CellAverage: " +
average.fieldTag().name();
67 template<
typename EvalT,
typename Traits>
74 num_qp = scalar.extent(1);
79 template<
typename EvalT,
typename Traits>
85 for (index_t cell = 0; cell < workset.
num_cells; ++cell) {
91 for (std::size_t qp = 0; qp < num_qp; ++qp) {
95 current *= (*
field)(cell,qp);
98 average(cell) += current/num_qp;
104 template<
typename EvalT,
typename TRAITS>
109 p->
set<std::string>(
"Average Name",
"?");
110 p->
set<std::string>(
"Field Name",
"?");
114 p->
set<
double>(
"Multiplier", 1.0);
117 p->
set(
"Field Multipliers", fms);
int num_cells
DEPRECATED - use: numCells()
T & get(const std::string &name, T def_value)
typename EvalT::ScalarT ScalarT
ParameterList & set(std::string const &name, T &&value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
std::vector< int >::size_type getIntegrationRuleIndex(int ir_degree, const panzer::Workset &workset, WorksetDetailsAccessor &wda)
double multiplier
The scalar multiplier out in front of the integral ( ).
PHX::MDField< ScalarT, Cell > average
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
void postRegistrationSetup(typename Traits::SetupData d, PHX::FieldManager< Traits > &fm)
Teuchos::RCP< PHX::DataLayout > dl_scalar
Data layout for scalar fields.
void evaluateFields(typename Traits::EvalData d)
void validateParameters(ParameterList const &validParamList, int const depth=1000, EValidateUsed const validateUsed=VALIDATE_USED_ENABLED, EValidateDefaults const validateDefaults=VALIDATE_DEFAULTS_ENABLED) const
PHX::MDField< const ScalarT, Cell, IP > scalar
PHX::MDField< ScalarT, panzer::Cell, panzer::BASIS > field
A field to which we'll contribute, or in which we'll store, the result of computing this integral...
CellAverage(const Teuchos::ParameterList &p)
bool isType(const std::string &name) const
std::vector< PHX::MDField< const ScalarT, Cell, IP > > field_multipliers
Teuchos::RCP< Teuchos::ParameterList > getValidParameters() const
Teuchos::RCP< const std::vector< panzer::Workset > > worksets_