Line data Source code
1 : //
2 : // Class Mesh
3 : // The Mesh base class. Right now, this mainly acts as a standard base
4 : // class for all meshes so that other objects can register as users of
5 : // the mesh and can be notified if the mesh changes (e.g., it is rescaled
6 : // or restructured entirely).
7 : //
8 : #ifndef IPPL_MESH_H
9 : #define IPPL_MESH_H
10 :
11 : #include "Types/Vector.h"
12 :
13 : namespace ippl {
14 : template <typename T, unsigned Dim>
15 : class Mesh {
16 : public:
17 : typedef T value_type;
18 : enum {
19 : Dimension = Dim
20 : };
21 :
22 : typedef Vector<T, Dim> vector_type;
23 : typedef Vector<vector_type, Dim> matrix_type;
24 :
25 762 : KOKKOS_INLINE_FUNCTION Mesh(){};
26 :
27 798 : KOKKOS_INLINE_FUNCTION virtual ~Mesh(){};
28 :
29 : // Get the origin of mesh vertex positions
30 : KOKKOS_INLINE_FUNCTION vector_type getOrigin() const;
31 :
32 : // Set the origin of mesh vertex positions
33 : KOKKOS_INLINE_FUNCTION void setOrigin(const vector_type& origin);
34 :
35 : KOKKOS_INLINE_FUNCTION const vector_type& getGridsize() const;
36 :
37 : /*!
38 : * Query the cell volume of the grid
39 : * @return The volume of a single mesh cell
40 : */
41 : KOKKOS_INLINE_FUNCTION virtual T getCellVolume() const = 0;
42 :
43 : /*!
44 : * Query the volume of the represented domain
45 : * @return Total volume of the mesh
46 : */
47 : KOKKOS_INLINE_FUNCTION virtual T getMeshVolume() const = 0;
48 :
49 : KOKKOS_INLINE_FUNCTION T getGridsize(size_t dim) const;
50 :
51 : KOKKOS_INLINE_FUNCTION virtual vector_type getVertexPosition(
52 : const NDIndex<Dim>& ndi) const = 0;
53 :
54 : KOKKOS_INLINE_FUNCTION virtual const vector_type& getMeshSpacing() const = 0;
55 :
56 : KOKKOS_INLINE_FUNCTION virtual vector_type getDeltaVertex(
57 : const NDIndex<Dim>& ndi) const = 0;
58 :
59 : protected:
60 : vector_type origin_m; // Origin of mesh coordinates (vertices)
61 : vector_type gridSizes_m; // Sizes (number of vertices)
62 : };
63 : } // namespace ippl
64 :
65 : #include "Meshes/Mesh.hpp"
66 :
67 : #endif
|