OpenPFC  0.1.4
Phase Field Crystal simulation framework
Loading...
Searching...
No Matches
world.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
59#pragma once
60
61#include <array>
62#include <ostream>
63
64#include "csys.hpp"
65#include "types.hpp"
66
67namespace pfc {
68namespace world {
69
73
91template <typename T> struct World final {
92 const Int3 m_lower;
93 const Int3 m_upper;
94 const Int3 m_size;
96
103 explicit World(const Int3 &lower, const Int3 &upper,
104 const CoordinateSystem<T> &cs);
105
111 bool operator==(const World &other) const noexcept {
112 return m_lower == other.m_lower && m_upper == other.m_upper &&
113 m_size == other.m_size && m_cs == other.m_cs;
114 }
115
121 bool operator!=(const World &other) const noexcept { return !(*this == other); }
122
129 template <typename T_>
130 friend std::ostream &operator<<(std::ostream &os, const World<T_> &w) noexcept;
131};
132
135
136} // namespace world
137
138// Export World to pfc namespace for convenient usage
140
141} // namespace pfc
142
143// Include World functionality modules
144#include "world_factory.hpp"
145#include "world_helpers.hpp"
146#include "world_queries.hpp"
std::array< int, 3 > Int3
Type aliases for clarity.
Definition types.hpp:45
Extensible coordinate system framework.
World< CartesianTag > CartesianWorld
Type alias for Cartesian 3D World (most common usage)
Definition world.hpp:134
Tag type for the 3D Cartesian coordinate system.
Definition csys.hpp:147
Primary template for defining coordinate systems by tag.
Definition csys.hpp:87
Represents the global simulation domain (the "world").
Definition world.hpp:91
const Int3 m_lower
Lower index bounds.
Definition world.hpp:92
const CoordinateSystem< T > m_cs
Coordinate system.
Definition world.hpp:95
bool operator==(const World &other) const noexcept
Equality operator.
Definition world.hpp:111
const Int3 m_upper
Upper index bounds.
Definition world.hpp:93
const Int3 m_size
Grid dimensions: {nx, ny, nz}.
Definition world.hpp:94
bool operator!=(const World &other) const noexcept
Inequality operator.
Definition world.hpp:121
World(const Int3 &lower, const Int3 &upper, const CoordinateSystem< T > &cs)
Constructs a World object.
friend std::ostream & operator<<(std::ostream &os, const World< T_ > &w) noexcept
Stream output operator.
Common type aliases used throughout OpenPFC.
World creation and factory functions.
Convenience functions for World creation.
World query and coordinate transformation functions.