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
1313from pyop2 .utils import as_tuple
1414from firedrake .petsc import PETSc
1515
1616
17-
1817class DummyOP2Mat :
1918 """A hashable implementation of M.handle"""
2019 def __init__ (self , handle ):
@@ -24,11 +23,11 @@ def __init__(self, handle):
2423class MatrixBase (ufl .Matrix ):
2524
2625 def __init__ (
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- ):
26+ self ,
27+ a : ufl .BaseForm | TensorBase | tuple [BaseArgument , BaseArgument ],
28+ bcs : Iterable [BCBase ] | None = None ,
29+ fc_params : dict [str , Any ] | None = None ,
30+ ):
3231 """A representation of the linear operator associated with a bilinear form and bcs.
3332 Explicitly assembled matrices and matrix-free .matrix classes will derive from this.
3433
@@ -143,13 +142,13 @@ def zero(self):
143142class Matrix (MatrixBase ):
144143
145144 def __init__ (
146- self ,
147- a : ufl .BaseForm ,
148- mat : op2 .Mat | PETSc .Mat ,
149- bcs : Iterable [BCBase ] | None = None ,
150- fc_params : dict [str , Any ] | None = None ,
151- options_prefix : str | None = None ,
152- ):
145+ self ,
146+ a : ufl .BaseForm ,
147+ mat : op2 .Mat | PETSc .Mat ,
148+ bcs : Iterable [BCBase ] | None = None ,
149+ fc_params : dict [str , Any ] | None = None ,
150+ options_prefix : str | None = None ,
151+ ):
153152 """A representation of an assembled bilinear form.
154153
155154 Parameters
@@ -187,15 +186,15 @@ def assemble(self):
187186class ImplicitMatrix (MatrixBase ):
188187
189188 def __init__ (
190- self ,
191- a : ufl .BaseForm ,
192- ctx : ImplicitMatrixContext ,
193- bcs : Iterable [BCBase ] | None = None ,
194- fc_params : dict [str , Any ] | None = None ,
195- options_prefix : str | None = None ,
196- ):
197- """A representation of the action of bilinear form operating without
198- explicitly assembling the associated matrix. This class wraps the
189+ self ,
190+ a : ufl .BaseForm ,
191+ ctx : ImplicitMatrixContext ,
192+ bcs : Iterable [BCBase ] | None = None ,
193+ fc_params : dict [str , Any ] | None = None ,
194+ options_prefix : str | None = None ,
195+ ):
196+ """A representation of the action of bilinear form operating without
197+ explicitly assembling the associated matrix. This class wraps the
199198 relevant information for Python PETSc matrix.
200199
201200 Parameters
@@ -236,12 +235,12 @@ def assemble(self):
236235class AssembledMatrix (MatrixBase ):
237236
238237 def __init__ (
239- self ,
240- args : tuple [BaseArgument , BaseArgument ],
241- petscmat : PETSc .Mat ,
242- bcs : Iterable [BCBase ] | None = None ,
243- options_prefix : str | None = None ,
244- ):
238+ self ,
239+ args : tuple [BaseArgument , BaseArgument ],
240+ petscmat : PETSc .Mat ,
241+ bcs : Iterable [BCBase ] | None = None ,
242+ options_prefix : str | None = None ,
243+ ):
245244 """A representation of a matrix that doesn't require knowing the underlying form.
246245
247246 Parameters
0 commit comments