43 #ifndef PANZER_DOF_CURL_IMPL_HPP 44 #define PANZER_DOF_CURL_IMPL_HPP 49 #include "Intrepid2_FunctionSpaceTools.hpp" 50 #include "Phalanx_KokkosDeviceTypes.hpp" 57 template <
typename ScalarT,
typename Array,
int spaceDim>
58 class EvaluateCurlWithSens_Vector {
67 typedef typename PHX::Device execution_space;
69 EvaluateCurlWithSens_Vector(PHX::MDField<const ScalarT,Cell,Point> in_dof_value,
70 PHX::MDField<ScalarT,Cell,Point,Dim> in_dof_curl,
77 KOKKOS_INLINE_FUNCTION
78 void operator()(
const unsigned int cell)
const 81 for (
int d=0; d<spaceDim; d++) {
92 template <
typename ScalarT,
typename ArrayT>
93 void evaluateCurl_withSens_vector(
int numCells,
94 PHX::MDField<ScalarT,Cell,Point,Dim> &
dof_curl,
95 PHX::MDField<const ScalarT,Cell,Point> &
dof_value,
104 for (
int cell=0; cell<numCells; cell++) {
106 for (
int d=0; d<spaceDim; d++) {
119 template <
typename ScalarT,
typename Array>
120 class EvaluateCurlWithSens_Scalar {
121 PHX::MDField<const ScalarT,Cell,Point>
dof_value;
122 PHX::MDField<ScalarT,Cell,Point>
dof_curl;
129 typedef typename PHX::Device execution_space;
131 EvaluateCurlWithSens_Scalar(PHX::MDField<const ScalarT,Cell,Point> in_dof_value,
132 PHX::MDField<ScalarT,Cell,Point> in_dof_curl,
139 KOKKOS_INLINE_FUNCTION
140 void operator()(
const unsigned int cell)
const 152 template <
typename ScalarT,
typename ArrayT>
153 void evaluateCurl_withSens_scalar(
int numCells,
154 PHX::MDField<ScalarT,Cell,Point> &
dof_curl,
155 PHX::MDField<const ScalarT,Cell,Point> &
dof_value,
163 for (
int cell=0; cell<numCells; cell++) {
176 template <
typename ScalarT,
typename Array,
int spaceDim>
177 class EvaluateCurlFastSens_Vector {
178 PHX::MDField<const ScalarT,Cell,Point>
dof_value;
179 PHX::MDField<ScalarT,Cell,Point,Dim>
dof_curl;
187 typedef typename PHX::Device execution_space;
189 EvaluateCurlFastSens_Vector(PHX::MDField<const ScalarT,Cell,Point> in_dof_value,
190 PHX::MDField<ScalarT,Cell,Point,Dim> in_dof_curl,
191 Kokkos::View<const int*,PHX::Device> in_offsets,
198 KOKKOS_INLINE_FUNCTION
199 void operator()(
const unsigned int cell)
const 202 for (
int d=0; d<spaceDim; d++) {
215 template <
typename ScalarT,
typename ArrayT>
216 void evaluateCurl_fastSens_vector(
int numCells,
217 PHX::MDField<ScalarT,Cell,Point,Dim> &
dof_curl,
218 PHX::MDField<const ScalarT,Cell,Point> &
dof_value,
219 const std::vector<int> &
offsets,
227 for (
int cell=0; cell<numCells; cell++) {
229 for (
int d=0; d<spaceDim; d++) {
245 template <
typename ScalarT,
typename Array>
246 class EvaluateCurlFastSens_Scalar {
247 PHX::MDField<const ScalarT,Cell,Point>
dof_value;
248 PHX::MDField<ScalarT,Cell,Point>
dof_curl;
249 Kokkos::View<const int*,PHX::Device>
offsets;
256 typedef typename PHX::Device execution_space;
258 EvaluateCurlFastSens_Scalar(PHX::MDField<const ScalarT,Cell,Point> in_dof_value,
259 PHX::MDField<ScalarT,Cell,Point> in_dof_curl,
260 Kokkos::View<const int*,PHX::Device> in_offsets,
267 KOKKOS_INLINE_FUNCTION
268 void operator()(
const unsigned int cell)
const 282 template <
typename ScalarT,
typename ArrayT>
283 void evaluateCurl_fastSens_scalar(
int numCells,
284 PHX::MDField<ScalarT,Cell,Point> &
dof_curl,
285 PHX::MDField<const ScalarT,Cell,Point> &
dof_value,
286 const std::vector<int> &
offsets,
293 for (
int cell=0; cell<numCells; cell++) {
317 template<
typename EvalT,
typename TRAITS>
320 use_descriptors_(false),
330 "DOFCurl: Basis of type \"" << basis->name() <<
"\" does not support CURL");
332 "DOFCurl: Basis of type \"" << basis->name() <<
"\" in DOF Curl should require orientations. So we are throwing.");
342 dof_curl_vector = PHX::MDField<ScalarT,Cell,Point,Dim>(p.
get<std::string>(
"Curl Name"),
357 template<
typename EvalT,
typename TRAITS>
360 const PHX::FieldTag & output,
364 : use_descriptors_(true)
393 template<
typename EvalT,
typename TRAITS>
399 if(basis_dimension==3)
400 this->utils.setFieldData(dof_curl_vector,fm);
402 this->utils.setFieldData(dof_curl_scalar,fm);
404 if(not use_descriptors_)
409 template<
typename EvalT,
typename TRAITS>
414 : *this->wda(workset).bases[basis_index];
416 if(basis_dimension==3) {
417 EvaluateCurlWithSens_Vector<ScalarT,typename BasisValues2<double>::Array_CellBasisIPDim,3> functor(
dof_value,dof_curl_vector,basisValues.
curl_basis_vector);
418 Kokkos::parallel_for(workset.num_cells,functor);
421 EvaluateCurlWithSens_Scalar<ScalarT,typename BasisValues2<double>::Array_CellBasisIP> functor(
dof_value,dof_curl_scalar,basisValues.
curl_basis_scalar);
422 Kokkos::parallel_for(workset.num_cells,functor);
433 template<
typename TRAITS>
436 use_descriptors_(false),
450 Kokkos::View<int*,PHX::Device> offsets_array_nc
451 = Kokkos::View<int*,PHX::Device>(
"offsets",
offsets.size());
452 for(std::size_t i=0;i<
offsets.size();i++)
453 offsets_array_nc(i) =
offsets[i];
454 offsets_array = offsets_array_nc;
456 accelerate_jacobian =
true;
459 accelerate_jacobian =
false;
463 "DOFCurl: Basis of type \"" << basis->name() <<
"\" does not support CURL");
465 "DOFCurl: Basis of type \"" << basis->name() <<
"\" in DOF Curl should require orientations. So we are throwing.");
475 dof_curl_vector = PHX::MDField<ScalarT,Cell,Point,Dim>(p.
get<std::string>(
"Curl Name"),
490 template<
typename TRAITS>
493 const PHX::FieldTag & output,
497 : use_descriptors_(true)
506 accelerate_jacobian =
false;
528 template<
typename TRAITS>
543 template<
typename TRAITS>
550 if(!accelerate_jacobian) {
553 Kokkos::parallel_for(workset.num_cells,functor);
557 Kokkos::parallel_for(workset.num_cells,functor);
566 Kokkos::parallel_for(workset.num_cells,functor);
570 Kokkos::parallel_for(workset.num_cells,functor);
void postRegistrationSetup(typename TRAITS::SetupData d, PHX::FieldManager< TRAITS > &fm)
panzer::BasisDescriptor bd_
T & get(const std::string &name, T def_value)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Array_CellBasisIPDim curl_basis_vector
PHX::MDField< ScalarT, Cell, Point > dof_curl_scalar
PHX::MDField< ScalarT, Cell, Point, Dim > dof_curl_vector
Teuchos::RCP< PHX::DataLayout > dl_scalar
Data layout for scalar fields.
bool isType(const std::string &name) const
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.
DOFCurl(const Teuchos::ParameterList &p)
Teuchos::RCP< PHX::DataLayout > dl_vector
Data layout for vector fields.
panzer::IntegrationDescriptor id_
WorksetDetailsAccessor wda
#define TEUCHOS_ASSERT(assertion_test)
void evaluateFields(typename TRAITS::EvalData d)
PHX::MDField< const ScalarT, Cell, Point > dof_value
PHX::MDField< ScalarT, Cell, Point, Dim > dof_curl
const std::string & getType() const
Get type of basis.
Kokkos::View< const int *, PHX::Device > offsets
PHX::MDField< const ScalarT, Cell, Point > dof_value
Array_CellBasisIP curl_basis_scalar