37using pfc::types::Bool3;
39using pfc::types::Real3;
57 throw std::invalid_argument(
"Grid size must be positive, got: " +
58 std::to_string(size));
80 throw std::invalid_argument(
"Grid size must be positive, got: " +
81 std::to_string(size));
84 throw std::invalid_argument(
"Spacing must be positive, got: " +
85 std::to_string(spacing));
116 Bool3 periodic = {
true,
true,
true}) {
118 for (
int i = 0;
i < 3; ++
i) {
120 throw std::invalid_argument(
"Grid size must be positive in all dimensions");
122 if (upper[i] <= lower[i]) {
123 throw std::invalid_argument(
"Upper bound must be greater than lower bound");
129 for (
int i = 0; i < 3; ++i) {
131 spacing[i] = (upper[i] - lower[i]) / size[i];
133 spacing[i] = (upper[i] - lower[i]) / (size[i] - 1);
137 return create(GridSize(size), PhysicalOrigin(lower), GridSpacing(spacing));
156 for (
int i = 0;
i < 3; ++
i) {
158 throw std::invalid_argument(
"Grid size must be positive");
160 if (spacing[
i] <= 0.0) {
161 throw std::invalid_argument(
"Spacing must be positive");
184 for (
int i = 0;
i < 3; ++
i) {
186 throw std::invalid_argument(
"Grid size must be positive");
std::array< int, 3 > Int3
Type aliases for clarity.
Definition types.hpp:45
CartesianWorld with_origin(Int3 size, Real3 origin)
Create grid with custom origin but unit spacing.
Definition world_helpers.hpp:182
CartesianWorld from_bounds(Int3 size, Real3 lower, Real3 upper, Bool3 periodic={true, true, true})
Create grid from physical bounds (automatically computes spacing).
Definition world_helpers.hpp:115
CartesianWorld uniform(int size)
Create uniform grid with unit spacing at origin.
Definition world_helpers.hpp:55
auto create(const World< T > &world, const heffte::box3d< int > &box)
Construct a new World object from an existing one and a box.
Definition decomposition.hpp:62
CartesianWorld with_spacing(Int3 size, Real3 spacing)
Create grid with default origin but custom spacing.
Definition world_helpers.hpp:154
Strong type aliases for geometric quantities.
Grid dimensions (number of grid points per dimension)
Definition strong_types.hpp:176
Physical spacing between grid points.
Definition strong_types.hpp:370
Physical origin of coordinate system.
Definition strong_types.hpp:424
Represents the global simulation domain (the "world").
Definition world.hpp:91
Common type aliases used throughout OpenPFC.
World class definition and unified interface.
World creation and factory functions.