![]() |
OpenPFC
0.1.4
Phase Field Crystal simulation framework
|
Represents a 3D integer box in grid index space. More...
#include <box3d.hpp>
Public Types | |
| using | Int3 = std::array< int, 3 > |
| Type aliases for clarity. | |
Public Member Functions | |
| Box3D (const Int3 &lower, const Int3 &upper) | |
| Constructs a Box3D with given lower and upper corners. | |
| const Int3 & | lower () const noexcept |
| Returns the lower corner indices. | |
| const Int3 & | upper () const noexcept |
| Returns the upper corner indices. | |
| Int3 | size () const noexcept |
| Returns the size (number of elements) in each dimension. | |
| 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. | |
| bool | operator== (const Box3D &other) const noexcept |
| Equality operator. | |
| bool | operator!= (const Box3D &other) const noexcept |
| Inequality operator. | |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const Box3D &box) noexcept |
| Output stream operator for Box3D objects. | |
Represents a 3D integer box in grid index space.
The Box3D class describes a discrete 3D rectangular region using integer lower and upper corner indices.
It is designed to represent local computational domains in the simulation, distinct from the continuous physical domain described by World.
Box3D is purely an index-space concept: it does not know about physical coordinates, spacing, or origin.
Example usage:
Design Responsibilities:
This class follows the Single Responsibility Principle (SRP).
Constructs a Box3D with given lower and upper corners.
| lower | Lower corner indices {i_min, j_min, k_min}. |
| upper | Upper corner indices {i_max, j_max, k_max}. |
| std::invalid_argument | if lower > upper in any dimension. |
Check if a given index {i,j,k} is inside this box.
| index | A grid index {i, j, k}. |
Returns the lower corner indices.
Inequality operator.
| other | Another box to compare. |
Equality operator.
| other | Another box to compare. |
|
noexcept |
Returns the size (number of elements) in each dimension.
Size is computed as (upper - lower + 1) per dimension.
|
noexcept |
Returns the upper corner indices.