dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #22888
Re: [Question #154649]: UFL algebra and Function Constant etc...
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 <question154649@xxxxxxxxxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dolfin
> More help : https://help.launchpad.net/ListHelp
>
Follow ups
References