LCOV - code coverage report
Current view: top level - src/Meshes - UniformCartesian.h (source / functions) Coverage Total Hit
Test: final_report.info Lines: 54.5 % 11 6
Test Date: 2025-07-18 17:15:09 Functions: 50.0 % 48 24

            Line data    Source code
       1              : //
       2              : // Class UniformCartesian
       3              : //   UniformCartesian class - represents uniform-spacing cartesian meshes.
       4              : //
       5              : #ifndef IPPL_UNIFORM_CARTESIAN_H
       6              : #define IPPL_UNIFORM_CARTESIAN_H
       7              : 
       8              : #include "Meshes/CartesianCentering.h"
       9              : #include "Meshes/Mesh.h"
      10              : 
      11              : namespace ippl {
      12              : 
      13              :     template <typename T, unsigned Dim>
      14              :     class UniformCartesian : public Mesh<T, Dim> {
      15              :     public:
      16              :         typedef typename Mesh<T, Dim>::vector_type vector_type;
      17              :         typedef Cell DefaultCentering;
      18              : 
      19              :         KOKKOS_INLINE_FUNCTION UniformCartesian();
      20              : 
      21              :         KOKKOS_INLINE_FUNCTION UniformCartesian(const NDIndex<Dim>& ndi, const vector_type& hx,
      22              :                                                 const vector_type& origin);
      23              : 
      24         1596 :         KOKKOS_INLINE_FUNCTION ~UniformCartesian() = default;
      25              : 
      26              :         KOKKOS_INLINE_FUNCTION void initialize(const NDIndex<Dim>& ndi, const vector_type& hx,
      27              :                                                const vector_type& origin);
      28              : 
      29              :         // Set the spacings of mesh vertex positions (recompute Dvc, cell volume):
      30              :         KOKKOS_INLINE_FUNCTION void setMeshSpacing(const vector_type& meshSpacing);
      31              : 
      32              :         // Get the spacings of mesh vertex positions along specified direction
      33              :         KOKKOS_INLINE_FUNCTION T getMeshSpacing(unsigned dim) const;
      34              : 
      35              :         KOKKOS_INLINE_FUNCTION const vector_type& getMeshSpacing() const override;
      36              : 
      37              :         KOKKOS_INLINE_FUNCTION T getCellVolume() const override;
      38              : 
      39              :         KOKKOS_INLINE_FUNCTION T getMeshVolume() const override;
      40              : 
      41              :         KOKKOS_INLINE_FUNCTION void updateCellVolume_m();
      42              : 
      43              :         // (x,y,z) coordinates of indexed vertex:
      44              :         KOKKOS_INLINE_FUNCTION vector_type
      45         1008 :         getVertexPosition(const NDIndex<Dim>& ndi) const override {
      46              :             //printf("inside getVertexPosition");
      47         1008 :             vector_type vertexPosition;
      48         4536 :             for (unsigned int d = 0; d < Dim; d++) {
      49         3528 :                 vertexPosition(d) = ndi[d].first() * meshSpacing_m[d] + this->origin_m(d);
      50              :                 //printf("vertexPos = %lf", vertexPosition(d));
      51              :             }
      52         1008 :             return vertexPosition;
      53              :         }
      54              : 
      55              :         // Vertex-vertex grid spacing of indexed cell:
      56            0 :         KOKKOS_INLINE_FUNCTION vector_type getDeltaVertex(const NDIndex<Dim>& ndi) const override {
      57            0 :             vector_type vertexVertexSpacing;
      58            0 :             for (unsigned int d = 0; d < Dim; d++)
      59            0 :                 vertexVertexSpacing[d] = meshSpacing_m[d] * ndi[d].length();
      60            0 :             return vertexVertexSpacing;
      61              :         }
      62              : 
      63              :     private:
      64              :         vector_type meshSpacing_m;  // delta-x, delta-y (>1D), delta-z (>2D)
      65              :         T volume_m;                 // Cell length(1D), area(2D), or volume (>2D)
      66              :     };
      67              : 
      68              : }  // namespace ippl
      69              : 
      70              : #include "Meshes/UniformCartesian.hpp"
      71              : 
      72              : #endif
        

Generated by: LCOV version 2.0-1