usnistgov / fipy

FiPy is a Finite Volume PDE solver written in Python
http://pages.nist.gov/fipy/en/latest
Other
504 stars 148 forks source link

Gmsh CellVariables can't be unpickled #217

Closed guyer closed 9 years ago

guyer commented 9 years ago

>>> from fipy import *
>>> circle = Gmsh2D(*
... cellSize = 0.05;
... radius = 1;
... Point(1) = {0, 0, 0, cellSize};
... Point(2) = {-radius, 0, 0, cellSize};
... Point(3) = {0, radius, 0, cellSize};
... Point(4) = {radius, 0, 0, cellSize};
... Point(5) = {0, -radius, 0, cellSize};
... Circle(6) = {2, 1, 3};
... Circle(7) = {3, 1, 4};
... Circle(8) = {4, 1, 5};
... Circle(9) = {5, 1, 2};
... Line Loop(10) = {6, 7, 8, 9};
... Plane Surface(11) = {10};
... Recombine Surface{11};
... *)
>>> x, y = circle.getCellCenters()
>>> phi = CellVariable(mesh=circle, value=x*y)
>>> dump.write(phi, "circle.dmp.gz")
>>> phi2 = dump.read("circle.dmp.gz")
------------------------------------------------------------
Traceback (most recent call last):
  ...
  File ".../fipy/meshes/numMesh/gmshImport.py", line 545, in _getGlobalOverlappingCellIDs
return nx.array(self.cellGlobalIDs + self.gCellGlobalIDs)
AttributeError: Gmsh2D instance has no attribute 'cellGlobalIDs'

This arises because __getstate__ bypasses __init__ and so Gmsh2D.mshFile.buildMeshData() never gets called (and couldn't be because we don't know what the original Gmsh script was.

self.cellGlobalIDs and self.gCellGlobalIDs need to be set to something sensible.

Imported from trac ticket #313, created by guyer on 11-29-2010 at 15:35, last modified: 01-28-2011 at 15:59

guyer commented 9 years ago

Fixed in r4018

Trac comment by guyer on 11-29-2010 at 16:06

guyer commented 9 years ago

Fix r4018 clobbered by r4080.

Trac comment by guyer on 01-28-2011 at 13:50

guyer commented 9 years ago

Re-fixed (with tests) in r4191.

Trac comment by guyer on 01-28-2011 at 15:59