[cig-commits] r16651 - in short/3D/PyLith/trunk: . pylith/utils
brad at geodynamics.org
brad at geodynamics.org
Wed May 5 15:48:01 PDT 2010
Author: brad
Date: 2010-05-05 15:48:01 -0700 (Wed, 05 May 2010)
New Revision: 16651
Modified:
short/3D/PyLith/trunk/TODO
short/3D/PyLith/trunk/pylith/utils/VTKDataReader.py
Log:
Improved efficiency of multiple calls to VTKDataReader.read().
Modified: short/3D/PyLith/trunk/TODO
===================================================================
--- short/3D/PyLith/trunk/TODO 2010-05-05 22:47:10 UTC (rev 16650)
+++ short/3D/PyLith/trunk/TODO 2010-05-05 22:48:01 UTC (rev 16651)
@@ -7,8 +7,6 @@
MAIN PRIORITIES
-* synchronization of VTK output and simulation (off by dt for explicit?)
-
* optimize VTKDataReader()
* Better preconditioning
@@ -122,6 +120,19 @@
Calculate eq statistics for given slip model (VTK output).
Ability to get shear modulus on both sides of the fault (use fault normal).
+* VTKDataReaderZip
+
+ Read VTK files from zipfile.
+
+ import zipfile
+ zip = zipfile.open("test.zip")
+ for filename in zip.namelist():
+ bytes = zip.read(filename)
+ reader.input_string = bytes
+ reader.update()
+ data = reader.get_output()
+
+
----------------------------------------------------------------------
FRICTION
----------------------------------------------------------------------
Modified: short/3D/PyLith/trunk/pylith/utils/VTKDataReader.py
===================================================================
--- short/3D/PyLith/trunk/pylith/utils/VTKDataReader.py 2010-05-05 22:47:10 UTC (rev 16650)
+++ short/3D/PyLith/trunk/pylith/utils/VTKDataReader.py 2010-05-05 22:48:01 UTC (rev 16651)
@@ -37,21 +37,24 @@
"""
def __init__(self):
- return
-
-
- def read(self, filename):
from enthought.tvtk.api import tvtk
reader = tvtk.UnstructuredGridReader()
- reader.file_name = filename
reader.read_all_scalars = True
reader.read_all_vectors = True
reader.read_all_tensors = True
reader.read_all_fields = True
- err = reader.update()
- data = reader.get_output()
+ self.reader = reader
+ return
+
+
+ def read(self, filename):
+ """
+ Read VTK file.
+ """
+ self.reader.file_name = filename
+ self.reader.update()
+ data = self.reader.get_output()
-
data = {'vertices': self._getVertices(data),
'cells': self._getCells(data),
'vertex_fields': self._getVertexFields(data),
More information about the CIG-COMMITS
mailing list