OpenPFC  0.1.4
Phase Field Crystal simulation framework
Loading...
Searching...
No Matches
box3d.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2025 VTT Technical Research Centre of Finland Ltd
2// SPDX-License-Identifier: AGPL-3.0-or-later
3
32#ifndef PFC_BOX3D_HPP
33#define PFC_BOX3D_HPP
34
35#include <array>
36#include <ostream>
37#include <stdexcept>
38
39namespace pfc {
40
74class Box3D {
75public:
77 using Int3 = std::array<int, 3>;
78
79private:
80 Int3 m_lower;
81 Int3 m_upper;
82
83public:
92 Box3D(const Int3 &lower, const Int3 &upper);
93
99
105
114
123
131
139
147
157 friend std::ostream &operator<<(std::ostream &os, const Box3D &box) noexcept;
158};
159
160} // namespace pfc
161
162#endif // PFC_BOX3D_HPP
Represents a 3D integer box in grid index space.
Definition box3d.hpp:74
Int3 size() const noexcept
Returns the size (number of elements) in each dimension.
std::array< int, 3 > Int3
Type aliases for clarity.
Definition box3d.hpp:77
const Int3 & upper() const noexcept
Returns the upper corner indices.
int total_size() const noexcept
Computes the total number of grid points in the box.
bool contains(const Int3 &index) const noexcept
Check if a given index {i,j,k} is inside this box.
const Int3 & lower() const noexcept
Returns the lower corner indices.
Box3D(const Int3 &lower, const Int3 &upper)
Constructs a Box3D with given lower and upper corners.
Represents the global simulation domain (the "world").
Definition world.hpp:91