[cig-commits] r8405 - in short/3D/PyLith/benchmarks/trunk/quasistatic/strikeslipnog: . results utils

brad at geodynamics.org brad at geodynamics.org
Fri Dec 7 09:16:10 PST 2007


Author: brad
Date: 2007-12-07 09:16:09 -0800 (Fri, 07 Dec 2007)
New Revision: 8405

Added:
   short/3D/PyLith/benchmarks/trunk/quasistatic/strikeslipnog/utils/
   short/3D/PyLith/benchmarks/trunk/quasistatic/strikeslipnog/utils/vtktoh5.py
Removed:
   short/3D/PyLith/benchmarks/trunk/quasistatic/strikeslipnog/results/vtktoh5.py
Log:
Moved vtktoh5.py to utils.

Deleted: short/3D/PyLith/benchmarks/trunk/quasistatic/strikeslipnog/results/vtktoh5.py
===================================================================
--- short/3D/PyLith/benchmarks/trunk/quasistatic/strikeslipnog/results/vtktoh5.py	2007-12-07 07:16:57 UTC (rev 8404)
+++ short/3D/PyLith/benchmarks/trunk/quasistatic/strikeslipnog/results/vtktoh5.py	2007-12-07 17:16:09 UTC (rev 8405)
@@ -1,47 +0,0 @@
-#!/usr/bin/env python
-#
-# ======================================================================
-#
-#                           Brad T. Aagaard
-#                        U.S. Geological Survey
-#
-# {LicenseText}
-#
-# ======================================================================
-#
-
-from enthought.mayavi.sources.vtk_file_reader import VTKFileReader
-import numpy
-import tables
-
-shape = "hex8"
-res = 1000
-t = 0.0
-filenameIn = "strikeslip_%s_%04dm_t%0.6f.vtk" % (shape, res, t)
-filenameOut = "strikeslip_%s_%04dm.h5" % (shape, res)
-
-reader = VTKFileReader()
-reader.initialize(filenameIn)
-data = reader.outputs[0]
-cellsVtk = data.get_cells().to_array()
-if shape == "hex8":
-    ncorners = 8
-elif shape == "tet4":
-    ncorners = 4
-(size,) = cellsVtk.shape
-ncells = size / (1+ncorners)
-assert((1+ncorners)*ncells == size)
-cellsVtk = numpy.reshape(cellsVtk, (ncells, 1+ncorners))[:,1:1+ncorners]
-verticesVtk = data._get_points().to_array()
-dispVtk = data._get_point_data()._get_vectors().to_array()
-
-h5 = tables.openFile(filenameOut, "w")
-h5.createGroup("/", "topology")
-h5.createArray("/topology", "vertices", verticesVtk)
-h5.createArray("/topology", "cells", cellsVtk)
-h5.createGroup("/", "data")
-h5.createArray("/data", "displacements", dispVtk)
-h5.close()
-
-# End of file
-

Copied: short/3D/PyLith/benchmarks/trunk/quasistatic/strikeslipnog/utils/vtktoh5.py (from rev 8404, short/3D/PyLith/benchmarks/trunk/quasistatic/strikeslipnog/results/vtktoh5.py)
===================================================================
--- short/3D/PyLith/benchmarks/trunk/quasistatic/strikeslipnog/results/vtktoh5.py	2007-12-07 07:16:57 UTC (rev 8404)
+++ short/3D/PyLith/benchmarks/trunk/quasistatic/strikeslipnog/utils/vtktoh5.py	2007-12-07 17:16:09 UTC (rev 8405)
@@ -0,0 +1,50 @@
+#!/usr/bin/env python
+#
+# ======================================================================
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# {LicenseText}
+#
+# ======================================================================
+#
+
+from enthought.mayavi.sources.vtk_file_reader import VTKFileReader
+import numpy
+import tables
+
+shape = "hex8"
+res = 500
+t = 0.0
+filenameRoot = "../results/strikeslip_%s_%04dm" % (shape, res)
+filenameIn = "%s_t%0.6f.vtk" % (filenameRoot, t)
+filenameOut = "%s.h5" % filenameRoot
+
+reader = VTKFileReader()
+reader.initialize(filenameIn)
+data = reader.outputs[0]
+cellsVtk = data.get_cells().to_array()
+if shape == "hex8":
+    ncorners = 8
+elif shape == "tet4":
+    ncorners = 4
+(size,) = cellsVtk.shape
+ncells = size / (1+ncorners)
+assert((1+ncorners)*ncells == size)
+cellsVtk = numpy.reshape(cellsVtk, (ncells, 1+ncorners))[:,1:1+ncorners]
+verticesVtk = data._get_points().to_array()
+dispVtk = data._get_point_data()._get_vectors().to_array()
+
+h5 = tables.openFile(filenameOut, "w")
+h5.createGroup("/", "topology")
+h5.createArray("/topology", "cells", cellsVtk)
+h5.createGroup("/", "geometry")
+h5.createArray("/geometry", "vertices", verticesVtk)
+h5.createGroup("/", "solution")
+h5.createGroup("/solution", "snapshot0")
+h5.createArray("/solution/snapshot0", "displacements", dispVtk)
+h5.close()
+
+# End of file
+



More information about the cig-commits mailing list