[cig-commits] r11284 - in short/3D/PyLith/trunk: . pylith/problems

brad at geodynamics.org brad at geodynamics.org
Wed Feb 27 20:33:25 PST 2008


Author: brad
Date: 2008-02-27 20:33:25 -0800 (Wed, 27 Feb 2008)
New Revision: 11284

Modified:
   short/3D/PyLith/trunk/TODO
   short/3D/PyLith/trunk/pylith/problems/Problem.py
Log:
Added check to make sure material and fault ids are unique.

Modified: short/3D/PyLith/trunk/TODO
===================================================================
--- short/3D/PyLith/trunk/TODO	2008-02-28 04:32:57 UTC (rev 11283)
+++ short/3D/PyLith/trunk/TODO	2008-02-28 04:33:25 UTC (rev 11284)
@@ -32,9 +32,6 @@
 
      a. Add check to make sure every material in mesh has a material model.
 
-        Add check for overlapping of material ids for bulk and
-        cohesive cells.
-
      b. When importing mesh, add check to make sure all cells have same
         number of vertices (especially CUBIT).
 

Modified: short/3D/PyLith/trunk/pylith/problems/Problem.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Problem.py	2008-02-28 04:32:57 UTC (rev 11283)
+++ short/3D/PyLith/trunk/pylith/problems/Problem.py	2008-02-28 04:33:25 UTC (rev 11284)
@@ -133,12 +133,27 @@
             "for spatial dimension '%d'." % \
             (self.dimension, mesh.dimension)
 
+    materialIds = {}
     for material in self.materials.components():
       if material.quadrature.spaceDim != self.dimension:
         raise ValueError, \
               "Spatial dimension of problem is '%d' but quadrature " \
               "for material '%s' is for spatial dimension '%d'." % \
               (self.dimension, material.label, material.quadrature.spaceDim)
+      if material.id in materialIds.keys():
+        raise ValueError, \
+            "ID values for materials '%s' and '%s' are both '%d'. " \
+            "Material id values must be unique." % \
+            (material.label, materialIds[material.id], material.id)
+      materialIds[material.id] = material.label
+    
+    for interface in self.interfaces.components():
+      if interface.id in materialIds.keys():
+        raise ValueError, \
+            "ID values for material '%s' and interface '%s' are both '%d'. " \
+            "Material and interface id values must be unique." % \
+            (materialIds[interface.id], interface.label, interface.id)
+      materialIds[interface.id] = interface.label
 
     self._logger.eventEnd(logEvent)
     return



More information about the cig-commits mailing list