43 #ifndef __Panzer_CellAverage_impl_hpp__
44 #define __Panzer_CellAverage_impl_hpp__
48 #include "Intrepid2_FunctionSpaceTools.hpp"
51 #include "Phalanx_DataLayout_MDALayout.hpp"
56 template<
typename EvalT,
typename Traits>
68 average = PHX::MDField<ScalarT,Cell>( p.
get<std::string>(
"Average Name"), dl_cell);
69 scalar = PHX::MDField<const ScalarT,Cell,IP>( p.
get<std::string>(
"Field Name"), ir->
dl_scalar);
71 this->addEvaluatedField(
average);
72 this->addDependentField(
scalar);
75 if(p.
isType<
double>(
"Multiplier"))
79 const std::vector<std::string>& field_multiplier_names =
82 for (std::vector<std::string>::const_iterator name =
83 field_multiplier_names.begin();
84 name != field_multiplier_names.end(); ++name) {
90 for (
typename std::vector<PHX::MDField<const ScalarT,Cell,IP> >::iterator
field =
field_multipliers.begin();
92 this->addDependentField(*
field);
94 std::string n =
"CellAverage: " +
average.fieldTag().name();
99 template<
typename EvalT,
typename Traits>
106 num_qp = scalar.extent(1);
111 template<
typename EvalT,
typename Traits>
117 for (index_t cell = 0; cell < workset.
num_cells; ++cell) {
123 for (std::size_t qp = 0; qp < num_qp; ++qp) {
125 for (
typename std::vector<PHX::MDField<const ScalarT,Cell,IP> >::iterator
field = field_multipliers.begin();
127 current *= (*
field)(cell,qp);
130 average(cell) += current/num_qp;
136 template<
typename EvalT,
typename TRAITS>
141 p->
set<std::string>(
"Average Name",
"?");
142 p->
set<std::string>(
"Field Name",
"?");
146 p->
set<
double>(
"Multiplier", 1.0);
149 p->
set(
"Field Multipliers", fms);
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)
typename EvalT::ScalarT ScalarT
std::vector< std::string >::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_