Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_IntegrationValues2_impl.hpp
Go to the documentation of this file.
1 #ifndef PANZER_INTEGRATION_VALUES_2_IMPL_HPP
2 #define PANZER_INTEGRATION_VALUES_2_IMPL_HPP
3 
4 /* Normally, we would fold this definition into the .cpp file since we
5  use ETI to compile this object. However, for unit testing the stand
6  alone device function swapQuadraturePoints, we need the definition
7  at the calling point to avoid requiring relocatable device code for
8  cuda. So for the IntegrationValues2 object, if there is a
9  standalone device member function, put it in this file (for unit
10  testing).
11  */
12 namespace panzer {
13 
14 template<typename Scalar,
15  typename T0,typename T1,typename T2,typename T3,
16  typename T4,typename T5,typename T6,typename T7>
17 void
19  int a,
20  int b,
21  T0& ref_ip_coordinates,
22  T1& ip_coordinates,
23  T2& weighted_measure,
24  T3& jac,
25  T4& jac_det,
26  T5& jac_inv,
27  T6& surface_normals,
28  T7& surface_rotation_matrices)
29 {
30  const int new_cell_point = a;
31  const int old_cell_point = b;
32 
33  const int cell_dim = ref_ip_coordinates.extent(2);
34 
35 #ifdef PANZER_DEBUG
36  KOKKOS_ASSERT(cell < ip_coordinates.extent_int(0));
37  KOKKOS_ASSERT(a < ip_coordinates.extent_int(1));
38  KOKKOS_ASSERT(b < ip_coordinates.extent_int(1));
39  KOKKOS_ASSERT(cell >= 0);
40  KOKKOS_ASSERT(a >= 0);
41  KOKKOS_ASSERT(b >= 0);
42 #endif
43 
44  // If this is a DFAD type, we will need to fix allocation to size the derivative array.
45  Scalar hold;
46 
47  hold = weighted_measure(cell,new_cell_point);
48  weighted_measure(cell,new_cell_point) = weighted_measure(cell,old_cell_point);
49  weighted_measure(cell,old_cell_point) = hold;
50 
51  hold = jac_det(cell,new_cell_point);
52  jac_det(cell,new_cell_point) = jac_det(cell,old_cell_point);
53  jac_det(cell,old_cell_point) = hold;
54 
55  for(int dim=0;dim<cell_dim;++dim){
56 
57  hold = ref_ip_coordinates(cell,new_cell_point,dim);
58  ref_ip_coordinates(cell,new_cell_point,dim) = ref_ip_coordinates(cell,old_cell_point,dim);
59  ref_ip_coordinates(cell,old_cell_point,dim) = hold;
60 
61  hold = ip_coordinates(cell,new_cell_point,dim);
62  ip_coordinates(cell,new_cell_point,dim) = ip_coordinates(cell,old_cell_point,dim);
63  ip_coordinates(cell,old_cell_point,dim) = hold;
64 
65  hold = surface_normals(cell,new_cell_point,dim);
66  surface_normals(cell,new_cell_point,dim) = surface_normals(cell,old_cell_point,dim);
67  surface_normals(cell,old_cell_point,dim) = hold;
68 
69  for(int dim2=0;dim2<cell_dim;++dim2){
70 
71  hold = jac(cell,new_cell_point,dim,dim2);
72  jac(cell,new_cell_point,dim,dim2) = jac(cell,old_cell_point,dim,dim2);
73  jac(cell,old_cell_point,dim,dim2) = hold;
74 
75  hold = jac_inv(cell,new_cell_point,dim,dim2);
76  jac_inv(cell,new_cell_point,dim,dim2) = jac_inv(cell,old_cell_point,dim,dim2);
77  jac_inv(cell,old_cell_point,dim,dim2) = hold;
78  }
79  }
80 
81  // Rotation matrices are always in 3D
82  for(int dim=0; dim<3; ++dim){
83  for(int dim2=0; dim2<3; ++dim2){
84  hold = surface_rotation_matrices(cell,new_cell_point,dim,dim2);
85  surface_rotation_matrices(cell,new_cell_point,dim,dim2) = surface_rotation_matrices(cell,old_cell_point,dim,dim2);
86  surface_rotation_matrices(cell,old_cell_point,dim,dim2) = hold;
87  }
88  }
89 }
90 
91 }
92 
93 #endif
KOKKOS_INLINE_FUNCTION void swapQuadraturePoints(int cell, int a, int b, T0 &ref_ip_coordinates, T1 &ip_coordinates, T2 &weighted_measure, T3 &jac, T4 &jac_det, T5 &jac_inv, T6 &surface_normals, T7 &surface_rotation_matrices)
Swap the ordering of quadrature points in a specified cell.