Skip to content

Commit

Permalink
Fix mat type
Browse files Browse the repository at this point in the history
  • Loading branch information
Umberto Zerbinati committed Jun 19, 2024
1 parent 578bf58 commit c141255
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions ngsPETSc/ksp.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
'''
from petsc4py import PETSc

from ngsolve import la, GridFunction, BaseMatrix
from ngsolve import la, GridFunction, BaseMatrix, BilinearForm

from ngsPETSc import Matrix, VectorMapping

Expand All @@ -25,9 +25,15 @@ class KrylovSolver():
:arg optionsPrefix: special solver options prefix for this specific Krylov solver
"""
def __init__(self, a, fes, p=None, solverParameters=None, optionsPrefix=None, nullspace=None):
a.Assemble()
Amat = a.mat
def __init__(self, a, fes, p=None, solverParameters=None, optionsPrefix=None, nullspace=None):

Check failure on line 28 in ngsPETSc/ksp.py

View workflow job for this annotation

GitHub Actions / lint

C0303

ngsPETSc/ksp.py:28:98: C0303 Trailing whitespace
if isinstance(BilinearForm):
a.Assemble()
Amat = a.mat
elif isinstance(a, (la.SparseMatrixd, la.ParallelMatrix)):
Amat = a
else:
raise TypeError("Provided operator is a '%s', and this is not supported."
% type(a).__name__)
if p is not None:
p.Assemble()
Pmat = p.mat
Expand Down

0 comments on commit c141255

Please sign in to comment.