11 #ifndef PANZER_NORMALS_IMPL_HPP
12 #define PANZER_NORMALS_IMPL_HPP
17 #include "Intrepid2_FunctionSpaceTools.hpp"
18 #include "Intrepid2_CellTools.hpp"
19 #include "Phalanx_Scratch_Utilities.hpp"
24 template<
typename EvalT,
typename Traits>
31 const std::string name = p.
get<std::string>(
"Name");
44 this->addEvaluatedField(
normals);
46 std::string n =
"Normals: " + name;
51 template<
typename EvalT,
typename Traits>
58 num_qp = normals.extent(1);
59 num_dim = normals.extent(2);
65 template<
typename EvalT,
typename Traits>
74 Intrepid2::CellTools<PHX::exec_space>::getPhysicalSideNormals(normals.get_view(),
75 this->wda(workset).int_rules[quad_index]->jac.get_view(),
76 side_id, *this->wda(workset).int_rules[quad_index]->int_rule->topology);
81 auto local_normals = normals;
82 auto local_num_qp = num_qp;
83 auto local_num_dim = num_dim;
85 if (Sacado::IsADType<ScalarT>::value) {
86 scratch = PHX::View<ScalarT*>(
"normals:scratch",workset.
num_cells,PHX::getFadSize(local_normals.get_static_view()));
89 scratch = PHX::View<ScalarT*>(
"normals:scratch",workset.
num_cells);
93 Kokkos::parallel_for(
"normalize", workset.
num_cells, KOKKOS_LAMBDA (index_t c) {
94 for(std::size_t q=0;q<local_num_qp;q++) {
98 for(std::size_t d=0;d<local_num_dim;d++)
99 norm(c) += local_normals(c,q,d)*local_normals(c,q,d);
102 norm(c) = sqrt(norm(c));
103 for(std::size_t d=0;d<local_num_dim;d++)
104 local_normals(c,q,d) /= norm(c);
int num_cells
DEPRECATED - use: numCells()
T & get(const std::string &name, T def_value)
Normals(const Teuchos::ParameterList &p)
std::vector< int >::size_type getIntegrationRuleIndex(int ir_degree, const panzer::Workset &workset, WorksetDetailsAccessor &wda)
bool isParameter(const std::string &name) const
PHX::MDField< ScalarT, Cell, Point, Dim > normals
void postRegistrationSetup(typename Traits::SetupData d, PHX::FieldManager< Traits > &fm)
void evaluateFields(typename Traits::EvalData d)
Teuchos::RCP< const std::vector< panzer::Workset > > worksets_