File: pc.py

package info (click to toggle)
petsc4py 3.24.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,592 kB
  • sloc: python: 13,451; ansic: 1,768; makefile: 345; f90: 313; sh: 14
file content (10 lines) | stat: -rw-r--r-- 347 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
# The user-defined Python class implementing the Jacobi method.
class myJacobi:
    # Setup the internal data. In this case, we access the matrix diagonal.
    def setUp(self, pc):
        _, P = pc.getOperators()
        self.D = P.getDiagonal()

    # Apply the preconditioner
    def apply(self, pc, x, y):
        y.pointwiseDivide(x, self.D)