gmarkall / manycore_form_compiler

MCFC is deprecated. See https://code.launchpad.net/~grm08/ffc/pyop2
https://code.launchpad.net/~grm08/ffc/pyop2
GNU General Public License v3.0
3 stars 1 forks source link

Determine coefficient for the solution of a solve #23

Closed kynan closed 13 years ago

kynan commented 13 years ago

Currently (as of c6346ba9b237bb9715e8) solve is a function taking two Forms as arguments and returning a Coefficient. The type of this Coefficient is determined by the element of the first argument contained in the form_data of the second argument to the call (which is assumed to be the right-hand-side). The solve 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 the Coefficient to return by solve without relying on any information in form_data?

dham commented 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.

kynan commented 13 years ago

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?

kynan commented 13 years ago

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.