Skip to content

OpenPFC release v0.1.2 (2025-11-21)

Choose a tag to compare

@ahojukka5 ahojukka5 released this 21 Nov 20:01
· 384 commits to master since this release
v0.1.2
2cc8fe2

This version of OpenPFC delivers developer ergonomics and reliability
improvements: ergonomic World creation helpers, compile-time mathematical
constants, comprehensive documentation, higher test coverage, and build
hardening — making OpenPFC easier to use and safer to extend.

Added: New ergonomic World creation helpers, a compile-time mathematical
constants library, major documentation improvements (100% @file coverage,
REUSE-compliant SPDX headers), and broader testing with ~90% line and ~95%
function coverage plus a pre-commit clang-format hook. Build hardening includes
-Werror=format-security.

Fixed: More robust CMake detection for Catch2 and HeFFTe, corrected tungsten
application linkage, replacement of runtime π calculations with
pfc::constants::pi, and minor formatting cleanups.

Breaking changes: Model::rank0 is now private; use
Model::is_rank0() instead. This is a straightforward search-and-replace with
no runtime overhead.


Added

  • Core: World construction helper functions in include/openpfc/core/world.hpp
    providing ergonomic, zero-cost abstractions for common grid creation patterns.
    Added 5 inline helper functions: uniform(int) and uniform(int, double) for
    N³ grids, from_bounds(...) for automatic spacing computation from physical
    bounds (periodic/non-periodic aware), with_spacing(...) for custom spacing
    with default origin, and with_origin(...) for custom origin with unit spacing.
    All helpers include input validation with clear error messages. Reduces
    boilerplate from world::create({64,64,64}, {0,0,0}, {1,1,1}) to
    world::uniform(64). Backward compatible - existing create() API unchanged.
    Comprehensive test coverage (32 new assertions). Example program added in
    examples/world_helpers_example.cpp.
  • Core: Mathematical constants in include/openpfc/constants.hpp for
    compile-time evaluation with zero runtime overhead. Added 12 constants: π,
    2π, π/2, π/4, 1/π, √π, √2, √3, e, ln(2), ln(10), and φ (golden ratio).
    All constants are constexpr double with 16+ decimal digits precision.
    Comprehensive Doxygen documentation included. Constants accessible via both
    pfc::constants::pi and pfc::pi namespaces. API matches C++20
    std::numbers for future migration.
  • Testing: Comprehensive test suite for mathematical constants in
    tests/unit/core/test_constants.cpp with 13 test cases and 41 assertions
    covering precision verification, derived constants, compile-time evaluation,
    and integration scenarios (FFT wave numbers, crystal geometry).
  • Testing: Pre-commit hook for automatic clang-format checking to prevent
    formatting issues before pushing to CI. Hook available in scripts/pre-commit-hook
    with installation instructions in scripts/README.md.
  • Testing: Comprehensive test coverage improvements achieving 90.7% line
    coverage and 94.8% function coverage. Added tests for utils.hpp,
    world.cpp, and fixed_bc.hpp.
  • Build system: Added -Werror=format-security compiler flag to catch
    format string vulnerabilities locally before CI, matching CI behavior.
  • Documentation: Added SPDX license headers to test README files
    (tests/, tests/benchmarks/, tests/fixtures/, tests/integration/,
    tests/unit/) for REUSE compliance (174/174 files now compliant).
  • Documentation: Added comprehensive @file documentation tags to all 41
    public header files in include/openpfc/ achieving 100% coverage. Each header
    now includes brief description, detailed explanation, practical usage examples,
    and cross-references to related components. Reduced Doxygen @file warnings
    from 47 to 0. Improves API discoverability for new users and enables better
    IDE/LLM assistance.

Fixed

  • Examples: Replaced runtime pi calculation (std::atan(1.0) * 4.0) with
    compile-time pfc::constants::pi in diffusion_model.hpp,
    12_cahn_hilliard.cpp, and 05_simulator.cpp for zero runtime overhead in
    FFT wave number calculations. Removed unused global PI constants.
  • CMake build system: Fixed Catch2 detection in FindCatch2.cmake by
    explicitly setting Catch2_FOUND variable after FetchContent_MakeAvailable.
    This enables the test suite to build when OpenPFC_BUILD_TESTS=ON.
  • CMake build system: Fixed HeFFTe detection in FindHeffte.cmake by
    setting Heffte_FOUND=TRUE after FetchContent to prevent fatal errors when
    HeFFTe is downloaded instead of using system-installed package.
  • tungsten application: Added explicit find_package(Heffte REQUIRED) and
    corrected target link to Heffte::Heffte to ensure proper linkage with
    separately installed HeFFTe v2.4.1.
  • Code quality: Fixed format-security compiler error in utils.hpp by
    adding overload for string_format() with no variadic arguments.
  • Code formatting: Removed trailing whitespace in test_fft.cpp to pass
    clang-format checks.

Breaking Changes

  • Model::rank0 is now private: The public member variable rank0 has been
    moved to private section and renamed to m_rank0. Use the Model::is_rank0()
    method instead.
    • Migration: Replace model.rank0 with model.is_rank0() in your code
    • Reason: Better encapsulation and consistent API with other query methods
      like get_world() and get_fft()
    • Impact: All examples and applications updated to use the new API
    • Note: The method is_rank0() is now const and inline for zero overhead