← Back to team overview

dolfin team mailing list archive

saving and loading function

 

Is it no longer possible to save and load functions ? 
The following example shows 
the problem: 


the script save_func.py:

from dolfin import *

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

d = Constant(mesh, 1)

d_proj = project(d, V)

file = File("d.xml")
file << d_proj


the script load_func.py 

from dolfin import *
mesh = UnitSquare(12,12)
V = FunctionSpace(mesh, "CG", 1)

d = Function(V)
file = File("d.xml")
file >> d 

Running these two gives: 

  File
"/home/kent-and/local/src/dolfin-dev/local/lib/python2.5/site-packages/dolfin/cpp.py", line 6968, in __rshift__
    return _cpp.File___rshift__(*args)
RuntimeError: *** Error: Unable to assign to function, not in the same
function space.


I assume that the reason is that I run these script in separate
sessions. 



Follow ups