![]() |
OpenPFC
0.1.4
Phase Field Crystal simulation framework
|
Strong type aliases for geometric quantities. More...


Go to the source code of this file.
Classes | |
| struct | pfc::GridSize |
| Grid dimensions (number of grid points per dimension) More... | |
| struct | pfc::LocalOffset |
| Local subdomain offset in local coordinate system. More... | |
| struct | pfc::GlobalOffset |
| Global subdomain offset in global coordinate system. More... | |
| struct | pfc::IndexBounds |
| Index space bounds (min and max indices) More... | |
| struct | pfc::GridSpacing |
| Physical spacing between grid points. More... | |
| struct | pfc::PhysicalOrigin |
| Physical origin of coordinate system. More... | |
| struct | pfc::PhysicalCoords |
| Physical coordinates in space. More... | |
| struct | pfc::PhysicalBounds |
| Physical space bounds (min and max coordinates) More... | |
Strong type aliases for geometric quantities.
This header provides lightweight strong type wrappers for geometric quantities used throughout OpenPFC. These types improve code clarity and type safety by distinguishing between different kinds of 3D arrays (size vs spacing vs offset).
OpenPFC uses strong types to make code self-documenting and type-safe:
Before (primitive obsession):
After (strong types):
All strong types are zero-cost - they compile away completely:
Assembly output is identical to using raw Int3 or Real3 types.
Strong types use implicit conversions for seamless backward compatibility:
Discrete (index) space:
GridSize - Grid dimensions (number of points per dimension)LocalOffset - Subdomain offset in local coordinate systemGlobalOffset - Subdomain offset in global coordinate systemIndexBounds - Min/max indices for a regionPhysical (coordinate) space:
GridSpacing - Physical spacing between grid pointsPhysicalOrigin - Physical origin of coordinate systemPhysicalCoords - Physical position in spacePhysicalBounds - Physical min/max coordinates for a regionUse strong types for:
Raw types are fine for:
Strong types have zero runtime overhead: