43 #ifndef __Panzer_Integerator_BasisTimesTensorTimesVector_impl_hpp__
44 #define __Panzer_Integerator_BasisTimesTensorTimesVector_impl_hpp__
64 template<
typename EvalT,
typename Traits>
68 const std::string& resName,
69 const std::string& valName,
72 const std::string& tensorName)
74 evalStyle_(evalStyle),
75 useDescriptors_(false),
76 basisName_(basis.name())
85 using PHX::typeAsString;
86 using std::invalid_argument;
87 using std::logic_error;
93 "Integrator_BasisTimesTensorTimesVector called with an empty residual name.")
95 "Integrator_BasisTimesTensorTimesVector called with an empty value name.")
98 "Error: Integrator_BasisTimesTensorTimesVector: Basis of type \""
99 << tmpBasis->name() <<
"\" is not a vector basis.");
101 logic_error,
"Integrator_BasisTimesTensorTimesVector: Basis of type \""
102 << tmpBasis->name() <<
"\" does not require orientations. This seems " \
103 "very strange, so I'm failing.");
107 this->addDependentField(vector_);
113 this->addContributedField(
field_);
115 this->addEvaluatedField(
field_);
118 tensor_ = MDField<const ScalarT, Cell, IP, Dim, Dim>(tensorName, ir.
dl_tensor);
119 this->addDependentField(
tensor_);
122 string n(
"Integrator_BasisTimesTensorTimesVector (");
127 n +=
", " + typeAsString<EvalT>() +
"): " +
field_.fieldTag().name();
136 template<
typename EvalT,
typename Traits>
140 const PHX::FieldTag& resTag,
141 const PHX::FieldTag& valTag,
144 const PHX::FieldTag& tensorTag)
146 evalStyle_(evalStyle),
147 useDescriptors_(true),
158 using PHX::typeAsString;
159 using std::invalid_argument;
160 using std::logic_error;
166 (
bd_.
getType() ==
"HDiv")), logic_error,
"Error: " \
167 "Integrator_BasisTimesTensorTimesVector: Basis of type \"" <<
bd_.
getType()
168 <<
"\" is not a vector basis.")
172 this->addDependentField(
vector_);
178 this->addContributedField(
field_);
180 this->addEvaluatedField(
field_);
184 this->addDependentField(
tensor_);
187 string n(
"Integrator_BasisTimesTensorTimesVector (");
192 n +=
", " + typeAsString<EvalT>() +
"): " +
field_.fieldTag().name();
201 template<
typename EvalT,
typename Traits>
208 p.get<std::string>(
"Residual Name"),
209 p.get<std::string>(
"Value Name"),
212 p.get<std::string>(
"Tensor Name"))
227 template<
typename EvalT,
typename Traits>
238 kokkosTensor_ = tensor_.get_static_view();
242 numQP_ = vector_.extent(1);
243 numDim_ = vector_.extent(2);
246 if (not useDescriptors_)
255 template<
typename EvalT,
typename Traits>
256 KOKKOS_INLINE_FUNCTION
260 const size_t& cell)
const
265 const int numBases(basis_.extent(1));
267 for (
int basis(0); basis < numBases; ++basis)
268 field_(cell, basis) = 0.0;
274 for (
int qp(0); qp < numQP_; ++qp)
276 for (
int dim(0); dim < numDim_; ++dim)
279 for (
int dim2(0); dim2 < numDim_; ++dim2)
280 tmp += kokkosTensor_(cell, qp, dim, dim2) * vector_(cell, qp, dim2);
281 for (
int basis(0); basis < numBases; ++basis)
282 field_(cell, basis) += basis_(cell, basis, qp, dim) * tmp;
292 template<
typename EvalT,
typename Traits>
298 using Kokkos::parallel_for;
299 using Kokkos::RangePolicy;
303 this->wda(workset).getBasisValues(bd_,id_) :
304 *this->wda(workset).bases[basisIndex_];
307 parallel_for(RangePolicy<>(0, workset.
num_cells), *
this);
315 template<
typename EvalT,
typename Traits>
330 p->set<
string>(
"Residual Name",
"?");
331 p->set<
string>(
"Value Name",
"?");
333 p->set(
"Basis", basis);
336 p->set<std::string>(
"Tensor Name",
"?");
342 #endif // __Panzer_Integerator_BasisTimesTensorTimesVector_impl_hpp__
Teuchos::RCP< Teuchos::ParameterList > getValidParameters() const
Get Valid Parameters.
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...
Teuchos::RCP< PHX::DataLayout > dl_tensor
Data layout for rank-2 tensor fields.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Integrator_BasisTimesTensorTimesVector(const panzer::EvaluatorStyle &evalStyle, const std::string &resName, const std::string &valName, const panzer::BasisIRLayout &basis, const panzer::IntegrationRule &ir, const std::string &tensorName)
Main Constructor.
void operator()(const std::size_t &cell) const
Perform the integration.
EvaluatorStyle
An indication of how an Evaluator will behave.
void postRegistrationSetup(typename Traits::SetupData sd, PHX::FieldManager< Traits > &fm)
Post-Registration Setup.
Teuchos::RCP< const PureBasis > getBasis() const
PHX::MDField< const ScalarT, panzer::Cell, panzer::IP, panzer::Dim > vector_
A field representing the vector-valued function we're integrating ( ).
void evaluateFields(typename Traits::EvalData workset)
Evaluate Fields.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
const std::string & getType() const
Get type of basis.
PHX::MDField< const ScalarT, panzer::Cell, panzer::IP, panzer::Dim, panzer::Dim > tensor_
The tensor field( ).
BasisDescriptor bd_
The BasisDescriptor for the basis to use.
panzer::EvaluatorStyle evalStyle
The EvaluatorStyle of the parent Integrator_CurlBasisDotVector object.
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.
typename EvalT::ScalarT ScalarT
The scalar type.
void validateParameters(ParameterList const &validParamList, int const depth=1000, EValidateUsed const validateUsed=VALIDATE_USED_ENABLED, EValidateDefaults const validateDefaults=VALIDATE_DEFAULTS_ENABLED) const
Array_CellBasisIPDim weighted_basis_vector
Teuchos::RCP< PHX::DataLayout > dl_vector
Data layout for vector fields.
Description and data layouts associated with a particular basis.
Teuchos::RCP< PHX::DataLayout > functional
<Cell,Basis>
Teuchos::RCP< const std::vector< panzer::Workset > > worksets_