43 #ifndef __Panzer_Integrator_DivBasisTimesScalar_impl_hpp__ 44 #define __Panzer_Integrator_DivBasisTimesScalar_impl_hpp__ 46 #include "Intrepid2_FunctionSpaceTools.hpp" 51 #include "Kokkos_ViewFactory.hpp" 62 p.validateParameters(*valid_params);
64 Teuchos::RCP<const PureBasis>
basis 65 = p.get< Teuchos::RCP<BasisIRLayout> >(
"Basis")->getBasis();
68 TEUCHOS_TEST_FOR_EXCEPTION(!
basis->supportsDiv(),std::logic_error,
69 "Integrator_DivBasisTimesScalar: Basis of type \"" <<
basis->name() <<
"\" does not support DIV.");
70 TEUCHOS_TEST_FOR_EXCEPTION(!
basis->requiresOrientations(),std::logic_error,
71 "Integration_DivBasisTimesScalar: Basis of type \"" <<
basis->name() <<
"\" should require orientations. So we are throwing.");
73 scalar = PHX::MDField<ScalarT,Cell,IP>( p.get<std::string>(
"Value Name"),
74 p.get< Teuchos::RCP<panzer::IntegrationRule> >(
"IR")->dl_scalar );
77 this->addDependentField(
scalar);
80 if (p.isType<Teuchos::RCP<
const std::vector<std::string> > >(
"Field Multipliers")) {
82 const std::vector<std::string>& field_multiplier_names =
83 *(p.get<Teuchos::RCP<const std::vector<std::string> > >(
"Field Multipliers"));
85 for (std::vector<std::string>::const_iterator name = field_multiplier_names.begin();
86 name != field_multiplier_names.end(); ++name) {
87 PHX::MDField<ScalarT,Cell,IP> tmp_field(*name, p.get< Teuchos::RCP<panzer::IntegrationRule> >(
"IR")->dl_scalar);
94 this->addDependentField(*
field);
97 "Integrator_DivBasisTimesScalar: " +
residual.fieldTag().name();
105 this->utils.setFieldData(
residual,fm);
106 this->utils.setFieldData(
scalar,fm);
111 this->utils.setFieldData(*
field,fm);
127 for (index_t cell = 0; cell < workset.num_cells; ++cell) {
128 for (std::size_t qp = 0; qp <
num_qp; ++qp) {
129 ScalarT tmpVar = 1.0;
132 tmpVar = tmpVar * (*
field)(cell,qp);
143 for (index_t cell = 0; cell < workset.num_cells; ++cell)
145 for (std::size_t qp = 0; qp <
num_qp; ++qp)
161 template<
typename EvalT,
typename TRAITS>
162 Teuchos::RCP<Teuchos::ParameterList>
165 Teuchos::RCP<Teuchos::ParameterList> p = Teuchos::rcp(
new Teuchos::ParameterList);
166 p->set<std::string>(
"Residual Name",
"?");
167 p->set<std::string>(
"Value Name",
"?");
168 p->set<std::string>(
"Test Field Name",
"?");
169 Teuchos::RCP<panzer::BasisIRLayout>
basis;
170 p->set(
"Basis",
basis);
171 Teuchos::RCP<panzer::IntegrationRule> ir;
173 p->set<
double>(
"Multiplier", 1.0);
174 Teuchos::RCP<const std::vector<std::string> > fms;
175 p->set(
"Field Multipliers", fms);
PHX::MDField< ScalarT > residual
Evaluates a Dirichlet BC residual corresponding to a field value.
std::vector< std::string >::size_type getBasisIndex(std::string basis_name, panzer::Workset &workset, WorksetDetailsAccessor &wda)
Returns the index in the workset bases for a particular BasisIRLayout name.
PHX::MDField< ScalarT, Cell > tmp
PHX::MDField< ScalarT > vector
Kokkos::DynRankView< typename InputArray::value_type, PHX::Device > createDynRankView(const InputArray &a, const std::string &name, const DimensionPack... dims)
Wrapper to simplify Panzer use of Sacado ViewFactory.
Teuchos::RCP< Teuchos::ParameterList > getValidParameters() const
PHX_EVALUATOR_CTOR(BasisValues_Evaluator, p)
PHX::MDField< const ScalarT, Cell, IP > field
PHX::MDField< const ScalarT, Cell, IP > scalar
PHX_EVALUATE_FIELDS(BasisValues_Evaluator, workset)
Teuchos::RCP< const panzer::PureBasis > basis
Interpolates basis DOF values to IP DOF values.
Array_CellBasisIP weighted_div_basis
std::vector< PHX::MDField< const ScalarT, Cell, IP > > field_multipliers
PHX_POST_REGISTRATION_SETUP(BasisValues_Evaluator, sd, fm)