← Back to team overview

dolfin team mailing list archive

Re: [Question #105494]: random function

 

Question #105494 on DOLFIN changed:
https://answers.launchpad.net/dolfin/+question/105494

    Status: Answered => Open

Achim Schroll is still having a problem:
Hi Johan, I don't get it. Expression gives the error...

class myrand(Expression):
    def eval(self, values, x):
        values[0] = gauss(0,1)

mesh = UnitSquare(20, 20)
V = FunctionSpace(mesh, "CG", 1)

randf1 = myrand(V)

Traceback (most recent call last):
  File "addnoise_ny.py", line 37, in <module>
    randf1 = myrand(V)
  File "/usr/lib/python2.5/site-packages/dolfin/expression.py", line 120, in __init__
    raise TypeError, "Expression need to be initialized using either a 'cpp.FunctionSpace', using kwarg 'V', or an 'ufl.FiniteElement' using kwarg 'element'."
TypeError: Expression need to be initialized using either a 'cpp.FunctionSpace', using kwarg 'V', or an 'ufl.FiniteElement' using kwarg 'element'.

-- 
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.



Follow ups

References