moved the blender funcs into the main grid object
This commit is contained in:
parent
7de03e8025
commit
bf993339d6
@ -1,5 +1,6 @@
|
|||||||
import sys
|
import sys
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
import pickle
|
||||||
|
|
||||||
from xml.dom.minidom import Document
|
from xml.dom.minidom import Document
|
||||||
|
|
||||||
@ -173,6 +174,13 @@ class grid(object):
|
|||||||
self.q *= new_max/largest_number
|
self.q *= new_max/largest_number
|
||||||
|
|
||||||
|
|
||||||
|
def dump_to_blender_files(self, pfile = '/tmp/points.p', cfile = '/tmp/cells.p'):
|
||||||
|
if len(self.verts[0]) == 2:
|
||||||
|
pickle.dump([(p[0], p[1], 0.0) for p in self.verts], open(pfile, 'w'))
|
||||||
|
else:
|
||||||
|
pickle.dump([(p[0], p[1], p[2]) for p in self.verts], open(pfile, 'w'))
|
||||||
|
|
||||||
|
pickle.dump([f.verts for f in self.cells.itervalues()], open(cfile, 'w'))
|
||||||
|
|
||||||
def get_xml(self):
|
def get_xml(self):
|
||||||
doc = Document()
|
doc = Document()
|
||||||
|
@ -99,9 +99,6 @@ class gmsh_grid(grid):
|
|||||||
self.cells[v[0]].add_neighbor(self.cells[v[1]])
|
self.cells[v[0]].add_neighbor(self.cells[v[1]])
|
||||||
self.cells[v[1]].add_neighbor(self.cells[v[0]])
|
self.cells[v[1]].add_neighbor(self.cells[v[0]])
|
||||||
|
|
||||||
def dump_to_blender_files(self, pfile = '/tmp/points.p', ffile = '/tmp/cells.p'):
|
|
||||||
pickle.dump([(p[0], p[1], 0.0) for p in self.verts], open(pfile, 'w'))
|
|
||||||
pickle.dump([f.verts for f in self.cells.itervalues()], open(ffile, 'w'))
|
|
||||||
|
|
||||||
class gmsh_grid3D(grid):
|
class gmsh_grid3D(grid):
|
||||||
|
|
||||||
@ -174,7 +171,3 @@ class gmsh_grid3D(grid):
|
|||||||
if len(v) > 1:
|
if len(v) > 1:
|
||||||
self.cells[v[0]].add_neighbor(self.cells[v[1]])
|
self.cells[v[0]].add_neighbor(self.cells[v[1]])
|
||||||
self.cells[v[1]].add_neighbor(self.cells[v[0]])
|
self.cells[v[1]].add_neighbor(self.cells[v[0]])
|
||||||
|
|
||||||
def dump_to_blender_files(self, pfile = '/tmp/points.p', ffile = '/tmp/cells.p'):
|
|
||||||
pickle.dump([(p[0], p[1], p[2]) for p in self.verts], open(pfile, 'w'))
|
|
||||||
pickle.dump([f.verts for f in self.cells.itervalues()], open(ffile, 'w'))
|
|
||||||
|
Loading…
Reference in New Issue
Block a user