11from __future__ import annotations
2- from typing import Any , Iterable , Literal , TYPE_CHECKING
2+ from typing import Any , Iterable , TYPE_CHECKING
33import itertools
44
55if TYPE_CHECKING :
66 from firedrake .bcs import BCBase
77 from firedrake .matrix_free .operators import ImplicitMatrixContext
88 from firedrake .slate .slate import TensorBase
9-
9+
1010import ufl
1111from ufl .argument import BaseArgument
1212from pyop2 import op2
1515from firedrake .petsc import PETSc
1616
1717
18-
1918class DummyOP2Mat :
2019 """A hashable implementation of M.handle"""
2120 def __init__ (self , handle ):
@@ -25,11 +24,11 @@ def __init__(self, handle):
2524class MatrixBase (ufl .Matrix ):
2625
2726 def __init__ (
28- self ,
29- a : ufl .BaseForm | TensorBase | tuple [BaseArgument , BaseArgument ],
30- bcs : Iterable [BCBase ] | None = None ,
31- fc_params : dict [str , Any ] | None = None ,
32- ):
27+ self ,
28+ a : ufl .BaseForm | TensorBase | tuple [BaseArgument , BaseArgument ],
29+ bcs : Iterable [BCBase ] | None = None ,
30+ fc_params : dict [str , Any ] | None = None ,
31+ ):
3332 """A representation of the linear operator associated with a bilinear form and bcs.
3433 Explicitly assembled matrices and matrix-free .matrix classes will derive from this.
3534
@@ -145,13 +144,13 @@ def zero(self):
145144class Matrix (MatrixBase ):
146145
147146 def __init__ (
148- self ,
149- a : ufl .BaseForm ,
150- mat : op2 .Mat | PETSc .Mat ,
151- bcs : Iterable [BCBase ] | None = None ,
152- fc_params : dict [str , Any ] | None = None ,
153- options_prefix : str | None = None ,
154- ):
147+ self ,
148+ a : ufl .BaseForm ,
149+ mat : op2 .Mat | PETSc .Mat ,
150+ bcs : Iterable [BCBase ] | None = None ,
151+ fc_params : dict [str , Any ] | None = None ,
152+ options_prefix : str | None = None ,
153+ ):
155154 """A representation of an assembled bilinear form.
156155
157156 Parameters
@@ -189,15 +188,15 @@ def assemble(self):
189188class ImplicitMatrix (MatrixBase ):
190189
191190 def __init__ (
192- self ,
193- a : ufl .BaseForm ,
194- ctx : ImplicitMatrixContext ,
195- bcs : Iterable [BCBase ] | None = None ,
196- fc_params : dict [str , Any ] | None = None ,
197- options_prefix : str | None = None ,
198- ):
199- """A representation of the action of bilinear form operating without
200- explicitly assembling the associated matrix. This class wraps the
191+ self ,
192+ a : ufl .BaseForm ,
193+ ctx : ImplicitMatrixContext ,
194+ bcs : Iterable [BCBase ] | None = None ,
195+ fc_params : dict [str , Any ] | None = None ,
196+ options_prefix : str | None = None ,
197+ ):
198+ """A representation of the action of bilinear form operating without
199+ explicitly assembling the associated matrix. This class wraps the
201200 relevant information for Python PETSc matrix.
202201
203202 Parameters
@@ -238,12 +237,12 @@ def assemble(self):
238237class AssembledMatrix (MatrixBase ):
239238
240239 def __init__ (
241- self ,
242- args : tuple [BaseArgument , BaseArgument ],
243- petscmat : PETSc .Mat ,
244- bcs : Iterable [BCBase ] | None = None ,
245- options_prefix : str | None = None ,
246- ):
240+ self ,
241+ args : tuple [BaseArgument , BaseArgument ],
242+ petscmat : PETSc .Mat ,
243+ bcs : Iterable [BCBase ] | None = None ,
244+ options_prefix : str | None = None ,
245+ ):
247246 """A representation of a matrix that doesn't require knowing the underlying form.
248247
249248 Parameters
0 commit comments