Skip to content

Commit 99c65e4

Browse files
committed
docs: Add a section on adding a custom backend.
1 parent cbfcf17 commit 99c65e4

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

docs/custom-backend.rst

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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::

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ The package is fully agnostic of the computational backend, which allows for eas
1919
examples
2020
custom-bc
2121
custom-model
22+
custom-backend
2223

2324
.. _problem definitions:
2425
.. toctree::

0 commit comments

Comments
 (0)