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"
56#include "Phalanx_GetNonConstDynRankViewFromConstMDField.hpp"
61template<
typename Scalar>
63applyOrientationsImpl(
const int num_cells,
64 Kokkos::DynRankView<Scalar, PHX::Device> view,
65 Kokkos::DynRankView<Intrepid2::Orientation, PHX::Device> orientations,
68 using ots=Intrepid2::OrientationTools<PHX::Device>;
70 auto sub_orientations = Kokkos::subview(orientations, std::make_pair(0,num_cells));
75 auto sub_view = Kokkos::subview(view, std::make_pair(0,num_cells), Kokkos::ALL(), Kokkos::ALL());
76 auto sub_view_clone = Kokkos::createDynRankView(view,
"sub_view_clone", sub_view.extent(0), sub_view.extent(1), sub_view.extent(2));
77 Kokkos::deep_copy(sub_view_clone, sub_view);
80 ots::modifyBasisByOrientation(sub_view, sub_view_clone, sub_orientations, &basis);
81 }
else if (view.rank() == 4){
83 auto sub_view = Kokkos::subview(view, std::make_pair(0,num_cells), Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL());
84 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));
85 Kokkos::deep_copy(sub_view_clone, sub_view);
88 ots::modifyBasisByOrientation(sub_view, sub_view_clone, sub_orientations, &basis);
90 throw std::logic_error(
"applyOrientationsImpl : Unknown view of rank " + std::to_string(view.rank()));
93template<
typename Scalar>
95applyOrientationsImpl(
const int num_cells,
96 Kokkos::DynRankView<Scalar, PHX::Device> view,
97 const std::vector<Intrepid2::Orientation> & orientations,
102 Kokkos::DynRankView<Intrepid2::Orientation,PHX::Device> device_orientations(
"drv_orts", num_cells);
103 auto host_orientations = Kokkos::create_mirror_view(device_orientations);
104 for(
int i=0; i < num_cells; ++i)
105 host_orientations(i) = orientations[i];
106 Kokkos::deep_copy(device_orientations,host_orientations);
109 applyOrientationsImpl(num_cells, view, device_orientations, basis);
115template <
typename Scalar>
118 const bool allocArrays,
119 const bool buildWeighted)
120 : compute_derivatives(true)
121 , build_weighted(buildWeighted)
122 , alloc_arrays(allocArrays)
125 , references_evaluated(false)
126 , orientations_applied_(false)
128 , num_evaluate_cells_(0)
155template <
typename Scalar>
158 const PHX::MDField<Scalar,Cell,IP,Dim,Dim> &
jac,
159 const PHX::MDField<Scalar,Cell,IP> & jac_det,
160 const PHX::MDField<Scalar,Cell,IP,Dim,Dim> & jac_inv,
161 const int in_num_cells)
164 build_weighted =
false;
166 setupUniform(basis_layout, cub_points,
jac, jac_det, jac_inv, in_num_cells);
168 const auto elmtspace = getElementSpace();
169 const int num_dims =
jac.extent(2);
173 getBasisValuesRef(
true,
true);
176 getVectorBasisValuesRef(
true,
true);
179 getGradBasisValuesRef(
true,
true);
183 getCurl2DVectorBasisRef(
true,
true);
184 else if(num_dims == 3)
185 getCurlVectorBasisRef(
true,
true);
189 getDivVectorBasisRef(
true,
true);
191 references_evaluated =
true;
195 getBasisValues(
false,
true,
true);
198 getVectorBasisValues(
false,
true,
true);
201 getGradBasisValues(
false,
true,
true);
205 getCurl2DVectorBasis(
false,
true,
true);
206 else if(num_dims == 3)
207 getCurlVectorBasis(
false,
true,
true);
211 getDivVectorBasis(
false,
true,
true);
214 orientations_applied_ = (orientations_.size()>0);
217template <
typename Scalar>
220 const PHX::MDField<Scalar,Cell,IP,Dim,Dim> &
jac,
221 const PHX::MDField<Scalar,Cell,IP> & jac_det,
222 const PHX::MDField<Scalar,Cell,IP,Dim,Dim> & jac_inv,
223 const PHX::MDField<Scalar,Cell,IP> & weighted_measure,
224 const PHX::MDField<Scalar,Cell,NODE,Dim> & vertex_coordinates,
225 bool use_vertex_coordinates,
226 const int in_num_cells)
230 evaluateValues(cub_points,
jac, jac_det, jac_inv, in_num_cells);
231 if(weighted_measure.size() > 0)
232 setWeightedMeasure(weighted_measure);
234 cell_vertex_coordinates_ = vertex_coordinates;
238 const auto elmtspace = getElementSpace();
239 const int num_dims =
jac.extent(2);
242 getBasisValues(
true,
true,
true);
245 getVectorBasisValues(
true,
true,
true);
248 getGradBasisValues(
true,
true,
true);
252 getCurl2DVectorBasis(
true,
true,
true);
253 else if(num_dims == 3)
254 getCurlVectorBasis(
true,
true,
true);
258 getDivVectorBasis(
true,
true,
true);
261 if(use_vertex_coordinates){
262 getBasisCoordinatesRef(
true,
true);
263 getBasisCoordinates(
true,
true);
267 orientations_applied_ = (orientations_.size()>0);
270template <
typename Scalar>
272evaluateValues(
const PHX::MDField<Scalar,Cell,IP,Dim> & cub_points,
273 const PHX::MDField<Scalar,Cell,IP,Dim,Dim> &
jac,
274 const PHX::MDField<Scalar,Cell,IP> & jac_det,
275 const PHX::MDField<Scalar,Cell,IP,Dim,Dim> & jac_inv,
276 const PHX::MDField<Scalar,Cell,IP> & weighted_measure,
277 const PHX::MDField<Scalar,Cell,NODE,Dim> & vertex_coordinates,
278 bool use_vertex_coordinates,
279 const int in_num_cells)
282 cell_vertex_coordinates_ = vertex_coordinates;
284 setup(basis_layout, cub_points,
jac, jac_det, jac_inv, in_num_cells);
285 if(weighted_measure.size() > 0)
286 setWeightedMeasure(weighted_measure);
288 const auto elmtspace = getElementSpace();
289 const int num_dims =
jac.extent(2);
292 getBasisValues(
false,
true,
true);
293 if(build_weighted) getBasisValues(
true,
true,
true);
297 getVectorBasisValues(
false,
true,
true);
298 if(build_weighted) getVectorBasisValues(
true,
true,
true);
302 getGradBasisValues(
false,
true,
true);
303 if(build_weighted) getGradBasisValues(
true,
true,
true);
308 getCurl2DVectorBasis(
false,
true,
true);
309 if(build_weighted) getCurl2DVectorBasis(
true,
true,
true);
310 }
else if(num_dims == 3) {
311 getCurlVectorBasis(
false,
true,
true);
312 if(build_weighted) getCurlVectorBasis(
true,
true,
true);
317 getDivVectorBasis(
false,
true,
true);
318 if(build_weighted) getDivVectorBasis(
true,
true,
true);
322 if(use_vertex_coordinates){
323 getBasisCoordinatesRef(
true,
true);
324 getBasisCoordinates(
true,
true);
328 orientations_applied_ = (orientations_.size()>0);
331template <
typename Scalar>
334 const PHX::MDField<Scalar,Cell,IP,Dim,Dim> &
jac,
335 const PHX::MDField<Scalar,Cell,IP> & jac_det,
336 const PHX::MDField<Scalar,Cell,IP,Dim,Dim> & jac_inv)
339 PHX::MDField<Scalar,Cell,IP> weighted_measure;
340 PHX::MDField<Scalar,Cell,NODE,Dim> vertex_coordinates;
341 evaluateValues(cub_points,
jac,jac_det,jac_inv,weighted_measure,vertex_coordinates,
false,
jac.extent(0));
345template <
typename Scalar>
348 const PHX::MDField<Scalar,Cell,IP,Dim,Dim> &
jac,
349 const PHX::MDField<Scalar,Cell,IP> & jac_det,
350 const PHX::MDField<Scalar,Cell,IP,Dim,Dim> & jac_inv,
351 const PHX::MDField<Scalar,Cell,NODE,Dim> & vertex_coordinates,
352 bool use_vertex_coordinates,
353 const int in_num_cells)
355 PHX::MDField<Scalar,Cell,IP> weighted_measure;
356 evaluateValues(cell_cub_points,
jac,jac_det,jac_inv,weighted_measure,vertex_coordinates,use_vertex_coordinates,in_num_cells);
359template <
typename Scalar>
362 const int in_num_cells)
364 num_evaluate_cells_ = in_num_cells < 0 ? vertex_coordinates.extent(0) : in_num_cells;
365 cell_vertex_coordinates_ = vertex_coordinates;
367 getBasisCoordinates(
true,
true);
371template <
typename Scalar>
374 const int in_num_cells)
376 if (!intrepid_basis->requireOrientation())
380 TEUCHOS_ASSERT(not orientations_applied_);
384 const int num_cell_basis_layout = in_num_cells < 0 ? basis_layout->numCells() : in_num_cells;
385 const int num_cell_orientation = orientations.size();
386 const int num_cells = num_cell_basis_layout < num_cell_orientation ? num_cell_basis_layout : num_cell_orientation;
387 const int num_dim = basis_layout->dimension();
390 Kokkos::DynRankView<Intrepid2::Orientation,PHX::Device> device_orientations(
"device_orientations", num_cells);
391 auto host_orientations = Kokkos::create_mirror_view(device_orientations);
392 for(
int i=0; i < num_cells; ++i)
393 host_orientations(i) = orientations[i];
394 Kokkos::deep_copy(device_orientations,host_orientations);
397 applyOrientationsImpl<Scalar>(num_cells, basis_scalar.get_view(), device_orientations, *intrepid_basis);
398 if(build_weighted) applyOrientationsImpl<Scalar>(num_cells, weighted_basis_scalar.get_view(), device_orientations, *intrepid_basis);
399 if(compute_derivatives) applyOrientationsImpl<Scalar>(num_cells, grad_basis.get_view(), device_orientations, *intrepid_basis);
400 if(compute_derivatives and build_weighted) applyOrientationsImpl<Scalar>(num_cells, weighted_grad_basis.get_view(), device_orientations, *intrepid_basis);
404 applyOrientationsImpl<Scalar>(num_cells, basis_vector.get_view(), device_orientations, *intrepid_basis);
405 if(build_weighted) applyOrientationsImpl<Scalar>(num_cells, weighted_basis_vector.get_view(), device_orientations, *intrepid_basis);
407 if(compute_derivatives) applyOrientationsImpl<Scalar>(num_cells, curl_basis_scalar.get_view(), device_orientations, *intrepid_basis);
408 if(compute_derivatives and build_weighted) applyOrientationsImpl<Scalar>(num_cells, weighted_curl_basis_scalar.get_view(), device_orientations, *intrepid_basis);
411 if(compute_derivatives) applyOrientationsImpl<Scalar>(num_cells, curl_basis_vector.get_view(), device_orientations, *intrepid_basis);
412 if(compute_derivatives and build_weighted) applyOrientationsImpl<Scalar>(num_cells, weighted_curl_basis_vector.get_view(), device_orientations, *intrepid_basis);
417 applyOrientationsImpl<Scalar>(num_cells, basis_vector.get_view(), device_orientations, *intrepid_basis);
418 if(build_weighted) applyOrientationsImpl<Scalar>(num_cells, weighted_basis_vector.get_view(), device_orientations, *intrepid_basis);
419 if(compute_derivatives) applyOrientationsImpl<Scalar>(num_cells, div_basis.get_view(), device_orientations, *intrepid_basis);
420 if(compute_derivatives and build_weighted) applyOrientationsImpl<Scalar>(num_cells, weighted_div_basis.get_view(), device_orientations, *intrepid_basis);
423 orientations_applied_ =
true;
427template <
typename Scalar>
431 TEUCHOS_TEST_FOR_EXCEPT_MSG(
true,
"panzer::BasisValues2::applyOrientations : this should not be called.");
434template <
typename Scalar>
436{
return basis_layout->getBasis()->getElementSpace(); }
438template <
typename Scalar>
440setupArrays(
const Teuchos::RCP<const panzer::BasisIRLayout>& layout,
441 bool computeDerivatives)
445 compute_derivatives = computeDerivatives;
446 basis_layout = layout;
447 num_cells_ = basis_layout->numCells();
448 Teuchos::RCP<const panzer::PureBasis> basisDesc = layout->getBasis();
451 int num_quad = layout->numPoints();
452 int dim = basisDesc->dimension();
453 int card = basisDesc->cardinality();
454 int numcells = basisDesc->numCells();
456 Teuchos::RCP<const shards::CellTopology> cellTopo = basisDesc->getCellTopology();
458 intrepid_basis = basisDesc->getIntrepid2Basis<PHX::Device::execution_space,Scalar,Scalar>();
478 if(compute_derivatives) {
511 if(compute_derivatives) {
527 else { TEUCHOS_ASSERT(
false); }
555 if(compute_derivatives) {
589 else { TEUCHOS_ASSERT(
false); }
600template <
typename Scalar>
603setup(
const Teuchos::RCP<const panzer::BasisIRLayout> & basis,
604 PHX::MDField<const Scalar, Cell, IP, Dim> reference_points,
605 PHX::MDField<const Scalar, Cell, IP, Dim, Dim> point_jacobian,
606 PHX::MDField<const Scalar, Cell, IP> point_jacobian_determinant,
607 PHX::MDField<const Scalar, Cell, IP, Dim, Dim> point_jacobian_inverse,
608 const int num_evaluated_cells)
610 basis_layout = basis;
611 intrepid_basis = basis->getBasis()->getIntrepid2Basis<PHX::Device::execution_space,Scalar,Scalar>();
612 num_cells_ = basis_layout->numCells();
613 num_evaluate_cells_ = num_evaluated_cells >= 0 ? num_evaluated_cells : num_cells_;
614 build_weighted =
false;
617 cubature_points_ref_ = reference_points;
618 cubature_jacobian_ = point_jacobian;
619 cubature_jacobian_determinant_ = point_jacobian_determinant;
620 cubature_jacobian_inverse_ = point_jacobian_inverse;
627template <
typename Scalar>
630setupUniform(
const Teuchos::RCP<const panzer::BasisIRLayout> & basis,
631 PHX::MDField<const Scalar, IP, Dim> reference_points,
632 PHX::MDField<const Scalar, Cell, IP, Dim, Dim> point_jacobian,
633 PHX::MDField<const Scalar, Cell, IP> point_jacobian_determinant,
634 PHX::MDField<const Scalar, Cell, IP, Dim, Dim> point_jacobian_inverse,
635 const int num_evaluated_cells)
637 basis_layout = basis;
638 intrepid_basis = basis->getBasis()->getIntrepid2Basis<PHX::Device::execution_space,Scalar,Scalar>();
639 num_cells_ = basis_layout->numCells();
640 num_evaluate_cells_ = num_evaluated_cells >= 0 ? num_evaluated_cells : num_cells_;
641 cubature_points_uniform_ref_ = reference_points;
642 build_weighted =
false;
645 cubature_jacobian_ = point_jacobian;
646 cubature_jacobian_determinant_ = point_jacobian_determinant;
647 cubature_jacobian_inverse_ = point_jacobian_inverse;
654template <
typename Scalar>
657setOrientations(
const std::vector<Intrepid2::Orientation> & orientations,
658 const int num_orientations_cells)
660 if(num_orientations_cells < 0)
661 num_orientations_cells_ = num_evaluate_cells_;
663 num_orientations_cells_ = num_orientations_cells;
664 if(orientations.size() == 0){
665 orientations_applied_ =
false;
668 orientations_ = orientations;
669 orientations_applied_ =
true;
675template <
typename Scalar>
680 cell_vertex_coordinates_ = vertex_coordinates;
683template <
typename Scalar>
689 basis_ref_scalar_evaluated_ =
false;
690 basis_scalar_evaluated_ =
false;
691 basis_ref_vector_evaluated_ =
false;
692 basis_vector_evaluated_ =
false;
693 grad_basis_ref_evaluated_ =
false;
694 grad_basis_evaluated_ =
false;
695 curl_basis_ref_scalar_evaluated_ =
false;
696 curl_basis_scalar_evaluated_ =
false;
697 curl_basis_ref_vector_evaluated_ =
false;
698 curl_basis_vector_evaluated_ =
false;
699 div_basis_ref_evaluated_ =
false;
700 div_basis_evaluated_ =
false;
701 weighted_basis_scalar_evaluated_ =
false;
702 weighted_basis_vector_evaluated_ =
false;
703 weighted_grad_basis_evaluated_ =
false;
704 weighted_curl_basis_scalar_evaluated_ =
false;
705 weighted_curl_basis_vector_evaluated_ =
false;
706 weighted_div_basis_evaluated_ =
false;
707 basis_coordinates_ref_evaluated_ =
false;
708 basis_coordinates_evaluated_ =
false;
736template <
typename Scalar>
741 TEUCHOS_TEST_FOR_EXCEPT_MSG(build_weighted,
742 "BasisValues2::setWeightedMeasure : Weighted measure already set. Can only set weighted measure once after setup or setupUniform have beens called.");
743 cubature_weights_ = weighted_measure;
744 build_weighted =
true;
752#define PANZER_CACHE_DATA(name) \
754 if(name.size()==tmp_##name.size()){ \
755 Kokkos::deep_copy(name.get_view(), tmp_##name.get_view()); \
759 name##_evaluated_ = true; \
762template <
typename Scalar>
766 const bool force)
const
769 if(basis_coordinates_ref_evaluated_ and not force)
770 return basis_coordinates_ref;
774 const int num_card = basis_layout->cardinality();
775 const int num_dim = basis_layout->dimension();
777 using coordsScalarType =
typename Intrepid2::Basis<PHX::Device::execution_space,Scalar,Scalar>::scalarType;
778 auto tmp_basis_coordinates_ref = af.
buildStaticArray<coordsScalarType,
BASIS,
Dim>(
"basis_coordinates_ref", num_card, num_dim);
779 intrepid_basis->getDofCoords(tmp_basis_coordinates_ref.get_view());
780 PHX::Device().fence();
785 return tmp_basis_coordinates_ref;
788template <
typename Scalar>
792 const bool force)
const
795 if(basis_ref_scalar_evaluated_ and not force)
796 return basis_ref_scalar;
799 TEUCHOS_ASSERT(hasUniformReferenceSpace());
807 const int num_quad = basis_layout->numPoints();
808 const int num_card = basis_layout->cardinality();
811 auto cubature_points_uniform_ref = PHX::getNonConstDynRankViewFromConstMDField(cubature_points_uniform_ref_);
813 intrepid_basis->getValues(tmp_basis_ref_scalar.get_view(), cubature_points_uniform_ref, Intrepid2::OPERATOR_VALUE);
814 PHX::Device().fence();
819 return tmp_basis_ref_scalar;
822template <
typename Scalar>
826 const bool force)
const
829 if(basis_ref_vector_evaluated_ and not force)
830 return basis_ref_vector;
833 TEUCHOS_ASSERT(hasUniformReferenceSpace());
841 const int num_quad = basis_layout->numPoints();
842 const int num_card = basis_layout->cardinality();
843 const int num_dim = basis_layout->dimension();
846 auto cubature_points_uniform_ref = PHX::getNonConstDynRankViewFromConstMDField(cubature_points_uniform_ref_);
848 intrepid_basis->getValues(tmp_basis_ref_vector.get_view(),cubature_points_uniform_ref,Intrepid2::OPERATOR_VALUE);
849 PHX::Device().fence();
854 return tmp_basis_ref_vector;
857template <
typename Scalar>
861 const bool force)
const
864 if(grad_basis_ref_evaluated_ and not force)
865 return grad_basis_ref;
868 TEUCHOS_ASSERT(hasUniformReferenceSpace());
876 const int num_quad = basis_layout->numPoints();
877 const int num_card = basis_layout->cardinality();
878 const int num_dim = basis_layout->dimension();
881 auto cubature_points_uniform_ref = PHX::getNonConstDynRankViewFromConstMDField(cubature_points_uniform_ref_);
883 intrepid_basis->getValues(tmp_grad_basis_ref.get_view(), cubature_points_uniform_ref, Intrepid2::OPERATOR_GRAD);
884 PHX::Device().fence();
889 return tmp_grad_basis_ref;
892template <
typename Scalar>
896 const bool force)
const
899 if(curl_basis_ref_scalar_evaluated_ and not force)
900 return curl_basis_ref_scalar;
903 TEUCHOS_ASSERT(hasUniformReferenceSpace());
904 TEUCHOS_ASSERT(basis_layout->dimension() == 2);
912 const int num_quad = basis_layout->numPoints();
913 const int num_card = basis_layout->cardinality();
915 auto tmp_curl_basis_ref_scalar = af.
buildStaticArray<Scalar,
BASIS,
IP>(
"dyn_curl_basis_ref_scalar",num_card,num_quad);
916 auto cubature_points_uniform_ref = PHX::getNonConstDynRankViewFromConstMDField(cubature_points_uniform_ref_);
918 intrepid_basis->getValues(tmp_curl_basis_ref_scalar.get_view(), cubature_points_uniform_ref, Intrepid2::OPERATOR_CURL);
919 PHX::Device().fence();
924 return tmp_curl_basis_ref_scalar;
927template <
typename Scalar>
931 const bool force)
const
934 if(curl_basis_ref_vector_evaluated_ and not force)
935 return curl_basis_ref_vector;
938 TEUCHOS_ASSERT(hasUniformReferenceSpace());
939 TEUCHOS_ASSERT(basis_layout->dimension() == 3);
947 const int num_quad = basis_layout->numPoints();
948 const int num_card = basis_layout->cardinality();
949 const int num_dim = basis_layout->dimension();
951 auto tmp_curl_basis_ref_vector = af.
buildStaticArray<Scalar,
BASIS,
IP,
Dim>(
"dyn_curl_basis_ref_vector",num_card,num_quad,num_dim);
952 auto cubature_points_uniform_ref = PHX::getNonConstDynRankViewFromConstMDField(cubature_points_uniform_ref_);
954 intrepid_basis->getValues(tmp_curl_basis_ref_vector.get_view(), cubature_points_uniform_ref, Intrepid2::OPERATOR_CURL);
955 PHX::Device().fence();
960 return tmp_curl_basis_ref_vector;
963template <
typename Scalar>
967 const bool force)
const
970 if(div_basis_ref_evaluated_ and not force)
971 return div_basis_ref;
974 TEUCHOS_ASSERT(hasUniformReferenceSpace());
982 const int num_quad = basis_layout->numPoints();
983 const int num_card = basis_layout->cardinality();
986 auto cubature_points_uniform_ref = PHX::getNonConstDynRankViewFromConstMDField(cubature_points_uniform_ref_);
988 intrepid_basis->getValues(tmp_div_basis_ref.get_view(), cubature_points_uniform_ref, Intrepid2::OPERATOR_DIV);
989 PHX::Device().fence();
994 return tmp_div_basis_ref;
997template <
typename Scalar>
1001 const bool force)
const
1004 if(basis_coordinates_evaluated_ and not force)
1005 return basis_coordinates;
1007 TEUCHOS_ASSERT(cell_vertex_coordinates_.size() > 0);
1009 const std::pair<int,int> cell_range(0,num_evaluate_cells_);
1010 const auto s_vertex_coordinates = Kokkos::subview(cell_vertex_coordinates_.get_view(),cell_range,Kokkos::ALL(),Kokkos::ALL());
1014 const int num_card = basis_layout->cardinality();
1015 const int num_dim = basis_layout->dimension();
1018 auto s_aux = Kokkos::subview(tmp_basis_coordinates.get_view(),cell_range,Kokkos::ALL(),Kokkos::ALL());
1021 auto const_bcr = getBasisCoordinatesRef(
false);
1022 auto bcr = PHX::getNonConstDynRankViewFromConstMDField(const_bcr);
1024 Intrepid2::CellTools<PHX::Device::execution_space> cell_tools;
1025 cell_tools.mapToPhysicalFrame(s_aux, bcr, s_vertex_coordinates, intrepid_basis->getBaseCellTopology());
1026 PHX::Device().fence();
1031 return tmp_basis_coordinates;
1034template <
typename Scalar>
1039 const bool force)
const
1042 if(weighted_basis_scalar_evaluated_ and not force)
1043 return weighted_basis_scalar;
1045 if(basis_scalar_evaluated_ and not force)
1046 return basis_scalar;
1050 const int num_cells = num_cells_;
1051 const int num_points = basis_layout->numPoints();
1052 const int num_card = basis_layout->cardinality();
1053 const int num_dim = basis_layout->dimension();
1056 TEUCHOS_ASSERT(cubature_weights_.size() > 0);
1059 const auto bv = getBasisValues(
false, force);
1062 auto tmp_weighted_basis_scalar = af.
buildStaticArray<Scalar,
Cell,
BASIS,
IP>(
"weighted_basis_scalar", num_cells, num_card, num_points);
1064 const std::pair<int,int> cell_range(0,num_evaluate_cells_);
1065 auto s_aux = Kokkos::subview(tmp_weighted_basis_scalar.get_view(),cell_range,Kokkos::ALL(),Kokkos::ALL());
1066 auto s_cw = Kokkos::subview(cubature_weights_.get_view(),cell_range,Kokkos::ALL());
1067 auto s_bv = Kokkos::subview(bv.get_view(),cell_range,Kokkos::ALL(),Kokkos::ALL());
1069 using fst=Intrepid2::FunctionSpaceTools<PHX::Device::execution_space>;
1070 fst::multiplyMeasure(s_aux,s_cw,s_bv);
1078 return tmp_weighted_basis_scalar;
1082 const auto element_space = getElementSpace();
1087 TEUCHOS_ASSERT(cubature_jacobian_determinant_.size() > 0);
1090 auto cell_basis_ref_scalar = af.
buildStaticArray<Scalar,
BASIS,
IP>(
"cell_basis_ref_scalar",num_card,num_points);
1093 if(hasUniformReferenceSpace()){
1095 auto cubature_points_uniform_ref = PHX::getNonConstDynRankViewFromConstMDField(cubature_points_uniform_ref_);
1098 intrepid_basis->getValues(cell_basis_ref_scalar.get_view(),cubature_points_uniform_ref,Intrepid2::OPERATOR_VALUE);
1100 const std::pair<int,int> cell_range(0,num_evaluate_cells_);
1101 auto s_aux = Kokkos::subview(tmp_basis_scalar.get_view(), cell_range, Kokkos::ALL(), Kokkos::ALL());
1104 using fst=Intrepid2::FunctionSpaceTools<PHX::Device::execution_space>;
1106 auto s_cjd = Kokkos::subview(cubature_jacobian_determinant_.get_view(), cell_range, Kokkos::ALL());
1107 fst::HVOLtransformVALUE(s_aux,s_cjd,cell_basis_ref_scalar.get_view());
1109 fst::HGRADtransformVALUE(s_aux,cell_basis_ref_scalar.get_view());
1111 PHX::Device().fence();
1130 auto cell_basis_scalar_host = Kokkos::create_mirror_view(cell_basis_scalar.get_view());
1131 auto cell_cub_points_host = Kokkos::create_mirror_view(cell_cub_points.get_view());
1132 auto cell_jac_det_host = Kokkos::create_mirror_view(cell_jac_det.get_view());
1133 auto cell_basis_ref_scalar_host = Kokkos::create_mirror_view(cell_basis_ref_scalar.get_view());
1134 auto cubature_points_ref_host = Kokkos::create_mirror_view(cubature_points_ref_.get_view());
1135 Kokkos::deep_copy(cubature_points_ref_host,cubature_points_ref_.get_view());
1136 auto cubature_jacobian_determinant_host = Kokkos::create_mirror_view(cubature_jacobian_determinant_.get_view());
1137 Kokkos::deep_copy(cubature_jacobian_determinant_host,cubature_jacobian_determinant_.get_view());
1138 auto tmp_basis_scalar_host = Kokkos::create_mirror_view(tmp_basis_scalar.get_view());
1141 for(
int cell=0; cell<num_evaluate_cells_; ++cell){
1144 for(
int p=0;p<num_points;++p)
1145 for(
int d=0;d<num_dim;++d)
1146 cell_cub_points_host(p,d)=cubature_points_ref_host(cell,p,d);
1147 Kokkos::deep_copy(cell_cub_points.get_view(),cell_cub_points_host);
1153 intrepid_basis->getValues(cell_basis_ref_scalar.get_view(),cell_cub_points.get_view(),Intrepid2::OPERATOR_VALUE);
1154 Kokkos::deep_copy(cell_basis_ref_scalar_host,cell_basis_ref_scalar.get_view());
1156 using fst=Intrepid2::FunctionSpaceTools<Kokkos::HostSpace>;
1160 for(
int p=0;p<num_points;++p)
1161 cell_jac_det_host(0,p)=cubature_jacobian_determinant_host(cell,p);
1163 fst::HVOLtransformVALUE(cell_basis_scalar_host,cell_jac_det_host,cell_basis_ref_scalar_host);
1165 fst::HGRADtransformVALUE(cell_basis_scalar_host,cell_basis_ref_scalar_host);
1168 for(
int b=0; b<num_card; ++b)
1169 for(
int p=0; p<num_points; ++p)
1170 tmp_basis_scalar_host(cell,b,p) = cell_basis_scalar_host(0,b,p);
1172 Kokkos::deep_copy(tmp_basis_scalar.get_view(),tmp_basis_scalar_host);
1181 if(orientations_.size() > 0)
1182 applyOrientationsImpl<Scalar>(num_orientations_cells_, tmp_basis_scalar.get_view(), orientations_, *intrepid_basis);
1187 return tmp_basis_scalar;
1193template <
typename Scalar>
1198 const bool force)
const
1201 if(weighted_basis_vector_evaluated_ and not force)
1202 return weighted_basis_vector;
1204 if(basis_vector_evaluated_ and not force)
1205 return basis_vector;
1209 const int num_cells = num_cells_;
1210 const int num_points = basis_layout->numPoints();
1211 const int num_card = basis_layout->cardinality();
1212 const int num_dim = basis_layout->dimension();
1216 TEUCHOS_ASSERT(cubature_weights_.size() > 0);
1219 const auto bv = getVectorBasisValues(
false, force);
1222 auto tmp_weighted_basis_vector = af.
buildStaticArray<Scalar,
Cell,
BASIS,
IP,
Dim>(
"weighted_basis_vector", num_cells, num_card, num_points, num_dim);
1224 const std::pair<int,int> cell_range(0,num_evaluate_cells_);
1225 auto s_aux = Kokkos::subview(tmp_weighted_basis_vector.get_view(),cell_range,Kokkos::ALL(),Kokkos::ALL(),Kokkos::ALL());
1226 auto s_cw = Kokkos::subview(cubature_weights_.get_view(),cell_range,Kokkos::ALL());
1227 auto s_bv = Kokkos::subview(bv.get_view(),cell_range,Kokkos::ALL(),Kokkos::ALL(),Kokkos::ALL());
1229 using fst=Intrepid2::FunctionSpaceTools<PHX::Device::execution_space>;
1230 fst::multiplyMeasure(s_aux, s_cw, s_bv);
1235 return tmp_weighted_basis_vector;
1239 const auto element_space = getElementSpace();
1241 TEUCHOS_ASSERT(num_dim != 1);
1245 TEUCHOS_ASSERT(cubature_jacobian_inverse_.size() > 0);
1247 TEUCHOS_ASSERT(cubature_jacobian_.size() > 0 && cubature_jacobian_determinant_.size() > 0);
1253 if(hasUniformReferenceSpace()){
1255 auto cubature_points_uniform_ref = PHX::getNonConstDynRankViewFromConstMDField(cubature_points_uniform_ref_);
1258 intrepid_basis->getValues(cell_basis_ref_vector.get_view(),cubature_points_uniform_ref,Intrepid2::OPERATOR_VALUE);
1260 const std::pair<int,int> cell_range(0,num_evaluate_cells_);
1261 auto s_aux = Kokkos::subview(tmp_basis_vector.get_view(), cell_range, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL());
1264 using fst=Intrepid2::FunctionSpaceTools<PHX::Device::execution_space>;
1267 auto s_jac_inv = Kokkos::subview(cubature_jacobian_inverse_.get_view(), cell_range, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL());
1269 fst::HCURLtransformVALUE(s_aux,s_jac_inv,cell_basis_ref_vector.get_view());
1272 auto s_jac = Kokkos::subview(cubature_jacobian_.get_view(), cell_range, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL());
1273 auto s_jac_det = Kokkos::subview(cubature_jacobian_determinant_.get_view(), cell_range, Kokkos::ALL());
1275 fst::HDIVtransformVALUE(s_aux,s_jac, s_jac_det, cell_basis_ref_vector.get_view());
1278 PHX::Device().fence();
1299 auto cell_basis_vector_host = Kokkos::create_mirror_view(cell_basis_vector.get_view());
1300 auto cell_cub_points_host = Kokkos::create_mirror_view(cell_cub_points.get_view());
1301 auto cell_jac_det_host = Kokkos::create_mirror_view(cell_jac_det.get_view());
1302 auto cell_jac_host = Kokkos::create_mirror_view(cell_jac.get_view());
1303 auto cell_jac_inv_host = Kokkos::create_mirror_view(cell_jac_inv.get_view());
1304 auto cell_basis_ref_vector_host = Kokkos::create_mirror_view(cell_basis_ref_vector.get_view());
1305 auto cubature_points_ref_host = Kokkos::create_mirror_view(cubature_points_ref_.get_view());
1306 Kokkos::deep_copy(cubature_points_ref_host,cubature_points_ref_.get_view());
1307 auto cubature_jacobian_host = Kokkos::create_mirror_view(cubature_jacobian_.get_view());
1308 Kokkos::deep_copy(cubature_jacobian_host,cubature_jacobian_.get_view());
1309 auto cubature_jacobian_inverse_host = Kokkos::create_mirror_view(cubature_jacobian_inverse_.get_view());
1310 Kokkos::deep_copy(cubature_jacobian_inverse_host,cubature_jacobian_inverse_.get_view());
1311 auto cubature_jacobian_determinant_host = Kokkos::create_mirror_view(cubature_jacobian_determinant_.get_view());
1312 Kokkos::deep_copy(cubature_jacobian_determinant_host,cubature_jacobian_determinant_.get_view());
1313 auto tmp_basis_vector_host = Kokkos::create_mirror_view(tmp_basis_vector.get_view());
1316 for(
int cell=0; cell<num_evaluate_cells_; ++cell){
1319 for(
int p=0;p<num_points;++p)
1320 for(
int d=0;d<num_dim;++d)
1321 cell_cub_points_host(p,d)=cubature_points_ref_host(cell,p,d);
1322 Kokkos::deep_copy(cell_cub_points.get_view(),cell_cub_points_host);
1328 intrepid_basis->getValues(cell_basis_ref_vector.get_view(),cell_cub_points.get_view(),Intrepid2::OPERATOR_VALUE);
1329 Kokkos::deep_copy(cell_basis_ref_vector_host,cell_basis_ref_vector.get_view());
1331 using fst=Intrepid2::FunctionSpaceTools<Kokkos::HostSpace>;
1335 for(
int p=0;p<num_points;++p)
1336 for(
int i=0; i<num_dim; ++i)
1337 for(
int j=0; j<num_dim; ++j)
1338 cell_jac_inv_host(0,p,i,j)=cubature_jacobian_inverse_host(cell,p,i,j);
1340 fst::HCURLtransformVALUE(cell_basis_vector_host,cell_jac_inv_host,cell_basis_ref_vector_host);
1343 for(
int p=0;p<num_points;++p)
1344 for(
int i=0; i<num_dim; ++i)
1345 for(
int j=0; j<num_dim; ++j)
1346 cell_jac_host(0,p,i,j)=cubature_jacobian_host(cell,p,i,j);
1348 for(
int p=0;p<num_points;++p)
1349 cell_jac_det_host(0,p)=cubature_jacobian_determinant_host(cell,p);
1351 fst::HDIVtransformVALUE(cell_basis_vector_host,cell_jac_host,cell_jac_det_host,cell_basis_ref_vector_host);
1355 for(
int b=0; b<num_card; ++b)
1356 for(
int p=0; p<num_points; ++p)
1357 for(
int d=0; d<num_dim; ++d)
1358 tmp_basis_vector_host(cell,b,p,d) = cell_basis_vector_host(0,b,p,d);
1360 Kokkos::deep_copy(tmp_basis_vector.get_view(),tmp_basis_vector_host);
1364 if(orientations_.size() > 0)
1365 applyOrientationsImpl<Scalar>(num_orientations_cells_, tmp_basis_vector.get_view(), orientations_, *intrepid_basis);
1370 return tmp_basis_vector;
1376template <
typename Scalar>
1381 const bool force)
const
1384 if(weighted_grad_basis_evaluated_ and not force)
1385 return weighted_grad_basis;
1387 if(grad_basis_evaluated_ and not force)
1392 const int num_cells = num_cells_;
1393 const int num_points = basis_layout->numPoints();
1394 const int num_card = basis_layout->cardinality();
1395 const int num_dim = basis_layout->dimension();
1399 TEUCHOS_ASSERT(cubature_weights_.size() > 0);
1402 const auto bv = getGradBasisValues(
false, force);
1405 auto tmp_weighted_grad_basis = af.
buildStaticArray<Scalar,
Cell,
BASIS,
IP,
Dim>(
"weighted_grad_basis", num_cells, num_card, num_points, num_dim);
1407 const std::pair<int,int> cell_range(0,num_evaluate_cells_);
1408 auto s_aux = Kokkos::subview(tmp_weighted_grad_basis.get_view(), cell_range, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL());
1409 auto s_cw = Kokkos::subview(cubature_weights_.get_view(), cell_range, Kokkos::ALL());
1410 auto s_bv = Kokkos::subview(bv.get_view(), cell_range, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL());
1412 using fst=Intrepid2::FunctionSpaceTools<PHX::Device::execution_space>;
1413 fst::multiplyMeasure(s_aux,s_cw,s_bv);
1418 return tmp_weighted_grad_basis;
1422 TEUCHOS_ASSERT(cubature_jacobian_inverse_.size() > 0);
1424 const auto element_space = getElementSpace();
1430 if(hasUniformReferenceSpace()){
1432 auto cubature_points_uniform_ref = PHX::getNonConstDynRankViewFromConstMDField(cubature_points_uniform_ref_);
1435 intrepid_basis->getValues(cell_grad_basis_ref.get_view(),cubature_points_uniform_ref,Intrepid2::OPERATOR_GRAD);
1437 const std::pair<int,int> cell_range(0,num_evaluate_cells_);
1438 auto s_aux = Kokkos::subview(tmp_grad_basis.get_view(), cell_range, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL());
1439 auto s_jac_inv = Kokkos::subview(cubature_jacobian_inverse_.get_view(), cell_range, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL());
1442 using fst=Intrepid2::FunctionSpaceTools<PHX::Device::execution_space>;
1443 fst::HGRADtransformGRAD(s_aux, s_jac_inv,cell_grad_basis_ref.get_view());
1445 PHX::Device().fence();
1467 auto cell_cub_points_host = Kokkos::create_mirror_view(cell_cub_points.get_view());
1468 auto cubature_points_ref_host = Kokkos::create_mirror_view(cubature_points_ref_.get_view());
1469 Kokkos::deep_copy(cubature_points_ref_host,cubature_points_ref_.get_view());
1470 auto cell_jac_inv_host = Kokkos::create_mirror_view(cell_jac_inv.get_view());
1471 auto cubature_jacobian_inverse_host = Kokkos::create_mirror_view(cubature_jacobian_inverse_.get_view());
1472 Kokkos::deep_copy(cubature_jacobian_inverse_host,cubature_jacobian_inverse_.get_view());
1473 auto cell_grad_basis_ref_host = Kokkos::create_mirror_view(cell_grad_basis_ref.get_view());
1474 auto cell_grad_basis_host = Kokkos::create_mirror_view(cell_grad_basis.get_view());
1475 auto tmp_grad_basis_host = Kokkos::create_mirror_view(tmp_grad_basis.get_view());
1478 for(
int cell=0; cell<num_evaluate_cells_; ++cell){
1481 for(
int p=0;p<num_points;++p)
1482 for(
int d=0;d<num_dim;++d)
1483 cell_cub_points_host(p,d)=cubature_points_ref_host(cell,p,d);
1489 Kokkos::deep_copy(cell_cub_points.get_view(),cell_cub_points_host);
1490 intrepid_basis->getValues(cell_grad_basis_ref.get_view(),cell_cub_points.get_view(),Intrepid2::OPERATOR_GRAD);
1491 Kokkos::deep_copy(cell_grad_basis_ref_host,cell_grad_basis_ref.get_view());
1493 for(
int p=0;p<num_points;++p)
1494 for(
int d=0;d<num_dim;++d)
1495 for(
int d2=0;d2<num_dim;++d2)
1496 cell_jac_inv_host(0,p,d,d2)=cubature_jacobian_inverse_host(cell,p,d,d2);
1498 using fst=Intrepid2::FunctionSpaceTools<Kokkos::HostSpace>;
1499 fst::HGRADtransformGRAD(cell_grad_basis_host,cell_jac_inv_host,cell_grad_basis_ref_host);
1503 for(
int b=0; b<num_card; ++b)
1504 for(
int p=0; p<num_points; ++p)
1505 for(
int d=0; d<num_dim; ++d)
1506 tmp_grad_basis_host(cell,b,p,d) = cell_grad_basis_host(0,b,p,d);
1507 Kokkos::deep_copy(tmp_grad_basis.get_view(),tmp_grad_basis_host);
1511 if(orientations_.size() > 0)
1512 applyOrientationsImpl<Scalar>(num_orientations_cells_, tmp_grad_basis.get_view(), orientations_, *intrepid_basis);
1517 return tmp_grad_basis;
1523template <
typename Scalar>
1528 const bool force)
const
1531 if(weighted_curl_basis_scalar_evaluated_ and not force)
1532 return weighted_curl_basis_scalar;
1534 if(curl_basis_scalar_evaluated_ and not force)
1535 return curl_basis_scalar;
1539 const int num_cells = num_cells_;
1540 const int num_points = basis_layout->numPoints();
1541 const int num_card = basis_layout->cardinality();
1542 const int num_dim = basis_layout->dimension();
1546 TEUCHOS_ASSERT(cubature_weights_.size() > 0);
1549 const auto bv = getCurl2DVectorBasis(
false, force);
1552 auto tmp_weighted_curl_basis_scalar = af.
buildStaticArray<Scalar,
Cell,
BASIS,
IP>(
"weighted_curl_basis_scalar", num_cells, num_card, num_points);
1554 const std::pair<int,int> cell_range(0,num_evaluate_cells_);
1555 auto s_aux = Kokkos::subview(tmp_weighted_curl_basis_scalar.get_view(), cell_range, Kokkos::ALL(), Kokkos::ALL());
1556 auto s_cw = Kokkos::subview(cubature_weights_.get_view(), cell_range, Kokkos::ALL());
1557 auto s_bv = Kokkos::subview(bv.get_view(), cell_range, Kokkos::ALL(), Kokkos::ALL());
1559 using fst=Intrepid2::FunctionSpaceTools<PHX::Device::execution_space>;
1560 fst::multiplyMeasure(s_aux,s_cw,s_bv);
1565 return tmp_weighted_curl_basis_scalar;
1569 TEUCHOS_ASSERT(cubature_jacobian_determinant_.size() > 0);
1570 TEUCHOS_ASSERT(num_dim == 2);
1572 const auto element_space = getElementSpace();
1575 auto cell_curl_basis_ref_scalar = af.
buildStaticArray<Scalar,
BASIS,
IP>(
"cell_curl_basis_ref_scalar",num_card,num_points);
1578 if(hasUniformReferenceSpace()){
1580 auto cubature_points_uniform_ref = PHX::getNonConstDynRankViewFromConstMDField(cubature_points_uniform_ref_);
1582 intrepid_basis->getValues(cell_curl_basis_ref_scalar.get_view(),cubature_points_uniform_ref,Intrepid2::OPERATOR_CURL);
1584 const std::pair<int,int> cell_range(0,num_evaluate_cells_);
1585 auto s_aux = Kokkos::subview(tmp_curl_basis_scalar.get_view(), cell_range, Kokkos::ALL(), Kokkos::ALL());
1586 auto s_jac_det = Kokkos::subview(cubature_jacobian_determinant_.get_view(), cell_range, Kokkos::ALL());
1591 using fst=Intrepid2::FunctionSpaceTools<PHX::Device::execution_space>;
1592 fst::HDIVtransformDIV(s_aux,s_jac_det,cell_curl_basis_ref_scalar.get_view());
1593 PHX::Device().fence();
1612 auto cell_cub_points_host = Kokkos::create_mirror_view(cell_cub_points.get_view());
1613 auto cubature_points_ref_host = Kokkos::create_mirror_view(cubature_points_ref_.get_view());
1614 Kokkos::deep_copy(cubature_points_ref_host,cubature_points_ref_.get_view());
1615 auto cell_jac_det_host = Kokkos::create_mirror_view(cell_jac_det.get_view());
1616 auto cubature_jacobian_determinant_host = Kokkos::create_mirror_view(cubature_jacobian_determinant_.get_view());
1617 Kokkos::deep_copy(cubature_jacobian_determinant_host,cubature_jacobian_determinant_.get_view());
1618 auto cell_curl_basis_ref_scalar_host = Kokkos::create_mirror_view(cell_curl_basis_ref_scalar.get_view());
1619 auto cell_curl_host = Kokkos::create_mirror_view(cell_curl.get_view());
1620 auto tmp_curl_basis_scalar_host = Kokkos::create_mirror_view(tmp_curl_basis_scalar.get_view());
1623 for(
int cell=0; cell<num_evaluate_cells_; ++cell){
1626 for(
int p=0;p<num_points;++p)
1627 for(
int d=0;d<num_dim;++d)
1628 cell_cub_points_host(p,d)=cubature_points_ref_host(cell,p,d);
1629 for(
int p=0;p<num_points;++p)
1630 cell_jac_det_host(0,p)=cubature_jacobian_determinant_host(cell,p);
1637 Kokkos::deep_copy(cell_cub_points.get_view(),cell_cub_points_host);
1638 intrepid_basis->getValues(cell_curl_basis_ref_scalar.get_view(),cell_cub_points.get_view(),Intrepid2::OPERATOR_CURL);
1639 Kokkos::deep_copy(cell_curl_basis_ref_scalar_host,cell_curl_basis_ref_scalar.get_view());
1644 using fst=Intrepid2::FunctionSpaceTools<Kokkos::HostSpace>;
1645 fst::HDIVtransformDIV(cell_curl_host,cell_jac_det_host,cell_curl_basis_ref_scalar_host);
1646 PHX::Device().fence();
1649 for(
int b=0; b<num_card; ++b)
1650 for(
int p=0; p<num_points; ++p)
1651 tmp_curl_basis_scalar_host(cell,b,p) = cell_curl_host(0,b,p);
1652 Kokkos::deep_copy(tmp_curl_basis_scalar.get_view(),tmp_curl_basis_scalar_host);
1656 if(orientations_.size() > 0)
1657 applyOrientationsImpl<Scalar>(num_orientations_cells_, tmp_curl_basis_scalar.get_view(), orientations_, *intrepid_basis);
1662 return tmp_curl_basis_scalar;
1668template <
typename Scalar>
1673 const bool force)
const
1676 if(weighted_curl_basis_vector_evaluated_ and not force)
1677 return weighted_curl_basis_vector;
1679 if(curl_basis_vector_evaluated_ and not force)
1680 return curl_basis_vector;
1684 const int num_cells = num_cells_;
1685 const int num_points = basis_layout->numPoints();
1686 const int num_card = basis_layout->cardinality();
1687 const int num_dim = basis_layout->dimension();
1691 TEUCHOS_ASSERT(cubature_weights_.size() > 0);
1694 const auto bv = getCurlVectorBasis(
false, force);
1697 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);
1699 const std::pair<int,int> cell_range(0,num_evaluate_cells_);
1700 auto s_aux = Kokkos::subview(tmp_weighted_curl_basis_vector.get_view(), cell_range, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL());
1701 auto s_cw = Kokkos::subview(cubature_weights_.get_view(), cell_range, Kokkos::ALL());
1702 auto s_bv = Kokkos::subview(bv.get_view(), cell_range, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL());
1704 using fst=Intrepid2::FunctionSpaceTools<PHX::Device::execution_space>;
1705 fst::multiplyMeasure(s_aux, s_cw, s_bv);
1710 return tmp_weighted_curl_basis_vector;
1714 TEUCHOS_ASSERT(cubature_jacobian_determinant_.size() > 0);
1715 TEUCHOS_ASSERT(num_dim == 3);
1717 const auto element_space = getElementSpace();
1720 auto cell_curl_basis_ref_vector = af.
buildStaticArray<Scalar,
BASIS,
IP,
Dim>(
"cell_curl_basis_ref_vector",num_card,num_points,num_dim);
1723 if(hasUniformReferenceSpace()){
1725 auto cubature_points_uniform_ref = PHX::getNonConstDynRankViewFromConstMDField(cubature_points_uniform_ref_);
1727 intrepid_basis->getValues(cell_curl_basis_ref_vector.get_view(),cubature_points_uniform_ref,Intrepid2::OPERATOR_CURL);
1729 const std::pair<int,int> cell_range(0,num_evaluate_cells_);
1730 auto s_aux = Kokkos::subview(tmp_curl_basis_vector.get_view(), cell_range, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL());
1731 auto s_jac = Kokkos::subview(cubature_jacobian_.get_view(), cell_range, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL());
1732 auto s_jac_det = Kokkos::subview(cubature_jacobian_determinant_.get_view(), cell_range, Kokkos::ALL());
1734 using fst=Intrepid2::FunctionSpaceTools<PHX::Device::execution_space>;
1735 fst::HCURLtransformCURL(s_aux, s_jac, s_jac_det,cell_curl_basis_ref_vector.get_view());
1736 PHX::Device().fence();
1756 auto cell_cub_points_host = Kokkos::create_mirror_view(cell_cub_points.get_view());
1757 auto cubature_points_ref_host = Kokkos::create_mirror_view(cubature_points_ref_.get_view());
1758 Kokkos::deep_copy(cubature_points_ref_host,cubature_points_ref_.get_view());
1759 auto cell_jac_host = Kokkos::create_mirror_view(cell_jac.get_view());
1760 auto cubature_jacobian_host = Kokkos::create_mirror_view(cubature_jacobian_.get_view());
1761 Kokkos::deep_copy(cubature_jacobian_host,cubature_jacobian_.get_view());
1762 auto cell_jac_det_host = Kokkos::create_mirror_view(cell_jac_det.get_view());
1763 auto cubature_jacobian_determinant_host = Kokkos::create_mirror_view(cubature_jacobian_determinant_.get_view());
1764 Kokkos::deep_copy(cubature_jacobian_determinant_host,cubature_jacobian_determinant_.get_view());
1765 auto cell_curl_basis_ref_vector_host = Kokkos::create_mirror_view(cell_curl_basis_ref_vector.get_view());
1766 auto cell_curl_host = Kokkos::create_mirror_view(cell_curl.get_view());
1767 auto tmp_curl_basis_vector_host = Kokkos::create_mirror_view(tmp_curl_basis_vector.get_view());
1770 for(
int cell=0; cell<num_evaluate_cells_; ++cell){
1773 for(
int p=0;p<num_points;++p)
1774 for(
int d=0;d<num_dim;++d)
1775 cell_cub_points_host(p,d)=cubature_points_ref_host(cell,p,d);
1776 for(
int p=0;p<num_points;++p)
1777 for(
int d=0;d<num_dim;++d)
1778 for(
int d2=0;d2<num_dim;++d2)
1779 cell_jac_host(0,p,d,d2)=cubature_jacobian_host(cell,p,d,d2);
1780 for(
int p=0;p<num_points;++p)
1781 cell_jac_det_host(0,p)=cubature_jacobian_determinant_host(cell,p);
1787 Kokkos::deep_copy(cell_cub_points.get_view(),cell_cub_points_host);
1788 intrepid_basis->getValues(cell_curl_basis_ref_vector.get_view(),cell_cub_points.get_view(),Intrepid2::OPERATOR_CURL);
1789 Kokkos::deep_copy(cell_curl_basis_ref_vector_host,cell_curl_basis_ref_vector.get_view());
1791 using fst=Intrepid2::FunctionSpaceTools<Kokkos::HostSpace>;
1792 fst::HCURLtransformCURL(cell_curl_host,cell_jac_host,cell_jac_det_host,cell_curl_basis_ref_vector_host);
1796 for(
int b=0; b<num_card; ++b)
1797 for(
int p=0; p<num_points; ++p)
1798 for(
int d=0;d<num_dim;++d)
1799 tmp_curl_basis_vector_host(cell,b,p,d) = cell_curl_host(0,b,p,d);
1800 Kokkos::deep_copy(tmp_curl_basis_vector.get_view(),tmp_curl_basis_vector_host);
1804 if(orientations_.size() > 0)
1805 applyOrientationsImpl<Scalar>(num_orientations_cells_, tmp_curl_basis_vector.get_view(), orientations_, *intrepid_basis);
1810 return tmp_curl_basis_vector;
1816template <
typename Scalar>
1821 const bool force)
const
1824 if(weighted_div_basis_evaluated_ and not force)
1825 return weighted_div_basis;
1827 if(div_basis_evaluated_ and not force)
1832 const int num_cells = num_cells_;
1833 const int num_points = basis_layout->numPoints();
1834 const int num_card = basis_layout->cardinality();
1835 const int num_dim = basis_layout->dimension();
1839 TEUCHOS_ASSERT(cubature_weights_.size() > 0);
1842 const auto bv = getDivVectorBasis(
false, force);
1845 auto tmp_weighted_div_basis = af.
buildStaticArray<Scalar,
Cell,
BASIS,
IP>(
"weighted_div_basis", num_cells, num_card, num_points);
1847 const std::pair<int,int> cell_range(0,num_evaluate_cells_);
1848 auto s_aux = Kokkos::subview(tmp_weighted_div_basis.get_view(), cell_range, Kokkos::ALL(), Kokkos::ALL());
1849 auto s_cw = Kokkos::subview(cubature_weights_.get_view(), cell_range, Kokkos::ALL());
1850 auto s_bv = Kokkos::subview(bv.get_view(), cell_range, Kokkos::ALL(), Kokkos::ALL());
1852 using fst=Intrepid2::FunctionSpaceTools<PHX::Device::execution_space>;
1853 fst::multiplyMeasure(s_aux, s_cw, s_bv);
1858 return tmp_weighted_div_basis;
1862 TEUCHOS_ASSERT(cubature_jacobian_determinant_.size() > 0);
1864 const auto element_space = getElementSpace();
1870 if(hasUniformReferenceSpace()){
1872 auto cubature_points_uniform_ref = PHX::getNonConstDynRankViewFromConstMDField(cubature_points_uniform_ref_);
1874 intrepid_basis->getValues(cell_div_basis_ref.get_view(),cubature_points_uniform_ref,Intrepid2::OPERATOR_DIV);
1876 const std::pair<int,int> cell_range(0,num_evaluate_cells_);
1877 auto s_aux = Kokkos::subview(tmp_div_basis.get_view(), cell_range, Kokkos::ALL(), Kokkos::ALL());
1878 auto s_jac_det = Kokkos::subview(cubature_jacobian_determinant_.get_view(), cell_range, Kokkos::ALL());
1880 using fst=Intrepid2::FunctionSpaceTools<PHX::Device::execution_space>;
1881 fst::HDIVtransformDIV(s_aux,s_jac_det,cell_div_basis_ref.get_view());
1882 PHX::Device().fence();
1901 auto cell_cub_points_host = Kokkos::create_mirror_view(cell_cub_points.get_view());
1902 auto cubature_points_ref_host = Kokkos::create_mirror_view(cubature_points_ref_.get_view());
1903 Kokkos::deep_copy(cubature_points_ref_host,cubature_points_ref_.get_view());
1904 auto cell_jac_det_host = Kokkos::create_mirror_view(cell_jac_det.get_view());
1905 auto cubature_jacobian_determinant_host = Kokkos::create_mirror_view(cubature_jacobian_determinant_.get_view());
1906 Kokkos::deep_copy(cubature_jacobian_determinant_host,cubature_jacobian_determinant_.get_view());
1907 auto cell_div_basis_ref_host = Kokkos::create_mirror_view(cell_div_basis_ref.get_view());
1908 auto cell_div_basis_host = Kokkos::create_mirror_view(cell_div_basis.get_view());
1909 auto tmp_div_basis_host = Kokkos::create_mirror_view(tmp_div_basis.get_view());
1912 for(
int cell=0; cell<num_evaluate_cells_; ++cell){
1915 for(
int p=0;p<num_points;++p)
1916 for(
int d=0;d<num_dim;++d)
1917 cell_cub_points_host(p,d)=cubature_points_ref_host(cell,p,d);
1918 for(
int p=0;p<num_points;++p)
1919 cell_jac_det_host(0,p)=cubature_jacobian_determinant_host(cell,p);
1925 Kokkos::deep_copy(cell_cub_points.get_view(),cell_cub_points_host);
1926 intrepid_basis->getValues(cell_div_basis_ref.get_view(),cell_cub_points.get_view(),Intrepid2::OPERATOR_DIV);
1927 Kokkos::deep_copy(cell_div_basis_ref_host,cell_div_basis_ref.get_view());
1929 using fst=Intrepid2::FunctionSpaceTools<PHX::Device::execution_space>;
1930 fst::HDIVtransformDIV(cell_div_basis.get_view(),cell_jac_det.get_view(),cell_div_basis_ref.get_view());
1931 Kokkos::deep_copy(cell_div_basis_host, cell_div_basis.get_static_view());
1935 for(
int b=0; b<num_card; ++b)
1936 for(
int p=0; p<num_points; ++p)
1937 tmp_div_basis_host(cell,b,p) = cell_div_basis_host(0,b,p);
1938 Kokkos::deep_copy(tmp_div_basis.get_view(),tmp_div_basis_host);
1942 if(orientations_.size() > 0)
1943 applyOrientationsImpl<Scalar>(num_orientations_cells_, tmp_div_basis.get_view(), orientations_, *intrepid_basis);
1948 return tmp_div_basis;
#define PANZER_CACHE_DATA(name)
PHX::MDField< const Scalar, Cell, BASIS, IP > ConstArray_CellBasisIP
ConstArray_BasisIP getCurl2DVectorBasisRef(const bool cache=true, const bool force=false) const
Get the curl of a vector basis evaluated at reference points.
bool weighted_div_basis_evaluated_
BasisValues2(const std::string &prefix="", const bool allocArrays=false, const bool buildWeighted=false)
Main constructor.
Intrepid2::Basis< PHX::Device::execution_space, Scalar, Scalar > IntrepidBasis
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.
bool grad_basis_evaluated_
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)
ConstArray_BasisIPDim getGradBasisValuesRef(const bool cache=true, const bool force=false) const
Get the gradient of the basis evaluated at reference points.
bool curl_basis_vector_evaluated_
bool basis_coordinates_evaluated_
ConstArray_BasisIPDim getVectorBasisValuesRef(const bool cache=true, const bool force=false) const
Get the vector basis values evaluated at reference points.
bool basis_vector_evaluated_
PureBasis::EElementSpace getElementSpace() const
bool weighted_curl_basis_scalar_evaluated_
bool curl_basis_ref_scalar_evaluated_
bool div_basis_ref_evaluated_
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.
bool weighted_basis_vector_evaluated_
bool weighted_grad_basis_evaluated_
void setup(const Teuchos::RCP< const panzer::BasisIRLayout > &basis, PHX::MDField< const Scalar, Cell, IP, Dim > reference_points, PHX::MDField< const Scalar, Cell, IP, Dim, Dim > point_jacobian, PHX::MDField< const Scalar, Cell, IP > point_jacobian_determinant, PHX::MDField< const Scalar, Cell, IP, Dim, Dim > point_jacobian_inverse, const int num_evaluated_cells=-1)
Setup for lazy evaluation for non-uniform point layout.
bool basis_ref_vector_evaluated_
ConstArray_CellBasisIP getBasisValues(const bool weighted, const bool cache=true, const bool force=false) const
Get the basis values evaluated at mesh points.
bool div_basis_evaluated_
ConstArray_BasisIP getBasisValuesRef(const bool cache=true, const bool force=false) const
Get the basis values evaluated at reference points.
PHX::MDField< const Scalar, BASIS, IP, Dim > ConstArray_BasisIPDim
bool grad_basis_ref_evaluated_
bool basis_coordinates_ref_evaluated_
void evaluateBasisCoordinates(const PHX::MDField< Scalar, Cell, NODE, Dim > &vertex_coordinates, const int in_num_cells=-1)
void setOrientations(const std::vector< Intrepid2::Orientation > &orientations, const int num_orientations_cells=-1)
Set the orientations object for applying orientations using the lazy evaluation path - required for c...
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)
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.
bool curl_basis_ref_vector_evaluated_
PHX::MDField< const Scalar, Cell, BASIS, IP, Dim > ConstArray_CellBasisIPDim
bool weighted_basis_scalar_evaluated_
void setWeightedMeasure(PHX::MDField< const Scalar, Cell, IP > weighted_measure)
Set the cubature weights (weighted measure) for the basis values object - required to get weighted ba...
ConstArray_BasisDim getBasisCoordinatesRef(const bool cache=true, const bool force=false) const
Get the reference coordinates for basis.
bool weighted_curl_basis_vector_evaluated_
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.
PHX::MDField< const Scalar, BASIS, IP > ConstArray_BasisIP
void setCellVertexCoordinates(PHX::MDField< Scalar, Cell, NODE, Dim > vertex_coordinates)
Set the cell vertex coordinates (required for getBasisCoordinates())
ConstArray_BasisIPDim getCurlVectorBasisRef(const bool cache=true, const bool force=false) const
Get the curl of a vector basis evaluated at reference points.
bool basis_ref_scalar_evaluated_
Used to check if arrays have been cached.
ConstArray_CellBasisDim getBasisCoordinates(const bool cache=true, const bool force=false) const
Carterisan coordinates for basis coefficients in mesh space.
bool curl_basis_scalar_evaluated_
void setupArrays(const Teuchos::RCP< const panzer::BasisIRLayout > &basis, bool computeDerivatives=true)
Sizes/allocates memory for arrays.
void setupUniform(const Teuchos::RCP< const panzer::BasisIRLayout > &basis, PHX::MDField< const Scalar, IP, Dim > reference_points, PHX::MDField< const Scalar, Cell, IP, Dim, Dim > point_jacobian, PHX::MDField< const Scalar, Cell, IP > point_jacobian_determinant, PHX::MDField< const Scalar, Cell, IP, Dim, Dim > point_jacobian_inverse, const int num_evaluated_cells=-1)
Setup for lazy evaluation for uniform point layout.
PHX::MDField< const Scalar, Cell, BASIS, Dim > ConstArray_CellBasisDim
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_BasisIP getDivVectorBasisRef(const bool cache=true, const bool force=false) const
Get the divergence of a vector basis evaluated at reference points.
void applyOrientations(const PHX::MDField< const Scalar, Cell, BASIS > &orientations)
Method to apply orientations to a basis values container.
bool basis_scalar_evaluated_
PHX::MDField< const Scalar, BASIS, Dim > ConstArray_BasisDim
PHX::MDField< Scalar, T0 > buildStaticArray(const std::string &str, int d0) const