11 #ifndef PANZER_STK_PROJECT_FIELD_IMPL_HPP
12 #define PANZER_STK_PROJECT_FIELD_IMPL_HPP
14 #include "Teuchos_Assert.hpp"
15 #include "Phalanx_DataLayout.hpp"
17 #include "Intrepid2_ProjectionTools.hpp"
18 #include "Intrepid2_OrientationTools.hpp"
22 #include "Kokkos_ViewFactory.hpp"
24 #include "Teuchos_FancyOStream.hpp"
26 namespace panzer_stk {
28 template<
typename EvalT,
typename Traits>
32 srcBasis_(src), dstBasis_(dst)
37 static_assert(std::is_same<EvalT,panzer::Traits::Residual>::value);
42 if (outName ==
"") outName = inName;
44 this->addEvaluatedField(
result_);
49 this->addNonConstDependentField(
source_);
51 this->setName(
"Project Field");
55 local_orts_ = Kokkos::DynRankView<Intrepid2::Orientation,PHX::Device>(
"orts",maxWorksetSize);
60 template<
typename EvalT,
typename Traits>
66 orientations_ = d.orientations_;
70 template<
typename EvalT,
typename Traits>
76 if (workset.num_cells<=0)
return;
79 using pts = Intrepid2::ProjectionTools<PHX::Device>;
81 size_t numCells = workset.num_cells;
82 const auto cell_range = std::pair<int,int>(0,numCells);
84 auto sub_local_orts = Kokkos::subview(local_orts_,cell_range);
85 auto orts_host = Kokkos::create_mirror_view(sub_local_orts);
88 if (orientations_ == Teuchos::null) {
90 for (
size_t i=0; i < numCells; ++i)
91 orts_host(i) = Intrepid2::Orientation();
93 for (
size_t i=0; i < numCells; ++i)
94 orts_host(i) = orientations_->at(workset.cell_local_ids[i]);
96 Kokkos::deep_copy(sub_local_orts,orts_host);
103 auto sub_result = Kokkos::subview(result_.get_view(),cell_range,Kokkos::ALL());
104 auto sub_source = Kokkos::subview(source_.get_view(),cell_range,Kokkos::ALL());
106 pts::projectField(sub_result,dstBasis.
get(),
107 sub_source,srcBasis.
get(),sub_local_orts);
PHX::MDField< double, panzer::Cell, panzer::BASIS > source_
ProjectField(const std::string &inName, Teuchos::RCP< panzer::PureBasis > src, Teuchos::RCP< panzer::PureBasis > dst, std::string outname="")
Teuchos::RCP< const panzer::PureBasis > srcBasis_
Teuchos::RCP< const panzer::PureBasis > dstBasis_
PHX::MDField< double, panzer::Cell, panzer::BASIS > result_
void postRegistrationSetup(typename Traits::SetupData d, PHX::FieldManager< Traits > &fm)
void evaluateFields(typename Traits::EvalData d)
Kokkos::DynRankView< Intrepid2::Orientation, PHX::Device > local_orts_
Teuchos::RCP< PHX::DataLayout > functional
<Cell,Basis> or <Cell,Basis>