chombo-discharge
CD_Tile.H
1 /* chombo-discharge
2  * Copyright © 2023 SINTEF Energy Research.
3  * Please refer to Copyright.txt and LICENSE in the chombo-discharge root directory.
4  */
5 
12 #ifndef CD_Tile_H
13 #define CD_Tile_H
14 
15 // Std includes
16 #include <array>
17 
18 // Our includes
19 #include <CD_NamespaceHeader.H>
20 
24 template <class T, size_t DIM>
25 class TileI
26 {
27 public:
31  TileI() noexcept;
32 
36  template <typename... Args, typename std::enable_if<sizeof...(Args) == DIM, int>::type = 0>
37  explicit TileI(Args... args) noexcept : m_indices{static_cast<T>(args)...}
38  {}
39 
43  virtual ~TileI() noexcept;
44 
49  inline T&
50  operator[](const size_t a_dir) noexcept;
51 
56  inline const T&
57  operator[](const size_t a_dir) const noexcept;
58 
63  inline std::array<T, DIM>&
64  getIndices() noexcept;
65 
70  inline const std::array<T, DIM>&
71  getIndices() const noexcept;
72 
77  inline constexpr bool
78  operator<(const TileI& a_otherTile) const noexcept;
79 
84  inline constexpr bool
85  operator>(const TileI& a_otherTile) const noexcept;
86 
91  inline constexpr bool
92  operator==(const TileI& a_otherTile) const noexcept;
93 
94 protected:
98  std::array<T, DIM> m_indices;
99 };
100 
101 #include <CD_NamespaceFooter.H>
102 
103 #include <CD_TileImplem.H>
104 
105 #endif
Implementation of CD_Tile.H.
Class for representing a tile (used in, e.g., TiledMeshRefine)
Definition: CD_Tile.H:26
std::array< T, DIM > m_indices
Index in N-dimensional space.
Definition: CD_Tile.H:98
TileI() noexcept
Default constructor. Sets m_indices = 0.
Definition: CD_TileImplem.H:38
TileI(Args... args) noexcept
Full constructor. Sets indices. Use as TileI(0,1,2,...)
Definition: CD_Tile.H:37
virtual ~TileI() noexcept
Destructor.
Definition: CD_TileImplem.H:51
std::array< T, DIM > & getIndices() noexcept
Get the indices.
Definition: CD_TileImplem.H:70