precice / fenics-adapter

preCICE-adapter for the open source computing platform FEniCS
GNU Lesser General Public License v3.0
29 stars 15 forks source link

Can we implicitly finalize? #98

Closed BenjaminRodenberg closed 3 years ago

BenjaminRodenberg commented 3 years ago

https://github.com/precice/fenics-adapter/blob/e16d434345553f8c8cccf8d0804c6af94168e7c1/fenicsprecice/fenicsprecice.py#L398-L406

The destructor of the preCICE cpp SolverInterface calls finalize. We have to check that this also works for the python-bindings (https://github.com/precice/python-bindings/blob/8463bf1160a734f0de76fc53090f779a4a6cae5a/precice.pyx#L82-L86). Then we can make calling finalize optional and remove it from corresponding tutorial cases.

BenjaminRodenberg commented 3 years ago

I did a quick check and found out that garbage collection of python automatically calls the destructor of the python-bindings. Meaning: This is not an issue of the fenics-adapter, but, if at all, of the python bindings.

Note that the destructor of the cpp API of preCICE automatically calls finalize and the python bindings should follow this behavior. I will check this for the python bindings and, if necessary, open an issue in the python bindings repository.

BenjaminRodenberg commented 3 years ago

Follow-up: Also for the python-bindings everything is in order. Additionally, I opened https://github.com/precice/precice/issues/893.