Hi -

I've been working with some meshes that I would like to cache. To prevent
having to run Gmsh each time using the same mesh, I've tried using the
read/write methods associated provided by tools.dump (I also tried raw
cPickle-ing and using shelf) but I seem to be losing the physical and
geometrical definitions created by makeMapVariables.  Is there something
I've missed or should I file a ticket on matforge?  It also looks like we
toss the mshFile so I don't believe I can just call
gmshMesh.py:makeMapVariables again later.

Also would you be interested in caching mesh output for a given geometry
description?  One could just hash incoming geometry descriptions and if
meshing is successful save a temporary file object named using the digest.
 I suppose this could be done in gmshMesh.py:openMSHFile?


Example below:

from fipy import *

cellSize = 0.05
radius = 1.

old = Gmsh2D('''
              cellSize = %(cellSize)g;
              radius = %(radius)g;
              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};
              Physical Surface("Circle") = {11};
              ''' % locals())

f, tempfile = dump.write(old)
new = dump.read(tempfile, f)

print old.physicalCells
print new.physicalCells


Running this in ipython gives:
In [8]: run circle_test.py
{'Circle': (CellVariable(value=array([1, 1, 1, ..., 1, 1, 1]),
mesh=Gmsh2D()) == 1)}
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/usr/local/lib/python2.7/site-packages/IPython/utils/py3compat.pyc in
execfile(fname, *where)
    202             else:
    203                 filename = fname
--> 204             __builtin__.execfile(filename, *where)

/Users/jsnyder/circle_test.py in <module>()
     25
     26 print old.physicalCells
---> 27 print new.physicalCells

AttributeError: 'Gmsh2D' object has no attribute 'physicalCells'

-- 
James Snyder
Biomedical Engineering
Northwestern University
ph: (847) 448-0386
_______________________________________________
fipy mailing list
[email protected]
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]

Reply via email to