Branch data Line data Source code
1 : :
2 : : namespace ippl {
3 : :
4 : : template <typename T>
5 : 208 : KOKKOS_FUNCTION typename EdgeElement<T>::vertex_points_t EdgeElement<T>::getLocalVertices()
6 : : const {
7 : : // For the ordering of local vertices, see section 3.3.1:
8 : : // https://amas.web.psi.ch/people/aadelmann/ETH-Accel-Lecture-1/projectscompleted/phys/bachelor_thesis_buehlluk.pdf
9 : 208 : EdgeElement::vertex_points_t vertices;
10 : 208 : vertices[0] = {0.0};
11 : 208 : vertices[1] = {1.0};
12 : 208 : return vertices;
13 : : }
14 : :
15 : : template <typename T>
16 : 22 : KOKKOS_FUNCTION typename EdgeElement<T>::point_t EdgeElement<T>::getTransformationJacobian(
17 : : const EdgeElement<T>::vertex_points_t& global_vertices) const {
18 : 22 : EdgeElement::point_t jacobian;
19 : :
20 : 22 : jacobian[0] = (global_vertices[1][0] - global_vertices[0][0]);
21 : :
22 : 22 : return jacobian;
23 : : }
24 : :
25 : : template <typename T>
26 : : KOKKOS_FUNCTION typename EdgeElement<T>::point_t
27 : 20 : EdgeElement<T>::getInverseTransformationJacobian(
28 : : const EdgeElement<T>::vertex_points_t& global_vertices) const {
29 : 20 : EdgeElement::point_t inv_jacobian;
30 : :
31 : 20 : inv_jacobian[0] = 1.0 / (global_vertices[1][0] - global_vertices[0][0]);
32 : :
33 : 20 : return inv_jacobian;
34 : : }
35 : :
36 : : template <typename T>
37 : 18 : KOKKOS_FUNCTION typename EdgeElement<T>::point_t EdgeElement<T>::globalToLocal(
38 : : const EdgeElement<T>::vertex_points_t& global_vertices,
39 : : const EdgeElement<T>::point_t& global_point) const {
40 : : // This is actually not a matrix, but an IPPL vector that represents a diagonal matrix
41 [ + - ]: 18 : const EdgeElement<T>::point_t glob2loc_matrix =
42 : : getInverseTransformationJacobian(global_vertices);
43 : :
44 [ + - + - ]: 18 : EdgeElement<T>::point_t local_point = glob2loc_matrix * (global_point - global_vertices[0]);
45 : :
46 : 18 : return local_point;
47 : 18 : }
48 : :
49 : : template <typename T>
50 : 18 : KOKKOS_FUNCTION typename EdgeElement<T>::point_t EdgeElement<T>::localToGlobal(
51 : : const EdgeElement<T>::vertex_points_t& global_vertices,
52 : : const EdgeElement<T>::point_t& local_point) const {
53 : : // This is actually not a matrix but an IPPL vector that represents a diagonal matrix
54 [ + - ]: 18 : const EdgeElement<T>::point_t loc2glob_matrix = getTransformationJacobian(global_vertices);
55 : :
56 [ # # # # : 18 : EdgeElement<T>::point_t global_point = (loc2glob_matrix * local_point) + global_vertices[0];
# # ]
[ + - + - ]
57 : :
58 : 18 : return global_point;
59 : 18 : }
60 : :
61 : : template <typename T>
62 : 4 : KOKKOS_FUNCTION T EdgeElement<T>::getDeterminantOfTransformationJacobian(
63 : : const EdgeElement<T>::vertex_points_t& global_vertices) const {
64 : 4 : T determinant = 1.0;
65 : :
66 : : // Since the jacobian is a diagonal matrix in our case the determinant is the product of the
67 : : // diagonal elements
68 [ + + + + ]: 8 : for (const T& jacobian_val : getTransformationJacobian(global_vertices)) {
69 : 4 : determinant *= jacobian_val;
70 : : }
71 : :
72 : 4 : return determinant;
73 : : }
74 : :
75 : : template <typename T>
76 : : KOKKOS_FUNCTION typename EdgeElement<T>::point_t
77 : 2 : EdgeElement<T>::getInverseTransposeTransformationJacobian(
78 : : const EdgeElement<T>::vertex_points_t& global_vertices) const {
79 : : // Simply return the inverse transformation jacobian since it is a diagonal matrix
80 : 2 : return getInverseTransformationJacobian(global_vertices);
81 : : }
82 : :
83 : : template <typename T>
84 : 200 : KOKKOS_FUNCTION bool EdgeElement<T>::isPointInRefElement(const Vector<T, 1>& point) const {
85 : : // check if the local coordinates are inside the reference element
86 [ + + ]: 400 : for (size_t d = 0; d < 1; d++) {
87 [ + - - + : 200 : if (point[d] > 1.0 || point[d] < 0.0) {
- + ]
88 : : // The global coordinates are outside of the support.
89 : 0 : return false;
90 : : }
91 : : }
92 : :
93 : 200 : return true;
94 : : }
95 : :
96 : : } // namespace ippl
|