chombo-discharge
Loading...
Searching...
No Matches
CD_Tile.H
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2021-2026 SINTEF Energy Research
3 *
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 */
6
13#ifndef CD_TILE_H
14#define CD_TILE_H
15
16// Std includes
17#include <array>
18
19// Our includes
20#include <CD_NamespaceHeader.H>
21
25template <class T, size_t DIM>
26class TileI
27{
28public:
32 TileI() noexcept;
33
38 template <typename... Args, typename std::enable_if<sizeof...(Args) == DIM, int>::type = 0>
39 explicit TileI(Args... args) noexcept : m_indices{static_cast<T>(args)...}
40 {}
41
45 virtual ~TileI() noexcept;
46
52 inline T&
53 operator[](const size_t a_dir) noexcept;
54
60 inline const T&
61 operator[](const size_t a_dir) const noexcept;
62
67 inline std::array<T, DIM>&
68 getIndices() noexcept;
69
74 inline const std::array<T, DIM>&
75 getIndices() const noexcept;
76
82 inline constexpr bool
83 operator<(const TileI& a_otherTile) const noexcept;
84
90 inline constexpr bool
91 operator>(const TileI& a_otherTile) const noexcept;
92
98 inline constexpr bool
99 operator==(const TileI& a_otherTile) const noexcept;
100
101protected:
105 std::array<T, DIM> m_indices;
106};
107
108#include <CD_NamespaceFooter.H>
109
110#include <CD_TileImplem.H>
111
112#endif
Implementation of CD_Tile.H.
Class for representing a tile (used in, e.g., TiledMeshRefine)
Definition CD_Tile.H:27
std::array< T, DIM > m_indices
Index in N-dimensional space.
Definition CD_Tile.H:105
TileI() noexcept
Default constructor. Sets m_indices = 0.
Definition CD_TileImplem.H:39
TileI(Args... args) noexcept
Full constructor. Sets indices. Use as TileI(0,1,2,...)
Definition CD_Tile.H:39
virtual ~TileI() noexcept
Destructor.
Definition CD_TileImplem.H:52
std::array< T, DIM > & getIndices() noexcept
Get the indices.
Definition CD_TileImplem.H:71