28 const Teuchos::ParameterList& p)
30 dof_name_ = (p.get< std::string >(
"DOF Name"));
32 if(p.isType< Teuchos::RCP<PureBasis> >(
"Basis"))
33 basis_ = p.get< Teuchos::RCP<PureBasis> >(
"Basis");
35 basis_ = p.get< Teuchos::RCP<const PureBasis> >(
"Basis");
37 pointRule_ = p.get<Teuchos::RCP<const PointRule> >(
"Point Rule");
39 Teuchos::RCP<PHX::DataLayout> basis_layout = basis_->functional;
40 Teuchos::RCP<PHX::DataLayout> vector_layout_vector = basis_->functional_grad;
43 TEUCHOS_ASSERT(basis_->isVectorBasis());
46 std::string orientationFieldName = basis_->name() +
" Orientation";
49 pointValues_.setupArrays(pointRule_);
52 constJac_ = pointValues_.jac;
53 this->addDependentField(constJac_);
55 gatherFieldNormals_ = PHX::MDField<ScalarT,Cell,NODE,Dim>(dof_name_+
"_Normals",vector_layout_vector);
56 this->addEvaluatedField(gatherFieldNormals_);
58 this->setName(
"Gather Normals");
68 orientations_ = Kokkos::View<Intrepid2::Orientation*>(
"orientations_",orientations->size());
69 auto orientations_host = Kokkos::create_mirror_view(orientations_);
70 for (
size_t i=0; i < orientations->size(); ++i)
71 orientations_host(i) = (*orientations)[i];
72 Kokkos::deep_copy(orientations_,orientations_host);
74 this->utils.setFieldData(pointValues_.jac,fm);
76 const shards::CellTopology & parentCell = *basis_->getCellTopology();
77 int sideDim = parentCell.getDimension()-1;
78 sideParam_ = Intrepid2::RefSubcellParametrization<PHX::Device>::get(sideDim, parentCell.getKey());
80 int numFaces = gatherFieldNormals_.extent(1);
81 keys_ = Kokkos::View<unsigned int*>(
"parentCell.keys",numFaces);
82 auto keys_host = Kokkos::create_mirror_view(keys_);
83 for (
int i=0; i < numFaces; ++i)
84 keys_host(i) = parentCell.getKey(sideDim,i);
85 Kokkos::deep_copy(keys_,keys_host);
88 int cellDim = parentCell.getDimension();
89 refEdges_ = Kokkos::createDynRankViewWithType<Kokkos::DynRankView<ScalarT,PHX::Device>>(gatherFieldNormals_.get_static_view(),
"ref_edges", (*d.
worksets_)[0].num_cells, sideDim, cellDim);
90 phyEdges_ = Kokkos::createDynRankViewWithType<Kokkos::DynRankView<ScalarT,PHX::Device>>(gatherFieldNormals_.get_static_view(),
"phy_edges", (*d.
worksets_)[0].num_cells, sideDim, cellDim);
102 int numFaces = gatherFieldNormals_.extent(1);
103 const auto worksetJacobians = pointValues_.jac.get_view();
105 auto gatherFieldNormals = gatherFieldNormals_;
106 auto sideParam = sideParam_;
108 auto orientations = orientations_;
109 auto refEdges = refEdges_;
110 auto phyEdges = phyEdges_;
113 Kokkos::parallel_for(
"panzer::GatherNormals",workset.
num_cells,KOKKOS_LAMBDA(
const int c){
114 int faceOrts[6] = {};
115 orientations(cell_local_ids(c)).getFaceOrientation(faceOrts, numFaces);
117 for(
int pt = 0; pt < numFaces; pt++) {
118 auto ortEdgeTan_U = Kokkos::subview(refEdges, c, 0, Kokkos::ALL());
119 auto ortEdgeTan_V = Kokkos::subview(refEdges, c, 1, Kokkos::ALL());
121 auto tmpRefEdges = Kokkos::subview(refEdges, c, Kokkos::ALL(), Kokkos::ALL());
122 Intrepid2::Impl::OrientationTools::getRefSubcellTangents(tmpRefEdges,
128 auto phyEdgeTan_U = Kokkos::subview(phyEdges, c, 0, Kokkos::ALL());
129 auto phyEdgeTan_V = Kokkos::subview(phyEdges, c, 1, Kokkos::ALL());
130 auto J = Kokkos::subview(worksetJacobians, c, pt, Kokkos::ALL(), Kokkos::ALL());
132 Intrepid2::Kernels::Serial::matvec_product(phyEdgeTan_U, J, ortEdgeTan_U);
133 Intrepid2::Kernels::Serial::matvec_product(phyEdgeTan_V, J, ortEdgeTan_V);
136 gatherFieldNormals(c,pt,0) = (phyEdgeTan_U(1)*phyEdgeTan_V(2) - phyEdgeTan_U(2)*phyEdgeTan_V(1));
137 gatherFieldNormals(c,pt,1) = (phyEdgeTan_U(2)*phyEdgeTan_V(0) - phyEdgeTan_U(0)*phyEdgeTan_V(2));
138 gatherFieldNormals(c,pt,2) = (phyEdgeTan_U(0)*phyEdgeTan_V(1) - phyEdgeTan_U(1)*phyEdgeTan_V(0));