OpenPFC  0.1.4
Phase Field Crystal simulation framework
Loading...
Searching...
No Matches
world.hpp File Reference

World class definition and unified interface. More...

#include <array>
#include <ostream>
#include "csys.hpp"
#include "types.hpp"
#include "world_factory.hpp"
#include "world_helpers.hpp"
#include "world_queries.hpp"
Include dependency graph for world.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  pfc::world::World< T >
 Represents the global simulation domain (the "world"). More...
 

Namespaces

namespace  pfc::world
 Namespace for decomposition-related classes and functions.
 

Typedefs

using pfc::world::CartesianWorld = World< CartesianTag >
 Type alias for Cartesian 3D World (most common usage)
 
using pfc::World = world::CartesianWorld
 

Detailed Description

World class definition and unified interface.

The World<CoordTag> class defines the global simulation domain in OpenPFC's computational physics framework. It provides a unified abstraction for describing a discretized physical space in which fields are defined, evolved, and coupled to solvers.

Architecture

World functionality is split across focused modules:

Quick Start

using namespace pfc;
// Create Cartesian world with default settings
World world = world::create({100, 100, 100});
// Query and transform
Real3 x = world::to_coords(world, {10, 20, 30});
Int3 i = world::to_indices(world, {10.0, 20.0, 30.0});
double dx = world::get_spacing(world, 0);
Represents the global simulation domain (the "world").
Definition world.hpp:91

Design Philosophy

World follows OpenPFC's "Laboratory, Not Fortress" principles:

  • Immutable value-type: No mutable state, thread-safe by design
  • Functional API: Free functions for operations (not member methods)
  • Template-based extensibility: Support custom coordinate systems via tags
  • Zero-overhead abstractions: Inline functions, no runtime polymorphism
  • Explicit over implicit: Clear, self-documenting APIs

Extending with Custom Coordinate Systems

Add custom coordinate systems (cylindrical, spherical, etc.) without modifying OpenPFC source. See examples/17_custom_coordinate_system.cpp for complete working examples and docs/extending_openpfc/adl_extension_patterns.md for comprehensive guide.

See also
world_factory.hpp for World creation functions
world_queries.hpp for queries and coordinate transforms
world_helpers.hpp for convenience constructors
examples/17_custom_coordinate_system.cpp for extension example