[cig-commits] r20990 - in short/3D/PyLith/branches/v1.8-stable: pylith/meshio unittests/pytests/meshio unittests/pytests/meshio/data

brad at geodynamics.org brad at geodynamics.org
Mon Nov 5 23:05:15 PST 2012


Author: brad
Date: 2012-11-05 23:05:14 -0800 (Mon, 05 Nov 2012)
New Revision: 20990

Modified:
   short/3D/PyLith/branches/v1.8-stable/pylith/meshio/PointsList.py
   short/3D/PyLith/branches/v1.8-stable/unittests/pytests/meshio/TestOutputSolnPoints.py
   short/3D/PyLith/branches/v1.8-stable/unittests/pytests/meshio/data/Makefile.am
Log:
Added unit test to expose bug in reading points list with one point. Fixed bug.

Modified: short/3D/PyLith/branches/v1.8-stable/pylith/meshio/PointsList.py
===================================================================
--- short/3D/PyLith/branches/v1.8-stable/pylith/meshio/PointsList.py	2012-11-05 20:28:17 UTC (rev 20989)
+++ short/3D/PyLith/branches/v1.8-stable/pylith/meshio/PointsList.py	2012-11-06 07:05:14 UTC (rev 20990)
@@ -89,6 +89,10 @@
       points = numpy.loadtxt(self.filename,
                              comments=self.commentDelimiter, 
                              delimiter=self.valueDelimiter)
+    ndims = len(points.shape)
+    if ndims == 1:
+      spaceDim = points.shape[0]
+      points = points.reshape((1,spaceDim))
     return points
   
 

Modified: short/3D/PyLith/branches/v1.8-stable/unittests/pytests/meshio/TestOutputSolnPoints.py
===================================================================
--- short/3D/PyLith/branches/v1.8-stable/unittests/pytests/meshio/TestOutputSolnPoints.py	2012-11-05 20:28:17 UTC (rev 20989)
+++ short/3D/PyLith/branches/v1.8-stable/unittests/pytests/meshio/TestOutputSolnPoints.py	2012-11-06 07:05:14 UTC (rev 20990)
@@ -102,6 +102,22 @@
     return
   
   
+  def test_initialize2(self):
+    """
+    Test initialize().
+    """
+    output = OutputSolnPoints()
+    output.inventory.reader.inventory.filename = "data/point.txt"
+    output.inventory.reader._configure()
+    output.inventory.writer.inventory.filename = "test.vtk"
+    output.inventory.writer._configure()
+    output._configure()
+
+    output.preinitialize()
+    output.initialize(self.mesh, self.normalizer)
+    return
+
+
   def test_initialize(self):
     """
     Test initialize().

Modified: short/3D/PyLith/branches/v1.8-stable/unittests/pytests/meshio/data/Makefile.am
===================================================================
--- short/3D/PyLith/branches/v1.8-stable/unittests/pytests/meshio/data/Makefile.am	2012-11-05 20:28:17 UTC (rev 20989)
+++ short/3D/PyLith/branches/v1.8-stable/unittests/pytests/meshio/data/Makefile.am	2012-11-06 07:05:14 UTC (rev 20990)
@@ -23,7 +23,8 @@
 	cube2.txt \
 	twohex8.exo \
 	twohex8.txt \
-	points.txt
+	points.txt \
+	point.txt
 
 noinst_TMP = \
 	cube2_test.txt \



More information about the CIG-COMMITS mailing list