11#ifndef PANZER_EVALUATOR_TRANSIENT_BASISTIMESSCALAR_IMPL_HPP
12#define PANZER_EVALUATOR_TRANSIENT_BASISTIMESSCALAR_IMPL_HPP
14#include "Intrepid2_FunctionSpaceTools.hpp"
18#include "Kokkos_ViewFactory.hpp"
23template<
typename EvalT,
typename Traits>
26 const Teuchos::ParameterList& p) :
27 residual( p.get<
std::string>(
"Residual Name"),
29 scalar( p.get<
std::string>(
"Value Name"),
34 p.validateParameters(*valid_params);
36 Teuchos::RCP<const PureBasis> basis
37 = p.get< Teuchos::RCP<BasisIRLayout> >(
"Basis")->getBasis();
40 TEUCHOS_TEST_FOR_EXCEPTION(!basis->isScalarBasis(),std::logic_error,
41 "Integrator_TransientBasisTimesScalar: Basis of type \"" << basis->name() <<
"\" is not a "
45 this->addDependentField(
scalar);
50 if (p.isType<Teuchos::RCP<
const std::vector<std::string> > >(
"Field Multipliers")) {
51 const std::vector<std::string>& field_multiplier_names =
52 *(p.get<Teuchos::RCP<const std::vector<std::string> > >(
"Field Multipliers"));
54 for (std::vector<std::string>::const_iterator name =
55 field_multiplier_names.begin();
56 name != field_multiplier_names.end(); ++name) {
57 PHX::MDField<const ScalarT,Cell,IP> tmp_field(*name, p.get< Teuchos::RCP<panzer::IntegrationRule> >(
"IR")->dl_scalar);
62 for (
typename std::vector<PHX::MDField<const ScalarT,Cell,IP> >::iterator
field =
field_multipliers.begin();
64 this->addDependentField(*
field);
66 std::string n =
"Integrator_TransientBasisTimesScalar: " +
residual.fieldTag().name();
71template<
typename EvalT,
typename Traits>
78 this->utils.setFieldData(residual,fm);
79 this->utils.setFieldData(scalar,fm);
81 num_nodes = residual.extent(1);
82 num_qp = scalar.extent(1);
86 tmp = Kokkos::createDynRankView(residual.get_static_view(),
"tmp",scalar.extent(0), num_qp);
90template<
typename EvalT,
typename Traits>
101 Kokkos::deep_copy (residual.get_static_view(),
ScalarT(0.0));
103 for (index_t cell = 0; cell < workset.
num_cells; ++cell) {
104 for (std::size_t qp = 0; qp < num_qp; ++qp) {
106 for (
typename std::vector<PHX::MDField<const ScalarT,Cell,IP> >::iterator
field = field_multipliers.begin();
108 tmp(cell,qp) = tmp(cell,qp) * (*field)(cell,qp);
113 Intrepid2::FunctionSpaceTools<PHX::exec_space>::
114 integrate<ScalarT>(residual.get_view(),
116 (this->wda(workset).bases[basis_index])->weighted_basis_scalar.get_view());
121template<
typename EvalT,
typename TRAITS>
122Teuchos::RCP<Teuchos::ParameterList>
125 Teuchos::RCP<Teuchos::ParameterList> p = Teuchos::rcp(
new Teuchos::ParameterList);
126 p->set<std::string>(
"Residual Name",
"?");
127 p->set<std::string>(
"Value Name",
"?");
128 Teuchos::RCP<panzer::BasisIRLayout> basis;
129 p->set(
"Basis", basis);
130 Teuchos::RCP<panzer::IntegrationRule> ir;
132 p->set<
double>(
"Multiplier", 1.0);
133 Teuchos::RCP<const std::vector<std::string> > fms;
134 p->set(
"Field Multipliers", fms);
double multiplier
The scalar multiplier out in front of the integral ( ).
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.
std::vector< PHX::MDField< const ScalarT, Cell, IP > > field_multipliers
void postRegistrationSetup(typename Traits::SetupData d, PHX::FieldManager< Traits > &fm)
Looks up the basis index needed by evaluateFields(). Called once before the first evaluation.
typename EvalT::ScalarT ScalarT
Integrator_TransientBasisTimesScalar(const Teuchos::ParameterList &p)
Construct from a ParameterList specifying the residual field name, integrand name,...
PHX::MDField< ScalarT, Cell, BASIS > residual
PHX::MDField< const ScalarT, Cell, IP > scalar
Teuchos::RCP< Teuchos::ParameterList > getValidParameters() const
Returns the ParameterList of valid parameters/defaults for this evaluator's constructor.
void evaluateFields(typename Traits::EvalData d)
Computes the residual field for this workset per the class description, when the workset indicates tr...
int num_cells
DEPRECATED - use: numCells()
bool evaluate_transient_terms
std::vector< std::string >::size_type getBasisIndex(std::string basis_name, const panzer::Workset &workset, WorksetDetailsAccessor &wda)
Returns the index in the workset bases for a particular BasisIRLayout name.
User-defined data passed to PHX::Evaluator::postRegistrationSetup() during the one-time setup phase.
Teuchos::RCP< const std::vector< panzer::Workset > > worksets_
All worksets that will be evaluated over the lifetime of this evaluator.