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

Core type definitions for World parameters. More...

#include <array>
#include <stdexcept>
Include dependency graph for types.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  pfc::types::Size3
 Represents the size of the 3d simulation domain. More...
 
struct  pfc::types::Periodic3
 Represents the periodicity of the 3d simulation domain. More...
 
struct  pfc::types::LowerBounds3
 Represents the lower bounds of the 3d simulation domain. More...
 
struct  pfc::types::UpperBounds3
 Represents the upper bounds of the 3d simulation domain. More...
 
struct  pfc::types::Spacing3
 Represents the spacing of the 3d simulation grid. More...
 

Typedefs

using pfc::types::Int3 = std::array< int, 3 >
 Type aliases for clarity.
 
using pfc::types::Real3 = std::array< double, 3 >
 
using pfc::types::Bool3 = std::array< bool, 3 >
 
using pfc::Int3 = types::Int3
 
using pfc::Real3 = types::Real3
 
using pfc::Bool3 = types::Bool3
 

Functions

const Real3 pfc::types::utils::compute_upper_bounds (const Size3 &size, const LowerBounds3 &lower, const Spacing3 &spacing, const Periodic3 &periodic)
 Computes the upper bounds based on size, lower bounds, and spacing.
 
Real3 pfc::types::utils::compute_spacing (const Size3 &size, const LowerBounds3 &lower, const UpperBounds3 &upper, const Periodic3 &periodic)
 Computes the spacing based on size, lower bounds, and upper bounds.
 

Detailed Description

Core type definitions for World parameters.

This header defines the fundamental types used to construct World objects:

  • Int3, Real3, Bool3: Array aliases for 3D data
  • Size3: Grid dimensions
  • Periodic3: Periodicity flags per dimension
  • LowerBounds3, UpperBounds3: Physical domain bounds
  • Spacing3: Grid spacing per dimension

These types provide strong typing to prevent confusion between different 3-element arrays (size vs spacing vs bounds), improving code clarity and catching errors at compile time.

pfc::types::Size3 size{64, 64, 64};
pfc::types::Spacing3 spacing{1.0, 1.0, 1.0};
pfc::types::Periodic3 periodic{true, true, false}; // Periodic in x, y only
Core type definitions for World parameters.
Represents the periodicity of the 3d simulation domain.
Definition types.hpp:100
Represents the size of the 3d simulation domain.
Definition types.hpp:84
Represents the spacing of the 3d simulation grid.
Definition types.hpp:139
See also
core/world.hpp for usage in World construction
core/csys.hpp for coordinate system integration
Author
OpenPFC Development Team
Date
2025

Function Documentation

◆ compute_spacing()

Real3 pfc::types::utils::compute_spacing ( const Size3 size,
const LowerBounds3 lower,
const UpperBounds3 upper,
const Periodic3 periodic 
)

Computes the spacing based on size, lower bounds, and upper bounds.

Parameters
sizeThe size of the simulation domain.
lowerThe lower bounds of the simulation domain.
upperThe upper bounds of the simulation domain.
periodicThe periodicity of the simulation domain.
Returns
The computed spacing.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ compute_upper_bounds()

const Real3 pfc::types::utils::compute_upper_bounds ( const Size3 size,
const LowerBounds3 lower,
const Spacing3 spacing,
const Periodic3 periodic 
)

Computes the upper bounds based on size, lower bounds, and spacing.

Parameters
sizeThe size of the simulation domain.
lowerThe lower bounds of the simulation domain.
spacingThe spacing of the simulation grid.
periodicThe periodicity of the simulation domain.
Returns
The computed upper bounds.
Here is the call graph for this function:
Here is the caller graph for this function: