43 #include "PanzerDiscFE_config.hpp" 47 #include "Kokkos_ViewFactory.hpp" 50 #include "Intrepid2_Utils.hpp" 51 #include "Intrepid2_FunctionSpaceTools.hpp" 52 #include "Intrepid2_Orientation.hpp" 53 #include "Intrepid2_OrientationTools.hpp" 58 template<
typename Scalar>
60 applyOrientationsImpl(
const int num_cells,
61 Kokkos::DynRankView<Scalar, PHX::Device> view,
62 Kokkos::DynRankView<Intrepid2::Orientation, PHX::Device> orientations,
65 using ots=Intrepid2::OrientationTools<PHX::Device>;
67 auto sub_orientations = Kokkos::subview(orientations, std::make_pair(0,num_cells));
72 auto sub_view = Kokkos::subview(view, std::make_pair(0,num_cells), Kokkos::ALL(), Kokkos::ALL());
73 auto sub_view_clone =
Kokkos::createDynRankView(view,
"sub_view_clone", sub_view.extent(0), sub_view.extent(1), sub_view.extent(2));
74 Kokkos::deep_copy(sub_view_clone, sub_view);
77 ots::modifyBasisByOrientation(sub_view, sub_view_clone, sub_orientations, &basis);
78 }
else if (view.rank() == 4){
80 auto sub_view = Kokkos::subview(view, std::make_pair(0,num_cells), Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL());
81 auto sub_view_clone =
Kokkos::createDynRankView(view,
"sub_view_clone", sub_view.extent(0), sub_view.extent(1), sub_view.extent(2), sub_view.extent(3));
82 Kokkos::deep_copy(sub_view_clone, sub_view);
85 ots::modifyBasisByOrientation(sub_view, sub_view_clone, sub_orientations, &basis);
87 throw std::logic_error(
"applyOrientationsImpl : Unknown view of rank " + std::to_string(view.rank()));
90 template<
typename Scalar>
92 applyOrientationsImpl(
const int num_cells,
93 Kokkos::DynRankView<Scalar, PHX::Device> view,
94 const std::vector<Intrepid2::Orientation> & orientations,
99 Kokkos::DynRankView<Intrepid2::Orientation,PHX::Device> device_orientations(
"drv_orts", num_cells);
100 auto host_orientations = Kokkos::create_mirror_view(device_orientations);
101 for(
int i=0; i < num_cells; ++i)
102 host_orientations(i) = orientations[i];
103 Kokkos::deep_copy(device_orientations,host_orientations);
106 applyOrientationsImpl(num_cells, view, device_orientations, basis);
112 template <
typename Scalar>
115 const bool allocArrays,
116 const bool buildWeighted)
117 : compute_derivatives(true)
118 , build_weighted(buildWeighted)
119 , alloc_arrays(allocArrays)
122 , references_evaluated(false)
123 , orientations_applied_(false)
125 , num_evaluate_cells_(0)
152 template <
typename Scalar>
155 const PHX::MDField<Scalar,Cell,IP,Dim,Dim> &
jac,
156 const PHX::MDField<Scalar,Cell,IP> & jac_det,
157 const PHX::MDField<Scalar,Cell,IP,Dim,Dim> & jac_inv,
158 const int in_num_cells)
161 build_weighted =
false;
163 setupUniform(basis_layout, cub_points,
jac, jac_det, jac_inv, in_num_cells);
165 const auto elmtspace = getElementSpace();
166 const int num_dims =
jac.extent(2);
170 getBasisValuesRef(
true,
true);
173 getVectorBasisValuesRef(
true,
true);
176 getGradBasisValuesRef(
true,
true);
180 getCurl2DVectorBasisRef(
true,
true);
181 else if(num_dims == 3)
182 getCurlVectorBasisRef(
true,
true);
186 getDivVectorBasisRef(
true,
true);
188 references_evaluated =
true;
192 getBasisValues(
false,
true,
true);
195 getVectorBasisValues(
false,
true,
true);
198 getGradBasisValues(
false,
true,
true);
202 getCurl2DVectorBasis(
false,
true,
true);
203 else if(num_dims == 3)
204 getCurlVectorBasis(
false,
true,
true);
208 getDivVectorBasis(
false,
true,
true);
211 orientations_applied_ = orientations_ != Teuchos::null;
214 template <
typename Scalar>
217 const PHX::MDField<Scalar,Cell,IP,Dim,Dim> &
jac,
218 const PHX::MDField<Scalar,Cell,IP> & jac_det,
219 const PHX::MDField<Scalar,Cell,IP,Dim,Dim> & jac_inv,
220 const PHX::MDField<Scalar,Cell,IP> & weighted_measure,
221 const PHX::MDField<Scalar,Cell,NODE,Dim> & vertex_coordinates,
222 bool use_vertex_coordinates,
223 const int in_num_cells)
227 evaluateValues(cub_points,
jac, jac_det, jac_inv, in_num_cells);
228 if(weighted_measure.size() > 0)
229 setWeightedMeasure(weighted_measure);
231 cell_vertex_coordinates_ = vertex_coordinates;
235 const auto elmtspace = getElementSpace();
236 const int num_dims =
jac.extent(2);
239 getBasisValues(
true,
true,
true);
242 getVectorBasisValues(
true,
true,
true);
245 getGradBasisValues(
true,
true,
true);
249 getCurl2DVectorBasis(
true,
true,
true);
250 else if(num_dims == 3)
251 getCurlVectorBasis(
true,
true,
true);
255 getDivVectorBasis(
true,
true,
true);
258 if(use_vertex_coordinates){
259 getBasisCoordinatesRef(
true,
true);
260 getBasisCoordinates(
true,
true);
264 orientations_applied_ = orientations_ != Teuchos::null;
267 template <
typename Scalar>
270 const PHX::MDField<Scalar,Cell,IP,Dim,Dim> &
jac,
271 const PHX::MDField<Scalar,Cell,IP> & jac_det,
272 const PHX::MDField<Scalar,Cell,IP,Dim,Dim> & jac_inv,
273 const PHX::MDField<Scalar,Cell,IP> & weighted_measure,
274 const PHX::MDField<Scalar,Cell,NODE,Dim> & vertex_coordinates,
275 bool use_vertex_coordinates,
276 const int in_num_cells)
279 cell_vertex_coordinates_ = vertex_coordinates;
281 setup(basis_layout, cub_points,
jac, jac_det, jac_inv, in_num_cells);
282 if(weighted_measure.size() > 0)
283 setWeightedMeasure(weighted_measure);
285 const auto elmtspace = getElementSpace();
286 const int num_dims =
jac.extent(2);
289 getBasisValues(
false,
true,
true);
290 if(build_weighted) getBasisValues(
true,
true,
true);
294 getVectorBasisValues(
false,
true,
true);
295 if(build_weighted) getVectorBasisValues(
true,
true,
true);
299 getGradBasisValues(
false,
true,
true);
300 if(build_weighted) getGradBasisValues(
true,
true,
true);
305 getCurl2DVectorBasis(
false,
true,
true);
306 if(build_weighted) getCurl2DVectorBasis(
true,
true,
true);
307 }
else if(num_dims == 3) {
308 getCurlVectorBasis(
false,
true,
true);
309 if(build_weighted) getCurlVectorBasis(
true,
true,
true);
314 getDivVectorBasis(
false,
true,
true);
315 if(build_weighted) getDivVectorBasis(
true,
true,
true);
319 if(use_vertex_coordinates){
320 getBasisCoordinatesRef(
true,
true);
321 getBasisCoordinates(
true,
true);
325 orientations_applied_ = orientations_ != Teuchos::null;
329 template <
typename Scalar>
332 const PHX::MDField<Scalar,Cell,IP,Dim,Dim> &
jac,
333 const PHX::MDField<Scalar,Cell,IP> & jac_det,
334 const PHX::MDField<Scalar,Cell,IP,Dim,Dim> & jac_inv)
337 PHX::MDField<Scalar,Cell,IP> weighted_measure;
338 PHX::MDField<Scalar,Cell,NODE,Dim> vertex_coordinates;
339 evaluateValues(cub_points,
jac,jac_det,jac_inv,weighted_measure,vertex_coordinates,
false,
jac.extent(0));
343 template <
typename Scalar>
346 const PHX::MDField<Scalar,Cell,IP,Dim,Dim> &
jac,
347 const PHX::MDField<Scalar,Cell,IP> & jac_det,
348 const PHX::MDField<Scalar,Cell,IP,Dim,Dim> & jac_inv,
349 const PHX::MDField<Scalar,Cell,NODE,Dim> & vertex_coordinates,
350 bool use_vertex_coordinates,
351 const int in_num_cells)
353 PHX::MDField<Scalar,Cell,IP> weighted_measure;
354 evaluateValues(cell_cub_points,
jac,jac_det,jac_inv,weighted_measure,vertex_coordinates,use_vertex_coordinates,in_num_cells);
357 template <
typename Scalar>
360 const int in_num_cells)
362 num_evaluate_cells_ = in_num_cells < 0 ? vertex_coordinates.extent(0) : in_num_cells;
363 cell_vertex_coordinates_ = vertex_coordinates;
365 getBasisCoordinates(
true,
true);
369 template <
typename Scalar>
372 const int in_num_cells)
374 if (!intrepid_basis->requireOrientation())
378 TEUCHOS_ASSERT(not orientations_applied_);
382 const int num_cell_basis_layout = in_num_cells < 0 ? basis_layout->numCells() : in_num_cells;
383 const int num_cell_orientation = orientations.size();
384 const int num_cells = num_cell_basis_layout < num_cell_orientation ? num_cell_basis_layout : num_cell_orientation;
385 const int num_dim = basis_layout->dimension();
388 Kokkos::DynRankView<Intrepid2::Orientation,PHX::Device> device_orientations(
"device_orientations", num_cells);
389 auto host_orientations = Kokkos::create_mirror_view(device_orientations);
390 for(
int i=0; i < num_cells; ++i)
391 host_orientations(i) = orientations[i];
392 Kokkos::deep_copy(device_orientations,host_orientations);
395 applyOrientationsImpl<Scalar>(num_cells, basis_scalar.get_view(), device_orientations, *intrepid_basis);
396 if(build_weighted) applyOrientationsImpl<Scalar>(num_cells, weighted_basis_scalar.get_view(), device_orientations, *intrepid_basis);
397 if(compute_derivatives) applyOrientationsImpl<Scalar>(num_cells, grad_basis.get_view(), device_orientations, *intrepid_basis);
398 if(compute_derivatives and build_weighted) applyOrientationsImpl<Scalar>(num_cells, weighted_grad_basis.get_view(), device_orientations, *intrepid_basis);
402 applyOrientationsImpl<Scalar>(num_cells, basis_vector.get_view(), device_orientations, *intrepid_basis);
403 if(build_weighted) applyOrientationsImpl<Scalar>(num_cells, weighted_basis_vector.get_view(), device_orientations, *intrepid_basis);
405 if(compute_derivatives) applyOrientationsImpl<Scalar>(num_cells, curl_basis_scalar.get_view(), device_orientations, *intrepid_basis);
406 if(compute_derivatives and build_weighted) applyOrientationsImpl<Scalar>(num_cells, weighted_curl_basis_scalar.get_view(), device_orientations, *intrepid_basis);
409 if(compute_derivatives) applyOrientationsImpl<Scalar>(num_cells, curl_basis_vector.get_view(), device_orientations, *intrepid_basis);
410 if(compute_derivatives and build_weighted) applyOrientationsImpl<Scalar>(num_cells, weighted_curl_basis_vector.get_view(), device_orientations, *intrepid_basis);
415 applyOrientationsImpl<Scalar>(num_cells, basis_vector.get_view(), device_orientations, *intrepid_basis);
416 if(build_weighted) applyOrientationsImpl<Scalar>(num_cells, weighted_basis_vector.get_view(), device_orientations, *intrepid_basis);
417 if(compute_derivatives) applyOrientationsImpl<Scalar>(num_cells, div_basis.get_view(), device_orientations, *intrepid_basis);
418 if(compute_derivatives and build_weighted) applyOrientationsImpl<Scalar>(num_cells, weighted_div_basis.get_view(), device_orientations, *intrepid_basis);
421 orientations_applied_ =
true;
425 template <
typename Scalar>
429 TEUCHOS_TEST_FOR_EXCEPT_MSG(
true,
"panzer::BasisValues2::applyOrientations : this should not be called.");
432 template <
typename Scalar>
434 {
return basis_layout->getBasis()->getElementSpace(); }
436 template <
typename Scalar>
438 setupArrays(
const Teuchos::RCP<const panzer::BasisIRLayout>& layout,
439 bool computeDerivatives)
443 compute_derivatives = computeDerivatives;
444 basis_layout = layout;
445 num_cells_ = basis_layout->numCells();
446 Teuchos::RCP<const panzer::PureBasis> basisDesc = layout->getBasis();
449 int num_quad = layout->numPoints();
450 int dim = basisDesc->dimension();
451 int card = basisDesc->cardinality();
452 int numcells = basisDesc->numCells();
454 Teuchos::RCP<const shards::CellTopology> cellTopo = basisDesc->getCellTopology();
456 intrepid_basis = basisDesc->getIntrepid2Basis<PHX::Device::execution_space,Scalar,Scalar>();
476 if(compute_derivatives) {
509 if(compute_derivatives) {
525 else { TEUCHOS_ASSERT(
false); }
553 if(compute_derivatives) {
587 else { TEUCHOS_ASSERT(
false); }
598 template <
typename Scalar>
601 setup(
const Teuchos::RCP<const panzer::BasisIRLayout> & basis,
602 PHX::MDField<Scalar, Cell, IP, Dim> reference_points,
603 PHX::MDField<Scalar, Cell, IP, Dim, Dim> point_jacobian,
604 PHX::MDField<Scalar, Cell, IP> point_jacobian_determinant,
605 PHX::MDField<Scalar, Cell, IP, Dim, Dim> point_jacobian_inverse,
606 const int num_evaluated_cells)
608 basis_layout = basis;
609 intrepid_basis = basis->getBasis()->getIntrepid2Basis<PHX::Device::execution_space,Scalar,Scalar>();
610 num_cells_ = basis_layout->numCells();
611 num_evaluate_cells_ = num_evaluated_cells >= 0 ? num_evaluated_cells : num_cells_;
612 build_weighted =
false;
615 cubature_points_ref_ = reference_points;
616 cubature_jacobian_ = point_jacobian;
617 cubature_jacobian_determinant_ = point_jacobian_determinant;
618 cubature_jacobian_inverse_ = point_jacobian_inverse;
625 template <
typename Scalar>
629 PHX::MDField<Scalar, IP, Dim> reference_points,
630 PHX::MDField<Scalar, Cell, IP, Dim, Dim> point_jacobian,
631 PHX::MDField<Scalar, Cell, IP> point_jacobian_determinant,
632 PHX::MDField<Scalar, Cell, IP, Dim, Dim> point_jacobian_inverse,
633 const int num_evaluated_cells)
635 basis_layout = basis;
636 intrepid_basis = basis->getBasis()->getIntrepid2Basis<PHX::Device::execution_space,Scalar,Scalar>();
637 num_cells_ = basis_layout->numCells();
638 num_evaluate_cells_ = num_evaluated_cells >= 0 ? num_evaluated_cells : num_cells_;
639 cubature_points_uniform_ref_ = reference_points;
640 build_weighted =
false;
643 cubature_jacobian_ = point_jacobian;
644 cubature_jacobian_determinant_ = point_jacobian_determinant;
645 cubature_jacobian_inverse_ = point_jacobian_inverse;
652 template <
typename Scalar>
656 const int num_orientations_cells)
658 if(num_orientations_cells < 0)
659 num_orientations_cells_ = num_evaluate_cells_;
661 num_orientations_cells_ = num_orientations_cells;
662 if(orientations == Teuchos::null){
663 orientations_applied_ =
false;
664 orientations_ = Teuchos::null;
667 orientations_ = orientations;
668 orientations_applied_ =
true;
674 template <
typename Scalar>
679 cell_vertex_coordinates_ = vertex_coordinates;
682 template <
typename Scalar>
688 basis_ref_scalar_evaluated_ =
false;
689 basis_scalar_evaluated_ =
false;
690 basis_ref_vector_evaluated_ =
false;
691 basis_vector_evaluated_ =
false;
692 grad_basis_ref_evaluated_ =
false;
693 grad_basis_evaluated_ =
false;
694 curl_basis_ref_scalar_evaluated_ =
false;
695 curl_basis_scalar_evaluated_ =
false;
696 curl_basis_ref_vector_evaluated_ =
false;
697 curl_basis_vector_evaluated_ =
false;
698 div_basis_ref_evaluated_ =
false;
699 div_basis_evaluated_ =
false;
700 weighted_basis_scalar_evaluated_ =
false;
701 weighted_basis_vector_evaluated_ =
false;
702 weighted_grad_basis_evaluated_ =
false;
703 weighted_curl_basis_scalar_evaluated_ =
false;
704 weighted_curl_basis_vector_evaluated_ =
false;
705 weighted_div_basis_evaluated_ =
false;
706 basis_coordinates_ref_evaluated_ =
false;
707 basis_coordinates_evaluated_ =
false;
735 template <
typename Scalar>
740 TEUCHOS_TEST_FOR_EXCEPT_MSG(build_weighted,
741 "BasisValues2::setWeightedMeasure : Weighted measure already set. Can only set weighted measure once after setup or setupUniform have beens called.");
742 cubature_weights_ = weighted_measure;
743 build_weighted =
true;
751 #define PANZER_CACHE_DATA(name) \ 753 if(name.size()==tmp_##name.size()){ \ 754 Kokkos::deep_copy(name.get_view(), tmp_##name.get_view()); \ 758 name##_evaluated_ = true; \ 761 template <
typename Scalar>
765 const bool force)
const 768 if(basis_coordinates_ref_evaluated_ and not force)
769 return basis_coordinates_ref;
773 const int num_card = basis_layout->cardinality();
774 const int num_dim = basis_layout->dimension();
776 using coordsScalarType =
typename Intrepid2::Basis<PHX::Device::execution_space,Scalar,Scalar>::scalarType;
777 auto tmp_basis_coordinates_ref = af.
buildStaticArray<coordsScalarType,
BASIS,
Dim>(
"basis_coordinates_ref", num_card, num_dim);
778 intrepid_basis->getDofCoords(tmp_basis_coordinates_ref.get_view());
779 PHX::Device().fence();
784 return tmp_basis_coordinates_ref;
787 template <
typename Scalar>
791 const bool force)
const 794 if(basis_ref_scalar_evaluated_ and not force)
795 return basis_ref_scalar;
798 TEUCHOS_ASSERT(hasUniformReferenceSpace());
806 const int num_quad = basis_layout->numPoints();
807 const int num_card = basis_layout->cardinality();
810 intrepid_basis->getValues(tmp_basis_ref_scalar.get_view(), cubature_points_uniform_ref_.get_view(), Intrepid2::OPERATOR_VALUE);
811 PHX::Device().fence();
816 return tmp_basis_ref_scalar;
819 template <
typename Scalar>
823 const bool force)
const 826 if(basis_ref_vector_evaluated_ and not force)
827 return basis_ref_vector;
830 TEUCHOS_ASSERT(hasUniformReferenceSpace());
838 const int num_quad = basis_layout->numPoints();
839 const int num_card = basis_layout->cardinality();
840 const int num_dim = basis_layout->dimension();
843 intrepid_basis->getValues(tmp_basis_ref_vector.get_view(),cubature_points_uniform_ref_.get_view(),Intrepid2::OPERATOR_VALUE);
844 PHX::Device().fence();
849 return tmp_basis_ref_vector;
852 template <
typename Scalar>
856 const bool force)
const 859 if(grad_basis_ref_evaluated_ and not force)
860 return grad_basis_ref;
863 TEUCHOS_ASSERT(hasUniformReferenceSpace());
871 const int num_quad = basis_layout->numPoints();
872 const int num_card = basis_layout->cardinality();
873 const int num_dim = basis_layout->dimension();
876 intrepid_basis->getValues(tmp_grad_basis_ref.get_view(), cubature_points_uniform_ref_.get_view(), Intrepid2::OPERATOR_GRAD);
877 PHX::Device().fence();
882 return tmp_grad_basis_ref;
885 template <
typename Scalar>
889 const bool force)
const 892 if(curl_basis_ref_scalar_evaluated_ and not force)
893 return curl_basis_ref_scalar;
896 TEUCHOS_ASSERT(hasUniformReferenceSpace());
897 TEUCHOS_ASSERT(basis_layout->dimension() == 2);
905 const int num_quad = basis_layout->numPoints();
906 const int num_card = basis_layout->cardinality();
908 auto tmp_curl_basis_ref_scalar = af.
buildStaticArray<Scalar,
BASIS,
IP>(
"dyn_curl_basis_ref_scalar",num_card,num_quad);
909 intrepid_basis->getValues(tmp_curl_basis_ref_scalar.get_view(), cubature_points_uniform_ref_.get_view(), Intrepid2::OPERATOR_CURL);
910 PHX::Device().fence();
915 return tmp_curl_basis_ref_scalar;
918 template <
typename Scalar>
922 const bool force)
const 925 if(curl_basis_ref_vector_evaluated_ and not force)
926 return curl_basis_ref_vector;
929 TEUCHOS_ASSERT(hasUniformReferenceSpace());
930 TEUCHOS_ASSERT(basis_layout->dimension() == 3);
938 const int num_quad = basis_layout->numPoints();
939 const int num_card = basis_layout->cardinality();
940 const int num_dim = basis_layout->dimension();
942 auto tmp_curl_basis_ref_vector = af.
buildStaticArray<Scalar,
BASIS,
IP,
Dim>(
"dyn_curl_basis_ref_vector",num_card,num_quad,num_dim);
943 intrepid_basis->getValues(tmp_curl_basis_ref_vector.get_view(), cubature_points_uniform_ref_.get_view(), Intrepid2::OPERATOR_CURL);
944 PHX::Device().fence();
949 return tmp_curl_basis_ref_vector;
952 template <
typename Scalar>
956 const bool force)
const 959 if(div_basis_ref_evaluated_ and not force)
960 return div_basis_ref;
963 TEUCHOS_ASSERT(hasUniformReferenceSpace());
971 const int num_quad = basis_layout->numPoints();
972 const int num_card = basis_layout->cardinality();
975 intrepid_basis->getValues(tmp_div_basis_ref.get_view(), cubature_points_uniform_ref_.get_view(), Intrepid2::OPERATOR_DIV);
976 PHX::Device().fence();
981 return tmp_div_basis_ref;
984 template <
typename Scalar>
988 const bool force)
const 991 if(basis_coordinates_evaluated_ and not force)
992 return basis_coordinates;
994 TEUCHOS_ASSERT(cell_vertex_coordinates_.size() > 0);
996 const std::pair<int,int> cell_range(0,num_evaluate_cells_);
997 const auto s_vertex_coordinates = Kokkos::subview(cell_vertex_coordinates_.get_view(),cell_range,Kokkos::ALL(),Kokkos::ALL());
1001 const int num_card = basis_layout->cardinality();
1002 const int num_dim = basis_layout->dimension();
1004 auto tmp_basis_coordinates = af.buildStaticArray<Scalar,
Cell,
BASIS,
IP>(
"basis_coordinates", num_cells_, num_card, num_dim);
1005 auto s_aux = Kokkos::subview(tmp_basis_coordinates.get_view(),cell_range,Kokkos::ALL(),Kokkos::ALL());
1008 auto bcr = getBasisCoordinatesRef(
false);
1009 Kokkos::DynRankView<double> bcr_copy(
"nonconst_bcr",bcr.extent(0),bcr.extent(1));
1010 Kokkos::deep_copy(bcr_copy,bcr.get_view());
1012 Intrepid2::CellTools<PHX::Device::execution_space> cell_tools;
1013 cell_tools.mapToPhysicalFrame(s_aux, bcr_copy, s_vertex_coordinates, intrepid_basis->getBaseCellTopology());
1014 PHX::Device().fence();
1019 return tmp_basis_coordinates;
1022 template <
typename Scalar>
1027 const bool force)
const 1030 if(weighted_basis_scalar_evaluated_ and not force)
1031 return weighted_basis_scalar;
1033 if(basis_scalar_evaluated_ and not force)
1034 return basis_scalar;
1038 const int num_cells = num_cells_;
1039 const int num_points = basis_layout->numPoints();
1040 const int num_card = basis_layout->cardinality();
1041 const int num_dim = basis_layout->dimension();
1045 TEUCHOS_ASSERT(cubature_weights_.size() > 0);
1048 const auto bv = getBasisValues(
false, force);
1051 auto tmp_weighted_basis_scalar = af.
buildStaticArray<Scalar,
Cell,
BASIS,
IP>(
"weighted_basis_scalar", num_cells, num_card, num_points);
1053 const std::pair<int,int> cell_range(0,num_evaluate_cells_);
1054 auto s_aux = Kokkos::subview(tmp_weighted_basis_scalar.get_view(),cell_range,Kokkos::ALL(),Kokkos::ALL());
1055 auto s_cw = Kokkos::subview(cubature_weights_.get_view(),cell_range,Kokkos::ALL());
1056 auto s_bv = Kokkos::subview(bv.get_view(),cell_range,Kokkos::ALL(),Kokkos::ALL());
1058 using fst=Intrepid2::FunctionSpaceTools<PHX::Device::execution_space>;
1059 fst::multiplyMeasure(s_aux,s_cw,s_bv);
1067 return tmp_weighted_basis_scalar;
1071 const auto element_space = getElementSpace();
1076 TEUCHOS_ASSERT(cubature_jacobian_determinant_.size() > 0);
1079 auto cell_basis_ref_scalar = af.
buildStaticArray<Scalar,
BASIS,
IP>(
"cell_basis_ref_scalar",num_card,num_points);
1082 if(hasUniformReferenceSpace()){
1085 intrepid_basis->getValues(cell_basis_ref_scalar.get_view(),cubature_points_uniform_ref_.get_view(),Intrepid2::OPERATOR_VALUE);
1087 const std::pair<int,int> cell_range(0,num_evaluate_cells_);
1088 auto s_aux = Kokkos::subview(tmp_basis_scalar.get_view(), cell_range, Kokkos::ALL(), Kokkos::ALL());
1091 using fst=Intrepid2::FunctionSpaceTools<PHX::Device::execution_space>;
1093 auto s_cjd = Kokkos::subview(cubature_jacobian_determinant_.get_view(), cell_range, Kokkos::ALL());
1094 fst::HVOLtransformVALUE(s_aux,s_cjd,cell_basis_ref_scalar.get_view());
1096 fst::HGRADtransformVALUE(s_aux,cell_basis_ref_scalar.get_view());
1098 PHX::Device().fence();
1117 auto cell_basis_scalar_host = Kokkos::create_mirror_view(cell_basis_scalar.get_view());
1118 auto cell_cub_points_host = Kokkos::create_mirror_view(cell_cub_points.get_view());
1119 auto cell_jac_det_host = Kokkos::create_mirror_view(cell_jac_det.get_view());
1120 auto cell_basis_ref_scalar_host = Kokkos::create_mirror_view(cell_basis_ref_scalar.get_view());
1121 auto cubature_points_ref_host = Kokkos::create_mirror_view(cubature_points_ref_.get_view());
1122 Kokkos::deep_copy(cubature_points_ref_host,cubature_points_ref_.get_view());
1123 auto cubature_jacobian_determinant_host = Kokkos::create_mirror_view(cubature_jacobian_determinant_.get_view());
1124 Kokkos::deep_copy(cubature_jacobian_determinant_host,cubature_jacobian_determinant_.get_view());
1125 auto tmp_basis_scalar_host = Kokkos::create_mirror_view(tmp_basis_scalar.get_view());
1128 for(
int cell=0; cell<num_evaluate_cells_; ++cell){
1131 for(
int p=0;p<num_points;++p)
1132 for(
int d=0;d<num_dim;++d)
1133 cell_cub_points_host(p,d)=cubature_points_ref_host(cell,p,d);
1134 Kokkos::deep_copy(cell_cub_points.get_view(),cell_cub_points_host);
1140 intrepid_basis->getValues(cell_basis_ref_scalar.get_view(),cell_cub_points.get_view(),Intrepid2::OPERATOR_VALUE);
1141 Kokkos::deep_copy(cell_basis_ref_scalar_host,cell_basis_ref_scalar.get_view());
1143 using fst=Intrepid2::FunctionSpaceTools<Kokkos::HostSpace>;
1147 for(
int p=0;p<num_points;++p)
1148 cell_jac_det_host(0,p)=cubature_jacobian_determinant_host(cell,p);
1150 fst::HVOLtransformVALUE(cell_basis_scalar_host,cell_jac_det_host,cell_basis_ref_scalar_host);
1152 fst::HGRADtransformVALUE(cell_basis_scalar_host,cell_basis_ref_scalar_host);
1155 for(
int b=0; b<num_card; ++b)
1156 for(
int p=0; p<num_points; ++p)
1157 tmp_basis_scalar_host(cell,b,p) = cell_basis_scalar_host(0,b,p);
1159 Kokkos::deep_copy(tmp_basis_scalar.get_view(),tmp_basis_scalar_host);
1168 if(orientations_ != Teuchos::null)
1169 applyOrientationsImpl<Scalar>(num_orientations_cells_, tmp_basis_scalar.get_view(), *orientations_->getOrientations(), *intrepid_basis);
1174 return tmp_basis_scalar;
1180 template <
typename Scalar>
1185 const bool force)
const 1188 if(weighted_basis_vector_evaluated_ and not force)
1189 return weighted_basis_vector;
1191 if(basis_vector_evaluated_ and not force)
1192 return basis_vector;
1196 const int num_cells = num_cells_;
1197 const int num_points = basis_layout->numPoints();
1198 const int num_card = basis_layout->cardinality();
1199 const int num_dim = basis_layout->dimension();
1203 TEUCHOS_ASSERT(cubature_weights_.size() > 0);
1206 const auto bv = getVectorBasisValues(
false, force);
1209 auto tmp_weighted_basis_vector = af.
buildStaticArray<Scalar,
Cell,
BASIS,
IP,
Dim>(
"weighted_basis_vector", num_cells, num_card, num_points, num_dim);
1211 const std::pair<int,int> cell_range(0,num_evaluate_cells_);
1212 auto s_aux = Kokkos::subview(tmp_weighted_basis_vector.get_view(),cell_range,Kokkos::ALL(),Kokkos::ALL(),Kokkos::ALL());
1213 auto s_cw = Kokkos::subview(cubature_weights_.get_view(),cell_range,Kokkos::ALL());
1214 auto s_bv = Kokkos::subview(bv.get_view(),cell_range,Kokkos::ALL(),Kokkos::ALL(),Kokkos::ALL());
1216 using fst=Intrepid2::FunctionSpaceTools<PHX::Device::execution_space>;
1217 fst::multiplyMeasure(s_aux, s_cw, s_bv);
1222 return tmp_weighted_basis_vector;
1226 const auto element_space = getElementSpace();
1228 TEUCHOS_ASSERT(num_dim != 1);
1232 TEUCHOS_ASSERT(cubature_jacobian_inverse_.size() > 0);
1234 TEUCHOS_ASSERT(cubature_jacobian_.size() > 0 && cubature_jacobian_determinant_.size() > 0);
1240 if(hasUniformReferenceSpace()){
1243 intrepid_basis->getValues(cell_basis_ref_vector.get_view(),cubature_points_uniform_ref_.get_view(),Intrepid2::OPERATOR_VALUE);
1245 const std::pair<int,int> cell_range(0,num_evaluate_cells_);
1246 auto s_aux = Kokkos::subview(tmp_basis_vector.get_view(), cell_range, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL());
1249 using fst=Intrepid2::FunctionSpaceTools<PHX::Device::execution_space>;
1252 auto s_jac_inv = Kokkos::subview(cubature_jacobian_inverse_.get_view(), cell_range, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL());
1254 fst::HCURLtransformVALUE(s_aux,s_jac_inv,cell_basis_ref_vector.get_view());
1257 auto s_jac = Kokkos::subview(cubature_jacobian_.get_view(), cell_range, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL());
1258 auto s_jac_det = Kokkos::subview(cubature_jacobian_determinant_.get_view(), cell_range, Kokkos::ALL());
1260 fst::HDIVtransformVALUE(s_aux,s_jac, s_jac_det, cell_basis_ref_vector.get_view());
1263 PHX::Device().fence();
1284 auto cell_basis_vector_host = Kokkos::create_mirror_view(cell_basis_vector.get_view());
1285 auto cell_cub_points_host = Kokkos::create_mirror_view(cell_cub_points.get_view());
1286 auto cell_jac_det_host = Kokkos::create_mirror_view(cell_jac_det.get_view());
1287 auto cell_jac_host = Kokkos::create_mirror_view(cell_jac.get_view());
1288 auto cell_jac_inv_host = Kokkos::create_mirror_view(cell_jac_inv.get_view());
1289 auto cell_basis_ref_vector_host = Kokkos::create_mirror_view(cell_basis_ref_vector.get_view());
1290 auto cubature_points_ref_host = Kokkos::create_mirror_view(cubature_points_ref_.get_view());
1291 Kokkos::deep_copy(cubature_points_ref_host,cubature_points_ref_.get_view());
1292 auto cubature_jacobian_host = Kokkos::create_mirror_view(cubature_jacobian_.get_view());
1293 Kokkos::deep_copy(cubature_jacobian_host,cubature_jacobian_.get_view());
1294 auto cubature_jacobian_inverse_host = Kokkos::create_mirror_view(cubature_jacobian_inverse_.get_view());
1295 Kokkos::deep_copy(cubature_jacobian_inverse_host,cubature_jacobian_inverse_.get_view());
1296 auto cubature_jacobian_determinant_host = Kokkos::create_mirror_view(cubature_jacobian_determinant_.get_view());
1297 Kokkos::deep_copy(cubature_jacobian_determinant_host,cubature_jacobian_determinant_.get_view());
1298 auto tmp_basis_vector_host = Kokkos::create_mirror_view(tmp_basis_vector.get_view());
1301 for(
int cell=0; cell<num_evaluate_cells_; ++cell){
1304 for(
int p=0;p<num_points;++p)
1305 for(
int d=0;d<num_dim;++d)
1306 cell_cub_points_host(p,d)=cubature_points_ref_host(cell,p,d);
1307 Kokkos::deep_copy(cell_cub_points.get_view(),cell_cub_points_host);
1313 intrepid_basis->getValues(cell_basis_ref_vector.get_view(),cell_cub_points.get_view(),Intrepid2::OPERATOR_VALUE);
1314 Kokkos::deep_copy(cell_basis_ref_vector_host,cell_basis_ref_vector.get_view());
1316 using fst=Intrepid2::FunctionSpaceTools<Kokkos::HostSpace>;
1320 for(
int p=0;p<num_points;++p)
1321 for(
int i=0; i<num_dim; ++i)
1322 for(
int j=0; j<num_dim; ++j)
1323 cell_jac_inv_host(0,p,i,j)=cubature_jacobian_inverse_host(cell,p,i,j);
1325 fst::HCURLtransformVALUE(cell_basis_vector_host,cell_jac_inv_host,cell_basis_ref_vector_host);
1328 for(
int p=0;p<num_points;++p)
1329 for(
int i=0; i<num_dim; ++i)
1330 for(
int j=0; j<num_dim; ++j)
1331 cell_jac_host(0,p,i,j)=cubature_jacobian_host(cell,p,i,j);
1333 for(
int p=0;p<num_points;++p)
1334 cell_jac_det_host(0,p)=cubature_jacobian_determinant_host(cell,p);
1336 fst::HDIVtransformVALUE(cell_basis_vector_host,cell_jac_host,cell_jac_det_host,cell_basis_ref_vector_host);
1340 for(
int b=0; b<num_card; ++b)
1341 for(
int p=0; p<num_points; ++p)
1342 for(
int d=0; d<num_dim; ++d)
1343 tmp_basis_vector_host(cell,b,p,d) = cell_basis_vector_host(0,b,p,d);
1345 Kokkos::deep_copy(tmp_basis_vector.get_view(),tmp_basis_vector_host);
1349 if(orientations_ != Teuchos::null)
1350 applyOrientationsImpl<Scalar>(num_orientations_cells_, tmp_basis_vector.get_view(), *orientations_->getOrientations(), *intrepid_basis);
1355 return tmp_basis_vector;
1361 template <
typename Scalar>
1366 const bool force)
const 1369 if(weighted_grad_basis_evaluated_ and not force)
1370 return weighted_grad_basis;
1372 if(grad_basis_evaluated_ and not force)
1377 const int num_cells = num_cells_;
1378 const int num_points = basis_layout->numPoints();
1379 const int num_card = basis_layout->cardinality();
1380 const int num_dim = basis_layout->dimension();
1384 TEUCHOS_ASSERT(cubature_weights_.size() > 0);
1387 const auto bv = getGradBasisValues(
false, force);
1390 auto tmp_weighted_grad_basis = af.
buildStaticArray<Scalar,
Cell,
BASIS,
IP,
Dim>(
"weighted_grad_basis", num_cells, num_card, num_points, num_dim);
1392 const std::pair<int,int> cell_range(0,num_evaluate_cells_);
1393 auto s_aux = Kokkos::subview(tmp_weighted_grad_basis.get_view(), cell_range, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL());
1394 auto s_cw = Kokkos::subview(cubature_weights_.get_view(), cell_range, Kokkos::ALL());
1395 auto s_bv = Kokkos::subview(bv.get_view(), cell_range, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL());
1397 using fst=Intrepid2::FunctionSpaceTools<PHX::Device::execution_space>;
1398 fst::multiplyMeasure(s_aux,s_cw,s_bv);
1403 return tmp_weighted_grad_basis;
1407 TEUCHOS_ASSERT(cubature_jacobian_inverse_.size() > 0);
1409 const auto element_space = getElementSpace();
1415 if(hasUniformReferenceSpace()){
1418 intrepid_basis->getValues(cell_grad_basis_ref.get_view(),cubature_points_uniform_ref_.get_view(),Intrepid2::OPERATOR_GRAD);
1420 const std::pair<int,int> cell_range(0,num_evaluate_cells_);
1421 auto s_aux = Kokkos::subview(tmp_grad_basis.get_view(), cell_range, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL());
1422 auto s_jac_inv = Kokkos::subview(cubature_jacobian_inverse_.get_view(), cell_range, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL());
1425 using fst=Intrepid2::FunctionSpaceTools<PHX::Device::execution_space>;
1426 fst::HGRADtransformGRAD(s_aux, s_jac_inv,cell_grad_basis_ref.get_view());
1428 PHX::Device().fence();
1450 auto cell_cub_points_host = Kokkos::create_mirror_view(cell_cub_points.get_view());
1451 auto cubature_points_ref_host = Kokkos::create_mirror_view(cubature_points_ref_.get_view());
1452 Kokkos::deep_copy(cubature_points_ref_host,cubature_points_ref_.get_view());
1453 auto cell_jac_inv_host = Kokkos::create_mirror_view(cell_jac_inv.get_view());
1454 auto cubature_jacobian_inverse_host = Kokkos::create_mirror_view(cubature_jacobian_inverse_.get_view());
1455 Kokkos::deep_copy(cubature_jacobian_inverse_host,cubature_jacobian_inverse_.get_view());
1456 auto cell_grad_basis_ref_host = Kokkos::create_mirror_view(cell_grad_basis_ref.get_view());
1457 auto cell_grad_basis_host = Kokkos::create_mirror_view(cell_grad_basis.get_view());
1458 auto tmp_grad_basis_host = Kokkos::create_mirror_view(tmp_grad_basis.get_view());
1461 for(
int cell=0; cell<num_evaluate_cells_; ++cell){
1464 for(
int p=0;p<num_points;++p)
1465 for(
int d=0;d<num_dim;++d)
1466 cell_cub_points_host(p,d)=cubature_points_ref_host(cell,p,d);
1472 Kokkos::deep_copy(cell_cub_points.get_view(),cell_cub_points_host);
1473 intrepid_basis->getValues(cell_grad_basis_ref.get_view(),cell_cub_points.get_view(),Intrepid2::OPERATOR_GRAD);
1474 Kokkos::deep_copy(cell_grad_basis_ref_host,cell_grad_basis_ref.get_view());
1476 for(
int p=0;p<num_points;++p)
1477 for(
int d=0;d<num_dim;++d)
1478 for(
int d2=0;d2<num_dim;++d2)
1479 cell_jac_inv_host(0,p,d,d2)=cubature_jacobian_inverse_host(cell,p,d,d2);
1481 using fst=Intrepid2::FunctionSpaceTools<Kokkos::HostSpace>;
1482 fst::HGRADtransformGRAD(cell_grad_basis_host,cell_jac_inv_host,cell_grad_basis_ref_host);
1486 for(
int b=0; b<num_card; ++b)
1487 for(
int p=0; p<num_points; ++p)
1488 for(
int d=0; d<num_dim; ++d)
1489 tmp_grad_basis_host(cell,b,p,d) = cell_grad_basis_host(0,b,p,d);
1490 Kokkos::deep_copy(tmp_grad_basis.get_view(),tmp_grad_basis_host);
1494 if(orientations_ != Teuchos::null)
1495 applyOrientationsImpl<Scalar>(num_orientations_cells_, tmp_grad_basis.get_view(), *orientations_->getOrientations(), *intrepid_basis);
1500 return tmp_grad_basis;
1506 template <
typename Scalar>
1511 const bool force)
const 1514 if(weighted_curl_basis_scalar_evaluated_ and not force)
1515 return weighted_curl_basis_scalar;
1517 if(curl_basis_scalar_evaluated_ and not force)
1518 return curl_basis_scalar;
1522 const int num_cells = num_cells_;
1523 const int num_points = basis_layout->numPoints();
1524 const int num_card = basis_layout->cardinality();
1525 const int num_dim = basis_layout->dimension();
1529 TEUCHOS_ASSERT(cubature_weights_.size() > 0);
1532 const auto bv = getCurl2DVectorBasis(
false, force);
1535 auto tmp_weighted_curl_basis_scalar = af.
buildStaticArray<Scalar,
Cell,
BASIS,
IP>(
"weighted_curl_basis_scalar", num_cells, num_card, num_points);
1537 const std::pair<int,int> cell_range(0,num_evaluate_cells_);
1538 auto s_aux = Kokkos::subview(tmp_weighted_curl_basis_scalar.get_view(), cell_range, Kokkos::ALL(), Kokkos::ALL());
1539 auto s_cw = Kokkos::subview(cubature_weights_.get_view(), cell_range, Kokkos::ALL());
1540 auto s_bv = Kokkos::subview(bv.get_view(), cell_range, Kokkos::ALL(), Kokkos::ALL());
1542 using fst=Intrepid2::FunctionSpaceTools<PHX::Device::execution_space>;
1543 fst::multiplyMeasure(s_aux,s_cw,s_bv);
1548 return tmp_weighted_curl_basis_scalar;
1552 TEUCHOS_ASSERT(cubature_jacobian_determinant_.size() > 0);
1553 TEUCHOS_ASSERT(num_dim == 2);
1555 const auto element_space = getElementSpace();
1558 auto cell_curl_basis_ref_scalar = af.
buildStaticArray<Scalar,
BASIS,
IP>(
"cell_curl_basis_ref_scalar",num_card,num_points);
1561 if(hasUniformReferenceSpace()){
1563 intrepid_basis->getValues(cell_curl_basis_ref_scalar.get_view(),cubature_points_uniform_ref_.get_view(),Intrepid2::OPERATOR_CURL);
1565 const std::pair<int,int> cell_range(0,num_evaluate_cells_);
1566 auto s_aux = Kokkos::subview(tmp_curl_basis_scalar.get_view(), cell_range, Kokkos::ALL(), Kokkos::ALL());
1567 auto s_jac_det = Kokkos::subview(cubature_jacobian_determinant_.get_view(), cell_range, Kokkos::ALL());
1572 using fst=Intrepid2::FunctionSpaceTools<PHX::Device::execution_space>;
1573 fst::HDIVtransformDIV(s_aux,s_jac_det,cell_curl_basis_ref_scalar.get_view());
1574 PHX::Device().fence();
1593 auto cell_cub_points_host = Kokkos::create_mirror_view(cell_cub_points.get_view());
1594 auto cubature_points_ref_host = Kokkos::create_mirror_view(cubature_points_ref_.get_view());
1595 Kokkos::deep_copy(cubature_points_ref_host,cubature_points_ref_.get_view());
1596 auto cell_jac_det_host = Kokkos::create_mirror_view(cell_jac_det.get_view());
1597 auto cubature_jacobian_determinant_host = Kokkos::create_mirror_view(cubature_jacobian_determinant_.get_view());
1598 Kokkos::deep_copy(cubature_jacobian_determinant_host,cubature_jacobian_determinant_.get_view());
1599 auto cell_curl_basis_ref_scalar_host = Kokkos::create_mirror_view(cell_curl_basis_ref_scalar.get_view());
1600 auto cell_curl_host = Kokkos::create_mirror_view(cell_curl.get_view());
1601 auto tmp_curl_basis_scalar_host = Kokkos::create_mirror_view(tmp_curl_basis_scalar.get_view());
1604 for(
int cell=0; cell<num_evaluate_cells_; ++cell){
1607 for(
int p=0;p<num_points;++p)
1608 for(
int d=0;d<num_dim;++d)
1609 cell_cub_points_host(p,d)=cubature_points_ref_host(cell,p,d);
1610 for(
int p=0;p<num_points;++p)
1611 cell_jac_det_host(0,p)=cubature_jacobian_determinant_host(cell,p);
1618 Kokkos::deep_copy(cell_cub_points.get_view(),cell_cub_points_host);
1619 intrepid_basis->getValues(cell_curl_basis_ref_scalar.get_view(),cell_cub_points.get_view(),Intrepid2::OPERATOR_CURL);
1620 Kokkos::deep_copy(cell_curl_basis_ref_scalar_host,cell_curl_basis_ref_scalar.get_view());
1625 using fst=Intrepid2::FunctionSpaceTools<Kokkos::HostSpace>;
1626 fst::HDIVtransformDIV(cell_curl_host,cell_jac_det_host,cell_curl_basis_ref_scalar_host);
1627 PHX::Device().fence();
1630 for(
int b=0; b<num_card; ++b)
1631 for(
int p=0; p<num_points; ++p)
1632 tmp_curl_basis_scalar_host(cell,b,p) = cell_curl_host(0,b,p);
1633 Kokkos::deep_copy(tmp_curl_basis_scalar.get_view(),tmp_curl_basis_scalar_host);
1637 if(orientations_ != Teuchos::null)
1638 applyOrientationsImpl<Scalar>(num_orientations_cells_, tmp_curl_basis_scalar.get_view(), *orientations_->getOrientations(), *intrepid_basis);
1643 return tmp_curl_basis_scalar;
1649 template <
typename Scalar>
1654 const bool force)
const 1657 if(weighted_curl_basis_vector_evaluated_ and not force)
1658 return weighted_curl_basis_vector;
1660 if(curl_basis_vector_evaluated_ and not force)
1661 return curl_basis_vector;
1665 const int num_cells = num_cells_;
1666 const int num_points = basis_layout->numPoints();
1667 const int num_card = basis_layout->cardinality();
1668 const int num_dim = basis_layout->dimension();
1672 TEUCHOS_ASSERT(cubature_weights_.size() > 0);
1675 const auto bv = getCurlVectorBasis(
false, force);
1678 auto tmp_weighted_curl_basis_vector = af.
buildStaticArray<Scalar,
Cell,
BASIS,
IP,
Dim>(
"weighted_curl_basis_vector", num_cells, num_card, num_points, num_dim);
1680 const std::pair<int,int> cell_range(0,num_evaluate_cells_);
1681 auto s_aux = Kokkos::subview(tmp_weighted_curl_basis_vector.get_view(), cell_range, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL());
1682 auto s_cw = Kokkos::subview(cubature_weights_.get_view(), cell_range, Kokkos::ALL());
1683 auto s_bv = Kokkos::subview(bv.get_view(), cell_range, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL());
1685 using fst=Intrepid2::FunctionSpaceTools<PHX::Device::execution_space>;
1686 fst::multiplyMeasure(s_aux, s_cw, s_bv);
1691 return tmp_weighted_curl_basis_vector;
1695 TEUCHOS_ASSERT(cubature_jacobian_determinant_.size() > 0);
1696 TEUCHOS_ASSERT(num_dim == 3);
1698 const auto element_space = getElementSpace();
1701 auto cell_curl_basis_ref_vector = af.
buildStaticArray<Scalar,
BASIS,
IP,
Dim>(
"cell_curl_basis_ref_vector",num_card,num_points,num_dim);
1704 if(hasUniformReferenceSpace()){
1706 intrepid_basis->getValues(cell_curl_basis_ref_vector.get_view(),cubature_points_uniform_ref_.get_view(),Intrepid2::OPERATOR_CURL);
1708 const std::pair<int,int> cell_range(0,num_evaluate_cells_);
1709 auto s_aux = Kokkos::subview(tmp_curl_basis_vector.get_view(), cell_range, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL());
1710 auto s_jac = Kokkos::subview(cubature_jacobian_.get_view(), cell_range, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL());
1711 auto s_jac_det = Kokkos::subview(cubature_jacobian_determinant_.get_view(), cell_range, Kokkos::ALL());
1713 using fst=Intrepid2::FunctionSpaceTools<PHX::Device::execution_space>;
1714 fst::HCURLtransformCURL(s_aux, s_jac, s_jac_det,cell_curl_basis_ref_vector.get_view());
1715 PHX::Device().fence();
1735 auto cell_cub_points_host = Kokkos::create_mirror_view(cell_cub_points.get_view());
1736 auto cubature_points_ref_host = Kokkos::create_mirror_view(cubature_points_ref_.get_view());
1737 Kokkos::deep_copy(cubature_points_ref_host,cubature_points_ref_.get_view());
1738 auto cell_jac_host = Kokkos::create_mirror_view(cell_jac.get_view());
1739 auto cubature_jacobian_host = Kokkos::create_mirror_view(cubature_jacobian_.get_view());
1740 Kokkos::deep_copy(cubature_jacobian_host,cubature_jacobian_.get_view());
1741 auto cell_jac_det_host = Kokkos::create_mirror_view(cell_jac_det.get_view());
1742 auto cubature_jacobian_determinant_host = Kokkos::create_mirror_view(cubature_jacobian_determinant_.get_view());
1743 Kokkos::deep_copy(cubature_jacobian_determinant_host,cubature_jacobian_determinant_.get_view());
1744 auto cell_curl_basis_ref_vector_host = Kokkos::create_mirror_view(cell_curl_basis_ref_vector.get_view());
1745 auto cell_curl_host = Kokkos::create_mirror_view(cell_curl.get_view());
1746 auto tmp_curl_basis_vector_host = Kokkos::create_mirror_view(tmp_curl_basis_vector.get_view());
1749 for(
int cell=0; cell<num_evaluate_cells_; ++cell){
1752 for(
int p=0;p<num_points;++p)
1753 for(
int d=0;d<num_dim;++d)
1754 cell_cub_points_host(p,d)=cubature_points_ref_host(cell,p,d);
1755 for(
int p=0;p<num_points;++p)
1756 for(
int d=0;d<num_dim;++d)
1757 for(
int d2=0;d2<num_dim;++d2)
1758 cell_jac_host(0,p,d,d2)=cubature_jacobian_host(cell,p,d,d2);
1759 for(
int p=0;p<num_points;++p)
1760 cell_jac_det_host(0,p)=cubature_jacobian_determinant_host(cell,p);
1766 Kokkos::deep_copy(cell_cub_points.get_view(),cell_cub_points_host);
1767 intrepid_basis->getValues(cell_curl_basis_ref_vector.get_view(),cell_cub_points.get_view(),Intrepid2::OPERATOR_CURL);
1768 Kokkos::deep_copy(cell_curl_basis_ref_vector_host,cell_curl_basis_ref_vector.get_view());
1770 using fst=Intrepid2::FunctionSpaceTools<Kokkos::HostSpace>;
1771 fst::HCURLtransformCURL(cell_curl_host,cell_jac_host,cell_jac_det_host,cell_curl_basis_ref_vector_host);
1775 for(
int b=0; b<num_card; ++b)
1776 for(
int p=0; p<num_points; ++p)
1777 for(
int d=0;d<num_dim;++d)
1778 tmp_curl_basis_vector_host(cell,b,p,d) = cell_curl_host(0,b,p,d);
1779 Kokkos::deep_copy(tmp_curl_basis_vector.get_view(),tmp_curl_basis_vector_host);
1783 if(orientations_ != Teuchos::null)
1784 applyOrientationsImpl<Scalar>(num_orientations_cells_, tmp_curl_basis_vector.get_view(), *orientations_->getOrientations(), *intrepid_basis);
1789 return tmp_curl_basis_vector;
1795 template <
typename Scalar>
1800 const bool force)
const 1803 if(weighted_div_basis_evaluated_ and not force)
1804 return weighted_div_basis;
1806 if(div_basis_evaluated_ and not force)
1811 const int num_cells = num_cells_;
1812 const int num_points = basis_layout->numPoints();
1813 const int num_card = basis_layout->cardinality();
1814 const int num_dim = basis_layout->dimension();
1818 TEUCHOS_ASSERT(cubature_weights_.size() > 0);
1821 const auto bv = getDivVectorBasis(
false, force);
1824 auto tmp_weighted_div_basis = af.
buildStaticArray<Scalar,
Cell,
BASIS,
IP>(
"weighted_div_basis", num_cells, num_card, num_points);
1826 const std::pair<int,int> cell_range(0,num_evaluate_cells_);
1827 auto s_aux = Kokkos::subview(tmp_weighted_div_basis.get_view(), cell_range, Kokkos::ALL(), Kokkos::ALL());
1828 auto s_cw = Kokkos::subview(cubature_weights_.get_view(), cell_range, Kokkos::ALL());
1829 auto s_bv = Kokkos::subview(bv.get_view(), cell_range, Kokkos::ALL(), Kokkos::ALL());
1831 using fst=Intrepid2::FunctionSpaceTools<PHX::Device::execution_space>;
1832 fst::multiplyMeasure(s_aux, s_cw, s_bv);
1837 return tmp_weighted_div_basis;
1841 TEUCHOS_ASSERT(cubature_jacobian_determinant_.size() > 0);
1843 const auto element_space = getElementSpace();
1849 if(hasUniformReferenceSpace()){
1851 intrepid_basis->getValues(cell_div_basis_ref.get_view(),cubature_points_uniform_ref_.get_view(),Intrepid2::OPERATOR_DIV);
1853 const std::pair<int,int> cell_range(0,num_evaluate_cells_);
1854 auto s_aux = Kokkos::subview(tmp_div_basis.get_view(), cell_range, Kokkos::ALL(), Kokkos::ALL());
1855 auto s_jac_det = Kokkos::subview(cubature_jacobian_determinant_.get_view(), cell_range, Kokkos::ALL());
1857 using fst=Intrepid2::FunctionSpaceTools<PHX::Device::execution_space>;
1858 fst::HDIVtransformDIV(s_aux,s_jac_det,cell_div_basis_ref.get_view());
1859 PHX::Device().fence();
1878 auto cell_cub_points_host = Kokkos::create_mirror_view(cell_cub_points.get_view());
1879 auto cubature_points_ref_host = Kokkos::create_mirror_view(cubature_points_ref_.get_view());
1880 Kokkos::deep_copy(cubature_points_ref_host,cubature_points_ref_.get_view());
1881 auto cell_jac_det_host = Kokkos::create_mirror_view(cell_jac_det.get_view());
1882 auto cubature_jacobian_determinant_host = Kokkos::create_mirror_view(cubature_jacobian_determinant_.get_view());
1883 Kokkos::deep_copy(cubature_jacobian_determinant_host,cubature_jacobian_determinant_.get_view());
1884 auto cell_div_basis_ref_host = Kokkos::create_mirror_view(cell_div_basis_ref.get_view());
1885 auto cell_div_basis_host = Kokkos::create_mirror_view(cell_div_basis.get_view());
1886 auto tmp_div_basis_host = Kokkos::create_mirror_view(tmp_div_basis.get_view());
1889 for(
int cell=0; cell<num_evaluate_cells_; ++cell){
1892 for(
int p=0;p<num_points;++p)
1893 for(
int d=0;d<num_dim;++d)
1894 cell_cub_points_host(p,d)=cubature_points_ref_host(cell,p,d);
1895 for(
int p=0;p<num_points;++p)
1896 cell_jac_det_host(0,p)=cubature_jacobian_determinant_host(cell,p);
1902 Kokkos::deep_copy(cell_cub_points.get_view(),cell_cub_points_host);
1903 intrepid_basis->getValues(cell_div_basis_ref.get_view(),cell_cub_points.get_view(),Intrepid2::OPERATOR_DIV);
1904 Kokkos::deep_copy(cell_div_basis_ref_host,cell_div_basis_ref.get_view());
1906 using fst=Intrepid2::FunctionSpaceTools<PHX::Device::execution_space>;
1907 fst::HDIVtransformDIV(cell_div_basis.get_view(),cell_jac_det.get_view(),cell_div_basis_ref.get_view());
1908 Kokkos::deep_copy(cell_div_basis_host, cell_div_basis.get_static_view());
1912 for(
int b=0; b<num_card; ++b)
1913 for(
int p=0; p<num_points; ++p)
1914 tmp_div_basis_host(cell,b,p) = cell_div_basis_host(0,b,p);
1915 Kokkos::deep_copy(tmp_div_basis.get_view(),tmp_div_basis_host);
1919 if(orientations_ != Teuchos::null)
1920 applyOrientationsImpl<Scalar>(num_orientations_cells_, tmp_div_basis.get_view(), *orientations_->getOrientations(), *intrepid_basis);
1925 return tmp_div_basis;
bool grad_basis_evaluated_
PHX::MDField< Scalar, T0 > buildStaticArray(const std::string &str, int d0) const
void setCellVertexCoordinates(PHX::MDField< Scalar, Cell, NODE, Dim > vertex_coordinates)
Set the cell vertex coordinates (required for getBasisCoordinates())
bool basis_ref_vector_evaluated_
ConstArray_BasisIPDim getVectorBasisValuesRef(const bool cache=true, const bool force=false) const
Get the vector basis values evaluated at reference points.
void evaluateValuesCV(const PHX::MDField< Scalar, Cell, IP, Dim > &cell_cub_points, const PHX::MDField< Scalar, Cell, IP, Dim, Dim > &jac, const PHX::MDField< Scalar, Cell, IP > &jac_det, const PHX::MDField< Scalar, Cell, IP, Dim, Dim > &jac_inv)
PHX::MDField< const Scalar, Cell, BASIS, IP > ConstArray_CellBasisIP
bool basis_ref_scalar_evaluated_
Used to check if arrays have been cached.
bool curl_basis_ref_scalar_evaluated_
bool weighted_curl_basis_scalar_evaluated_
void setWeightedMeasure(PHX::MDField< Scalar, Cell, IP > weighted_measure)
Set the cubature weights (weighted measure) for the basis values object - required to get weighted ba...
bool curl_basis_vector_evaluated_
bool weighted_basis_vector_evaluated_
PHX::MDField< const Scalar, Cell, BASIS, Dim > ConstArray_CellBasisDim
bool weighted_grad_basis_evaluated_
void applyOrientations(const PHX::MDField< const Scalar, Cell, BASIS > &orientations)
Method to apply orientations to a basis values container.
PHX::MDField< const Scalar, BASIS, IP > ConstArray_BasisIP
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.
void setOrientations(const Teuchos::RCP< const OrientationsInterface > &orientations, const int num_orientations_cells=-1)
Set the orientations object for applying orientations using the lazy evaluation path - required for c...
bool basis_coordinates_evaluated_
void evaluateBasisCoordinates(const PHX::MDField< Scalar, Cell, NODE, Dim > &vertex_coordinates, const int in_num_cells=-1)
bool weighted_div_basis_evaluated_
ConstArray_CellBasisIP getDivVectorBasis(const bool weighted, const bool cache=true, const bool force=false) const
Get the divergence of a vector basis evaluated at mesh points.
ConstArray_CellBasisIPDim getVectorBasisValues(const bool weighted, const bool cache=true, const bool force=false) const
Get the vector basis values evaluated at mesh points.
ConstArray_CellBasisIPDim getGradBasisValues(const bool weighted, const bool cache=true, const bool force=false) const
Get the gradient of the basis evaluated at mesh points.
ConstArray_CellBasisIPDim getCurlVectorBasis(const bool weighted, const bool cache=true, const bool force=false) const
Get the curl of a 3D vector basis evaluated at mesh points.
void setupUniform(const Teuchos::RCP< const panzer::BasisIRLayout > &basis, PHX::MDField< Scalar, IP, Dim > reference_points, PHX::MDField< Scalar, Cell, IP, Dim, Dim > point_jacobian, PHX::MDField< Scalar, Cell, IP > point_jacobian_determinant, PHX::MDField< Scalar, Cell, IP, Dim, Dim > point_jacobian_inverse, const int num_evaluated_cells=-1)
Setup for lazy evaluation for uniform point layout.
ConstArray_BasisIP getDivVectorBasisRef(const bool cache=true, const bool force=false) const
Get the divergence of a vector basis evaluated at reference points.
#define PANZER_CACHE_DATA(name)
void setupArrays(const Teuchos::RCP< const panzer::BasisIRLayout > &basis, bool computeDerivatives=true)
Sizes/allocates memory for arrays.
ConstArray_BasisDim getBasisCoordinatesRef(const bool cache=true, const bool force=false) const
Get the reference coordinates for basis.
PHX::MDField< const Scalar, Cell, BASIS, IP, Dim > ConstArray_CellBasisIPDim
Intrepid2::Basis< PHX::Device::execution_space, Scalar, Scalar > IntrepidBasis
bool basis_scalar_evaluated_
PHX::MDField< const Scalar, BASIS, IP, Dim > ConstArray_BasisIPDim
BasisValues2(const std::string &prefix="", const bool allocArrays=false, const bool buildWeighted=false)
Main constructor.
ConstArray_BasisIPDim getGradBasisValuesRef(const bool cache=true, const bool force=false) const
Get the gradient of the basis evaluated at reference points.
bool basis_coordinates_ref_evaluated_
ConstArray_BasisIP getCurl2DVectorBasisRef(const bool cache=true, const bool force=false) const
Get the curl of a vector basis evaluated at reference points.
ConstArray_CellBasisIP getCurl2DVectorBasis(const bool weighted, const bool cache=true, const bool force=false) const
Get the curl of a 2D vector basis evaluated at mesh points.
ConstArray_CellBasisIP getBasisValues(const bool weighted, const bool cache=true, const bool force=false) const
Get the basis values evaluated at mesh points.
ConstArray_CellBasisDim getBasisCoordinates(const bool cache=true, const bool force=false) const
Carterisan coordinates for basis coefficients in mesh space.
ConstArray_BasisIPDim getCurlVectorBasisRef(const bool cache=true, const bool force=false) const
Get the curl of a vector basis evaluated at reference points.
bool curl_basis_ref_vector_evaluated_
ConstArray_BasisIP getBasisValuesRef(const bool cache=true, const bool force=false) const
Get the basis values evaluated at reference points.
bool grad_basis_ref_evaluated_
PureBasis::EElementSpace getElementSpace() const
PHX::MDField< const Scalar, BASIS, Dim > ConstArray_BasisDim
void setup(const Teuchos::RCP< const panzer::BasisIRLayout > &basis, PHX::MDField< Scalar, Cell, IP, Dim > reference_points, PHX::MDField< Scalar, Cell, IP, Dim, Dim > point_jacobian, PHX::MDField< Scalar, Cell, IP > point_jacobian_determinant, PHX::MDField< Scalar, Cell, IP, Dim, Dim > point_jacobian_inverse, const int num_evaluated_cells=-1)
Setup for lazy evaluation for non-uniform point layout.
bool weighted_curl_basis_vector_evaluated_
void evaluateValues(const PHX::MDField< Scalar, IP, Dim > &cub_points, const PHX::MDField< Scalar, Cell, IP, Dim, Dim > &jac, const PHX::MDField< Scalar, Cell, IP > &jac_det, const PHX::MDField< Scalar, Cell, IP, Dim, Dim > &jac_inv, const int in_num_cells=-1)
bool curl_basis_scalar_evaluated_
bool basis_vector_evaluated_
bool div_basis_ref_evaluated_
bool div_basis_evaluated_
bool weighted_basis_scalar_evaluated_