Documentation for OpenFLUID
2.2.0
|
When working on several simulators, it often appears that parts are redundant between them. These identical codes can become a problem when a change is required, it has to be done in each simulator, which generates a real risk of discrepency.
To solve these cases, we decided to use a git feature named Submodule that allows us to encapsulate this common code in a dedicated location with its own versioning history. This feature fits well our existing use of git
as versioning control system and it can be integrated in our existing workflows.
For now, OpenFLUID environment can only deal with simple fragments with two constraints:
The current handling of fragments is sufficient for many use cases, such as:
Example of simulator structure including a fragment:
Source files import are slightly different when using a fragment, compilation system triggered by the user knows the location src/fragments/
and syntax such as #include <fragmentName/myCommonFunctions.hpp>
can be used.
To add a new fragment or import one from a distant repository, right-click on the simulator and chose the wanted action in the "add fragment" submenu. If you want to add an existing fragment, you will then be able to add it from a Hub or from a direct git repository.
It is also possible to remove a submodule by doing a right-click on the targetted fragment and select the "remove fragment" option.
For operations such as:
openfluid-fragment.json
file should be added at root directory of the fragment to describe useful information, especially the field openfluid-components
in fragment
sub-dictionary to inform the simulator developer to add any required OpenFLUID components to ware CMakeLists.txt
file.these function will then be usable in the simulator code as follows: