dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #17918
Re: [Question #105494]: random function
Question #105494 on DOLFIN changed:
https://answers.launchpad.net/dolfin/+question/105494
Status: Open => Answered
Johan Hake proposed the following answer:
Achim!
Just change Function -> Expression and you are good to go!
Johan
On Thursday March 25 2010 05:21:34 Achim Schroll wrote:
> New question #105494 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/105494
>
> why does my random function return just zero?
>
> from dolfin import *
> from random import *
>
> # random funtion
> class myrand(Function):
> def __init__(self, V):
> Function.__init__(self, V)
> def eval(self, values, x):
> values[0] = gauss(0,1)
>
> # Create mesh and finite element
> mesh = UnitSquare(20, 20)
> V = FunctionSpace(mesh, "CG", 1)
>
> randf = myrand(V)
--
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.