43 #ifndef PANZER_EVALUATOR_CrossProduct_IMPL_HPP
44 #define PANZER_EVALUATOR_CrossProduct_IMPL_HPP
56 template<
typename EvalT,
typename Traits>
61 std::string result_name = p.
get<std::string>(
"Result Name");
62 std::string vec_a_name = p.
get<std::string>(
"Vector A Name");
63 std::string vec_b_name = p.
get<std::string>(
"Vector B Name");
69 useScalarField = (pr->spatial_dimension==2);
72 vec_a_cross_vec_b = PHX::MDField<ScalarT>(result_name, pr->dl_vector);
74 vec_a_cross_vec_b = PHX::MDField<ScalarT>(result_name, pr->dl_scalar);
76 vec_a = PHX::MDField<const ScalarT>(vec_a_name, pr->dl_vector);
77 vec_b = PHX::MDField<const ScalarT>(vec_b_name, pr->dl_vector);
79 this->addEvaluatedField(vec_a_cross_vec_b);
80 this->addDependentField(vec_a);
81 this->addDependentField(vec_b);
83 std::string n =
"CrossProduct: " + result_name +
" = " + vec_a_name +
" . " + vec_b_name;
88 template<
typename EvalT,
typename Traits>
95 num_pts = vec_a.extent(1);
96 num_dim = vec_a.extent(2);
103 template<
typename EvalT,
typename Traits>
110 for (index_t cell = 0; cell < workset.
num_cells; ++cell) {
111 for (
int p = 0; p < num_pts; ++p) {
112 vec_a_cross_vec_b(cell,p) = vec_a(cell,p,0)*vec_b(cell,p,1)-vec_a(cell,p,1)*vec_b(cell,p,0);
117 for (index_t cell = 0; cell < workset.
num_cells; ++cell) {
118 for (
int p = 0; p < num_pts; ++p) {
119 vec_a_cross_vec_b(cell,p,0) = vec_a(cell,p,1)*vec_b(cell,p,2)-vec_a(cell,p,2)*vec_b(cell,p,1);
120 vec_a_cross_vec_b(cell,p,1) = -(vec_a(cell,p,0)*vec_b(cell,p,2)-vec_a(cell,p,2)*vec_b(cell,p,0));
121 vec_a_cross_vec_b(cell,p,2) = vec_a(cell,p,0)*vec_b(cell,p,1)-vec_a(cell,p,1)*vec_b(cell,p,0);
void postRegistrationSetup(typename Traits::SetupData d, PHX::FieldManager< Traits > &fm)
T & get(const std::string &name, T def_value)
void evaluateFields(typename Traits::EvalData d)
#define TEUCHOS_ASSERT(assertion_test)
CrossProduct(const Teuchos::ParameterList &p)