OpenPFC  0.1.4
Phase Field Crystal simulation framework
Loading...
Searching...
No Matches
pfc::csys::CoordinateSystem< Tag > Struct Template Reference

Primary template for defining coordinate systems by tag. More...

Detailed Description

template<typename Tag>
struct pfc::csys::CoordinateSystem< Tag >

Primary template for defining coordinate systems by tag.

The CoordinateSystem<Tag> template provides a mechanism to define coordinate systems in a modular and extensible way, where each Tag corresponds to a specific geometry (e.g., Cartesian, Polar, Cylindrical).

Specializations of this template should define:

  • The internal parameters of the coordinate system (e.g., offset, spacing)
  • Methods to map between index space and physical space:
    • to_physical(const Int3&) -> Real3
    • to_index(const Real3&) -> Int3

This design decouples geometry from logic and enables user-defined coordinate systems to integrate cleanly with the simulation framework. It also avoids inheritance or runtime polymorphism, favoring compile-time specialization and inlining for performance-critical transformations.

Example usage:

struct CartesianTag {};
template <>
Real3 offset;
Real3 spacing;
Real3 to_physical(const Int3& idx) const noexcept;
Int3 to_index(const Real3& pos) const noexcept;
};
const Int3 to_index(const CartesianCS &cs, const Real3 &xyz) noexcept
Convert physical coordinates to grid indices.
Definition csys.hpp:307
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

Coordinate systems are used by the World<Tag> class and related infrastructure to define how grid indices map to real-world physical coordinates.

Template Parameters
TagA user-defined type that uniquely identifies the coordinate system.
Examples
/home/runner/work/OpenPFC/OpenPFC/include/openpfc/core/world_queries.hpp.

The documentation for this struct was generated from the following file: