43 #ifndef __Panzer_CellExtreme_impl_hpp__
44 #define __Panzer_CellExtreme_impl_hpp__
48 #include "Intrepid2_FunctionSpaceTools.hpp"
51 #include "Phalanx_DataLayout_MDALayout.hpp"
56 template<
typename EvalT,
typename Traits>
66 if(p.
isType<
bool>(
"Use Max"))
73 extreme = PHX::MDField<ScalarT>( p.
get<std::string>(
"Extreme Name"), dl_cell);
74 scalar = PHX::MDField<const ScalarT,Cell,IP>( p.
get<std::string>(
"Field Name"), ir->dl_scalar);
76 this->addEvaluatedField(
extreme);
77 this->addDependentField(
scalar);
80 if(p.
isType<
double>(
"Multiplier"))
84 const std::vector<std::string>& field_multiplier_names =
87 for (std::vector<std::string>::const_iterator name =
88 field_multiplier_names.begin();
89 name != field_multiplier_names.end(); ++name) {
95 for (
typename std::vector<PHX::MDField<const ScalarT,Cell,IP> >::iterator
field =
field_multipliers.begin();
97 this->addDependentField(*
field);
99 std::string n =
"CellExtreme: " +
extreme.fieldTag().name();
104 template<
typename EvalT,
typename Traits>
111 num_qp = scalar.extent(1);
116 template<
typename EvalT,
typename Traits>
122 for (index_t cell = 0; cell < workset.
num_cells; ++cell) {
124 for (std::size_t qp = 0; qp < num_qp; ++qp) {
126 for (
typename std::vector<PHX::MDField<const ScalarT,Cell,IP> >::iterator
field = field_multipliers.begin();
128 current *= (*
field)(cell,qp);
132 extreme(cell) = current;
136 extreme(cell) = extreme(cell)<current ? current : extreme(cell);
138 extreme(cell) = extreme(cell)>current ? current : extreme(cell);
144 template<
typename EvalT,
typename TRAITS>
149 p->
set<std::string>(
"Extreme Name",
"?");
150 p->
set<std::string>(
"Field Name",
"?");
154 p->
set<
bool>(
"Use Max",
true);
155 p->
set<
double>(
"Multiplier", 1.0);
158 p->
set(
"Field Multipliers", fms);
void evaluateFields(typename Traits::EvalData d)
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
CellExtreme(const Teuchos::ParameterList &p)
std::vector< PHX::MDField< const ScalarT, Cell, IP > > field_multipliers
std::vector< std::string >::size_type getIntegrationRuleIndex(int ir_degree, const panzer::Workset &workset, WorksetDetailsAccessor &wda)
Teuchos::RCP< Teuchos::ParameterList > getValidParameters() const
double multiplier
The scalar multiplier out in front of the integral ( ).
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
void postRegistrationSetup(typename Traits::SetupData d, PHX::FieldManager< Traits > &fm)
PHX::MDField< ScalarT > extreme
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, panzer::Cell, panzer::BASIS > field
A field to which we'll contribute, or in which we'll store, the result of computing this integral...
bool isType(const std::string &name) const
PHX::MDField< const ScalarT, Cell, IP > scalar
Teuchos::RCP< const std::vector< panzer::Workset > > worksets_