[Do not merge!] Clean handling of domain boundary conditions #32
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Compute boundary conditions variables and arrays just once when calling
Set_BC
(before this task was quite duplicated / scattered in various routines).This approach use Fortran derived types, which IMO should be used more for grouping arrays or variables into consistent structures (e.g., stack, receivers, etc. -> flow graph), which is much more readable and less error prone.
One important caveat: derived types are not supported by
f2py
. f90wrap is a tool built on top off2py
and adds support for derived types. Another benefit of usingf90wrap
is that it may issueRuntimeError
to Python (see #13).However, to use
f90wrap
we would need to update the CMake script, and either add support for it in scikit-build (contributing upstream) or rewrite the Python setup by hand. Both would need work/time. Additionally,f90wrap
would be another build and runtime dependency (conda-forge package are not up-to-date and only for linux/macos).To install/use f90wrap:
pip install f90wrap
mkdir -p build/f90wrap; cd build/f90wrap
f90wrap -m fastscapelib_fortran ../../src/*.f90
gfortran -c ../../src/*.f90 -fPIC
f2py-f90wrap -c -m _fastscapelib_fortran f90wrap_*.f90 *.o