|
| 1 | +Adding a custom backend |
| 2 | +======================= |
| 3 | +Adding a custom backend can be useful when using an external package for providing a model, or when using a custom solver. |
| 4 | +As mentioned in :ref:`choosing a backend`, we provide some basic parallel backends (:mod:`Epetra <.interface.Epetra>` and :mod:`PETSc <.interface.PETSc>`) that can be used as base classes. |
| 5 | + |
| 6 | +There are only a few methods that should be implemented when adding a custom backend. |
| 7 | +These methods are the ones that raise a ``NotImplementedError`` in :mod:`BaseInterface <.interface.BaseInterface>`. |
| 8 | +Of course all other methods in :mod:`BaseInterface <.interface.BaseInterface>` can also be overloaded, but they are all just convenience methods and are not required by this package. |
| 9 | + |
| 10 | +``solve(self, jac, rhs)`` or optionally ``solve(self, jac, rhs, rhs2=None, V=None, W=None, C=None)`` |
| 11 | + Should solve a linear system with matrix ``jac`` and right-hand side ``rhs`` and then return the solution. |
| 12 | + |
| 13 | +``jacobian(self, state)`` |
| 14 | + Should return a matrix object for the current state that can be used by the linear solver. |
| 15 | + |
| 16 | +``rhs(self, state)`` |
| 17 | + Should return the right-hand side for the current state. |
| 18 | + |
| 19 | +``vector(self)`` |
| 20 | + Should return a new vector that can interact with the linear solver. |
| 21 | + |
| 22 | +``mass_matrix(self)`` |
| 23 | + Should return a mass matrix object as used for time integration and eigenvalue computation. |
| 24 | + This is optional if neither of those is used. |
| 25 | + |
| 26 | +``eigs(self, state, return_eigenvectors=False, enable_recycling=False)`` |
| 27 | + Used for eigenvalue computation during the continuation. |
| 28 | + This is optional and only used when automatically detecting bifurcations. |
| 29 | + |
| 30 | +``set_parameter(self, name, value)`` |
| 31 | + Used during the continuation to set the continuation parameter. |
| 32 | + This already has a default implementation that can be used if no custom discretization is being provided. |
| 33 | + |
| 34 | +.. |
| 35 | + Explicitly enable math mode |
| 36 | +.. math:: |
0 commit comments