From e39fec77e411115e029b3f8dc0ba26694aabd48e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9cile=20Daversin-Catty?= Date: Fri, 10 Jul 2020 11:47:51 +0200 Subject: [PATCH 01/14] Start adding ingredients for integration over edges (dl) --- test/test_classcoverage.py | 10 + test/test_measures.py | 4 + test/test_piecewise_checks.py | 7 + ufl/__init__.py | 6 +- ufl/algorithms/apply_geometry_lowering.py | 34 ++- ufl/algorithms/apply_integral_scaling.py | 12 +- ufl/algorithms/apply_restrictions.py | 4 +- ufl/cell.py | 2 + ufl/geometry.py | 247 +++++++++++++++++++++- ufl/measure.py | 4 + 10 files changed, 322 insertions(+), 8 deletions(-) diff --git a/test/test_classcoverage.py b/test/test_classcoverage.py index af96b4e6e..d8355051d 100755 --- a/test/test_classcoverage.py +++ b/test/test_classcoverage.py @@ -184,6 +184,16 @@ def testAll(self): g = FacetJacobianInverse(cell) _test_object(g, (dim-1, dim), ()) + cell3D = tetrahedron # EdgeJacobian is not available in 2D + dim3D = cell3D.geometric_dimension() + assert dim3D == 3 + g = EdgeJacobian(cell3D) + _test_object(g, (dim3D, dim3D-2), ()) + g = EdgeJacobianDeterminant(cell3D) + _test_object(g, (), ()) + g = EdgeJacobianInverse(cell3D) + _test_object(g, (dim3D-2, dim3D), ()) + g = FacetNormal(cell) _test_object(g, (dim,), ()) # g = CellNormal(cell) diff --git a/test/test_measures.py b/test/test_measures.py index ff5c4433f..b96778ebd 100755 --- a/test/test_measures.py +++ b/test/test_measures.py @@ -25,6 +25,8 @@ def test_construct_forms_from_default_measures(): ds = Measure("ds") dS = Measure("dS") + dl = Measure("dl") + dP = Measure("dP") # dV = Measure("dV") @@ -46,6 +48,8 @@ def test_construct_forms_from_default_measures(): assert ds.integral_type() == "exterior_facet" assert dS.integral_type() == "interior_facet" + assert dl.integral_type() == "edge" + assert dP.integral_type() == "vertex" # TODO: Change dP to dV: # assert dP.integral_type() == "point" diff --git a/test/test_piecewise_checks.py b/test/test_piecewise_checks.py index 1db8ec6c2..d9632f34c 100755 --- a/test/test_piecewise_checks.py +++ b/test/test_piecewise_checks.py @@ -182,6 +182,13 @@ def mappings_are_cellwise_constant(domain, test): assert is_cellwise_constant(e) == test e = FacetJacobianInverse(domain) assert is_cellwise_constant(e) == test + if domain.topological_dimension() > 2: + e = EdgeJacobian(domain) + assert is_cellwise_constant(e) == test + e = EdgeJacobianDeterminant(domain) + assert is_cellwise_constant(e) == test + e = EdgeJacobianInverse(domain) + assert is_cellwise_constant(e) == test def test_mappings_are_cellwise_constant_on_linear_affine_cells(affine_domains): diff --git a/ufl/__init__.py b/ufl/__init__.py index f0558dcbf..b346b5282 100644 --- a/ufl/__init__.py +++ b/ufl/__init__.py @@ -207,7 +207,7 @@ * Integral measures:: - - dx, ds, dS, dP + - dx, ds, dS, dP, dl - dc, dC, dO, dI, dX - ds_b, ds_t, ds_tb, ds_v, dS_h, dS_v @@ -351,7 +351,7 @@ vertex, interval, triangle, tetrahedron, quadrilateral, hexahedron, facet, i, j, k, l, p, q, r, s, - dx, ds, dS, dP, + dx, ds, dS, dP, dl, dc, dC, dO, dI, dX, ds_b, ds_t, ds_tb, ds_v, dS_h, dS_v ) @@ -409,7 +409,7 @@ 'Integral', 'Measure', 'register_integral_type', 'integral_types', 'custom_integral_types', 'replace', 'replace_integral_domains', 'derivative', 'action', 'energy_norm', 'rhs', 'lhs', 'extract_blocks', 'system', 'functional', 'adjoint', 'sensitivity_rhs', - 'dx', 'ds', 'dS', 'dP', + 'dx', 'ds', 'dS', 'dP', 'dl', 'dc', 'dC', 'dO', 'dI', 'dX', 'ds_b', 'ds_t', 'ds_tb', 'ds_v', 'dS_h', 'dS_v', 'vertex', 'interval', 'triangle', 'tetrahedron', diff --git a/ufl/algorithms/apply_geometry_lowering.py b/ufl/algorithms/apply_geometry_lowering.py index a773109ba..d2424f00a 100644 --- a/ufl/algorithms/apply_geometry_lowering.py +++ b/ufl/algorithms/apply_geometry_lowering.py @@ -26,7 +26,8 @@ Jacobian, JacobianInverse, JacobianDeterminant, CellOrientation, CellOrigin, CellCoordinate, FacetJacobian, FacetJacobianDeterminant, - CellFacetJacobian, + EdgeJacobian, #EdgeJacobianDeterminant, + CellFacetJacobian, CellEdgeJacobian, MaxCellEdgeLength, CellEdgeVectors, FacetEdgeVectors, CellVertices, ReferenceNormal, @@ -104,7 +105,6 @@ def jacobian_determinant(self, o): if domain.topological_dimension() < domain.geometric_dimension(): co = CellOrientation(domain) detJ = co * detJ - return detJ @memoized_handler @@ -147,6 +147,36 @@ def facet_jacobian_determinant(self, o): return detFJ + @memoized_handler + def edge_jacobian(self, o): + if self._preserve_types[o._ufl_typecode_]: + return o + + domain = o.ufl_domain() + J = self.jacobian(Jacobian(domain)) + REJ = CellEdgeJacobian(domain) + i, j, k = indices(3) + return as_tensor(J[i, k] * REJ[k, j], (i, j)) + + @memoized_handler + def edge_jacobian_inverse(self, o): + if self._preserve_types[o._ufl_typecode_]: + return o + + domain = o.ufl_domain() + EJ = self.edge_jacobian(EdgeJacobian(domain)) + return inverse_expr(EJ) + + @memoized_handler + def edge_jacobian_determinant(self, o): + if self._preserve_types[o._ufl_typecode_]: + return o + + domain = o.ufl_domain() + EJ = self.edge_jacobian(EdgeJacobian(domain)) + detEJ = determinant_expr(EJ) + return detEJ + @memoized_handler def spatial_coordinate(self, o): "Fall through to coordinate field of domain if it exists." diff --git a/ufl/algorithms/apply_integral_scaling.py b/ufl/algorithms/apply_integral_scaling.py index 79c50c794..b190f1e0c 100644 --- a/ufl/algorithms/apply_integral_scaling.py +++ b/ufl/algorithms/apply_integral_scaling.py @@ -8,7 +8,7 @@ # SPDX-License-Identifier: LGPL-3.0-or-later from ufl.log import error -from ufl.classes import JacobianDeterminant, FacetJacobianDeterminant, QuadratureWeight, Form, Integral +from ufl.classes import JacobianDeterminant, FacetJacobianDeterminant, EdgeJacobianDeterminant, QuadratureWeight, Form, Integral from ufl.measure import custom_integral_types, point_integral_types from ufl.differentiation import CoordinateDerivative from ufl.algorithms.apply_geometry_lowering import apply_geometry_lowering @@ -59,6 +59,16 @@ def compute_integrand_scaling_factor(integral): else: # No need to scale 'integral' over a vertex scale = 1 + elif integral_type.startswith("edge"): + if tdim > 2: + # Scaling integral by edge jacobian determinant from one + # side and quadrature weight + detEJ = EdgeJacobianDeterminant(domain) + degree = estimate_total_polynomial_degree(apply_geometry_lowering(detEJ)) + scale = detEJ * weight + else: + # Edge integral doesnt make sense if tdim <= 2 + scale = 1 elif integral_type in custom_integral_types: # Scaling with custom weight, which includes eventual volume diff --git a/ufl/algorithms/apply_restrictions.py b/ufl/algorithms/apply_restrictions.py index a9d38d79d..09ce51124 100644 --- a/ufl/algorithms/apply_restrictions.py +++ b/ufl/algorithms/apply_restrictions.py @@ -212,7 +212,9 @@ def _default_restricted(self, o): min_facet_edge_length = _default_restricted max_facet_edge_length = _default_restricted facet_origin = _default_restricted # FIXME: Is this valid for quads? - + edge_jacobian = _default_restricted + edge_jacobian_determinant = _default_restricted + edge_jacobian_inverse = _default_restricted def apply_default_restrictions(expression): """Some terminals can be restricted from either side. diff --git a/ufl/cell.py b/ufl/cell.py index 3262858e2..4d0554f5d 100644 --- a/ufl/cell.py +++ b/ufl/cell.py @@ -99,6 +99,8 @@ def __lt__(self, other): "tetrahedron": "triangle", "hexahedron": "quadrilateral"} +cellname2edgename = {"tetrahedron": "interval", + "hexahedron": "interval"} # --- Basic cell representation classes diff --git a/ufl/geometry.py b/ufl/geometry.py index baab8fbd7..c2ab7a9c1 100644 --- a/ufl/geometry.py +++ b/ufl/geometry.py @@ -30,6 +30,8 @@ x = x[q] SpatialCoordinate = quadrature point from input array (dc) +Xe = Xe[q] + EdgeCoordinate = quadrature point on edge (dl) Jacobians of mappings between coordinates: @@ -42,12 +44,31 @@ Jxf = dx/dXf = grad_Xf x(Xf) = Jxc Jcf = dx/dX dX/dXf = grad_X x(X) grad_Xf X(Xf) FacetJacobian = Jacobian * CellFacetJacobian +Jce = dX/dXe = grad_Xe X(Xe) + CellEdgeJacobian + +Jfe = dXf/dXe = grad_Xe Xf(Xe) + FacetEdgeJacobian + +Jxe = dx/dXe = grad_Xe x(Xe) = Jxc Jce = dx/dX dX/dXe = grad_X x(X) grad_Xe X(Xe) + EdgeJacobian = Jacobian * CellEdgeJacobian +# NOTE : Jxe could also be defined from CellFacetJacobian and FacetEdgeJacobian +# Jxe(v2) = dx/dXe = grad_Xe x(Xe) = Jxc Jcf Jfe = dx/dX dX/dXf dXf/dXe +# = grad_X x(X) grad_Xf X(Xf) grad_Xe Xf(Xe) +# EdgeJacobian = Jacobian * CellFacetJacobian * FacetEdgeJacobian Possible computation of X from Xf: X = Jcf Xf + X0f CellCoordinate = CellFacetJacobian * FacetCoordinate + CellFacetOrigin +Possible computation of X and Xf from Xe: + +X = Jce Xe + X0e + CellCoordinate = CellEdgeJacobian * EdgeCoordinate + CellEdgeOrigin + +Xf = Jfe Xe + X0e and X = Jcf (Jfe Xe + X0e) + X0f + FacetCoordinate = FacetEdgeJacobian * EdgeCoordinate + CellEdgeOrigin Possible computation of x from X: @@ -65,6 +86,10 @@ x = Jxf Xf + x0f SpatialCoordinate = FacetJacobian * FacetCoordinate + FacetOrigin +Possible computation of x from Xe: + +x = x(X(Xe)) = Jxe Xe + x0e + SpatialCoordinate = EdgeJacobian * EdgeCoordinate + EdgeOrigin Inverse relations: @@ -77,8 +102,12 @@ Xf = CFK * (X - X0f) FacetCoordinate = CellFacetJacobianInverse * (CellCoordinate - CellFacetOrigin) -""" +Xe = EK * (x - x0e) + EdgeCoordinate = EdgeJacobianInverse * (SpatialCoordinate - EdgeOrigin) +Xe = CEK * (X - X0e) + EdgeCoordinate = CellEdgeJacobianInverse * (CellCoordinate - CellEdgeOrigin) +""" # --- Expression node types @@ -131,6 +160,11 @@ class GeometricFacetQuantity(GeometricQuantity): __slots__ = () +@ufl_type(is_abstract=True) +class GeometricEdgeQuantity(GeometricQuantity): + __slots__ = () + + # --- Coordinate represented in different coordinate systems @ufl_type() @@ -231,6 +265,34 @@ def is_cellwise_constant(self): t = self._domain.topological_dimension() return t <= 1 +@ufl_type() +class EdgeCoordinate(GeometricEdgeQuantity): + """UFL geometry representation: The coordinate in a reference cell of an edge. + + In the context of expression integration over an edge, + represents the reference edge coordinate of each quadrature point. + + In the context of expression evaluation in a point on an edge, + represents that point in the reference coordinate system of the edge. + """ + __slots__ = () + name = "Xe" + + def __init__(self, domain): + GeometricEdgeQuantity.__init__(self, domain) + t = self._domain.topological_dimension() + if t < 3: + error("EdgeCoordinate is only defined for topological dimensions >= 3.") + + @property + def ufl_shape(self): + t = self._domain.topological_dimension() + return (t - 2,) + + def is_cellwise_constant(self): + "Return whether this expression is spatially constant over each cell." + return False + # --- Origin of coordinate systems in larger coordinate systems @@ -261,6 +323,18 @@ def ufl_shape(self): return (g,) +@ufl_type() +class EdgeOrigin(GeometricEdgeQuantity): + """UFL geometry representation: The spatial coordinate corresponding to origin of a reference edge.""" + __slots__ = () + name = "x0e" + + @property + def ufl_shape(self): + g = self._domain.geometric_dimension() + return (g,) + + @ufl_type() class CellFacetOrigin(GeometricFacetQuantity): """UFL geometry representation: The reference cell coordinate corresponding to origin of a reference facet.""" @@ -273,6 +347,18 @@ def ufl_shape(self): return (t,) +@ufl_type() +class CellEdgeOrigin(GeometricEdgeQuantity): + """UFL geometry representation: The reference cell coordinate corresponding to origin of a reference edge.""" + __slots__ = () + name = "X0e" + + @property + def ufl_shape(self): + t = self._domain.topological_dimension() + return (t,) + + # --- Jacobians of mappings between coordinate systems @ufl_type() @@ -331,6 +417,39 @@ def is_cellwise_constant(self): return self._domain.is_piecewise_linear_simplex_domain() +@ufl_type() +class EdgeJacobian(GeometricEdgeQuantity): + """UFL geometry representation: The Jacobian of the mapping from reference edge to spatial coordinates. + + EJ_ij = dx_i/dXe_j + + The EdgeJacobian is the product of the Jacobian and CellEdgeJacobian: + + EJ = dx/dXe = dx/dX dX/dXe = J * CEJ + + """ + __slots__ = () + name = "EJ" + + def __init__(self, domain): + GeometricEdgeQuantity.__init__(self, domain) + t = self._domain.topological_dimension() + if t < 3: + error("EdgeJacobian is only defined for topological dimensions >= 3.") + + @property + def ufl_shape(self): + g = self._domain.geometric_dimension() + t = self._domain.topological_dimension() + return (g, t - 2) + + def is_cellwise_constant(self): + "Return whether this expression is spatially constant over each cell." + # Only true for a piecewise linear coordinate field in simplex + # cells + return self._domain.is_piecewise_linear_simplex_domain() + + @ufl_type() class CellFacetJacobian(GeometricFacetQuantity): # dX/dXf """UFL geometry representation: The Jacobian of the mapping from reference facet to reference cell coordinates. @@ -358,6 +477,60 @@ def is_cellwise_constant(self): return True +@ufl_type() +class CellEdgeJacobian(GeometricEdgeQuantity): # dX/dXe + """UFL geometry representation: The Jacobian of the mapping from reference edge to reference cell coordinates. + + CEJ_ij = dX_i/dXe_j + """ + __slots__ = () + name = "CEJ" + + def __init__(self, domain): + GeometricEdgeQuantity.__init__(self, domain) + t = self._domain.topological_dimension() + if t < 3: + error("CellEdgeJacobian is only defined for topological dimensions >= 3.") + + @property + def ufl_shape(self): + t = self._domain.topological_dimension() + return (t, t - 2) + + def is_cellwise_constant(self): + "Return whether this expression is spatially constant over each cell." + # This is always a constant mapping between two reference + # coordinate systems. + return True + + +@ufl_type() +class FacetEdgeJacobian(GeometricEdgeQuantity): # dXf/dXe + """UFL geometry representation: The Jacobian of the mapping from reference edge to reference facet coordinates. + + FEJ_ij = dXf_i/dXe_j + """ + __slots__ = () + name = "FEJ" + + def __init__(self, domain): + GeometricEdgeQuantity.__init__(self, domain) + t = self._domain.topological_dimension() + if t < 3: + error("FacetEdgeJacobian is only defined for topological dimensions >= 3.") + + @property + def ufl_shape(self): + t = self._domain.topological_dimension() + return (t - 1, t - 2) + + def is_cellwise_constant(self): + "Return whether this expression is spatially constant over each cell." + # This is always a constant mapping between two reference + # coordinate systems. + return True + + @ufl_type() class ReferenceCellEdgeVectors(GeometricCellQuantity): """UFL geometry representation: The vectors between reference cell vertices for each edge in cell.""" @@ -510,6 +683,18 @@ def is_cellwise_constant(self): return self._domain.is_piecewise_linear_simplex_domain() +@ufl_type() +class EdgeJacobianDeterminant(GeometricEdgeQuantity): + """UFL geometry representation: The pseudo-determinant of the EdgeJacobian.""" + __slots__ = () + name = "detEJ" + + def is_cellwise_constant(self): + "Return whether this expression is spatially constant over each cell." + # Only true for a piecewise linear coordinate field in simplex cells + return self._domain.is_piecewise_linear_simplex_domain() + + @ufl_type() class CellFacetJacobianDeterminant(GeometricFacetQuantity): """UFL geometry representation: The pseudo-determinant of the CellFacetJacobian.""" @@ -522,6 +707,18 @@ def is_cellwise_constant(self): # cells return self._domain.is_piecewise_linear_simplex_domain() +@ufl_type() +class CellEdgeJacobianDeterminant(GeometricEdgeQuantity): + """UFL geometry representation: The pseudo-determinant of the CellEdgeJacobian.""" + __slots__ = () + name = "detCEJ" + + def is_cellwise_constant(self): + "Return whether this expression is spatially constant over each cell." + # Only true for a piecewise linear coordinate field in simplex + # cells + return self._domain.is_piecewise_linear_simplex_domain() + # --- Inverses (signed or pseudo) of geometry mapping Jacobians @@ -574,6 +771,31 @@ def is_cellwise_constant(self): return self._domain.is_piecewise_linear_simplex_domain() +@ufl_type() +class EdgeJacobianInverse(GeometricEdgeQuantity): + """UFL geometry representation: The pseudo-inverse of the EdgeJacobian.""" + __slots__ = () + name = "EK" + + def __init__(self, domain): + GeometricEdgeQuantity.__init__(self, domain) + t = self._domain.topological_dimension() + if t < 3: + error("EdgeJacobianInverse is only defined for topological dimensions >= 3.") + + @property + def ufl_shape(self): + g = self._domain.geometric_dimension() + t = self._domain.topological_dimension() + return (t - 2, g) + + def is_cellwise_constant(self): + "Return whether this expression is spatially constant over each cell." + # Only true for a piecewise linear coordinate field in simplex + # cells + return self._domain.is_piecewise_linear_simplex_domain() + + @ufl_type() class CellFacetJacobianInverse(GeometricFacetQuantity): """UFL geometry representation: The pseudo-inverse of the CellFacetJacobian.""" @@ -597,6 +819,29 @@ def is_cellwise_constant(self): return self._domain.is_piecewise_linear_simplex_domain() +@ufl_type() +class CellEdgeJacobianInverse(GeometricEdgeQuantity): + """UFL geometry representation: The pseudo-inverse of the EdgeFacetJacobian.""" + __slots__ = () + name = "CEK" + + def __init__(self, domain): + GeometricEdgeQuantity.__init__(self, domain) + t = self._domain.topological_dimension() + if t < 3: + error("CellEdgeJacobianInverse is only defined for topological dimensions >= 3.") + + @property + def ufl_shape(self): + t = self._domain.topological_dimension() + return (t - 2, t) + + def is_cellwise_constant(self): + "Return whether this expression is spatially constant over each cell." + # Only true for a piecewise linear coordinate field in simplex cells + return self._domain.is_piecewise_linear_simplex_domain() + + # --- Types representing normal or tangent vectors @ufl_type() diff --git a/ufl/measure.py b/ufl/measure.py index c624e4177..9a3b57932 100644 --- a/ufl/measure.py +++ b/ufl/measure.py @@ -38,6 +38,9 @@ ("exterior_facet", "ds"), # Over one-sided exterior facets of a mesh ("interior_facet", "dS"), # Over two-sided facets between pairs of adjacent cells of a mesh + # === Integration over topological dimension - 2: + ("edge", "dl"), # Over edges of a mesh + # === Integration over topological dimension 0 ("vertex", "dP"), # Over vertices of a mesh # ("vertex", "dV"), # TODO: Use this over vertices? @@ -65,6 +68,7 @@ custom_integral_types = ("custom", "cutcell", "interface", "overlap") point_integral_types = ("vertex",) # "point") facet_integral_types = ("exterior_facet", "interior_facet") +edge_integral_types = ("edge",) def register_integral_type(integral_type, measure_name): From 63c3f453fc40d20cd9eb49c36529f459e26fdb0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9cile=20Daversin-Catty?= Date: Fri, 10 Jul 2020 11:57:35 +0200 Subject: [PATCH 02/14] Flake8 fixes + update authors --- AUTHORS | 1 + ufl/algorithms/apply_geometry_lowering.py | 2 +- ufl/algorithms/apply_restrictions.py | 1 + ufl/cell.py | 1 + ufl/geometry.py | 3 +++ 5 files changed, 7 insertions(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index 8b0fd6507..7cd4a89f4 100644 --- a/AUTHORS +++ b/AUTHORS @@ -29,3 +29,4 @@ Contributors: | Jack S. Hale | Tuomas Airaksinen | Reuben W. Hill + | Cécile Daversin-Catty diff --git a/ufl/algorithms/apply_geometry_lowering.py b/ufl/algorithms/apply_geometry_lowering.py index d2424f00a..70569296f 100644 --- a/ufl/algorithms/apply_geometry_lowering.py +++ b/ufl/algorithms/apply_geometry_lowering.py @@ -26,7 +26,7 @@ Jacobian, JacobianInverse, JacobianDeterminant, CellOrientation, CellOrigin, CellCoordinate, FacetJacobian, FacetJacobianDeterminant, - EdgeJacobian, #EdgeJacobianDeterminant, + EdgeJacobian, # EdgeJacobianDeterminant, CellFacetJacobian, CellEdgeJacobian, MaxCellEdgeLength, CellEdgeVectors, FacetEdgeVectors, CellVertices, diff --git a/ufl/algorithms/apply_restrictions.py b/ufl/algorithms/apply_restrictions.py index 09ce51124..120fac85b 100644 --- a/ufl/algorithms/apply_restrictions.py +++ b/ufl/algorithms/apply_restrictions.py @@ -216,6 +216,7 @@ def _default_restricted(self, o): edge_jacobian_determinant = _default_restricted edge_jacobian_inverse = _default_restricted + def apply_default_restrictions(expression): """Some terminals can be restricted from either side. diff --git a/ufl/cell.py b/ufl/cell.py index 4d0554f5d..fce8fb118 100644 --- a/ufl/cell.py +++ b/ufl/cell.py @@ -104,6 +104,7 @@ def __lt__(self, other): # --- Basic cell representation classes + @attach_operators_from_hash_data class Cell(AbstractCell): "Representation of a named finite element cell with known structure." diff --git a/ufl/geometry.py b/ufl/geometry.py index c2ab7a9c1..4afd71a4e 100644 --- a/ufl/geometry.py +++ b/ufl/geometry.py @@ -111,6 +111,7 @@ # --- Expression node types + @ufl_type(is_abstract=True) class GeometricQuantity(Terminal): __slots__ = ("_domain",) @@ -265,6 +266,7 @@ def is_cellwise_constant(self): t = self._domain.topological_dimension() return t <= 1 + @ufl_type() class EdgeCoordinate(GeometricEdgeQuantity): """UFL geometry representation: The coordinate in a reference cell of an edge. @@ -707,6 +709,7 @@ def is_cellwise_constant(self): # cells return self._domain.is_piecewise_linear_simplex_domain() + @ufl_type() class CellEdgeJacobianDeterminant(GeometricEdgeQuantity): """UFL geometry representation: The pseudo-determinant of the CellEdgeJacobian.""" From 5e7e5115b3b87a2b494948cc157eb7ed3432c28a Mon Sep 17 00:00:00 2001 From: Joe Dean Date: Fri, 22 Jul 2022 16:43:39 +0100 Subject: [PATCH 03/14] Append all data --- ufl/form.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/ufl/form.py b/ufl/form.py index 767689775..b4ac27c9a 100644 --- a/ufl/form.py +++ b/ufl/form.py @@ -431,14 +431,10 @@ def _analyze_subdomain_data(self): sd = integral.subdomain_data() # Collect subdomain data - data = subdomain_data[domain].get(it) - if data is None: - subdomain_data[domain][it] = sd - elif sd is not None: - if data.ufl_id() != sd.ufl_id(): - error( - "Integrals in form have different subdomain_data objects." - ) + if subdomain_data[domain].get(it) is None: + subdomain_data[domain][it] = [sd] + else: + subdomain_data[domain][it].append(sd) self._subdomain_data = subdomain_data def _analyze_form_arguments(self): From 8c1161f8b07fa1243ec616a5db3688c7aeb102d1 Mon Sep 17 00:00:00 2001 From: Joe Dean Date: Fri, 22 Jul 2022 17:08:00 +0100 Subject: [PATCH 04/14] Update tests --- test/test_measures.py | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/test/test_measures.py b/test/test_measures.py index ff5c4433f..62e0607e2 100755 --- a/test/test_measures.py +++ b/test/test_measures.py @@ -185,23 +185,33 @@ def test_foo(): domain, = Mx.ufl_domains() assert domain.ufl_id() == mydomain.ufl_id() assert domain.ufl_cargo() == mymesh - assert Mx.subdomain_data()[mydomain]["cell"] == cell_domains + assert(len(Mx.subdomain_data()[mydomain]["cell"]) == 1) + assert(Mx.subdomain_data()[mydomain]["cell"][0]) == cell_domains domain, = Ms.ufl_domains() assert domain.ufl_cargo() == mymesh - assert Ms.subdomain_data()[mydomain][ - "exterior_facet"] == exterior_facet_domains + assert(len(Ms.subdomain_data()[mydomain][ + "exterior_facet"]) == 1) + assert(Ms.subdomain_data()[mydomain][ + "exterior_facet"][0]) == exterior_facet_domains domain, = MS.ufl_domains() assert domain.ufl_cargo() == mymesh - assert MS.subdomain_data()[mydomain][ - "interior_facet"] == interior_facet_domains + assert(len(MS.subdomain_data()[mydomain][ + "interior_facet"]) == 1) + assert(MS.subdomain_data()[mydomain][ + "interior_facet"][0] == interior_facet_domains) # Test joining of these domains in a single form domain, = M.ufl_domains() assert domain.ufl_cargo() == mymesh - assert M.subdomain_data()[mydomain]["cell"] == cell_domains - assert M.subdomain_data()[mydomain][ - "exterior_facet"] == exterior_facet_domains - assert M.subdomain_data()[mydomain][ - "interior_facet"] == interior_facet_domains + assert(len(M.subdomain_data()[mydomain]["cell"]) == 1) + assert(M.subdomain_data()[mydomain]["cell"][0] == cell_domains) + assert(len(M.subdomain_data()[mydomain][ + "exterior_facet"]) == 1) + assert(M.subdomain_data()[mydomain][ + "exterior_facet"][0] == exterior_facet_domains) + assert(len(M.subdomain_data()[mydomain][ + "interior_facet"]) == 1) + assert(M.subdomain_data()[mydomain][ + "interior_facet"][0] == interior_facet_domains) From d3a13db750d81d7e9fb87ad884c090a49f27e2ea Mon Sep 17 00:00:00 2001 From: Joe Dean Date: Wed, 14 Sep 2022 16:30:42 +0100 Subject: [PATCH 05/14] Change dolfinx branch --- .github/workflows/fenicsx-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/fenicsx-tests.yml b/.github/workflows/fenicsx-tests.yml index 103a2b31c..60878d774 100644 --- a/.github/workflows/fenicsx-tests.yml +++ b/.github/workflows/fenicsx-tests.yml @@ -86,7 +86,7 @@ jobs: with: path: ./dolfinx repository: FEniCS/dolfinx - ref: main + ref: jpdean/manual_integration_domains_2 - name: Install DOLFINx run: | cmake -G Ninja -DCMAKE_BUILD_TYPE=Developer -B build -S dolfinx/cpp/ From 5e057b4a30ed02b06fed227be5c5828675b23035 Mon Sep 17 00:00:00 2001 From: Joe Dean Date: Fri, 16 Sep 2022 12:21:13 +0100 Subject: [PATCH 06/14] Use different UFL branch --- .github/workflows/fenicsx-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/fenicsx-tests.yml b/.github/workflows/fenicsx-tests.yml index 60878d774..fa98a9cd1 100644 --- a/.github/workflows/fenicsx-tests.yml +++ b/.github/workflows/fenicsx-tests.yml @@ -86,7 +86,7 @@ jobs: with: path: ./dolfinx repository: FEniCS/dolfinx - ref: jpdean/manual_integration_domains_2 + ref: jpdean/multiple_subdomain_data - name: Install DOLFINx run: | cmake -G Ninja -DCMAKE_BUILD_TYPE=Developer -B build -S dolfinx/cpp/ From 874a0709d2460ff41711903169fdc36362691dd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9cile?= Date: Mon, 26 Sep 2022 15:07:09 +0200 Subject: [PATCH 07/14] A few more adds for integration over edges --- ufl/cell.py | 15 +++++++++++++++ ufl/geometry.py | 5 +++++ 2 files changed, 20 insertions(+) diff --git a/ufl/cell.py b/ufl/cell.py index 8204eb03a..1741bc89c 100644 --- a/ufl/cell.py +++ b/ufl/cell.py @@ -169,6 +169,21 @@ def facet_types(self): return tuple(ufl.Cell(facet_name, self.geometric_dimension()) for facet_name in facet_type_names[self.cellname()]) + # --- Edge properties --- + + def edge_types(self): + # TODO Move outside method? + "A tuple of ufl.Cell representing the edged of self." + edge_type_names = {"tetrahedron": ("interval",), + "hexahedron": ("interval",), + "prism": ("interval",)} + + if self.cellname() in ["interval", "triangle", "quadrilateral"]: + error("edge_types cannot be used with dimension < 3") + + return tuple(ufl.Cell(edge_name, self.geometric_dimension()) + for edge_name in edge_type_names[self.cellname()]) + # --- Special functions for proper object behaviour --- def __str__(self): diff --git a/ufl/geometry.py b/ufl/geometry.py index dea26fdd6..20dc209fc 100644 --- a/ufl/geometry.py +++ b/ufl/geometry.py @@ -999,6 +999,11 @@ class ReferenceFacetVolume(GeometricFacetQuantity): __slots__ = () name = "reference_facet_volume" +@ufl_type() +class ReferenceEdgeVolume(GeometricEdgeQuantity): + """UFL geometry representation: The volume of the reference cell of the current edge.""" + __slots__ = () + name = "reference_edge_volume" @ufl_type() class CellVolume(GeometricCellQuantity): From 9326658503997e4e9de7e0cd4a95e9b57f9da1de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9cile?= Date: Tue, 27 Sep 2022 09:26:49 +0200 Subject: [PATCH 08/14] Fix flake8 --- ufl/geometry.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ufl/geometry.py b/ufl/geometry.py index 20dc209fc..56505100e 100644 --- a/ufl/geometry.py +++ b/ufl/geometry.py @@ -999,12 +999,14 @@ class ReferenceFacetVolume(GeometricFacetQuantity): __slots__ = () name = "reference_facet_volume" + @ufl_type() class ReferenceEdgeVolume(GeometricEdgeQuantity): """UFL geometry representation: The volume of the reference cell of the current edge.""" __slots__ = () name = "reference_edge_volume" + @ufl_type() class CellVolume(GeometricCellQuantity): """UFL geometry representation: The volume of the cell.""" From 047ded5b3b92118453242b27eac3d46d7ffdcac1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20S=2E=20Dokken?= Date: Thu, 5 Dec 2024 14:52:16 +0100 Subject: [PATCH 09/14] Add docstrings --- ufl/algorithms/apply_geometry_lowering.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ufl/algorithms/apply_geometry_lowering.py b/ufl/algorithms/apply_geometry_lowering.py index 0daac08ad..75c512e52 100644 --- a/ufl/algorithms/apply_geometry_lowering.py +++ b/ufl/algorithms/apply_geometry_lowering.py @@ -168,6 +168,7 @@ def facet_jacobian_determinant(self, o): @memoized_handler def edge_jacobian(self, o): + """Apply to edge_jacobian.""" if self._preserve_types[o._ufl_typecode_]: return o @@ -179,6 +180,7 @@ def edge_jacobian(self, o): @memoized_handler def edge_jacobian_inverse(self, o): + """Apply to edge_jacobian_inverse.""" if self._preserve_types[o._ufl_typecode_]: return o @@ -188,6 +190,7 @@ def edge_jacobian_inverse(self, o): @memoized_handler def edge_jacobian_determinant(self, o): + """Apply to edge_jacobian_determinant.""" if self._preserve_types[o._ufl_typecode_]: return o From 6d16784da822a7c19926c1959992124d5c5a0fb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20S=2E=20Dokken?= Date: Thu, 5 Dec 2024 15:01:39 +0100 Subject: [PATCH 10/14] Ruff formatting --- ufl/__init__.py | 1 + ufl/algorithms/apply_geometry_lowering.py | 39 +++++---------- ufl/cell.py | 9 ---- ufl/geometry.py | 61 +++++++++++++++-------- 4 files changed, 55 insertions(+), 55 deletions(-) diff --git a/ufl/__init__.py b/ufl/__init__.py index 312c43865..2ddf16cc2 100644 --- a/ufl/__init__.py +++ b/ufl/__init__.py @@ -616,6 +616,7 @@ "dP", "dc", "dC", + "dl", "dO", "dI", "dX", diff --git a/ufl/algorithms/apply_geometry_lowering.py b/ufl/algorithms/apply_geometry_lowering.py index 75c512e52..2a8899a74 100644 --- a/ufl/algorithms/apply_geometry_lowering.py +++ b/ufl/algorithms/apply_geometry_lowering.py @@ -251,8 +251,7 @@ def cell_volume(self, o): if not domain.is_piecewise_linear_simplex_domain(): # Don't lower for non-affine cells, instead leave it to # form compiler - warnings.warn( - "Only know how to compute the cell volume of an affine cell.") + warnings.warn("Only know how to compute the cell volume of an affine cell.") return o r = self.jacobian_determinant(JacobianDeterminant(domain)) @@ -270,8 +269,7 @@ def facet_area(self, o): if not domain.is_piecewise_linear_simplex_domain(): # Don't lower for non-affine cells, instead leave it to # form compiler - warnings.warn( - "Only know how to compute the facet area of an affine cell.") + warnings.warn("Only know how to compute the facet area of an affine cell.") return o # Area of "facet" of interval (i.e. "area" of a vertex) is defined as 1.0 @@ -291,8 +289,7 @@ def circumradius(self, o): domain = extract_unique_domain(o) if not domain.is_piecewise_linear_simplex_domain(): - raise ValueError( - "Circumradius only makes sense for affine simplex cells") + raise ValueError("Circumradius only makes sense for affine simplex cells") cellname = domain.ufl_cell().cellname() cellvolume = self.cell_volume(CellVolume(domain)) @@ -305,8 +302,7 @@ def circumradius(self, o): edges = CellEdgeVectors(domain) num_edges = edges.ufl_shape[0] j = Index() - elen = [real(sqrt(real(edges[e, j] * conj(edges[e, j])))) - for e in range(num_edges)] + elen = [real(sqrt(real(edges[e, j] * conj(edges[e, j])))) for e in range(num_edges)] if cellname == "triangle": return (elen[0] * elen[1] * elen[2]) / (4.0 * cellvolume) @@ -344,8 +340,7 @@ def _reduce_cell_edge_length(self, o, reduction_op): if domain.ufl_coordinate_element().embedded_subdegree > 1: # Don't lower bendy cells, instead leave it to form compiler - warnings.warn( - "Only know how to compute cell edge lengths of P1 or Q1 cell.") + warnings.warn("Only know how to compute cell edge lengths of P1 or Q1 cell.") return o elif domain.ufl_cell().cellname() == "interval": @@ -357,8 +352,7 @@ def _reduce_cell_edge_length(self, o, reduction_op): edges = CellEdgeVectors(domain) num_edges = edges.ufl_shape[0] j = Index() - elen2 = [real(edges[e, j] * conj(edges[e, j])) - for e in range(num_edges)] + elen2 = [real(edges[e, j] * conj(edges[e, j])) for e in range(num_edges)] return real(sqrt(reduce(reduction_op, elen2))) @memoized_handler @@ -371,8 +365,7 @@ def cell_diameter(self, o): if domain.ufl_coordinate_element().embedded_subdegree > 1: # Don't lower bendy cells, instead leave it to form compiler - warnings.warn( - "Only know how to compute cell diameter of P1 or Q1 cell.") + warnings.warn("Only know how to compute cell diameter of P1 or Q1 cell.") return o elif domain.is_piecewise_linear_simplex_domain(): @@ -384,8 +377,7 @@ def cell_diameter(self, o): verts = CellVertices(domain) verts = [verts[v, ...] for v in range(verts.ufl_shape[0])] j = Index() - elen2 = (real((v0 - v1)[j] * conj((v0 - v1)[j])) - for v0, v1 in combinations(verts, 2)) + elen2 = (real((v0 - v1)[j] * conj((v0 - v1)[j])) for v0, v1 in combinations(verts, 2)) return real(sqrt(reduce(max_value, elen2))) @memoized_handler @@ -406,13 +398,11 @@ def _reduce_facet_edge_length(self, o, reduction_op): domain = extract_unique_domain(o) if domain.ufl_cell().topological_dimension() < 3: - raise ValueError( - "Facet edge lengths only make sense for topological dimension >= 3.") + raise ValueError("Facet edge lengths only make sense for topological dimension >= 3.") elif domain.ufl_coordinate_element().embedded_subdegree > 1: # Don't lower bendy cells, instead leave it to form compiler - warnings.warn( - "Only know how to compute facet edge lengths of P1 or Q1 cell.") + warnings.warn("Only know how to compute facet edge lengths of P1 or Q1 cell.") return o else: @@ -420,8 +410,7 @@ def _reduce_facet_edge_length(self, o, reduction_op): edges = FacetEdgeVectors(domain) num_edges = edges.ufl_shape[0] j = Index() - elen2 = [real(edges[e, j] * conj(edges[e, j])) - for e in range(num_edges)] + elen2 = [real(edges[e, j] * conj(edges[e, j])) for e in range(num_edges)] return real(sqrt(reduce(reduction_op, elen2))) @memoized_handler @@ -448,16 +437,14 @@ def cell_normal(self, o): # to the 'right') cell_normal = as_vector((-J[1, 0], J[0, 0])) else: - raise ValueError( - f"Cell normal not implemented for tdim {tdim}, gdim {gdim}") + raise ValueError(f"Cell normal not implemented for tdim {tdim}, gdim {gdim}") # Return normalized vector, sign corrected by cell # orientation co = CellOrientation(domain) return co * cell_normal / sqrt(cell_normal[i] * cell_normal[i]) else: - raise ValueError( - f"Cell normal undefined for tdim {tdim}, gdim {gdim}") + raise ValueError(f"Cell normal undefined for tdim {tdim}, gdim {gdim}") @memoized_handler def facet_normal(self, o): diff --git a/ufl/cell.py b/ufl/cell.py index e734155fa..d85c305e5 100644 --- a/ufl/cell.py +++ b/ufl/cell.py @@ -167,15 +167,6 @@ def facet_types(self) -> typing.Tuple[AbstractCell, ...]: tdim = self.topological_dimension() return self.sub_entity_types(tdim - 1) - def edge_types(self) -> typing.Tuple[AbstractCell, ...]: - """Get the unique edge types. - - Edges are entities of dimension tdim-2. - """ - tdim = self.topological_dimension() - assert tdim == 3, "Edges only make sense for cells of dimension 2 or higher." - return self.sub_entity_types(1) - def ridge_types(self) -> typing.Tuple[AbstractCell, ...]: """Get the unique ridge types. diff --git a/ufl/geometry.py b/ufl/geometry.py index 642ae965e..ee3dba6aa 100644 --- a/ufl/geometry.py +++ b/ufl/geometry.py @@ -93,13 +93,15 @@ FacetCoordinate = FacetJacobianInverse * (SpatialCoordinate - FacetOrigin) Xf = CFK * (X - X0f) - FacetCoordinate = CellFacetJacobianInverse * (CellCoordinate - CellFacetOrigin) + FacetCoordinate = CellFacetJacobianInverse * \ + (CellCoordinate - CellFacetOrigin) Xe = EK * (x - x0e) EdgeCoordinate = EdgeJacobianInverse * (SpatialCoordinate - EdgeOrigin) Xe = CEK * (X - X0e) - EdgeCoordinate = CellEdgeJacobianInverse * (CellCoordinate - CellEdgeOrigin) + EdgeCoordinate = CellEdgeJacobianInverse * \ + (CellCoordinate - CellEdgeOrigin) """ # --- Expression node types @@ -168,6 +170,8 @@ class GeometricFacetQuantity(GeometricQuantity): @ufl_type(is_abstract=True) class GeometricEdgeQuantity(GeometricQuantity): + """Geometric edge quantity.""" + __slots__ = () @@ -281,7 +285,7 @@ def is_cellwise_constant(self): @ufl_type() class EdgeCoordinate(GeometricEdgeQuantity): - """UFL geometry representation: The coordinate in a reference cell of an edge. + """The coordinate in a reference cell of an edge. In the context of expression integration over an edge, represents the reference edge coordinate of each quadrature point. @@ -294,13 +298,15 @@ class EdgeCoordinate(GeometricEdgeQuantity): name = "Xe" def __init__(self, domain): + """Initialise.""" GeometricEdgeQuantity.__init__(self, domain) t = self._domain.topological_dimension() if t < 3: - error("EdgeCoordinate is only defined for topological dimensions >= 3.") + raise ValueError("EdgeCoordinate is only defined for topological dimensions >= 3.") @property def ufl_shape(self): + """Get the UFL shape.""" t = self._domain.topological_dimension() return (t - 2,) @@ -346,13 +352,14 @@ def ufl_shape(self): @ufl_type() class EdgeOrigin(GeometricEdgeQuantity): - """UFL geometry representation: The spatial coordinate corresponding to origin of a reference edge.""" + """The spatial coordinate corresponding to origin of a reference edge.""" __slots__ = () name = "x0e" @property def ufl_shape(self): + """Get the UFL shape.""" g = self._domain.geometric_dimension() return (g,) @@ -373,13 +380,14 @@ def ufl_shape(self): @ufl_type() class CellEdgeOrigin(GeometricEdgeQuantity): - """UFL geometry representation: The reference cell coordinate corresponding to origin of a reference edge.""" + """The reference cell coordinate corresponding to origin of a reference edge.""" __slots__ = () name = "X0e" @property def ufl_shape(self): + """Get the UFL shape.""" t = self._domain.topological_dimension() return (t,) @@ -447,7 +455,7 @@ def is_cellwise_constant(self): @ufl_type() class EdgeJacobian(GeometricEdgeQuantity): - """UFL geometry representation: The Jacobian of the mapping from reference edge to spatial coordinates. + """The Jacobian of the mapping from reference edge to spatial coordinates. EJ_ij = dx_i/dXe_j @@ -461,13 +469,15 @@ class EdgeJacobian(GeometricEdgeQuantity): name = "EJ" def __init__(self, domain): + """Initialise.""" GeometricEdgeQuantity.__init__(self, domain) t = self._domain.topological_dimension() if t < 3: - error("EdgeJacobian is only defined for topological dimensions >= 3.") + raise ValueError("EdgeJacobian is only defined for topological dimensions >= 3.") @property def ufl_shape(self): + """Get the UFL shape.""" g = self._domain.geometric_dimension() t = self._domain.topological_dimension() return (g, t - 2) @@ -511,7 +521,7 @@ def is_cellwise_constant(self): @ufl_type() class CellEdgeJacobian(GeometricEdgeQuantity): # dX/dXe - """UFL geometry representation: The Jacobian of the mapping from reference edge to reference cell coordinates. + """The Jacobian of the mapping from reference edge to reference cell coordinates. CEJ_ij = dX_i/dXe_j """ @@ -520,13 +530,15 @@ class CellEdgeJacobian(GeometricEdgeQuantity): # dX/dXe name = "CEJ" def __init__(self, domain): + """Initialise.""" GeometricEdgeQuantity.__init__(self, domain) t = self._domain.topological_dimension() if t < 3: - error("CellEdgeJacobian is only defined for topological dimensions >= 3.") + raise ValueError("CellEdgeJacobian is only defined for topological dimensions >= 3.") @property def ufl_shape(self): + """Get the UFL shape.""" t = self._domain.topological_dimension() return (t, t - 2) @@ -539,7 +551,7 @@ def is_cellwise_constant(self): @ufl_type() class FacetEdgeJacobian(GeometricEdgeQuantity): # dXf/dXe - """UFL geometry representation: The Jacobian of the mapping from reference edge to reference facet coordinates. + """The Jacobian of the mapping from reference edge to reference facet coordinates. FEJ_ij = dXf_i/dXe_j """ @@ -548,13 +560,15 @@ class FacetEdgeJacobian(GeometricEdgeQuantity): # dXf/dXe name = "FEJ" def __init__(self, domain): + """Initialise.""" GeometricEdgeQuantity.__init__(self, domain) t = self._domain.topological_dimension() if t < 3: - error("FacetEdgeJacobian is only defined for topological dimensions >= 3.") + raise ValueError("FacetEdgeJacobian is only defined for topological dimensions >= 3.") @property def ufl_shape(self): + """Get the UFL shape.""" t = self._domain.topological_dimension() return (t - 1, t - 2) @@ -753,7 +767,7 @@ def is_cellwise_constant(self): @ufl_type() class EdgeJacobianDeterminant(GeometricEdgeQuantity): - """UFL geometry representation: The pseudo-determinant of the EdgeJacobian.""" + """The pseudo-determinant of the EdgeJacobian.""" __slots__ = () name = "detEJ" @@ -780,7 +794,7 @@ def is_cellwise_constant(self): @ufl_type() class CellEdgeJacobianDeterminant(GeometricEdgeQuantity): - """UFL geometry representation: The pseudo-determinant of the CellEdgeJacobian.""" + """The pseudo-determinant of the CellEdgeJacobian.""" __slots__ = () name = "detCEJ" @@ -852,19 +866,21 @@ def is_cellwise_constant(self): @ufl_type() class EdgeJacobianInverse(GeometricEdgeQuantity): - """UFL geometry representation: The pseudo-inverse of the EdgeJacobian.""" + """The pseudo-inverse of the EdgeJacobian.""" __slots__ = () name = "EK" def __init__(self, domain): + """Initialise.""" GeometricEdgeQuantity.__init__(self, domain) t = self._domain.topological_dimension() if t < 3: - error("EdgeJacobianInverse is only defined for topological dimensions >= 3.") + raise ValueError("EdgeJacobianInverse is only defined for topological dimensions >= 3.") @property def ufl_shape(self): + """Get the UFL shape.""" g = self._domain.geometric_dimension() t = self._domain.topological_dimension() return (t - 2, g) @@ -906,19 +922,23 @@ def is_cellwise_constant(self): @ufl_type() class CellEdgeJacobianInverse(GeometricEdgeQuantity): - """UFL geometry representation: The pseudo-inverse of the EdgeFacetJacobian.""" + """The pseudo-inverse of the EdgeFacetJacobian.""" __slots__ = () name = "CEK" def __init__(self, domain): + """Initialise.""" GeometricEdgeQuantity.__init__(self, domain) t = self._domain.topological_dimension() if t < 3: - error("CellEdgeJacobianInverse is only defined for topological dimensions >= 3.") + raise ValueError( + "CellEdgeJacobianInverse is only defined for topological dimensions >= 3." + ) @property def ufl_shape(self): + """Get the UFL shape.""" t = self._domain.topological_dimension() return (t - 2, t) @@ -1014,7 +1034,7 @@ class ReferenceFacetVolume(GeometricFacetQuantity): @ufl_type() class ReferenceEdgeVolume(GeometricEdgeQuantity): - """UFL geometry representation: The volume of the reference cell of the current edge.""" + """The volume of the reference cell of the current edge.""" __slots__ = () name = "reference_edge_volume" @@ -1045,7 +1065,8 @@ class CellDiameter(GeometricCellQuantity): @ufl_type() -class FacetArea(GeometricFacetQuantity): # FIXME: Should this be allowed for interval domain? +# FIXME: Should this be allowed for interval domain? +class FacetArea(GeometricFacetQuantity): """The area of the facet.""" __slots__ = () From a33f42af95f92443698fd3f2b2e1c1d20787bd63 Mon Sep 17 00:00:00 2001 From: jorgensd Date: Thu, 5 Dec 2024 20:31:10 +0000 Subject: [PATCH 11/14] Modern ruff formatting of almost all slots --- ufl/__init__.py | 332 +++++++++++++++--------------- ufl/action.py | 8 +- ufl/adjoint.py | 6 +- ufl/algorithms/__init__.py | 58 +++--- ufl/algorithms/domain_analysis.py | 6 +- ufl/argument.py | 12 +- ufl/cell.py | 4 +- ufl/classes.py | 8 +- ufl/coefficient.py | 10 +- ufl/constantvalue.py | 4 +- ufl/core/expr.py | 2 +- ufl/core/multiindex.py | 2 +- ufl/differentiation.py | 2 +- ufl/finiteelement.py | 8 +- ufl/form.py | 10 +- ufl/integral.py | 6 +- ufl/matrix.py | 12 +- ufl/measure.py | 2 +- ufl/tensors.py | 2 +- 19 files changed, 247 insertions(+), 247 deletions(-) diff --git a/ufl/__init__.py b/ufl/__init__.py index 2ddf16cc2..2309f652e 100644 --- a/ufl/__init__.py +++ b/ufl/__init__.py @@ -439,212 +439,212 @@ from ufl.utils.sequences import product __all__ = [ - "product", - "as_cell", + "H1", + "H2", + "L2", "AbstractCell", + "AbstractDomain", + "AbstractFiniteElement", + "AbstractPullback", + "Action", + "Adjoint", + "And", + "Argument", + "Arguments", + "BaseForm", "Cell", + "CellDiameter", + "CellNormal", + "CellVolume", + "Circumradius", + "Coargument", + "Coefficient", + "Coefficients", + "Cofunction", + "Constant", + "Dn", + "Dx", "EdgeJacobian", "EdgeJacobianDeterminant", "EdgeJacobianInverse", - "TensorProductCell", - "AbstractDomain", - "Mesh", - "MeshView", - "L2", - "H1", - "H2", + "ExternalOperator", + "FacetArea", + "FacetNormal", + "Form", + "FormSum", + "FunctionSpace", "HCurl", + "HCurlDiv", "HDiv", - "HInf", - "HEin", "HDivDiv", - "HCurlDiv", - "identity_pullback", - "l2_piola", - "contravariant_piola", - "covariant_piola", - "double_contravariant_piola", - "double_covariant_piola", - "covariant_contravariant_piola", - "l2_piola", - "MixedPullback", - "SymmetricPullback", - "AbstractPullback", - "SpatialCoordinate", - "CellVolume", - "CellDiameter", - "Circumradius", - "MinCellEdgeLength", - "MaxCellEdgeLength", - "FacetArea", - "MinFacetEdgeLength", - "MaxFacetEdgeLength", - "FacetNormal", - "CellNormal", + "HEin", + "HInf", + "Identity", + "Index", + "Integral", + "Interpolate", "Jacobian", "JacobianDeterminant", "JacobianInverse", - "AbstractFiniteElement", - "FunctionSpace", + "Matrix", + "MaxCellEdgeLength", + "MaxFacetEdgeLength", + "Measure", + "Mesh", + "MeshView", + "MinCellEdgeLength", + "MinFacetEdgeLength", "MixedFunctionSpace", - "Argument", - "Coargument", + "MixedPullback", + "Not", + "Or", + "PermutationSymbol", + "SpatialCoordinate", + "SymmetricPullback", + "TensorConstant", + "TensorProductCell", "TestFunction", - "TrialFunction", - "Arguments", "TestFunctions", + "TrialFunction", "TrialFunctions", - "Coefficient", - "Cofunction", - "Coefficients", - "Matrix", - "Adjoint", - "Action", - "Interpolate", - "interpolate", - "ExternalOperator", - "Constant", "VectorConstant", - "TensorConstant", - "split", - "PermutationSymbol", - "Identity", - "zero", - "as_ufl", - "Index", - "indices", + "ZeroBaseForm", + "acos", + "action", + "adjoint", + "as_cell", + "as_matrix", "as_tensor", + "as_ufl", "as_vector", - "as_matrix", - "unit_vector", - "unit_vectors", - "unit_matrix", - "unit_matrices", - "rank", - "shape", - "conj", - "real", - "imag", - "outer", - "inner", - "dot", - "cross", - "perp", - "det", - "inv", - "cofac", - "transpose", - "tr", - "diag", - "diag_vector", - "dev", - "skew", - "sym", - "sqrt", - "exp", - "ln", - "erf", - "cos", - "sin", - "tan", - "acos", "asin", "atan", "atan2", - "cosh", - "sinh", - "tanh", - "bessel_J", - "bessel_Y", + "avg", "bessel_I", + "bessel_J", "bessel_K", - "eq", - "ne", - "le", - "ge", - "lt", - "gt", - "And", - "Or", - "Not", + "bessel_Y", + "cell_avg", + "cofac", "conditional", - "sign", - "max_value", - "min_value", - "variable", - "diff", - "Dx", - "grad", - "div", + "conj", + "contravariant_piola", + "cos", + "cosh", + "covariant_contravariant_piola", + "covariant_piola", + "cross", "curl", - "rot", - "nabla_grad", - "nabla_div", - "Dn", - "exterior_derivative", - "jump", - "avg", - "cell_avg", - "facet_avg", - "elem_mult", - "elem_div", - "elem_pow", - "elem_op", - "Form", - "BaseForm", - "FormSum", - "ZeroBaseForm", - "Integral", - "Measure", - "register_integral_type", - "integral_types", "custom_integral_types", - "replace", - "derivative", - "action", - "energy_norm", - "rhs", - "lhs", - "extract_blocks", - "system", - "functional", - "adjoint", - "sensitivity_rhs", - "dx", - "ds", - "dS", - "dP", - "dc", "dC", - "dl", - "dO", "dI", + "dO", + "dP", + "dS", + "dS_h", + "dS_v", "dX", + "dc", + "derivative", + "det", + "dev", + "diag", + "diag_vector", + "diff", + "div", + "dl", + "dot", + "double_contravariant_piola", + "double_covariant_piola", + "ds", "ds_b", "ds_t", "ds_tb", "ds_v", - "dS_h", - "dS_v", - "vertex", - "interval", - "triangle", - "tetrahedron", - "prism", - "pyramid", - "pentatope", - "tesseract", - "quadrilateral", - "hexahedron", + "dx", + "e", + "elem_div", + "elem_mult", + "elem_op", + "elem_pow", + "energy_norm", + "eq", + "erf", + "exp", + "exterior_derivative", + "extract_blocks", "facet", + "facet_avg", + "functional", + "ge", + "grad", + "gt", + "hexahedron", "i", + "identity_pullback", + "imag", + "indices", + "inner", + "integral_types", + "interpolate", + "interval", + "inv", "j", + "jump", "k", "l", + "l2_piola", + "l2_piola", + "le", + "lhs", + "ln", + "lt", + "max_value", + "min_value", + "nabla_div", + "nabla_grad", + "ne", + "outer", "p", + "pentatope", + "perp", + "pi", + "prism", + "product", + "pyramid", "q", + "quadrilateral", "r", + "rank", + "real", + "register_integral_type", + "replace", + "rhs", + "rot", "s", - "e", - "pi", + "sensitivity_rhs", + "shape", + "sign", + "sin", + "sinh", + "skew", + "split", + "sqrt", + "sym", + "system", + "tan", + "tanh", + "tesseract", + "tetrahedron", + "tr", + "transpose", + "triangle", + "unit_matrices", + "unit_matrix", + "unit_vector", + "unit_vectors", + "variable", + "vertex", + "zero", ] diff --git a/ufl/action.py b/ufl/action.py index fb6416865..470e85016 100644 --- a/ufl/action.py +++ b/ufl/action.py @@ -38,14 +38,14 @@ class Action(BaseForm): """ __slots__ = ( - "_left", - "_right", - "ufl_operands", - "_repr", "_arguments", "_coefficients", "_domains", "_hash", + "_left", + "_repr", + "_right", + "ufl_operands", ) def __new__(cls, *args, **kw): diff --git a/ufl/adjoint.py b/ufl/adjoint.py index 987372a73..71227f578 100644 --- a/ufl/adjoint.py +++ b/ufl/adjoint.py @@ -28,13 +28,13 @@ class Adjoint(BaseForm): """ __slots__ = ( - "_form", - "_repr", "_arguments", "_coefficients", "_domains", - "ufl_operands", + "_form", "_hash", + "_repr", + "ufl_operands", ) def __new__(cls, *args, **kw): diff --git a/ufl/algorithms/__init__.py b/ufl/algorithms/__init__.py index 18dce39fd..541abbfb5 100644 --- a/ufl/algorithms/__init__.py +++ b/ufl/algorithms/__init__.py @@ -15,43 +15,43 @@ # on grepping of other FEniCS code for ufl.algorithm imports. __all__ = [ - "estimate_total_polynomial_degree", - "sort_elements", - "compute_form_data", - "preprocess_form", - "apply_transformer", + "FormSplitter", + "MultiFunction", "ReuseTransformer", - "load_ufl_file", "Transformer", - "MultiFunction", - "extract_unique_elements", - "extract_type", - "extract_elements", - "extract_sub_elements", - "expand_indices", - "replace", - "expand_derivatives", - "extract_coefficients", - "extract_base_form_operators", - "strip_variables", - "strip_terminal_data", - "replace_terminal_data", - "post_traversal", + "apply_transformer", "change_to_reference_grad", - "validate_form", - "FormSplitter", - "extract_arguments", - "compute_form_adjoint", - "compute_form_action", "compute_energy_norm", + "compute_form_action", + "compute_form_adjoint", + "compute_form_arities", + "compute_form_data", + "compute_form_functional", "compute_form_lhs", "compute_form_rhs", - "compute_form_functional", "compute_form_signature", - "compute_form_arities", - "tree_format", - "read_ufl_file", + "estimate_total_polynomial_degree", + "expand_derivatives", + "expand_indices", + "extract_arguments", + "extract_base_form_operators", + "extract_coefficients", + "extract_elements", + "extract_sub_elements", + "extract_type", + "extract_unique_elements", "load_forms", + "load_ufl_file", + "post_traversal", + "preprocess_form", + "read_ufl_file", + "replace", + "replace_terminal_data", + "sort_elements", + "strip_terminal_data", + "strip_variables", + "tree_format", + "validate_form", ] from ufl.algorithms.ad import expand_derivatives diff --git a/ufl/algorithms/domain_analysis.py b/ufl/algorithms/domain_analysis.py index 19e0f4e3c..3a1aed9d0 100644 --- a/ufl/algorithms/domain_analysis.py +++ b/ufl/algorithms/domain_analysis.py @@ -33,12 +33,12 @@ class IntegralData(object): __slots__ = ( "domain", + "enabled_coefficients", + "integral_coefficients", "integral_type", - "subdomain_id", "integrals", "metadata", - "integral_coefficients", - "enabled_coefficients", + "subdomain_id", ) def __init__(self, domain, integral_type, subdomain_id, integrals, metadata): diff --git a/ufl/argument.py b/ufl/argument.py index a9326a237..4ff5927fa 100644 --- a/ufl/argument.py +++ b/ufl/argument.py @@ -149,11 +149,11 @@ class Argument(FormArgument, BaseArgument): """UFL value: Representation of an argument to a form.""" __slots__ = ( - "_ufl_function_space", - "_ufl_shape", "_number", "_part", "_repr", + "_ufl_function_space", + "_ufl_shape", ) _primal = True @@ -195,15 +195,15 @@ class Coargument(BaseForm, BaseArgument): """UFL value: Representation of an argument to a form in a dual space.""" __slots__ = ( - "_ufl_function_space", - "_ufl_shape", "_arguments", "_coefficients", - "ufl_operands", + "_hash", "_number", "_part", "_repr", - "_hash", + "_ufl_function_space", + "_ufl_shape", + "ufl_operands", ) _primal = False diff --git a/ufl/cell.py b/ufl/cell.py index d85c305e5..6d565d7fd 100644 --- a/ufl/cell.py +++ b/ufl/cell.py @@ -243,11 +243,11 @@ class Cell(AbstractCell): __slots__ = ( "_cellname", - "_tdim", "_num_cell_entities", - "_sub_entity_types", "_sub_entities", "_sub_entity_types", + "_sub_entity_types", + "_tdim", ) def __init__(self, cellname: str): diff --git a/ufl/classes.py b/ufl/classes.py index b8f48516c..cd162757f 100644 --- a/ufl/classes.py +++ b/ufl/classes.py @@ -63,12 +63,12 @@ nonterminal_classes = set(c for c in all_ufl_classes if not c._ufl_is_terminal_) __all__ += [ - "all_ufl_classes", + "__exproperators", "abstract_classes", - "ufl_classes", - "terminal_classes", + "all_ufl_classes", "nonterminal_classes", - "__exproperators", + "terminal_classes", + "ufl_classes", ] diff --git a/ufl/coefficient.py b/ufl/coefficient.py index bd35f8275..3fc668bb6 100644 --- a/ufl/coefficient.py +++ b/ufl/coefficient.py @@ -106,15 +106,15 @@ class Cofunction(BaseCoefficient, BaseForm): """UFL form argument type: Representation of a form coefficient from a dual space.""" __slots__ = ( - "_count", - "_counted_class", "_arguments", "_coefficients", - "_ufl_function_space", - "ufl_operands", + "_count", + "_counted_class", + "_hash", "_repr", + "_ufl_function_space", "_ufl_shape", - "_hash", + "ufl_operands", ) _primal = False _dual = True diff --git a/ufl/constantvalue.py b/ufl/constantvalue.py index b918a670b..007350680 100644 --- a/ufl/constantvalue.py +++ b/ufl/constantvalue.py @@ -63,7 +63,7 @@ class Zero(ConstantValue): Class for representing zero tensors of different shapes. """ - __slots__ = ("ufl_shape", "ufl_free_indices", "ufl_index_dimensions") + __slots__ = ("ufl_free_indices", "ufl_index_dimensions", "ufl_shape") _cache = {} @@ -453,7 +453,7 @@ class PermutationSymbol(ConstantValue): or alternating symbol. """ - __slots__ = ("ufl_shape", "_dim") + __slots__ = ("_dim", "ufl_shape") def __init__(self, dim): """Initialise.""" diff --git a/ufl/core/expr.py b/ufl/core/expr.py index cef955f0e..41b6e55a6 100644 --- a/ufl/core/expr.py +++ b/ufl/core/expr.py @@ -83,7 +83,7 @@ class MyOperator(Operator): # This is to freeze member variables for objects of this class and # save memory by skipping the per-instance dict. - __slots__ = ("_hash", "__weakref__") + __slots__ = ("__weakref__", "_hash") # _ufl_noslots_ = True # --- Basic object behaviour --- diff --git a/ufl/core/multiindex.py b/ufl/core/multiindex.py index 2d91e40f3..75116fff1 100644 --- a/ufl/core/multiindex.py +++ b/ufl/core/multiindex.py @@ -28,7 +28,7 @@ def __init__(self): class FixedIndex(IndexBase): """UFL value: An index with a specific value assigned.""" - __slots__ = ("_value", "_hash") + __slots__ = ("_hash", "_value") _cache = {} diff --git a/ufl/differentiation.py b/ufl/differentiation.py index 74e33617d..5c1d0b842 100644 --- a/ufl/differentiation.py +++ b/ufl/differentiation.py @@ -196,9 +196,9 @@ class VariableDerivative(Derivative): """Variable Derivative.""" __slots__ = ( - "ufl_shape", "ufl_free_indices", "ufl_index_dimensions", + "ufl_shape", ) def __new__(cls, f, v): diff --git a/ufl/finiteelement.py b/ufl/finiteelement.py index 8dbc76ed1..3aceef689 100644 --- a/ufl/finiteelement.py +++ b/ufl/finiteelement.py @@ -147,14 +147,14 @@ class FiniteElement(AbstractFiniteElement): """A directly defined finite element.""" __slots__ = ( - "_repr", - "_str", - "_family", "_cell", "_degree", - "_reference_value_shape", + "_family", "_pullback", + "_reference_value_shape", + "_repr", "_sobolev_space", + "_str", "_sub_elements", "_subdegree", ) diff --git a/ufl/form.py b/ufl/form.py index 4fc7c2165..3435f8428 100644 --- a/ufl/form.py +++ b/ufl/form.py @@ -226,7 +226,7 @@ def _ufl_expr_reconstruct_(self, *operands): class Form(BaseForm): """Description of a weak form consisting of a sum of integrals over subdomains.""" - __slots__ = ( + __slots__ = ( # noqa: RUF023 # --- List of Integral objects (a Form is a sum of these # Integrals, everything else is derived) "_integrals", @@ -690,12 +690,12 @@ class FormSum(BaseForm): __slots__ = ( "_arguments", "_coefficients", - "_weights", "_components", - "ufl_operands", - "_domains", "_domain_numbering", + "_domains", "_hash", + "_weights", + "ufl_operands", ) _ufl_required_methods_ = "_analyze_form_arguments" @@ -843,11 +843,11 @@ class ZeroBaseForm(BaseForm): __slots__ = ( "_arguments", "_coefficients", - "ufl_operands", "_domains", "_hash", # Pyadjoint compatibility "form", + "ufl_operands", ) def __init__(self, arguments): diff --git a/ufl/integral.py b/ufl/integral.py index 510f4ebd5..8561d9b7a 100644 --- a/ufl/integral.py +++ b/ufl/integral.py @@ -22,12 +22,12 @@ class Integral(object): """An integral over a single domain.""" __slots__ = ( - "_integrand", "_integral_type", - "_ufl_domain", - "_subdomain_id", + "_integrand", "_metadata", "_subdomain_data", + "_subdomain_id", + "_ufl_domain", ) def __init__(self, integrand, integral_type, domain, subdomain_id, metadata, subdomain_data): diff --git a/ufl/matrix.py b/ufl/matrix.py index 039d70e23..d548c0abd 100644 --- a/ufl/matrix.py +++ b/ufl/matrix.py @@ -21,16 +21,16 @@ class Matrix(BaseForm, Counted): """An assemble linear operator between two function spaces.""" __slots__ = ( + "_arguments", + "_coefficients", "_count", "_counted_class", - "_ufl_function_spaces", - "ufl_operands", - "_repr", + "_domains", "_hash", + "_repr", + "_ufl_function_spaces", "_ufl_shape", - "_arguments", - "_coefficients", - "_domains", + "ufl_operands", ) def __getnewargs__(self): diff --git a/ufl/measure.py b/ufl/measure.py index e41a89adb..1e23c3274 100644 --- a/ufl/measure.py +++ b/ufl/measure.py @@ -102,7 +102,7 @@ class Measure(object): expression. """ - __slots__ = ("_integral_type", "_domain", "_subdomain_id", "_metadata", "_subdomain_data") + __slots__ = ("_domain", "_integral_type", "_metadata", "_subdomain_data", "_subdomain_id") def __init__( self, diff --git a/ufl/tensors.py b/ufl/tensors.py index 3edb0759c..cfdda07ca 100644 --- a/ufl/tensors.py +++ b/ufl/tensors.py @@ -128,7 +128,7 @@ def substring(expressions, indent): class ComponentTensor(Operator): """Maps the free indices of a scalar valued expression to tensor axes.""" - __slots__ = ("ufl_shape", "ufl_free_indices", "ufl_index_dimensions") + __slots__ = ("ufl_free_indices", "ufl_index_dimensions", "ufl_shape") def __new__(cls, expression, indices): """Create a new ComponentTensor.""" From da5cf5f674e6b6f391ef73a2b561304f74cbc7fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Schartum=20Dokken?= Date: Thu, 5 Dec 2024 21:47:54 +0100 Subject: [PATCH 12/14] Revert brnach --- .github/workflows/fenicsx-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/fenicsx-tests.yml b/.github/workflows/fenicsx-tests.yml index 74d95f115..192c4156d 100644 --- a/.github/workflows/fenicsx-tests.yml +++ b/.github/workflows/fenicsx-tests.yml @@ -77,7 +77,7 @@ jobs: with: path: ./dolfinx repository: FEniCS/dolfinx - ref: jpdean/multiple_subdomain_data + ref: main - name: Install DOLFINx run: | cmake -G Ninja -DCMAKE_BUILD_TYPE=Developer -B build -S dolfinx/cpp/ From a8dedf41a75c24554bc069f291d132181a6f36c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20S=2E=20Dokken?= Date: Thu, 16 Jan 2025 16:54:06 +0100 Subject: [PATCH 13/14] Sort imports/ruff --- test/test_classcoverage.py | 6 +++--- test/test_piecewise_checks.py | 6 +++--- ufl/__init__.py | 14 +++++++------- ufl/algorithms/apply_geometry_lowering.py | 4 ++-- ufl/algorithms/apply_integral_scaling.py | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/test/test_classcoverage.py b/test/test_classcoverage.py index 7cd6da705..c7696c1e5 100755 --- a/test/test_classcoverage.py +++ b/test/test_classcoverage.py @@ -11,9 +11,6 @@ Circumradius, Coefficient, Constant, - RidgeJacobian, - RidgeJacobianDeterminant, - RidgeJacobianInverse, FacetArea, FacetNormal, FunctionSpace, @@ -27,6 +24,9 @@ Not, Or, PermutationSymbol, + RidgeJacobian, + RidgeJacobianDeterminant, + RidgeJacobianInverse, SpatialCoordinate, TensorConstant, VectorConstant, diff --git a/test/test_piecewise_checks.py b/test/test_piecewise_checks.py index 5a3491f34..2f139c182 100755 --- a/test/test_piecewise_checks.py +++ b/test/test_piecewise_checks.py @@ -29,12 +29,12 @@ from ufl.checks import is_cellwise_constant from ufl.classes import ( CellCoordinate, - RidgeJacobian, - RidgeJacobianDeterminant, - RidgeJacobianInverse, FacetJacobian, FacetJacobianDeterminant, FacetJacobianInverse, + RidgeJacobian, + RidgeJacobianDeterminant, + RidgeJacobianInverse, ) from ufl.finiteelement import FiniteElement from ufl.pullback import identity_pullback diff --git a/ufl/__init__.py b/ufl/__init__.py index 72fd56f03..6c6480925 100644 --- a/ufl/__init__.py +++ b/ufl/__init__.py @@ -287,9 +287,6 @@ CellNormal, CellVolume, Circumradius, - RidgeJacobian, - RidgeJacobianDeterminant, - RidgeJacobianInverse, FacetArea, FacetNormal, Jacobian, @@ -299,6 +296,9 @@ MaxFacetEdgeLength, MinCellEdgeLength, MinFacetEdgeLength, + RidgeJacobian, + RidgeJacobianDeterminant, + RidgeJacobianInverse, SpatialCoordinate, ) from ufl.integral import Integral @@ -308,9 +308,9 @@ dC, dc, dI, - dr, dO, dP, + dr, dS, ds, ds_b, @@ -464,9 +464,6 @@ "Constant", "Dn", "Dx", - "RidgeJacobian", - "RidgeJacobianDeterminant", - "RidgeJacobianInverse", "ExternalOperator", "FacetArea", "FacetNormal", @@ -499,6 +496,9 @@ "Not", "Or", "PermutationSymbol", + "RidgeJacobian", + "RidgeJacobianDeterminant", + "RidgeJacobianInverse", "SpatialCoordinate", "SymmetricPullback", "TensorConstant", diff --git a/ufl/algorithms/apply_geometry_lowering.py b/ufl/algorithms/apply_geometry_lowering.py index 54e7f1b59..472c7b650 100644 --- a/ufl/algorithms/apply_geometry_lowering.py +++ b/ufl/algorithms/apply_geometry_lowering.py @@ -16,14 +16,13 @@ from ufl.classes import ( CellCoordinate, - CellRidgeJacobian, CellEdgeVectors, CellFacetJacobian, CellOrientation, CellOrigin, + CellRidgeJacobian, CellVertices, CellVolume, - RidgeJacobian, Expr, FacetEdgeVectors, FacetJacobian, @@ -39,6 +38,7 @@ ReferenceFacetVolume, ReferenceGrad, ReferenceNormal, + RidgeJacobian, SpatialCoordinate, ) from ufl.compound_expressions import cross_expr, determinant_expr, inverse_expr diff --git a/ufl/algorithms/apply_integral_scaling.py b/ufl/algorithms/apply_integral_scaling.py index 45647cb9f..a7e7bc2c1 100644 --- a/ufl/algorithms/apply_integral_scaling.py +++ b/ufl/algorithms/apply_integral_scaling.py @@ -9,12 +9,12 @@ from ufl.algorithms.apply_geometry_lowering import apply_geometry_lowering from ufl.algorithms.estimate_degrees import estimate_total_polynomial_degree from ufl.classes import ( - RidgeJacobianDeterminant, FacetJacobianDeterminant, Form, Integral, JacobianDeterminant, QuadratureWeight, + RidgeJacobianDeterminant, ) from ufl.differentiation import CoordinateDerivative from ufl.measure import custom_integral_types, point_integral_types From 23d0b2ba4d0d29542035ccdfc4f3e5ab741f1fbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20S=2E=20Dokken?= Date: Thu, 16 Jan 2025 16:55:35 +0100 Subject: [PATCH 14/14] Add myself to authorlist (overdue) --- AUTHORS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index ad4d496c3..856ddc0a1 100644 --- a/AUTHORS +++ b/AUTHORS @@ -32,4 +32,4 @@ Contributors: | Cécile Daversin-Catty | Nacime Bouziani | Matthew Scroggs - \ No newline at end of file + | Jørgen S. Dokken \ No newline at end of file