From 27869b44b4a407bc9fac3a42fd7d76ba67733ca3 Mon Sep 17 00:00:00 2001 From: Matthew Scroggs Date: Mon, 13 Nov 2023 15:19:35 +0000 Subject: [PATCH 1/7] Convert rst to md (#239) * move README.rst to README.md * move changelog to md * update styling * indentation? --- ChangeLog.rst => ChangeLog.md | 177 ++++++++++++++-------------------- README.md | 35 +++++++ README.rst | 47 --------- 3 files changed, 108 insertions(+), 151 deletions(-) rename ChangeLog.rst => ChangeLog.md (79%) create mode 100644 README.md delete mode 100644 README.rst diff --git a/ChangeLog.rst b/ChangeLog.md similarity index 79% rename from ChangeLog.rst rename to ChangeLog.md index 28559668d..75d1ab629 100644 --- a/ChangeLog.rst +++ b/ChangeLog.md @@ -1,97 +1,91 @@ -Changelog -========= +# Changelog -2021.1.0 -------------- +## 2021.1.0 - Mixed dimensional domain support -2019.1.0 (2019-04-17) ---------------------- +## 2019.1.0 (2019-04-17) - Remove scripts - Remove LaTeX support (not functional) - Add support for complex valued elements; complex mode - is chosen by ``compute_form_data(form, complex_mode=True)`` typically + is chosen by `compute_form_data(form, complex_mode=True)` typically by a form compiler; otherwise UFL language is agnostic to the choice of real/complex domain -2018.1.0 (2018-06-14) ---------------------- +## 2018.1.0 (2018-06-14) - Remove python2 support -2017.2.0 (2017-12-05) ---------------------- +## 2017.2.0 (2017-12-05) -- Add geometric quantity ``CellDiameter`` defined as a set diameter +- Add geometric quantity `CellDiameter` defined as a set diameter of the cell, i.e., maximal distance between any two points of the cell; implemented on simplices and quads/hexes - Rename internally used reference quantities - ``(Cell|Facet)EdgeVectors`` to ``Reference(Cell|Facet)EdgeVectors`` -- Add internally used quantites ``CellVertices``, - ``(Cell|Facet)EdgeVectors`` which are physical-coordinates-valued; + `(Cell|Facet)EdgeVectors` to `Reference(Cell|Facet)EdgeVectors` +- Add internally used quantites `CellVertices`, + `(Cell|Facet)EdgeVectors` which are physical-coordinates-valued; will be useful for further geometry lowering implementations for quads/hexes -- Implement geometry lowering of ``(Min|Max)(Cell|Facet)EdgeLength`` +- Implement geometry lowering of `(Min|Max)(Cell|Facet)EdgeLength` for quads and hexes -2017.1.0.post1 (2017-09-12) ---------------------------- +## 2017.1.0.post1 (2017-09-12) - Change PyPI package name to fenics-ufl. -2017.1.0 (2017-05-09) ---------------------- +## 2017.1.0 (2017-05-09) -- Add the ``DirectionalSobolevSpace`` subclass of ``SobolevSpace``. This +- Add the `DirectionalSobolevSpace` subclass of `SobolevSpace`. This allows one to use spaces where elements have varying continuity in different spatial directions. -- Add ``sobolev_space`` methods for ``HDiv`` and ``HCurl`` finite +- Add `sobolev_space` methods for `HDiv` and `HCurl` finite elements. -- Add ``sobolev_space`` methods for ``TensorProductElement`` and - ``EnrichedElement``. The smallest shared Sobolev space will be +- Add `sobolev_space` methods for `TensorProductElement` and + `EnrichedElement`. The smallest shared Sobolev space will be returned for enriched elements. For the tensor product elements, a - ``DirectionalSobolevSpace`` is returned depending on the order of the + `DirectionalSobolevSpace` is returned depending on the order of the spaces associated with the component elements. -2016.2.0 (2016-11-30) ---------------------- +## 2016.2.0 (2016-11-30) -- Add call operator syntax to ``Form`` to replace arguments and +- Add call operator syntax to `Form` to replace arguments and coefficients. This makes it easier to e.g. express the norm - defined by a bilinear form as a functional. Example usage:: - + defined by a bilinear form as a functional. Example usage: + ```python # Equivalent to replace(a, {u: f, v: f}) M = a(f, f) # Equivalent to replace(a, {f:1}) c = a(coefficients={f:1}) -- Add call operator syntax to ``Form`` to replace arguments and - coefficients:: - + ``` +- Add call operator syntax to `Form` to replace arguments and + coefficients: + ```python a(f, g) == replace(a, {u: f, v: g}) a(coefficients={f:1}) == replace(a, {f:1}) -- Add ``@`` operator to ``Form``: ``form @ f == action(form, f)`` + ``` +- Add `@` operator to `Form`: `form @ f == action(form, f)` (python 3.5+ only) -- Reduce noise in Mesh str such that ``print(form)`` gets more short and +- Reduce noise in Mesh str such that `print(form)` gets more short and readable -- Fix repeated ``split(function)`` for arbitrary nested elements -- EnrichedElement: Remove ``+/*`` warning - - In the distant past, ``A + B => MixedElement([A, B])``. The change - that ``A + B => EnrichedElement([A, B])`` was made in ``d622c74`` (22 - March 2010). A warning was introduced in ``fcbc5ff`` (26 March 2010) - that the meaning of ``+`` had changed, and that users wanting a - ``MixedElement`` should use ``*`` instead. People have, presumably, +- Fix repeated `split(function)` for arbitrary nested elements +- EnrichedElement: Remove `+/*` warning + + In the distant past, `A + B => MixedElement([A, B])`. The change + that `A + B => EnrichedElement([A, B])` was made in `d622c74` (22 + March 2010). A warning was introduced in `fcbc5ff` (26 March 2010) + that the meaning of `+` had changed, and that users wanting a + `MixedElement` should use `*` instead. People have, presumably, been seeing this warning for 6 1/2 years by now, so it's probably safe to remove. -- Rework ``TensorProductElement`` implementation, replaces - ``OuterProductElement`` -- Rework ``TensorProductCell`` implementation, replaces - ``OuterProductCell`` -- Remove ``OuterProductVectorElement`` and ``OuterProductTensorElement`` -- Add ``FacetElement`` and ``InteriorElement`` -- Add ``Hellan-Herrmann-Johnson`` element +- Rework `TensorProductElement` implementation, replaces + `OuterProductElement` +- Rework `TensorProductCell` implementation, replaces + `OuterProductCell` +- Remove `OuterProductVectorElement` and `OuterProductTensorElement` +- Add `FacetElement` and `InteriorElement` +- Add `Hellan-Herrmann-Johnson` element - Add support for double covariant and contravariant mappings in mixed elements - Support discontinuous Taylor elements on all simplices @@ -103,8 +97,7 @@ Changelog - Add bitbucket pipelines testing - Improve documentation -2016.1.0 (2016-06-23) ---------------------- +## 2016.1.0 (2016-06-23) - Add operator A^(i,j) := as_tensor(A, (i,j)) - Updates to old manual for publishing on fenics-ufl.readthedocs.org @@ -127,8 +120,7 @@ Changelog - Large reworking of symbolic geometry pipeline - Implement symbolic Piola mappings -1.6.0 (2015-07-28) ------------------- +## 1.6.0 (2015-07-28) - Change approach to attaching __hash__ implementation to accomodate python 3 - Implement new non-recursive traversal based hash computation @@ -147,13 +139,12 @@ Changelog - Remove Measure constants - Remove cell2D and cell3D - Implement reference_value in apply_restrictions -- Rename point integral to vertex integral and kept ``*dP`` syntax +- Rename point integral to vertex integral and kept `*dP` syntax - Replace lambda functions in ufl_type with named functions for nicer stack traces - Minor bugfixes, removal of unused code and cleanups -1.5.0 (2015-01-12) ------------------- +## 1.5.0 (2015-01-12) - Require Python 2.7 - Python 3 support @@ -192,10 +183,9 @@ Changelog - Fix signature stability w.r.t. metadata dicts - Minor bugfixes, removal of unused code and cleanups -1.4.0 (2014-06-02) ------------------- +## 1.4.0 (2014-06-02) -- New integral type custom_integral (``*dc``) +- New integral type custom_integral (`*dc`) - Add analysis of which coefficients each integral actually uses to optimize assembly - Improved svg rendering of cells and sobolevspaces in ipython notebook - Add sobolev spaces, use notation "element in HCurl" (HCurl, HDiv, H1, H2, L2) @@ -225,8 +215,7 @@ Changelog - Various minor bugfixes - Various docstring improvements -1.3.0 (2014-01-07) ------------------- +## 1.3.0 (2014-01-07) - Add cell_avg and facet_avg operators, can be applied to a Coefficient or Argument or restrictions thereof - Fix bug in cofactor: now it is transposed the correct way. @@ -236,8 +225,7 @@ Changelog - Add atan2 function - Allow form+0 -> form -1.2.0 (2013-03-24) ------------------- +## 1.2.0 (2013-03-24) - NB! Using shapes such as (1,) and (1,1) instead of () for 1D tensor quantities I, x, grad(f) - Add cell.facet_diameter @@ -249,8 +237,7 @@ Changelog - Generalize jump(v,n) for rank(v) > 2 - Fix some minor bugs -1.1.0 (2013-01-07) ------------------- +## 1.1.0 (2013-01-07) - Add support for pickling of expressions (thanks to Graham Markall) - Add shorthand notation A**2 == inner(A, A), special cased for power 2. @@ -260,8 +247,7 @@ Changelog - Bugfix in quadrature degree estimation, never returning <0 now - Remove use of cmp to accomodate removal from python 3 -1.1-alpha-prerelease (2012-11-18) ---------------------------------- +## 1.1-alpha-prerelease (2012-11-18) (Not released, snapshot archived with submission of UFL journal paper) - Support adding 0 to forms, allowing sum([a]) @@ -273,13 +259,11 @@ Changelog - Add simplification f/f -> 1 - Add operators <,>,<=,>= in place of lt,gt,le,ge -1.0.0 (2011-12-07) ------------------- +## 1.0.0 (2011-12-07) - No changes since rc1. -1.0-rc1 (2011-11-22) --------------------- +## 1.0-rc1 (2011-11-22) - Added tests covering snippets from UFL chapter in FEniCS book - Added more unit tests @@ -288,27 +272,24 @@ Changelog - Fixed rtruediv bug - Fixed bug with derivatives of elements of type Real with unspecified cell -1.0-beta3 (2011-10-26) ----------------------- +## 1.0-beta3 (2011-10-26) - Added nabla_grad and nabla_div operators - Added error function erf(x) - Added bessel functions of first and second kind, normal and modified, bessel_J(nu, x), bessel_Y(nu, x), bessel_I(nu, x), bessel_K(nu, x) - Extended derivative() to allow indexed coefficient(s) as differentiation variable -- Made ``*Constant`` use the ``Real`` space instead of ``DG0`` +- Made `*Constant` use the `Real` space instead of `DG0` - Bugfix in adjoint where test and trial functions were in different spaces - Bugfix in replace where the argument to a grad was replaced with 0 - Bugfix in reconstruction of tensor elements - Some other minor bugfixes -1.0-beta2 (2011-08-11) ----------------------- +## 1.0-beta2 (2011-08-11) - Support c*form where c depends on a coefficient in a Real space -1.0-beta (2011-07-08) ---------------------- +## 1.0-beta (2011-07-08) - Add script ufl-version - Added syntax for associating an arbitrary domain data object with a measure: @@ -319,8 +300,7 @@ Changelog - Fixed support for symmetries in subelements of a mixed element - Add support for specifying derivatives of coefficients to derivative() -0.9.1 (2011-05-16) ------------------- +## 0.9.1 (2011-05-16) - Remove set_foo functions in finite element classes - Change license from GPL v3 or later to LGPL v3 or later @@ -332,23 +312,20 @@ Changelog - Add subdomain member variables to form class - Allow action on forms of arbitrary rank -0.9.0 (2011-02-23) ------------------- +## 0.9.0 (2011-02-23) - Allow jump(Sigma, n) for matrix-valued expression Sigma - Bug fix in scalar curl operator - Bug fix in deviatoric operator -0.5.4 (2010-09-01) ------------------- +## 0.5.4 (2010-09-01) - Bug fixes in PartExtracter - Do not import x for coordinate - Add Circumradius to Cell (Cell.circumradius) - Add CellVolume to Cell (Cell.volume) -0.5.3 (2010-07-01) ------------------- +## 0.5.3 (2010-07-01) - Rename ElementRestriction --> RestrictedElement - Experimental import of x from tetrahedron @@ -357,46 +334,40 @@ Changelog - Rename ElementUnion -> EnrichedElement - Add support for tan() and inverse trigonometric functions -0.5.2 (2010-02-15) ------------------- +## 0.5.2 (2010-02-15) - Attach form data to preprocessed form, accessible by form.form_data() -0.5.1 (2010-02-03) ------------------- +## 0.5.1 (2010-02-03) - Fix bug in propagate_restriction -0.5.0 (2010-02-01) ------------------- +## 0.5.0 (2010-02-01) - Several interface changes in FormData class - Introduce call preprocess(form) to be called at beginning of compilation - Rename BasisFunction --> Argument - Rename Function --> Coefficient -0.4.1 (2009-12-04) ------------------- +## 0.4.1 (2009-12-04) - Redefine grad().T --> grad() - New meaning of estimate_max_polynomial_degree - New function estimate_total_polynomial_degree - Allow degree = None and cell = None for elements -0.4.0 (2009-09-23) ------------------- +## 0.4.0 (2009-09-23) - Extensions for ElementRestriction (restrict FiniteElement to Cell) - Bug fix for lhs/rhs with list tensor types - Add new log function set_prefix - Add new log function log(level, message) -- Added macro cell integral ``*dE`` +- Added macro cell integral `*dE` - Added mechanism to add additional integral types - Added LiftingOperator and LiftingFunction - Added ElementRestriction -0.3.0 (2009-05-28) ------------------- +## 0.3.0 (2009-05-28) - Some critical bugfixes, in particular in differentiation. - Added form operators "system" and "sensitivity_rhs". @@ -408,12 +379,10 @@ Changelog for quadrature degree estimation. - Improved manual. -0.2.0 (2009-04-07) ------------------- +## 0.2.0 (2009-04-07) - Initial release of UFL. -0.1.0 (unreleased) ------------------- +## 0.1.0 (unreleased) - Unreleased development versions of UFL. diff --git a/README.md b/README.md new file mode 100644 index 000000000..5da66e02f --- /dev/null +++ b/README.md @@ -0,0 +1,35 @@ +# UFL - Unified Form Language + +The Unified Form Language (UFL) is a domain specific language for +declaration of finite element discretizations of variational forms. More +precisely, it defines a flexible interface for choosing finite element +spaces and defining expressions for weak forms in a notation close to +mathematical notation. + +UFL is part of the FEniCS Project. For more information, visit +https://www.fenicsproject.org + +[![UFL CI](https://github.com/FEniCS/ufl/workflows/UFL%20CI/badge.svg)](https://github.com/FEniCS/ufl/workflows/UFL%20CI) +[![Coverage Status](https://coveralls.io/repos/github/FEniCS/ufl/badge.svg?branch=master)](https://coveralls.io/github/FEniCS/ufl?branch=master) +[![Documentation Status](https://readthedocs.org/projects/fenics-ufl/badge/?version=latest)](https://fenics.readthedocs.io/projects/ufl/en/latest/?badge=latest) + +## Documentation + +Documentation can be viewed at https://fenics-ufl.readthedocs.org/. + + +## License + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with this program. If not, see . + diff --git a/README.rst b/README.rst deleted file mode 100644 index 452963331..000000000 --- a/README.rst +++ /dev/null @@ -1,47 +0,0 @@ -=========================== -UFL - Unified Form Language -=========================== - -The Unified Form Language (UFL) is a domain specific language for -declaration of finite element discretizations of variational forms. More -precisely, it defines a flexible interface for choosing finite element -spaces and defining expressions for weak forms in a notation close to -mathematical notation. - -UFL is part of the FEniCS Project. For more information, visit -https://www.fenicsproject.org - -.. image:: https://github.com/FEniCS/ufl/workflows/UFL%20CI/badge.svg - :target: https://github.com/FEniCS/ufl/workflows/UFL%20CI -.. image:: https://github.com/FEniCS/ufl/actions/workflows/spack.yml/badge.svg - :target: https://github.com/FEniCS/ufl/actions/workflows/spack.yml -.. image:: https://coveralls.io/repos/github/FEniCS/ufl/badge.svg?branch=master - :target: https://coveralls.io/github/FEniCS/ufl?branch=master - :alt: Coverage Status -.. image:: https://readthedocs.org/projects/fenics-ufl/badge/?version=latest - :target: https://fenics.readthedocs.io/projects/ufl/en/latest/?badge=latest - :alt: Documentation Status - - -Documentation -============= - -Documentation can be viewed at https://fenics-ufl.readthedocs.org/. - - -License -======= - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . - From d2b4fe69d2f40a2831d749537c7a864bd5bbfb4c Mon Sep 17 00:00:00 2001 From: Matthew Scroggs Date: Wed, 15 Nov 2023 13:47:04 +0000 Subject: [PATCH 2/7] use tsfc master on CI (#240) * use tsfc master on CI * another branch name --- .github/workflows/tsfc-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tsfc-tests.yml b/.github/workflows/tsfc-tests.yml index 45752de0c..06b10a13d 100644 --- a/.github/workflows/tsfc-tests.yml +++ b/.github/workflows/tsfc-tests.yml @@ -32,14 +32,14 @@ jobs: with: path: ./tsfc repository: firedrakeproject/tsfc - ref: mscroggs/newfl-legacy2 + ref: master - name: Install tsfc run: | cd tsfc pip install -r requirements-ext.txt pip install git+https://github.com/coneoproject/COFFEE.git#egg=coffee pip install git+https://github.com/firedrakeproject/fiat.git#egg=fenics-fiat - pip install git+https://github.com/FInAT/FInAT.git@mscroggs/ufl-elements + pip install git+https://github.com/FInAT/FInAT.git#egg=finat pip install git+https://github.com/firedrakeproject/loopy.git#egg=loopy pip install .[ci] pip install pytest From 5c08401c8c797eaacc16b9e0e65e6a1e72da5a8b Mon Sep 17 00:00:00 2001 From: Francesco Ballarin Date: Wed, 15 Nov 2023 17:15:12 +0100 Subject: [PATCH 3/7] Update OMPI environment variables in FEniCSx integration test for openmpi v5 (#241) --- .github/workflows/fenicsx-tests.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/fenicsx-tests.yml b/.github/workflows/fenicsx-tests.yml index b2a47af67..6a8856e47 100644 --- a/.github/workflows/fenicsx-tests.yml +++ b/.github/workflows/fenicsx-tests.yml @@ -59,11 +59,6 @@ jobs: PETSC_ARCH: linux-gnu-complex128-32 OMPI_ALLOW_RUN_AS_ROOT: 1 OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1 - OMPI_MCA_rmaps_base_oversubscribe: 1 - OMPI_MCA_plm: isolated - OMPI_MCA_btl_vader_single_copy_mechanism: none - OMPI_MCA_mpi_yield_when_idle: 1 - OMPI_MCA_hwloc_base_binding_policy: none steps: - uses: actions/checkout@v4 From 3eda4f9dcc6d2d04fd9d4b8e58576b45d60b34fa Mon Sep 17 00:00:00 2001 From: "Jack S. Hale" Date: Tue, 21 Nov 2023 16:28:51 +0100 Subject: [PATCH 4/7] Fix license file field. (#244) --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b3751e708..9617fef89 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ authors = [{email="fenics-dev@googlegroups.com"}, {name="FEniCS Project"}] maintainers = [{email="fenics-dev@googlegroups.com"}, {name="FEniCS Project Steering Council"}] description = "Unified Form Language" readme = "README.rst" -license = {file = "LICENSE"} +license = {file = "COPYING.lesser"} requires-python = ">=3.8.0" dependencies = ["numpy"] From e8d3077b21a3452ff471be383a77de38817b9468 Mon Sep 17 00:00:00 2001 From: JHopeCollins Date: Wed, 22 Nov 2023 16:54:35 +0000 Subject: [PATCH 5/7] FormSum.coefficients should be ordered the same as Form.coefficients (#243) --- ufl/form.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ufl/form.py b/ufl/form.py index f4b546b41..3f85b709d 100644 --- a/ufl/form.py +++ b/ufl/form.py @@ -784,8 +784,11 @@ def _analyze_form_arguments(self): for component in self._components: arguments.extend(component.arguments()) coefficients.extend(component.coefficients()) - self._arguments = tuple(set(arguments)) - self._coefficients = tuple(set(coefficients)) + # Define canonical numbering of arguments and coefficients + self._arguments = tuple( + sorted(set(arguments), key=lambda x: x.number())) + self._coefficients = tuple( + sorted(set(coefficients), key=lambda x: x.count())) def _analyze_domains(self): """Analyze which domains can be found in FormSum.""" From 60a1cfc1b8a89c9bf1976d45d86e0334c2bfb70e Mon Sep 17 00:00:00 2001 From: Pablo Brubeck Date: Wed, 29 Nov 2023 16:21:01 +0000 Subject: [PATCH 6/7] Expunge ufl_domain (#246) * Expunge Expr.ufl_domain() * Remove failing assertion * Action: get ufl_domains() from operands --- ufl/action.py | 5 +++-- ufl/algorithms/change_to_reference.py | 3 ++- ufl/algorithms/compute_form_data.py | 6 ++++-- ufl/algorithms/estimate_degrees.py | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/ufl/action.py b/ufl/action.py index 5d6004994..1887da201 100644 --- a/ufl/action.py +++ b/ufl/action.py @@ -16,6 +16,7 @@ from ufl.differentiation import CoefficientDerivative from ufl.form import BaseForm, Form, FormSum, ZeroBaseForm from ufl.matrix import Matrix +from itertools import chain # --- The Action class represents the action of a numerical object that needs # to be computed at assembly time --- @@ -121,8 +122,8 @@ def _analyze_domains(self): """Analyze which domains can be found in Action.""" from ufl.domain import join_domains - # Collect unique domains - self._domains = join_domains([e.ufl_domain() for e in self.ufl_operands]) + # Collect domains + self._domains = join_domains(chain.from_iterable(e.ufl_domains() for e in self.ufl_operands)) def equals(self, other): """Check if two Actions are equal.""" diff --git a/ufl/algorithms/change_to_reference.py b/ufl/algorithms/change_to_reference.py index c232d3c7b..ed5c22ca2 100644 --- a/ufl/algorithms/change_to_reference.py +++ b/ufl/algorithms/change_to_reference.py @@ -13,6 +13,7 @@ from ufl.core.multiindex import indices from ufl.corealg.map_dag import map_expr_dag from ufl.corealg.multifunction import MultiFunction +from ufl.domain import extract_unique_domain from ufl.tensors import as_tensor """ @@ -139,7 +140,7 @@ def grad(self, o): f = ReferenceValue(f) # Get domain and create Jacobian inverse object - domain = o.ufl_domain() + domain = extract_unique_domain(o) Jinv = JacobianInverse(domain) if is_cellwise_constant(Jinv): diff --git a/ufl/algorithms/compute_form_data.py b/ufl/algorithms/compute_form_data.py index f8c9df4ac..af0ddf68d 100644 --- a/ufl/algorithms/compute_form_data.py +++ b/ufl/algorithms/compute_form_data.py @@ -30,6 +30,7 @@ from ufl.algorithms.remove_complex_nodes import remove_complex_nodes from ufl.classes import Coefficient, Form, FunctionSpace, GeometricFacetQuantity from ufl.corealg.traversal import traverse_unique_terminals +from ufl.domain import extract_unique_domain from ufl.utils.sequences import max_degree @@ -180,8 +181,9 @@ def _build_coefficient_replace_map(coefficients, element_mapping=None): # coefficient had a domain, the new one does too. # This should be overhauled with requirement that Expressions # always have a domain. - if f.ufl_domain() is not None: - new_e = FunctionSpace(f.ufl_domain(), new_e) + domain = extract_unique_domain(f) + if domain is not None: + new_e = FunctionSpace(domain, new_e) new_f = Coefficient(new_e, count=i) new_coefficients.append(new_f) replace_map[f] = new_f diff --git a/ufl/algorithms/estimate_degrees.py b/ufl/algorithms/estimate_degrees.py index ccaf64c7e..334041d3f 100644 --- a/ufl/algorithms/estimate_degrees.py +++ b/ufl/algorithms/estimate_degrees.py @@ -95,7 +95,7 @@ def _reduce_degree(self, v, f): This is used when derivatives are taken. It does not reduce the degree when TensorProduct elements or quadrilateral elements are involved. """ - if isinstance(f, int) and v.ufl_domain().ufl_cell().cellname() not in ["quadrilateral", "hexahedron"]: + if isinstance(f, int) and extract_unique_domain(v).ufl_cell().cellname() not in ["quadrilateral", "hexahedron"]: return max(f - 1, 0) else: return f From 3fc1763197744d50d7b34fa49a4b14897d1c5445 Mon Sep 17 00:00:00 2001 From: Nacime Bouziani <48448063+nbouziani@users.noreply.github.com> Date: Wed, 29 Nov 2023 17:07:19 +0000 Subject: [PATCH 7/7] Fix cofunction equality (#247) * Add trimmed serendipity * Fix value shape for trimmed serendipity * ufl plumbing update for trimmed serendipity. * Plumbing for SminusDiv.py * Adding in element stuff for SminusCurl. * Fix typo * remove spurioius names * Update equality inheritance for Cofunctions --------- Co-authored-by: Rob Kirby Co-authored-by: Justincrum Co-authored-by: David A. Ham Co-authored-by: ksagiyam Co-authored-by: ksagiyam <46749170+ksagiyam@users.noreply.github.com> Co-authored-by: Connor Ward Co-authored-by: Iglesia Dolci Co-authored-by: Jack Betteridge <43041811+JDBetteridge@users.noreply.github.com> --- ufl/coefficient.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ufl/coefficient.py b/ufl/coefficient.py index 584d06c3f..3ff9c34e0 100644 --- a/ufl/coefficient.py +++ b/ufl/coefficient.py @@ -116,6 +116,8 @@ class Cofunction(BaseCoefficient, BaseForm): _primal = False _dual = True + __eq__ = BaseForm.__eq__ + def __new__(cls, *args, **kw): """Create a new Cofunction.""" if args[0] and is_primal(args[0]):