Python nonlinear solvers interface memory management

Issue #814 new
Jan Blechta created an issue

NonlinearProblem and NewtonSolver contain virtual methods that

  1. take tensor arguments by reference
  2. are supposed to be overloaded by user in Python

SWIG directors create no-deleter shared pointers from references. This is not good.

Possible solutions:

  1. Implement a check into SWIG directors checking that user did not store the pointers.

  2. Change NonlinearProblem and NewtonSolver C++ interface to take shared pointers instead of references. Note also NewtonSolver::solve(GenericVector& x) would need to be change into shared ptr, because x is then passed to other Python methods.

This issue can be solved in concert with #556 which may introduce interface changes too.

Comments (0)

  1. Log in to comment