LCOV - code coverage report
Current view: top level - elsa/storage/functions - Real.hpp (source / functions) Hit Total Coverage
Test: coverage-all.lcov Lines: 3 3 100.0 %
Date: 2024-05-16 04:22:26 Functions: 2 2 100.0 %

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include "CUDADefines.h"
       4             : #include "TypeTraits.hpp"
       5             : #include <thrust/complex.h>
       6             : #include <complex>
       7             : 
       8             : namespace elsa::fn
       9             : {
      10             :     namespace detail
      11             :     {
      12             :         struct real_fn {
      13             :             template <class T>
      14             :             __host__ __device__ constexpr auto operator()(const T& arg) const noexcept
      15             :                 -> std::enable_if_t<!is_complex_v<T>, T>
      16             :             {
      17             :                 return arg;
      18             :             }
      19             : 
      20             :             template <class T>
      21             :             __host__ __device__ constexpr auto
      22             :                 operator()(const thrust::complex<T>& arg) const noexcept
      23             :                 -> decltype(std::declval<thrust::complex<T>>().real())
      24        5488 :             {
      25        5488 :                 return arg.real();
      26        5488 :             }
      27             : 
      28             :             template <class T>
      29             :             __host__ constexpr auto operator()(const std::complex<T>& arg) const noexcept
      30             :                 -> decltype(std::real(std::declval<std::complex<T>>()))
      31             :             {
      32             :                 return std::real(arg);
      33             :             }
      34             :         };
      35             :     } // namespace detail
      36             : 
      37             :     static constexpr __device__ detail::real_fn real;
      38             : } // namespace elsa::fn

Generated by: LCOV version 1.14