LCOV - code coverage report
Current view: top level - src/FEM/Elements - EdgeElement.hpp (source / functions) Coverage Total Hit
Test: final_report.info Lines: 97.1 % 35 34
Test Date: 2025-07-18 17:15:09 Functions: 100.0 % 16 16

            Line data    Source code
       1              : 
       2              : namespace ippl {
       3              : 
       4              :     template <typename T>
       5          392 :     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          392 :         EdgeElement::vertex_points_t vertices;
      10          392 :         vertices[0] = {0.0};
      11          392 :         vertices[1] = {1.0};
      12          392 :         return vertices;
      13              :     }
      14              : 
      15              :     template <typename T>
      16           48 :     KOKKOS_FUNCTION typename EdgeElement<T>::point_t EdgeElement<T>::getTransformationJacobian(
      17              :         const EdgeElement<T>::vertex_points_t& global_vertices) const {
      18           48 :         EdgeElement::point_t jacobian;
      19              : 
      20           48 :         jacobian[0] = (global_vertices[1][0] - global_vertices[0][0]);
      21              : 
      22           48 :         return jacobian;
      23              :     }
      24              : 
      25              :     template <typename T>
      26              :     KOKKOS_FUNCTION typename EdgeElement<T>::point_t
      27           40 :     EdgeElement<T>::getInverseTransformationJacobian(
      28              :         const EdgeElement<T>::vertex_points_t& global_vertices) const {
      29           40 :         EdgeElement::point_t inv_jacobian;
      30              : 
      31           40 :         inv_jacobian[0] = 1.0 / (global_vertices[1][0] - global_vertices[0][0]);
      32              : 
      33           40 :         return inv_jacobian;
      34              :     }
      35              : 
      36              :     template <typename T>
      37           36 :     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           36 :         const EdgeElement<T>::point_t glob2loc_matrix =
      42              :             getInverseTransformationJacobian(global_vertices);
      43              : 
      44           36 :         EdgeElement<T>::point_t local_point = glob2loc_matrix * (global_point - global_vertices[0]);
      45              : 
      46           36 :         return local_point;
      47           36 :     }
      48              : 
      49              :     template <typename T>
      50           36 :     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           36 :         const EdgeElement<T>::point_t loc2glob_matrix = getTransformationJacobian(global_vertices);
      55              : 
      56           36 :         EdgeElement<T>::point_t global_point = (loc2glob_matrix * local_point) + global_vertices[0];
      57              : 
      58           36 :         return global_point;
      59           36 :     }
      60              : 
      61              :     template <typename T>
      62           12 :     KOKKOS_FUNCTION T EdgeElement<T>::getDeterminantOfTransformationJacobian(
      63              :         const EdgeElement<T>::vertex_points_t& global_vertices) const {
      64           12 :         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           24 :         for (const T& jacobian_val : getTransformationJacobian(global_vertices)) {
      69           12 :             determinant *= jacobian_val;
      70              :         }
      71              : 
      72           12 :         return determinant;
      73              :     }
      74              : 
      75              :     template <typename T>
      76              :     KOKKOS_FUNCTION typename EdgeElement<T>::point_t
      77            4 :     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            4 :         return getInverseTransformationJacobian(global_vertices);
      81              :     }
      82              : 
      83              :     template <typename T>
      84          376 :     KOKKOS_FUNCTION bool EdgeElement<T>::isPointInRefElement(const Vector<T, 1>& point) const {
      85              :         // check if the local coordinates are inside the reference element
      86          752 :         for (size_t d = 0; d < 1; d++) {
      87          376 :             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          376 :         return true;
      94              :     }
      95              : 
      96              : }  // namespace ippl
        

Generated by: LCOV version 2.0-1