43 #ifndef PANZER_GATHER_TANGENTS_IMPL_HPP
44 #define PANZER_GATHER_TANGENTS_IMPL_HPP
46 #include "Teuchos_Assert.hpp"
47 #include "Phalanx_DataLayout.hpp"
49 #include "Intrepid2_Kernels.hpp"
50 #include "Intrepid2_OrientationTools.hpp"
53 #include "Kokkos_ViewFactory.hpp"
55 #include "Teuchos_FancyOStream.hpp"
57 template<
typename EvalT,
typename Traits>
62 dof_name_ = (p.
get< std::string >(
"DOF Name"));
78 std::string orientationFieldName = basis_->name() +
" Orientation";
84 constJac_ = pointValues_.jac;
85 this->addDependentField(constJac_);
88 this->addEvaluatedField(gatherFieldTangents_);
90 this->setName(
"Gather Tangents");
94 template<
typename EvalT,
typename Traits>
101 auto orientations_host = Kokkos::create_mirror_view(orientations_);
102 for (
size_t i=0; i < orientations->size(); ++i)
103 orientations_host(i) = (*orientations)[i];
104 Kokkos::deep_copy(orientations_,orientations_host);
106 this->utils.setFieldData(pointValues_.jac,fm);
107 const shards::CellTopology & parentCell = *basis_->getCellTopology();
108 const int edgeDim = 1;
109 edgeParam_ = Intrepid2::RefSubcellParametrization<PHX::Device>::get(edgeDim, parentCell.getKey());
111 const int numEdges = gatherFieldTangents_.extent(1);
113 auto keys_host = Kokkos::create_mirror_view(keys_);
114 for (
int i=0; i < numEdges; ++i)
115 keys_host(i) = parentCell.getKey(edgeDim,i);
116 Kokkos::deep_copy(keys_,keys_host);
120 template<
typename EvalT,
typename Traits>
128 const shards::CellTopology & parentCell = *basis_->getCellTopology();
129 const int cellDim = parentCell.getDimension();
130 const int numEdges = gatherFieldTangents_.extent(1);
133 const auto worksetJacobians = pointValues_.jac.get_view();
135 auto gatherFieldTangents = gatherFieldTangents_.get_static_view();
137 auto orientations = orientations_;
138 auto edgeParam = edgeParam_;
141 Kokkos::parallel_for(
"panzer::GatherTangets",workset.
num_cells,KOKKOS_LAMBDA(
const int c){
142 int edgeOrts[12] = {};
143 orientations(cell_local_ids(c)).getEdgeOrientation(edgeOrts, numEdges);
145 auto workspace = Kokkos::subview(workspace_tmp,c,Kokkos::ALL(),Kokkos::ALL());
146 for(
int pt = 0; pt < numEdges; pt++) {
147 auto phyEdgeTan = Kokkos::subview(gatherFieldTangents, c, pt, Kokkos::ALL());
148 auto ortEdgeTan = Kokkos::subview(workspace_tmp,c,0,Kokkos::ALL());
150 Intrepid2::Impl::OrientationTools::getRefSubcellTangents(
157 auto J = Kokkos::subview(worksetJacobians, c, pt, Kokkos::ALL(), Kokkos::ALL());
158 Intrepid2::Kernels::Serial::matvec_product(phyEdgeTan, J, ortEdgeTan);
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.
Teuchos::RCP< const std::vector< Intrepid2::Orientation > > orientations_
int num_cells
DEPRECATED - use: numCells()
T & get(const std::string &name, T def_value)
GatherTangents(const Teuchos::ParameterList &p)
void setupArrays(const Teuchos::RCP< const panzer::PointRule > &pr)
Sizes/allocates memory for arrays.
Kokkos::View< const int *, PHX::Device > getLocalCellIDs() const
Get the local cell IDs for the workset.
bool isType(const std::string &name) const
#define TEUCHOS_ASSERT(assertion_test)
void evaluateFields(typename Traits::EvalData d)
void postRegistrationSetup(typename Traits::SetupData d, PHX::FieldManager< Traits > &vm)