IPPL (Independent Parallel Particle Layer)
IPPL
Loading...
Searching...
No Matches
EdgeElement.hpp
Go to the documentation of this file.
1
2namespace ippl {
3
4 template <typename T>
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
10 vertices[0] = {0.0};
11 vertices[1] = {1.0};
12 return vertices;
13 }
14
15 template <typename T>
17 const EdgeElement<T>::vertex_points_t& global_vertices) const {
18 EdgeElement::point_t jacobian;
19
20 jacobian[0] = (global_vertices[1][0] - global_vertices[0][0]);
21
22 return jacobian;
23 }
24
25 template <typename T>
26 KOKKOS_FUNCTION typename EdgeElement<T>::point_t
28 const EdgeElement<T>::vertex_points_t& global_vertices) const {
29 EdgeElement::point_t inv_jacobian;
30
31 inv_jacobian[0] = 1.0 / (global_vertices[1][0] - global_vertices[0][0]);
32
33 return inv_jacobian;
34 }
35
36 template <typename T>
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 const EdgeElement<T>::point_t glob2loc_matrix =
42 getInverseTransformationJacobian(global_vertices);
43
44 EdgeElement<T>::point_t local_point = glob2loc_matrix * (global_point - global_vertices[0]);
45
46 return local_point;
47 }
48
49 template <typename T>
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 const EdgeElement<T>::point_t loc2glob_matrix = getTransformationJacobian(global_vertices);
55
56 EdgeElement<T>::point_t global_point = (loc2glob_matrix * local_point) + global_vertices[0];
57
58 return global_point;
59 }
60
61 template <typename T>
63 const EdgeElement<T>::vertex_points_t& global_vertices) const {
64 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 for (const T& jacobian_val : getTransformationJacobian(global_vertices)) {
69 determinant *= jacobian_val;
70 }
71
72 return determinant;
73 }
74
75 template <typename T>
76 KOKKOS_FUNCTION typename EdgeElement<T>::point_t
78 const EdgeElement<T>::vertex_points_t& global_vertices) const {
79 // Simply return the inverse transformation jacobian since it is a diagonal matrix
80 return getInverseTransformationJacobian(global_vertices);
81 }
82
83 template <typename T>
84 KOKKOS_FUNCTION bool EdgeElement<T>::isPointInRefElement(const Vector<T, 1>& point) const {
85 // check if the local coordinates are inside the reference element
86 for (size_t d = 0; d < 1; d++) {
87 if (point[d] > 1.0 || point[d] < 0.0) {
88 // The global coordinates are outside of the support.
89 return false;
90 }
91 }
92
93 return true;
94 }
95
96} // namespace ippl
Definition Archive.h:20
KOKKOS_FUNCTION point_t globalToLocal(const vertex_points_t &, const point_t &) const
Transforms a point from global to local coordinates.
KOKKOS_FUNCTION point_t getInverseTransposeTransformationJacobian(const vertex_points_t &global_vertices) const
Returns the inverse of the transpose of the transformation Jacobian.
KOKKOS_FUNCTION bool isPointInRefElement(const Vector< T, 1 > &point) const
Returns whether a point in local coordinates ([0, 1]) is inside the reference element.
KOKKOS_FUNCTION point_t getTransformationJacobian(const vertex_points_t &global_vertices) const
Function to return the Jacobian of the transformation matrix.
KOKKOS_FUNCTION vertex_points_t getLocalVertices() const
Function to return the coordinates of the vertices of the reference element.
Element1D< T, NumVertices >::point_t point_t
Definition EdgeElement.h:17
Element1D< T, NumVertices >::vertex_points_t vertex_points_t
Definition EdgeElement.h:18
KOKKOS_FUNCTION point_t localToGlobal(const vertex_points_t &global_vertices, const point_t &point) const
Transforms a point from local to global coordinates.
KOKKOS_FUNCTION T getDeterminantOfTransformationJacobian(const vertex_points_t &global_vertices) const
Returns the determinant of the transformation Jacobian.
KOKKOS_FUNCTION point_t getInverseTransformationJacobian(const vertex_points_t &global_vertices) const
Function to return the inverse of the Jacobian of the transformation matrix.