43 #ifndef PANZER_EVALUATOR_CURLBASISDOTVECTOR_IMPL_HPP 44 #define PANZER_EVALUATOR_CURLBASISDOTVECTOR_IMPL_HPP 46 #include "Intrepid2_FunctionSpaceTools.hpp" 51 #include "Phalanx_KokkosDeviceTypes.hpp" 62 p.validateParameters(*valid_params);
69 "Integrator_CurlBasisDotVector: Basis of type \"" <<
basis->
name() <<
"\" does not support CURL.");
71 "Integration_CurlBasisDotVector: Basis of type \"" <<
basis->
name() <<
"\" should require orientations. So we are throwing.");
73 "Integrator_CurlBasisDotVector: Evaluator requires 2D or 3D basis types, the basis \"" <<
basis->
name() <<
"\" is neither.");
80 flux_vector = PHX::MDField<const ScalarT,Cell,IP,Dim>( p.get<std::string>(
"Value Name"),
85 flux_scalar = PHX::MDField<const ScalarT,Cell,IP>( p.get<std::string>(
"Value Name"),
93 if (p.isType<
Teuchos::RCP<
const std::vector<std::string> > >(
"Field Multipliers"))
95 const std::vector<std::string>& field_multiplier_names =
98 for (std::vector<std::string>::const_iterator name = field_multiplier_names.begin();
99 name != field_multiplier_names.end(); ++name)
108 this->addDependentField(*
field);
111 "Integrator_CurlBasisDotVector: " +
residual.fieldTag().name();
120 this->utils.setFieldData(
residual,fm);
125 this->utils.setFieldData(*
field,fm);
155 template <
typename ScalarT>
156 class FillScratchVector {
158 typedef typename PHX::Device execution_space;
168 PHX::MDField<const ScalarT,Cell,IP>
field;
170 struct Initialize {};
171 struct FieldMultipliers {};
173 KOKKOS_INLINE_FUNCTION
174 void operator()(
const Initialize,
const unsigned cell)
const 176 for (std::size_t qp = 0; qp <
scratch.dimension_1(); ++qp)
177 for (std::size_t d = 0; d <
scratch.dimension_2(); ++d)
181 KOKKOS_INLINE_FUNCTION
182 void operator()(
const FieldMultipliers,
const unsigned cell)
const 184 for (std::size_t qp = 0; qp <
scratch.dimension_1(); ++qp)
185 for (std::size_t d = 0; d <
scratch.dimension_2(); ++d)
190 template <
typename ScalarT>
191 class FillScratchScalar {
193 typedef typename PHX::Device execution_space;
196 PHX::MDField<ScalarT,Cell,IP>
scratch;
203 PHX::MDField<const ScalarT,Cell,IP>
field;
205 struct Initialize {};
206 struct FieldMultipliers {};
208 KOKKOS_INLINE_FUNCTION
209 void operator()(
const Initialize,
const unsigned cell)
const 211 for (std::size_t qp = 0; qp <
scratch.dimension_1(); ++qp)
215 KOKKOS_INLINE_FUNCTION
216 void operator()(
const FieldMultipliers,
const unsigned cell)
const 218 for (std::size_t qp = 0; qp <
scratch.dimension_1(); ++qp)
223 template <
typename ScalarT,
int spaceDim>
224 class IntegrateValuesVector {
226 typedef typename PHX::Device execution_space;
227 PHX::MDField<ScalarT,Cell,IP,Dim>
scratch;
230 KOKKOS_INLINE_FUNCTION
236 for (
int d = 0; d < spaceDim; d++) {
244 template <
typename ScalarT>
245 class IntegrateValuesScalar {
247 typedef typename PHX::Device execution_space;
248 PHX::MDField<ScalarT,Cell,IP>
scratch;
249 PHX::MDField<ScalarT,Cell,BASIS>
residual;
251 KOKKOS_INLINE_FUNCTION
271 typedef FillScratchVector<ScalarT> FillScratch;
272 FillScratch fillScratch;
278 Kokkos::parallel_for(Kokkos::RangePolicy<PHX::Device,typename FillScratch::Initialize>(0,workset.num_cells), fillScratch);
283 fillScratch.field = *
field;
285 Kokkos::parallel_for(Kokkos::RangePolicy<PHX::Device,typename FillScratch::FieldMultipliers>(0,workset.num_cells), fillScratch);
289 IntegrateValuesVector<ScalarT,3> intValues;
294 Kokkos::parallel_for(workset.num_cells, intValues);
297 typedef FillScratchScalar<ScalarT> FillScratch;
298 FillScratch fillScratch;
304 Kokkos::parallel_for(Kokkos::RangePolicy<PHX::Device,typename FillScratch::Initialize>(0,workset.num_cells), fillScratch);
309 fillScratch.field = *
field;
311 Kokkos::parallel_for(Kokkos::RangePolicy<PHX::Device,typename FillScratch::FieldMultipliers>(0,workset.num_cells), fillScratch);
315 IntegrateValuesScalar<ScalarT> intValues;
320 Kokkos::parallel_for(workset.num_cells, intValues);
326 for (index_t cell = 0; cell < workset.num_cells; ++cell)
328 for (std::size_t qp = 0; qp <
num_qp; ++qp)
330 ScalarT tmpVar = 1.0;
335 tmpVar = tmpVar * (*
field)(cell,qp);
339 for (std::size_t dim = 0; dim <
num_dim; ++dim)
352 for (index_t cell = 0; cell < workset.num_cells; ++cell)
355 for (std::size_t qp = 0; qp <
num_qp; ++qp)
356 for (std::size_t dim = 0; dim <
num_dim; ++dim)
364 for (index_t cell = 0; cell < workset.num_cells; ++cell)
367 for (std::size_t qp = 0; qp <
num_qp; ++qp)
377 template<
typename EvalT,
typename TRAITS>
382 p->
set<std::string>(
"Residual Name",
"?");
383 p->
set<std::string>(
"Value Name",
"?");
384 p->
set<std::string>(
"Test Field Name",
"?");
389 p->
set<
double>(
"Multiplier", 1.0);
391 p->
set(
"Field Multipliers", fms);
PHX::MDField< ScalarT > residual
Evaluates a Dirichlet BC residual corresponding to a field value.
Array_CellBasisIPDim weighted_curl_basis_vector
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< Scalar, T0 > buildStaticArray(const std::string &str, int d0) const
std::string name() const
A unique key that is the combination of the basis type and basis order.
PHX::MDField< ScalarT, Cell, IP, Dim > scratch_vector
PHX::MDField< const ScalarT, Cell, IP, Dim > flux_vector
ParameterList & set(std::string const &name, T const &value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
PHX::MDField< ScalarT, Cell, IP, Dim > vectorField
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
PHX::MDField< double, Cell, BASIS, IP, Dim > weighted_curl_basis
void operator()(const FieldMultTag< NUM_FIELD_MULT > &, const std::size_t &cell) const
PHX::MDField< const ScalarT, Cell, IP > flux_scalar
PHX::MDField< ScalarT > vector
bool requiresOrientations() const
PHX::MDField< ScalarT, Cell, IP, Dim > scratch
Teuchos::RCP< Teuchos::ParameterList > getValidParameters() const
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Teuchos::RCP< PHX::DataLayout > dl_scalar
Data layout for scalar fields.
int dimension() const
Returns the dimension of the basis from the topology.
PHX_EVALUATOR_CTOR(BasisValues_Evaluator, p)
PHX::MDField< const ScalarT, Cell, IP > field
Array_CellBasisIP weighted_curl_basis_scalar
PHX_EVALUATE_FIELDS(BasisValues_Evaluator, workset)
PHX::MDField< ScalarT, Cell, IP > scratch_scalar
Teuchos::RCP< PHX::DataLayout > dl_vector
Data layout for vector fields.
Teuchos::RCP< const panzer::PureBasis > basis
Interpolates basis DOF values to IP DOF values.
std::vector< PHX::MDField< const ScalarT, Cell, IP > > field_multipliers
PHX_POST_REGISTRATION_SETUP(BasisValues_Evaluator, sd, fm)
bool supportsCurl() const