Closed kynan closed 13 years ago
I think the answer is that you don't need to know it yet. Instead you can put some sort of placeholder element in there and then sort it out later once the UFL has been parsed.
For now I use extract_arguments
from ufl.algorithms
which seems to do the job. So the forms not being canonicalised yet is not a problem.
About taking the element of the first argument of the right-hand-side form: Since the right hand side should always only have a single argument (the trial function) this should be robust. Opinions?
A related issue is that the forms passed to solve
are not preprocessed, whereas those in the dictionary of UFL objects are. As a workaround I attach the original form to the form_data
in the canonicalise step and do the name lookup for forms remembered by solve
against this original form for any form in the dictionary of UFL objects.
Currently (as of c6346ba9b237bb9715e8)
solve
is a function taking twoForm
s as arguments and returning aCoefficient
. The type of thisCoefficient
is determined by theelement
of the firstargument
contained in theform_data
of the second argument to the call (which is assumed to be the right-hand-side). Thesolve
function is placed in the namespace for the UFL to be executed.In the planned pipeline, the execution happens before the forms are canonicalised, i.e. the
form_data
is not available at this point and hence above approach fails.What is a robust way do determine the
element
type for theCoefficient
to return bysolve
without relying on any information inform_data
?