Skip to content

Extend porting guide with more points #356

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

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions docs/openfoam-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,12 @@ We take into account the following relevant differences between OpenFOAM version
- **dictionary access:** In dictionaries (essentially: in the `preciceDict`), some methods are not available. These are mainly used in the configuration step in `Adapter.C`, but also in `ForceBase.C`.
- Replace `preciceDict.get<fileName>("...")` with `static_cast<fileName>(preciceDict.lookup("...")`.
- Replace `preciceDict.get<word>("...")` with `static_cast<word>(preciceDict.lookup("..."))`.
- Replace `preciceDict.getOrDefault` with `preciceDict.lookupOrDefault`.
- Replace `preciceDict.get<wordList>("...")` with `static_cast<wordList>(preciceDict.lookup("..."))`.
- Replace `preciceDict.findDict("...")` with `preciceDict.subDictPtr("...")`.
- **Db access:** In the macro that deals with adding checkpointed fields, some methods are not available.
- Replace `mesh_.sortedNames<GeomField>()` with `mesh_.lookupClass<GeomField>().sortedToc()`.
- Replace `mesh_.thisDb().getObjectPtr<GeomField>(obj)` with `&(const_cast<GeomField&>(mesh_.thisDb().lookupObject<GeomField>(obj)))`.
- Replace `mesh_.sortedNames<GeomFieldType>()` with `mesh_.lookupClass<GeomFieldType>().sortedToc()`.
- Replace `mesh_.thisDb().getObjectPtr<GeomFieldType>(obj)` with `&(const_cast<GeomFieldType&>(mesh_.thisDb().lookupObject<GeomFieldType>(obj)))`.
- **Pointers:** `std::unique_ptr` is not available.
- Replace `std::unique_ptr<T>` with `Foam::autoPtr<T>`.
- Replace calls to pointer `.reset()`, such as `ForceOwning_.reset(new volVectorField(`, with `ForceOwning_ = new volVectorField(`. Adjust the number of closing parentheses.
Expand Down Expand Up @@ -134,6 +135,9 @@ Related work in the adapter: [PR #33](https://github.com/precice/openfoam-adapte

OpenFOAM 7 was [released](https://openfoam.org/release/7/) in July 2019 ([GitHub mirror](https://github.com/OpenFOAM/OpenFOAM-7), [Doxygen](https://cpp.openfoam.org/v7)). Compared to OpenFOAM 6:

- **writeEntry:** The interface for `writeEntry` was changed.
- Where in the latest adapter (`FF/BoundaryConditions`) you see `this->writeEntry("value", os)`, replace it with `writeEntry(os, "value", *this)`.
- Similarly, where `this->valueFraction().writeEntry("valueFraction", os);`, replace it with `writeEntry(os, "valueFraction", this->valueFraction())`. Similarly for `this->refValue().writeEntry("refValue", os)`.
- **fileName:** `fileName::DIRECTORY` was renamed to `fileType::directory`.
- Replace this in the `Adapter.C`.

Expand Down