LCOV - code coverage report
Current view: top level - src/Set - Matrix3.H (source / functions) Hit Total Coverage
Test: coverage_merged.info Lines: 6 6 100.0 %
Date: 2024-11-18 05:28:54 Functions: 0 0 -

          Line data    Source code
       1             : #ifndef SET_MATRIX3_H
       2             : #define SET_MATRIX3_H
       3             : 
       4             : #include "Set/Base.H"
       5             : 
       6             : namespace Set
       7             : {
       8             : class Matrix3
       9             : {
      10             : public:
      11             :     Set::Matrix data[AMREX_SPACEDIM];
      12             :     AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE
      13             :     Scalar & operator () (const int i, const int j, const int k)
      14             :     {
      15   193430700 :         return data[i](j,k);
      16             :     }
      17             :     AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE
      18             :     const Scalar & operator () (const int i, const int j, const int k) const
      19             :     {
      20   185685900 :         return data[i](j,k);
      21             :     }
      22             :     AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE
      23             :     Matrix & operator [] (const int i)
      24             :     {
      25      742816 :         return data[i];
      26             :     }
      27             : 
      28             :     AMREX_FORCE_INLINE
      29             :     Set::Scalar norm()
      30             :     {
      31      371408 :         Set::Scalar ret = 0.0;
      32     1114226 :         for (int i = 0 ; i < AMREX_SPACEDIM; i++) ret += data[i].squaredNorm();
      33      371408 :         return sqrt(ret);
      34             :     }
      35             : 
      36             :     //AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE void operator  = (Matrix3 a) {for (int i = 0; i < AMREX_SPACEDIM; i++) data[i]  = a.data[i];}
      37             :     AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE void operator += (Matrix3 a) {for (int i = 0; i < AMREX_SPACEDIM; i++) data[i] += a.data[i];}
      38             :     AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE void operator -= (Matrix3 a) {for (int i = 0; i < AMREX_SPACEDIM; i++) data[i] -= a.data[i];}
      39             :     AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE void operator *= (Set::Scalar alpha) {for (int i = 0; i < AMREX_SPACEDIM; i++) data[i] *= alpha;}
      40             :     AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE void operator /= (Set::Scalar alpha) {for (int i = 0; i < AMREX_SPACEDIM; i++) data[i] /= alpha;}
      41             : 
      42             :     static Matrix3 Zero()
      43             :     {
      44             :         Matrix3 ret;
      45             :         for (int i = 0; i < AMREX_SPACEDIM; i++) ret.data[i] = Set::Matrix::Zero();
      46             :         return ret;
      47             :     }
      48             :     static Matrix3 Random()
      49             :     {
      50             :         Matrix3 ret;
      51             :         for (int i = 0; i < AMREX_SPACEDIM; i++) ret.data[i] = Set::Matrix::Random();
      52             :         return ret;
      53             :     }
      54             : 
      55             : };
      56             : }
      57             : #endif

Generated by: LCOV version 1.14