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"))
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) {
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>
123 std::size_t num_pt = this->num_qp;
124 bool extreme_max = this->use_max;
125 auto scalar_view = scalar.get_view();
126 auto extreme_view = extreme.get_view();
129 PHX::View<ScalarT**> mult_field(
"Multiplied Field", workset.
num_cells, scalar.extent(1));
132 Kokkos::parallel_for(
"Initialize Muliplier Field", workset.
num_cells, KOKKOS_LAMBDA(
const int cell) {
133 for (std::size_t qp = 0; qp < num_pt; ++qp) {
134 mult_field(cell, qp) = mult * scalar_view(cell, qp);
139 for (std::size_t field_num = 0; field_num < field_multipliers.size(); ++field_num)
141 auto field = field_multipliers[field_num];
142 Kokkos::parallel_for(
"CellExtreme: Multiply Fields", workset.
num_cells, KOKKOS_LAMBDA(
const int cell) {
143 for (std::size_t qp = 0; qp < num_pt; ++qp) {
144 mult_field(cell, qp) *=
field(cell, qp);
150 Kokkos::parallel_for (
"CellExtreme", workset.
num_cells, KOKKOS_LAMBDA(
const int cell) {
151 for (std::size_t qp = 0; qp < num_pt; ++qp) {
152 auto current = mult_field(cell, qp);
156 extreme_view(cell) = current;
160 extreme_view(cell) = extreme_view(cell)<current ? current : extreme_view(cell);
162 extreme_view(cell) = extreme_view(cell)>current ? current : extreme_view(cell);
168 template<
typename EvalT,
typename TRAITS>
173 p->
set<std::string>(
"Extreme Name",
"?");
174 p->
set<std::string>(
"Field Name",
"?");
178 p->
set<
bool>(
"Use Max",
true);
179 p->
set<
double>(
"Multiplier", 1.0);
182 p->
set(
"Field Multipliers", fms);
int num_cells
DEPRECATED - use: numCells()
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)
CellExtreme(const Teuchos::ParameterList &p)
std::vector< PHX::MDField< const ScalarT, Cell, IP > > field_multipliers
std::vector< int >::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_