UFL

Construct Test/TrialFunction from Coefficient (using its element)

Registered by Florian Rathgeber

Convenience shorthand notation allowing the following:

  # c is a Coefficient (i.e. a field over some element) we got from an external source
  u = TrialFunction(c)
  v = TestFunction(c)

which would construct test and trial functions living on the same element / function space as the Coefficient c.

Currently one needs to write (rather non-intuitive):

  u = TrialFunction(c.element())
  v = TestFunction(c.element())

Implementation is easy: check type of the 1st parameter to Argument constructor, if it is a Coefficient, extract its element, proceed as usual. As a side effect this would allow any Argument to be constructed from a Coefficient (not taking into account the Coefficient's count). If that is not wanted, this case distinction could be made in the Test/TrialFunction constructors instead.

Blueprint information

Status:
Complete
Approver:
None
Priority:
Not
Drafter:
None
Direction:
Needs approval
Assignee:
None
Definition:
Obsolete
Series goal:
None
Implementation:
Unknown
Milestone target:
None
Completed by
Martin Sandve Alnæs

Whiteboard

I disagree. The argument lives in a finite element space, that is what it takes in its constructor, and v TrialFunction(c.element()) communicates perfectly well that v and c share the same element.

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.