Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rely on std::filesystem for file_utils #3042

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from

Commits on Jun 17, 2024

  1. Rely on std::filesystem for file_utils

    First attempt was to remove `file_utils` in favor of direct calls
    to things like `std::filesystem::exists` and
    ``std::filesystem::path::get_extension`. However, many places in
    openmc use strings to store paths to files and directories which
    would require patterns that previously look like
    ```cpp
    if (!file_exists(member_string_var_)) {
    ...
    }
    ```
    where a class stores a string file path at `member_string_var_`
    to change to
    ```cpp
    std::filesystem::path p(member_string_var_);
    if (!std::filesystem::exists(p)) {
    ...
    }
    ```
    This second pattern would be repeated in a lot of the code base,
    so keeping `file_exists(std::string)` means less repeated code.
    
    An alternative is to use `std::filesystem::path` objects to represent
    paths to files and directories. This would work pretty easily in at
    least two locations:
    
    - `Library::path_`
    - `DAGUniverse::filename_`
    
    But the primary source of "strings for paths" is due to various
    settings, e.g., `settings::path_input`. I don't believe those can be
    converted to `std::filesystem::path` objects because they must be
    more portable to C and, by extension, Python.
    
    Closes openmc-dev#3041
    Andrew Johnson committed Jun 17, 2024
    Configuration menu
    Copy the full SHA
    21692af View commit details
    Browse the repository at this point in the history

Commits on Jun 18, 2024

  1. Fix get_file_extension

    Andrew Johnson committed Jun 18, 2024
    Configuration menu
    Copy the full SHA
    01e7381 View commit details
    Browse the repository at this point in the history

Commits on Jun 20, 2024

  1. Ensure source point file has .h5 extension

    Andrew Johnson committed Jun 20, 2024
    Configuration menu
    Copy the full SHA
    b6b9765 View commit details
    Browse the repository at this point in the history
  2. openmc_statepoint_write no longer appends to given filename

    Always writes an h5 formatted file to the provided
    filepath, even if the extension is not .h5
    Andrew Johnson committed Jun 20, 2024
    Configuration menu
    Copy the full SHA
    013ccbe View commit details
    Browse the repository at this point in the history
  3. write_source_point no longer appends to given filename

    Always writes an h5 formatted file to the
    provided filepath, even if the extension is not .h5
    Andrew Johnson committed Jun 20, 2024
    Configuration menu
    Copy the full SHA
    c41d41d View commit details
    Browse the repository at this point in the history
  4. Add tests for dir_name off develop

    Andrew Johnson committed Jun 20, 2024
    Configuration menu
    Copy the full SHA
    ce39071 View commit details
    Browse the repository at this point in the history
  5. Update and annotate dir_name no longer returns final dir separator

    Previous implementation returned the substring up to and including
    the final directory separator. This is not consistent with
    `std::filesystem::path::parent_path`
    Andrew Johnson committed Jun 20, 2024
    Configuration menu
    Copy the full SHA
    0f98f16 View commit details
    Browse the repository at this point in the history
  6. Update dagmc universe construction with std::filesystem

    Andrew Johnson committed Jun 20, 2024
    Configuration menu
    Copy the full SHA
    96a7a1f View commit details
    Browse the repository at this point in the history

Commits on Jun 21, 2024

  1. Revert "Ensure source point file has .h5 extension"

    This reverts commit b6b9765.
    Andrew Johnson committed Jun 21, 2024
    Configuration menu
    Copy the full SHA
    ef1da94 View commit details
    Browse the repository at this point in the history
  2. Ensure source write file names have correct extensions

    Avoids needing to modify a user-provided file name in
    write_source_point and write_mcnp_source_point
    Andrew Johnson committed Jun 21, 2024
    Configuration menu
    Copy the full SHA
    47e50a3 View commit details
    Browse the repository at this point in the history