Question #154649 on DOLFIN changed: https://answers.launchpad.net/dolfin/+question/154649
Status: Open => Answered Martin Sandve Alnæs proposed the following answer: No. Constant is a dolfin type, a subclass of ufl.Coefficient. A Coefficient represents a function provided to the compiled form at run time, and thus cannot be removed by UFL. You could possibly restructure your application def foo(f): return -f x = foo(Constant(1.0)) # UFL expression y = foo(1.0) # computation directly in python but I guess your application is more complicated than this :) Martin On 29 April 2011 01:30, Chaffra <question154...@answers.launchpad.net> wrote: > New question #154649 on DOLFIN: > https://answers.launchpad.net/dolfin/+question/154649 > > I have a general question about the algebra in dolfin. > > a = Constant(1.0) is a Constant but b = -a is a Product. Is there an easy way > to convert b back to a Constant? The same would apply for Function. I know > project would do it (convert a Constant to a Function) but maybe something > can be done at the algebra level because I found project to be time consuming. > > Thanks, > Chaffra > > -- > You received this question notification because you are a member of > DOLFIN Team, which is an answer contact for DOLFIN. > > _______________________________________________ > Mailing list: https://launchpad.net/~dolfin > Post to : dolfin@lists.launchpad.net > Unsubscribe : https://launchpad.net/~dolfin > More help : https://help.launchpad.net/ListHelp > -- You received this question notification because you are a member of DOLFIN Team, which is an answer contact for DOLFIN. _______________________________________________ Mailing list: https://launchpad.net/~dolfin Post to : dolfin@lists.launchpad.net Unsubscribe : https://launchpad.net/~dolfin More help : https://help.launchpad.net/ListHelp