FEniCS / ufl

UFL - Unified Form Language
https://fenicsproject.org
GNU Lesser General Public License v3.0
97 stars 64 forks source link

Fix zero simplification in BaseForm.__add__ #262

Closed nbouziani closed 5 months ago

nbouziani commented 5 months ago

This PR fixes the rule for simplifying the sum of a BaseForm with a ufl.constantvalue.Zero. The rule used to be that any Zero that is added to a BaseForm is dismissed if that zero is scalar and doesn't have free indices. This logic, inherited from ufl.Expr objects, doesn't apply to BaseForm objects and should be removed.