Skip to content

Feature: OpenFOAM reader [1/n] - First structure#2256

Open
sandro-elsweijer wants to merge 13 commits into
mainfrom
feature-openfoam_reader_0
Open

Feature: OpenFOAM reader [1/n] - First structure#2256
sandro-elsweijer wants to merge 13 commits into
mainfrom
feature-openfoam_reader_0

Conversation

@sandro-elsweijer
Copy link
Copy Markdown
Member

@sandro-elsweijer sandro-elsweijer commented Apr 1, 2026

Closes #2257

Describe your changes here:
Implements a first structure of the OpenFOAM reader.
The first draft of the OpenFOAM reader struct reads the files inside an OpenFOAM case and fills internal data structures.
The conversion of this data into a cmesh follows in the next PRs. Otherwise this PR would be too big to review.
The reader is not inside cmesh/IO/OpenFOAM, since the reader will not only provide a cmesh, but also a forest with data. So there is no clear distinction between the reader cmesh and forest and the OpenFOAM functionality is its own category.

This PR also implements an OpenFOAM example and it has two purposes:

  1. The OpenFOAM reader is a header file and this example makes cmake compile the header.
  2. During development, the example can be used to test and debug the code.

There is no test yet, since the OpenFOAM reader is not finished yet. I plan to implement two tests:

  1. A test where a very simple mesh is read and manually checked.
  2. A component test where we use an OpenFOAM writer to write a mesh and afterwards we read it using the OpenFOAM reader. The output and input mesh should be equal.
    Both tests can only be written, when the reader is finished.

All these boxes must be checked by the AUTHOR before requesting review:

  • The PR is small enough to be reviewed easily. If not, consider splitting up the changes in multiple PRs.
  • The title starts with one of the following prefixes: Documentation:, Bugfix:, Feature:, Improvement: or Other:.
  • If the PR is related to an issue, make sure to link it.
  • The author made sure that, as a reviewer, he/she would check all boxes below.

All these boxes must be checked by the REVIEWERS before merging the pull request:

As a reviewer please read through all the code lines and make sure that the code is fully understood, bug free, well-documented and well-structured.

General

  • The reviewer executed the new code features at least once and checked the results manually.
  • The code follows the t8code coding guidelines.
  • New source/header files are properly added to the CMake files.
  • The code is well documented. In particular, all function declarations, structs/classes and their members have a proper doxygen documentation. Make sure to add a file documentation for each file!
  • All new algorithms and data structures are sufficiently optimal in terms of memory and runtime (If this should be merged, but there is still potential for optimization, create a new issue).

Tests

  • The code is covered in an existing or new test case using Google Test.
  • The code coverage of the project (reported in the CI) should not decrease. If coverage is decreased, make sure that this is reasonable and acceptable.
  • Valgrind doesn't find any bugs in the new code. This script can be used to check for errors; see also this wiki article.

If the Pull request introduces code that is not covered by the github action (for example coupling with a new library):

  • Should this use case be added to the github action?
  • If not, does the specific use case compile and all tests pass (check manually).

Scripts and Wiki

  • If a new directory with source files is added, it must be covered by the scripts/internal/find_all_source_files.sh to check the indentation of these files.
  • If this PR introduces a new feature, it must be covered in an example or tutorial and a Wiki article.

License

  • The author added a BSD statement to doc/ (or already has one).

@sandro-elsweijer sandro-elsweijer changed the title Feature: First structure of the OpenFOAM reader Feature: OpenFOAM reader [1/n] - First structure Apr 1, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 1, 2026

Codecov Report

❌ Patch coverage is 0% with 159 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.87%. Comparing base (2b91986) to head (712608e).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/t8_openfoam/t8_openfoam_reader.cxx 0.00% 159 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2256      +/-   ##
==========================================
- Coverage   82.57%   81.87%   -0.71%     
==========================================
  Files         116      117       +1     
  Lines       18553    18712     +159     
==========================================
  Hits        15320    15320              
- Misses       3233     3392     +159     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sandro-elsweijer sandro-elsweijer marked this pull request as draft April 2, 2026 09:06
@sandro-elsweijer sandro-elsweijer marked this pull request as ready for review April 2, 2026 10:44
@spenke91 spenke91 self-assigned this Apr 27, 2026
@spenke91 spenke91 self-requested a review April 27, 2026 13:24
Copy link
Copy Markdown
Collaborator

@spenke91 spenke91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for this feature @sandro-elsweijer ! I really like the code structure and style 👍 I do have some remarks, though, most of them being minor issues...

I went through the code, but did not run the example myself yet, since I did not have an OpenFOAM case readily available and would argue that we should add an example case anyway 😇

Comment thread src/t8_openfoam/t8_openfoam_reader.hxx Outdated
Comment thread src/t8_openfoam/t8_openfoam_reader.hxx Outdated
Comment thread src/t8_openfoam/t8_openfoam_reader.hxx
Comment thread src/t8_openfoam/t8_openfoam_reader.hxx Outdated
Comment thread src/t8_openfoam/t8_openfoam_reader.hxx Outdated
Comment thread src/t8_openfoam/t8_openfoam_reader.hxx Outdated
Comment thread src/t8_openfoam/t8_openfoam_reader.hxx Outdated
Comment thread src/t8_openfoam/t8_openfoam_reader.hxx Outdated
Comment thread src/t8_openfoam/t8_openfoam_reader.hxx Outdated
Comment thread example/IO/cmesh/OpenFOAM/t8_read_openfoam_case.cxx
@spenke91 spenke91 assigned sandro-elsweijer and unassigned spenke91 May 5, 2026
@sandro-elsweijer sandro-elsweijer force-pushed the feature-openfoam_reader_0 branch from d31c0e0 to f6d0397 Compare May 18, 2026 11:46
Copy link
Copy Markdown
Collaborator

@spenke91 spenke91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update! The code changes all look good to me.
I will test the reader later today with the example case -- and then most probably give you a green light 🟢

Comment thread src/t8_openfoam/t8_openfoam_reader.hxx Outdated
Comment thread src/t8_openfoam/t8_openfoam_reader.hxx Outdated
Comment thread src/t8_openfoam/t8_openfoam_reader.hxx Outdated
Comment thread example/IO/cmesh/OpenFOAM/t8_read_openfoam_case.cxx
Comment thread src/t8_openfoam/t8_openfoam_reader.hxx
Comment thread src/t8_openfoam/t8_openfoam_reader.hxx Outdated
@spenke91 spenke91 enabled auto-merge May 20, 2026 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: OpenFOAM reader [1/n] - First structure

2 participants