- Thank you received: 24
picklinge GridFunction Error
4 years 6 months ago - 4 years 6 months ago #2655
by hvwahl
picklinge GridFunction Error was created by hvwahl
Hi everyone,
im trying to pickle and unpickle GridFunctions in a time dependent problem, in order to restart a computation from the pickled data. However, on writing the data from an unpickled GridFunction into the GridFunction used in the computation
I get the following an error:
I have attached an MWE and I on the master branch commit ee5d90c06.
Can anyone help me with this?
Best wishes,
Henry
im trying to pickle and unpickle GridFunctions in a time dependent problem, in order to restart a computation from the pickled data. However, on writing the data from an unpickled GridFunction into the GridFunction used in the computation
Code:
v1 = GridFunction(V)
unpickler = pickle.Unpickler(open("1.dat","rb"))
up1, = unpickler.load()
v1.vec.data = up1.data
Code:
netgen.libngpy._meshing.NgException: Archive error: Polymorphic type ngcomp::S_GridFunction<double> not registered for archive
Can anyone help me with this?
Best wishes,
Henry
Attachments:
Last edit: 4 years 6 months ago by hvwahl.
4 years 6 months ago #2656
by cwinters
Replied by cwinters on topic picklinge GridFunction Error
Hi Henry,
you have to use
since you can not write a GridFunction on a Basevector.
If I want to save some data for longer times, I usually save the raw data of the vector (just the values in a list and some information the reconstruct the FESpace). There have been quite a lot changes in the pickling interface which caused me some troubles in the past when loading with a newer NGSolve.
Best,
Christoph
you have to use
Code:
v1.vec.data = up1.vec.data
If I want to save some data for longer times, I usually save the raw data of the vector (just the values in a list and some information the reconstruct the FESpace). There have been quite a lot changes in the pickling interface which caused me some troubles in the past when loading with a newer NGSolve.
Best,
Christoph
4 years 6 months ago #2657
by hvwahl
Replied by hvwahl on topic picklinge GridFunction Error
Hi Christoph,
thanks for the quick reply! Sorry I missed that!
Best wishes,
Henry
thanks for the quick reply! Sorry I missed that!
Best wishes,
Henry
4 years 6 months ago #2658
by hvwahl
Replied by hvwahl on topic picklinge GridFunction Error
On a related Note:
I also need to pickle BitArrays. I have implemented this netgen/libsrc/core/python_ngcore_export.cpp , but would it be possible to get this into the source code? What would be the best way to do this?
Best wishes,
Henry
I also need to pickle BitArrays. I have implemented this netgen/libsrc/core/python_ngcore_export.cpp , but would it be possible to get this into the source code? What would be the best way to do this?
Best wishes,
Henry
Time to create page: 0.105 seconds