Handle zero forms
# Handle zero valued forms:
If form simplification renders a form empty, it should add a zero term such
that the form can be assembled.
Some examples:
L = (0*v)*dx --> (0)*dx --> (0*v)*dx
L = g*v*dx + 0*v*dx -> g*v*dx
L = 0*v*dx + 0*g*v*dx -> (0*v)*dx
L = 0*v*very_
Blueprint information
- Status:
- Complete
- Approver:
- None
- Priority:
- Undefined
- Drafter:
- None
- Direction:
- Needs approval
- Assignee:
- None
- Definition:
- Obsolete
- Series goal:
- None
- Implementation:
- Unknown
- Milestone target:
- None
- Started by
- Completed by
- Garth Wells
Related branches
Related bugs
Sprints
Whiteboard
Representing (0*v)*dx would require a quite substantial redesign. The automatic simplification of obvious zeros to Zero is critical for performance.
One possible solution would be to make dependencies on Arguments a first class property of an Expr:
e = u*v
args = e.arguments()
args == (u, v)
This would simplify some checking and analysis as well.
GNW: I'm handling this case on the DOLFIN side as a special case. I think that that is the right place to do it. Therefore, no change required to UFL.