fastscape-lem / fastscapelib-fortran

A Fortran (+ Python bindings) library of efficient algorithms for landscape evolution modeling
https://fastscape-lem.github.io/fastscapelib-fortran/
GNU General Public License v3.0
23 stars 17 forks source link

[Do not merge!] Clean handling of domain boundary conditions #32

Open benbovy opened 4 years ago

benbovy commented 4 years ago

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 of f2py and adds support for derived types. Another benefit of using f90wrap is that it may issue RuntimeError 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: