File: ksppython_protocol.py

package info (click to toggle)
petsc4py 3.23.1-1exp2
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 3,448 kB
  • sloc: python: 12,503; ansic: 1,697; makefile: 343; f90: 313; sh: 14
file content (40 lines) | stat: -rw-r--r-- 1,196 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from petsc4py.PETSc import KSP
from petsc4py.PETSc import Vec
from petsc4py.PETSc import Viewer


# A template class with the Python methods supported by KSPPYTHON


class KSPPythonProtocol:
    def solve(self, ksp: KSP, b: Vec, x: Vec) -> None:
        """Solve the linear system with right-hand side b. Return solution in x."""
        ...

    def solveTranspose(self, ksp: KSP, b: Vec, x: Vec) -> None:
        """Solve the transposed linear system with right-hand side b. Return solution in x."""
        ...

    def view(self, ksp: KSP, viewer: Viewer) -> None:
        """View the Krylov solver."""
        ...

    def setFromOptions(self, ksp: KSP) -> None:
        """Process command line for customization."""
        ...

    def setUp(self, ksp: KSP) -> None:
        """Perform the required setup."""
        ...

    def buildSolution(self, ksp: KSP, x: Vec) -> None:
        """Compute the solution vector."""
        ...

    def buildResidual(self, ksp: KSP, t: Vec, r: Vec) -> None:
        """Compute the residual vector, return it in r. t is a scratch working vector."""
        ...

    def reset(self, ksp: KSP) -> None:
        """Reset the Krylov solver."""
        ...