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

brad at geodynamics.org brad at geodynamics.org
Thu Nov 8 19:57:00 PST 2012


Author: brad
Date: 2012-11-08 19:56:59 -0800 (Thu, 08 Nov 2012)
New Revision: 21005

Modified:
   short/3D/PyLith/branches/v1.8-stable/pylith/bc/DirichletBC.py
   short/3D/PyLith/branches/v1.8-stable/unittests/pytests/bc/TestDirichletBC.py
Log:
Added check to make sure DOF in Dirichlet BC is valid.

Modified: short/3D/PyLith/branches/v1.8-stable/pylith/bc/DirichletBC.py
===================================================================
--- short/3D/PyLith/branches/v1.8-stable/pylith/bc/DirichletBC.py	2012-11-08 05:37:23 UTC (rev 21004)
+++ short/3D/PyLith/branches/v1.8-stable/pylith/bc/DirichletBC.py	2012-11-09 03:56:59 UTC (rev 21005)
@@ -80,6 +80,11 @@
     self._eventLogger.eventBegin(logEvent)
 
     BoundaryCondition.verifyConfiguration(self, self.mesh)
+    spaceDim = self.mesh.coordsys().spaceDim()
+    for d in self.bcDOF:
+      if d < 0 or d >= spaceDim:
+        raise ValueError("Attempting to constrain DOF (%d) that doesn't exist. Space dimension is %d." % \
+                         (d, spaceDim))
 
     self._eventLogger.eventEnd(logEvent)
     return

Modified: short/3D/PyLith/branches/v1.8-stable/unittests/pytests/bc/TestDirichletBC.py
===================================================================
--- short/3D/PyLith/branches/v1.8-stable/unittests/pytests/bc/TestDirichletBC.py	2012-11-08 05:37:23 UTC (rev 21004)
+++ short/3D/PyLith/branches/v1.8-stable/unittests/pytests/bc/TestDirichletBC.py	2012-11-09 03:56:59 UTC (rev 21005)
@@ -99,6 +99,22 @@
     return
 
 
+  def test_verifyConfiguration(self):
+    """
+    Test verifyConfiguration().
+
+    WARNING: This is not a rigorous test of verifyConfiguration() because we
+    don't verify the results.
+    """
+
+    (mesh, bc, field) = self._initialize()
+    bc.verifyConfiguration()
+
+    # We should really add something here to check to make sure things
+    # actually initialized correctly    
+    return
+
+
   def test_setConstraintSizes(self):
     """
     Test setConstraintSizes().



More information about the CIG-COMMITS mailing list