[cig-commits] r18711 - in short/3D/PyLith/branches/v1.6-stable: examples/3d/hex8 pylith/bc pylith/feassemble pylith/friction pylith/meshio unittests/pytests/bc unittests/pytests/faults unittests/pytests/materials unittests/pytests/meshio
brad at geodynamics.org
brad at geodynamics.org
Thu Jul 7 16:33:59 PDT 2011
Author: brad
Date: 2011-07-07 16:33:59 -0700 (Thu, 07 Jul 2011)
New Revision: 18711
Modified:
short/3D/PyLith/branches/v1.6-stable/examples/3d/hex8/pylithapp.cfg
short/3D/PyLith/branches/v1.6-stable/examples/3d/hex8/step03.cfg
short/3D/PyLith/branches/v1.6-stable/pylith/bc/DirichletBC.py
short/3D/PyLith/branches/v1.6-stable/pylith/feassemble/FIATLagrange.py
short/3D/PyLith/branches/v1.6-stable/pylith/feassemble/FIATSimplex.py
short/3D/PyLith/branches/v1.6-stable/pylith/friction/FrictionModel.py
short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterVTK.py
short/3D/PyLith/branches/v1.6-stable/unittests/pytests/bc/TestDirichletBC.py
short/3D/PyLith/branches/v1.6-stable/unittests/pytests/bc/TestNeumann.py
short/3D/PyLith/branches/v1.6-stable/unittests/pytests/faults/TestFaultCohesiveDyn.py
short/3D/PyLith/branches/v1.6-stable/unittests/pytests/faults/TestFaultCohesiveKin.py
short/3D/PyLith/branches/v1.6-stable/unittests/pytests/materials/TestElasticMaterial.py
short/3D/PyLith/branches/v1.6-stable/unittests/pytests/meshio/TestOutputSolnSubset.py
Log:
Added stricter validation. Require descriptive labels to be specified to allow better error messages. Updated unit tests.
Modified: short/3D/PyLith/branches/v1.6-stable/examples/3d/hex8/pylithapp.cfg
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/examples/3d/hex8/pylithapp.cfg 2011-07-07 23:04:05 UTC (rev 18710)
+++ short/3D/PyLith/branches/v1.6-stable/examples/3d/hex8/pylithapp.cfg 2011-07-07 23:33:59 UTC (rev 18711)
@@ -53,6 +53,7 @@
[pylithapp.timedependent.materials.upper_crust]
label = Upper crust material
id = 1
+db_properties.label = Properties for upper crust
db_properties.iohandler.filename = spatialdb/mat_elastic.spatialdb
quadrature.cell = pylith.feassemble.FIATLagrange
quadrature.cell.dimension = 3
@@ -60,6 +61,7 @@
[pylithapp.timedependent.materials.lower_crust]
label = Lower crust material
id = 2
+db_properties.label = Properties for lower crust
db_properties.iohandler.filename = spatialdb/mat_elastic.spatialdb
quadrature.cell = pylith.feassemble.FIATLagrange
quadrature.cell.dimension = 3
Modified: short/3D/PyLith/branches/v1.6-stable/examples/3d/hex8/step03.cfg
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/examples/3d/hex8/step03.cfg 2011-07-07 23:04:05 UTC (rev 18710)
+++ short/3D/PyLith/branches/v1.6-stable/examples/3d/hex8/step03.cfg 2011-07-07 23:33:59 UTC (rev 18711)
@@ -100,8 +100,10 @@
# The slip time and final slip are defined in spatial databases.
[pylithapp.timedependent.interfaces.fault.eq_srcs.rupture.slip_function]
+slip.label = Final slip
slip.iohandler.filename = spatialdb/finalslip.spatialdb
slip.query_type = linear
+slip_time.label = Slip initiation time
slip_time.iohandler.filename = spatialdb/sliptime.spatialdb
# ----------------------------------------------------------------------
Modified: short/3D/PyLith/branches/v1.6-stable/pylith/bc/DirichletBC.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/pylith/bc/DirichletBC.py 2011-07-07 23:04:05 UTC (rev 18710)
+++ short/3D/PyLith/branches/v1.6-stable/pylith/bc/DirichletBC.py 2011-07-07 23:33:59 UTC (rev 18711)
@@ -114,8 +114,13 @@
"""
Setup members using inventory.
"""
- BoundaryCondition._configure(self)
- TimeDependentPoints._configure(self)
+ try:
+ BoundaryCondition._configure(self)
+ TimeDependentPoints._configure(self)
+ except ValueError as err:
+ aliases = ", ".join(self.aliases)
+ raise ValueError("Error while configuring Dirichlet boundary condition "
+ "(%s):\n%s" % (aliases, err.message))
return
Modified: short/3D/PyLith/branches/v1.6-stable/pylith/feassemble/FIATLagrange.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/pylith/feassemble/FIATLagrange.py 2011-07-07 23:04:05 UTC (rev 18710)
+++ short/3D/PyLith/branches/v1.6-stable/pylith/feassemble/FIATLagrange.py 2011-07-07 23:33:59 UTC (rev 18711)
@@ -406,13 +406,18 @@
"""
Set members based using inventory.
"""
- ReferenceCell._configure(self)
- self.cellDim = self.inventory.dimension
- self.degree = self.inventory.degree
- self.order = self.inventory.order
-
- if self.order == -1:
- self.order = self.degree+1
+ try:
+ ReferenceCell._configure(self)
+ self.cellDim = self.inventory.dimension
+ self.degree = self.inventory.degree
+ self.order = self.inventory.order
+
+ if self.order == -1:
+ self.order = self.degree+1
+ except ValueError as err:
+ aliases = ", ".join(self.aliases)
+ raise ValueError("Error while configuring quadrature "
+ "(%s):\n%s" % (aliases, err.message))
return
Modified: short/3D/PyLith/branches/v1.6-stable/pylith/feassemble/FIATSimplex.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/pylith/feassemble/FIATSimplex.py 2011-07-07 23:04:05 UTC (rev 18710)
+++ short/3D/PyLith/branches/v1.6-stable/pylith/feassemble/FIATSimplex.py 2011-07-07 23:33:59 UTC (rev 18711)
@@ -158,12 +158,17 @@
"""
Set members based using inventory.
"""
- ReferenceCell._configure(self)
- self.shape = self.inventory.shape
- self.degree = self.inventory.degree
- self.order = self.inventory.order
- if self.order == -1:
- self.order = self.degree
+ try:
+ ReferenceCell._configure(self)
+ self.shape = self.inventory.shape
+ self.degree = self.inventory.degree
+ self.order = self.inventory.order
+ if self.order == -1:
+ self.order = self.degree
+ except ValueError as err:
+ aliases = ", ".join(self.aliases)
+ raise ValueError("Error while configuring quadrature "
+ "(%s):\n%s" % (aliases, err.message))
return
Modified: short/3D/PyLith/branches/v1.6-stable/pylith/friction/FrictionModel.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/pylith/friction/FrictionModel.py 2011-07-07 23:04:05 UTC (rev 18710)
+++ short/3D/PyLith/branches/v1.6-stable/pylith/friction/FrictionModel.py 2011-07-07 23:33:59 UTC (rev 18711)
@@ -32,6 +32,16 @@
from pylith.utils.PetscComponent import PetscComponent
+# Validator for label
+def validateLabel(value):
+ """
+ Validate descriptive label.
+ """
+ if 0 == len(value):
+ raise ValueError("Discriptive label for friction model not specified.")
+ return value
+
+
# FrictionModel class
class FrictionModel(PetscComponent):
"""
Modified: short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterVTK.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterVTK.py 2011-07-07 23:04:05 UTC (rev 18710)
+++ short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterVTK.py 2011-07-07 23:33:59 UTC (rev 18711)
@@ -82,4 +82,19 @@
return
+ # PRIVATE METHODS ////////////////////////////////////////////////////
+
+ def _configure(self):
+ """
+ Configure object.
+ """
+ try:
+ DataWriter._configure(self)
+ except ValueError as err:
+ aliases = ", ".join(self.aliases)
+ raise ValueError("Error while configuring VTK output "
+ "(%s):\n%s" % (aliases, err.message))
+
+ return
+
# End of file
Modified: short/3D/PyLith/branches/v1.6-stable/unittests/pytests/bc/TestDirichletBC.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/unittests/pytests/bc/TestDirichletBC.py 2011-07-07 23:04:05 UTC (rev 18710)
+++ short/3D/PyLith/branches/v1.6-stable/unittests/pytests/bc/TestDirichletBC.py 2011-07-07 23:33:59 UTC (rev 18711)
@@ -45,6 +45,7 @@
"""
from spatialdata.spatialdb.SimpleDB import SimpleDB
db = SimpleDB()
+ db.inventory.label = "simple database"
db._configure()
from spatialdata.spatialdb.TimeHistory import TimeHistory
@@ -53,6 +54,7 @@
from pylith.bc.DirichletBC import DirichletBC
bc = DirichletBC()
+ bc.inventory.label = "abc"
bc.inventory.dbInitial = db
bc.inventory.dbRate = db
bc.inventory.dbChange = db
Modified: short/3D/PyLith/branches/v1.6-stable/unittests/pytests/bc/TestNeumann.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/unittests/pytests/bc/TestNeumann.py 2011-07-07 23:04:05 UTC (rev 18710)
+++ short/3D/PyLith/branches/v1.6-stable/unittests/pytests/bc/TestNeumann.py 2011-07-07 23:33:59 UTC (rev 18711)
@@ -188,7 +188,6 @@
"""
from spatialdata.spatialdb.SimpleDB import SimpleDB
db = SimpleDB()
- db._configure()
db.inventory.label = "TestNeumann tri3"
db.inventory.iohandler.inventory.filename = "data/tri3_tractions.spatialdb"
db.inventory.iohandler._configure()
Modified: short/3D/PyLith/branches/v1.6-stable/unittests/pytests/faults/TestFaultCohesiveDyn.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/unittests/pytests/faults/TestFaultCohesiveDyn.py 2011-07-07 23:04:05 UTC (rev 18710)
+++ short/3D/PyLith/branches/v1.6-stable/unittests/pytests/faults/TestFaultCohesiveDyn.py 2011-07-07 23:33:59 UTC (rev 18711)
@@ -46,6 +46,7 @@
Test _configure().
"""
fault = FaultCohesiveDyn()
+ fault.inventory.faultLabel = "fault group"
fault._configure()
return
@@ -299,6 +300,7 @@
from pylith.friction.StaticFriction import StaticFriction
friction = StaticFriction()
+ friction.inventory.label = "Static friction"
friction.inventory.dbProperties = dbFriction
friction._configure()
Modified: short/3D/PyLith/branches/v1.6-stable/unittests/pytests/faults/TestFaultCohesiveKin.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/unittests/pytests/faults/TestFaultCohesiveKin.py 2011-07-07 23:04:05 UTC (rev 18710)
+++ short/3D/PyLith/branches/v1.6-stable/unittests/pytests/faults/TestFaultCohesiveKin.py 2011-07-07 23:33:59 UTC (rev 18711)
@@ -46,6 +46,7 @@
Test _configure().
"""
fault = FaultCohesiveKin()
+ fault.inventory.faultLabel = "fault group"
fault._configure()
return
@@ -65,6 +66,7 @@
Test useFaultMesh().
"""
fault = FaultCohesiveKin()
+ fault.inventory.faultLabel = "fault group"
fault._configure()
fault.useFaultMesh(True);
@@ -77,7 +79,8 @@
"""
Test faultMeshFilename().
"""
- fault = FaultCohesiveKin()
+ fault = FaultCohesiveKin()
+ fault.inventory.faultLabel = "fault group"
fault._configure()
filename = "SanAndreas.inp"
Modified: short/3D/PyLith/branches/v1.6-stable/unittests/pytests/materials/TestElasticMaterial.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/unittests/pytests/materials/TestElasticMaterial.py 2011-07-07 23:04:05 UTC (rev 18710)
+++ short/3D/PyLith/branches/v1.6-stable/unittests/pytests/materials/TestElasticMaterial.py 2011-07-07 23:33:59 UTC (rev 18711)
@@ -49,6 +49,7 @@
db._configure()
material = self.material
+ material.inventory.label = "Elastic material"
material.inventory.dbInitialStress = db
material.inventory.useInitialStress = True
material._configure()
@@ -69,6 +70,7 @@
db._configure()
material = self.material
+ material.inventory.label = "Elastic material"
material.inventory.dbInitialStrain = db
material.inventory.useInitialStrain = True
material._configure()
Modified: short/3D/PyLith/branches/v1.6-stable/unittests/pytests/meshio/TestOutputSolnSubset.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/unittests/pytests/meshio/TestOutputSolnSubset.py 2011-07-07 23:04:05 UTC (rev 18710)
+++ short/3D/PyLith/branches/v1.6-stable/unittests/pytests/meshio/TestOutputSolnSubset.py 2011-07-07 23:33:59 UTC (rev 18711)
@@ -67,6 +67,7 @@
"""
output = OutputSolnSubset()
output.inventory.writer._configure()
+ output.inventory.label = "nodeset"
output._configure()
return
More information about the CIG-COMMITS
mailing list