[cig-commits] r16223 - in short/3D/PyLith/trunk: . libsrc/faults modulesrc modulesrc/faults unittests/pytests unittests/pytests/faults unittests/pytests/faults/data unittests/pytests/friction unittests/pytests/friction/data

brad at geodynamics.org brad at geodynamics.org
Wed Feb 3 08:48:19 PST 2010


Author: brad
Date: 2010-02-03 08:48:18 -0800 (Wed, 03 Feb 2010)
New Revision: 16223

Added:
   short/3D/PyLith/trunk/unittests/pytests/faults/TestFaultCohesiveDynL.py
   short/3D/PyLith/trunk/unittests/pytests/faults/data/tri3_initialtractions.spatialdb
   short/3D/PyLith/trunk/unittests/pytests/faults/data/tri3_staticfriction.spatialdb
   short/3D/PyLith/trunk/unittests/pytests/friction/
   short/3D/PyLith/trunk/unittests/pytests/friction/Makefile.am
   short/3D/PyLith/trunk/unittests/pytests/friction/TestFrictionModel.py
   short/3D/PyLith/trunk/unittests/pytests/friction/TestStaticFriction.py
   short/3D/PyLith/trunk/unittests/pytests/friction/data/
   short/3D/PyLith/trunk/unittests/pytests/friction/data/Makefile.am
   short/3D/PyLith/trunk/unittests/pytests/friction/data/staticfriction.spatialdb
   short/3D/PyLith/trunk/unittests/pytests/friction/testfriction.py
Modified:
   short/3D/PyLith/trunk/configure.ac
   short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveDynL.hh
   short/3D/PyLith/trunk/modulesrc/Makefile.am
   short/3D/PyLith/trunk/modulesrc/faults/FaultCohesiveDynL.i
   short/3D/PyLith/trunk/unittests/pytests/Makefile.am
   short/3D/PyLith/trunk/unittests/pytests/faults/data/Makefile.am
   short/3D/PyLith/trunk/unittests/pytests/faults/testfaults.py
Log:
Added some Python unit tests for fault friction stuff.

Modified: short/3D/PyLith/trunk/configure.ac
===================================================================
--- short/3D/PyLith/trunk/configure.ac	2010-02-03 13:38:45 UTC (rev 16222)
+++ short/3D/PyLith/trunk/configure.ac	2010-02-03 16:48:18 UTC (rev 16223)
@@ -271,6 +271,8 @@
 		unittests/pytests/faults/data/Makefile
 		unittests/pytests/feassemble/Makefile
 		unittests/pytests/feassemble/data/Makefile
+		unittests/pytests/friction/Makefile
+		unittests/pytests/friction/data/Makefile
 		unittests/pytests/materials/Makefile
 		unittests/pytests/materials/data/Makefile
 		unittests/pytests/meshio/Makefile

Modified: short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveDynL.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveDynL.hh	2010-02-03 13:38:45 UTC (rev 16222)
+++ short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveDynL.hh	2010-02-03 16:48:18 UTC (rev 16223)
@@ -113,6 +113,12 @@
    */
   void dbInitialTract(spatialdata::spatialdb::SpatialDB* db);
   
+  /** Set the friction (constitutive) model.
+   *
+   * @param model Fault constutive model.
+   */
+  void frictionModel(friction::FrictionModel* const model);
+
   /** Initialize fault. Determine orientation and setup boundary
    * condition parameters.
    *
@@ -222,12 +228,6 @@
    */
   bool useLagrangeConstraints(void) const;
 
-  /** Get the friction (constitutive) model.
-   *
-   * @param model Fault constutive model.
-   */
-  void frictionModel(friction::FrictionModel* const model);
-
   /** Get fields associated with fault.
    *
    * @returns Fields associated with fault.

Modified: short/3D/PyLith/trunk/modulesrc/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/modulesrc/Makefile.am	2010-02-03 13:38:45 UTC (rev 16222)
+++ short/3D/PyLith/trunk/modulesrc/Makefile.am	2010-02-03 16:48:18 UTC (rev 16223)
@@ -15,6 +15,7 @@
 	bc \
 	faults \
 	feassemble \
+	friction \
 	materials \
 	meshio \
 	mpi \

Modified: short/3D/PyLith/trunk/modulesrc/faults/FaultCohesiveDynL.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/faults/FaultCohesiveDynL.i	2010-02-03 13:38:45 UTC (rev 16222)
+++ short/3D/PyLith/trunk/modulesrc/faults/FaultCohesiveDynL.i	2010-02-03 16:48:18 UTC (rev 16223)
@@ -41,6 +41,12 @@
        */
       void dbInitialTract(spatialdata::spatialdb::SpatialDB* db);
   
+      /** Set the friction (constitutive) model.
+       *
+       * @param model Fault constutive model.
+       */
+      void frictionModel(pylith::friction::FrictionModel* const model);
+
       /** Initialize fault. Determine orientation and setup boundary
        * condition parameters.
        *

Modified: short/3D/PyLith/trunk/unittests/pytests/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/Makefile.am	2010-02-03 13:38:45 UTC (rev 16222)
+++ short/3D/PyLith/trunk/unittests/pytests/Makefile.am	2010-02-03 16:48:18 UTC (rev 16223)
@@ -14,6 +14,7 @@
 	bc \
 	faults \
 	feassemble \
+	friction \
 	materials \
 	meshio \
 	mpi \

Added: short/3D/PyLith/trunk/unittests/pytests/faults/TestFaultCohesiveDynL.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/faults/TestFaultCohesiveDynL.py	                        (rev 0)
+++ short/3D/PyLith/trunk/unittests/pytests/faults/TestFaultCohesiveDynL.py	2010-02-03 16:48:18 UTC (rev 16223)
@@ -0,0 +1,339 @@
+#!/usr/bin/env python
+#
+# ======================================================================
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# {LicenseText}
+#
+# ======================================================================
+#
+
+## @file unittests/pytests/faults/TestFaultCohesiveDynL.py
+
+## @brief Unit testing of FaultCohesiveDynL object.
+
+import unittest
+
+from pylith.faults.FaultCohesiveDynL import FaultCohesiveDynL
+
+from spatialdata.geocoords.CSCart import CSCart
+from pyre.units.time import second
+
+# ----------------------------------------------------------------------
+class TestFaultCohesiveDynL(unittest.TestCase):
+  """
+  Unit testing of Fault object.
+  """
+
+  def test_constructor(self):
+    """
+    Test constructor.
+    """
+    fault = FaultCohesiveDynL()
+    return
+
+
+  def test_configure(self):
+    """
+    Test _configure().
+    """
+    fault = FaultCohesiveDynL()
+    fault._configure()
+    return
+
+
+  def test_implementsIntegrator(self):
+    """
+    Test to make sure FaultCohesiveDynL satisfies integrator requirements.
+    """
+    fault = FaultCohesiveDynL()
+    from pylith.feassemble.Integrator import implementsIntegrator
+    self.failUnless(implementsIntegrator(fault))
+    return
+    
+
+  def test_adjustTopology(self):
+    """
+    Test adjustTopology().
+
+    WARNING: This is not a rigorous test of adjustTopology() because we
+    neither set the input fields or verify the results.
+    """
+    cs = CSCart()
+    cs.inventory.spaceDim = 2
+    cs._configure()
+    
+    from spatialdata.units.Nondimensional import Nondimensional
+    normalizer = Nondimensional()
+    normalizer._configure()
+
+    from pylith.meshio.MeshIOAscii import MeshIOAscii
+    importer = MeshIOAscii()
+    importer.inventory.filename = "data/tri3.mesh"
+    importer.inventory.coordsys = cs
+    importer._configure()
+    mesh = importer.read(debug=False, interpolate=False)
+
+    fault = FaultCohesiveDynL()
+    fault.inventory.matId = 10
+    fault.inventory.faultLabel = "fault"
+    fault._configure()
+
+    nvertices = fault.numVertices(mesh)
+    firstFaultVertex = 0
+    firstLagrangeVertex = nvertices
+    firstFaultCell      = 2*nvertices
+    fault.adjustTopology(mesh, firstFaultVertex, firstLagrangeVertex,
+                         firstFaultCell)
+
+    # We should really add something here to check to make sure things
+    # actually initialized correctly    
+    return
+
+
+  def test_initialize(self):
+    """
+    Test initialize().
+
+    WARNING: This is not a rigorous test of initialize() because we
+    neither set the input fields or verify the results.
+    """
+    (mesh, fault, fields) = self._initialize()
+    
+    # We should really add something here to check to make sure things
+    # actually initialized correctly    
+    return
+
+
+  def test_timeStep(self):
+    """
+    Test timeStep().
+    """
+    dt = 2.4
+    (mesh, fault, fields) = self._initialize()
+    fault.timeStep(dt)
+
+    # No test of result
+    return
+
+  
+  def test_stableTimeStep(self):
+    """
+    Test stableTimeStep().
+    """
+    (mesh, fault, fields) = self._initialize()
+
+    self.assertEqual(1.0e+30, fault.stableTimeStep(mesh))
+    return
+
+  
+  def test_needNewJacobian(self):
+    """
+    Test needNewJacobian().
+    """
+    (mesh, fault, fields) = self._initialize()
+    self.assertEqual(True, fault.needNewJacobian())
+    return
+
+  
+  def test_useSolnIncr(self):
+    """
+    Test useSolnIncr().
+    """
+    (mesh, fault, fields) = self._initialize()
+    fault.useSolnIncr(True)
+
+    # We should really add something here to check to make sure things
+    # actually initialized correctly    
+    return
+
+  
+  def test_integrateResidual(self):
+    """
+    Test integrateResidual().
+
+    WARNING: This is not a rigorous test of integrateResidual() because we
+    neither set the input fields or verify the results.
+    """
+    (mesh, fault, fields) = self._initialize()
+
+    residual = fields.get("residual")
+    t = 1.0
+    fault.integrateResidual(residual, t, fields)
+
+    # We should really add something here to check to make sure things
+    # actually initialized correctly    
+    return
+
+  
+  def test_integrateJacobian(self):
+    """
+    Test integrateJacobian().
+
+    WARNING: This is not a rigorous test of integrateJacobian() because we
+    neither set the input fields or verify the results.
+    """
+    (mesh, fault, fields) = self._initialize()
+
+    from pylith.topology.Jacobian import Jacobian
+    jacobian = Jacobian(fields)
+    jacobian.zero()
+    t = 1.0
+    fault.integrateJacobian(jacobian, t, fields)
+    self.assertEqual(False, fault.needNewJacobian())
+
+    # We should really add something here to check to make sure things
+    # actually initialized correctly    
+    return
+
+  
+  def test_poststep(self):
+    """
+    Test poststep().
+
+    WARNING: This is not a rigorous test of poststep() because we
+    neither set the input fields or verify the results.
+    """
+    (mesh, fault, fields) = self._initialize()
+
+    t = 0.50
+    residual = fields.get("residual")
+    fault.integrateResidual(residual, t, fields)
+
+    dt = 0.1
+    totalTime = 5
+    fault.poststep(t, dt, totalTime, fields)
+
+    # We should really add something here to check to make sure things
+    # actually initialized correctly    
+    return
+  
+
+  def test_finalize(self):
+    """
+    Test finalize().
+
+    WARNING: This is not a rigorous test of finalize() because we
+    neither set the input fields or verify the results.
+    """
+    (mesh, fault, fields) = self._initialize()
+
+    fault.finalize()
+
+    # We should really add something here to check to make sure things
+    # actually initialized correctly.
+    return
+
+
+  def test_factory(self):
+    """
+    Test factory method.
+    """
+    from pylith.faults.FaultCohesiveDynL import fault
+    f = fault()
+    return
+
+
+  # PRIVATE METHODS ////////////////////////////////////////////////////
+
+  def _initialize(self):
+    """
+    Initialize fault.
+    """
+    dt = 2.4
+    
+    from spatialdata.units.Nondimensional import Nondimensional
+    normalizer = Nondimensional()
+    normalizer._configure()
+
+    # Setup mesh
+    cs = CSCart()
+    cs.inventory.spaceDim = 2
+    cs._configure()
+
+    from pylith.meshio.MeshIOAscii import MeshIOAscii
+    importer = MeshIOAscii()
+    importer.inventory.filename = "data/tri3.mesh"
+    importer.inventory.coordsys = cs
+    importer._configure()
+    mesh = importer.read(debug=False, interpolate=False)
+
+    # Setup quadrature
+    from pylith.feassemble.FIATSimplex import FIATSimplex
+    cell = FIATSimplex()
+    cell.inventory.shape = "line"
+    cell.inventory.degree = 1
+    cell.inventory.order = 1
+    cell._configure()
+    from pylith.feassemble.Quadrature import SubMeshQuadrature
+    quadrature = SubMeshQuadrature()
+    quadrature.inventory.cell = cell
+    quadrature._configure()
+
+    # Setup earthquake source
+    from spatialdata.spatialdb.SimpleDB import SimpleDB
+    from spatialdata.spatialdb.SimpleIOAscii import SimpleIOAscii
+    ioTractions = SimpleIOAscii()
+    ioTractions.inventory.filename = "data/tri3_initialtractions.spatialdb"
+    ioTractions._configure()
+    dbTractions = SimpleDB()
+    dbTractions.inventory.iohandler = ioTractions
+    dbTractions.inventory.label = "initial tractions"
+    dbTractions._configure()
+    
+    ioFriction = SimpleIOAscii()
+    ioFriction.inventory.filename = "data/tri3_staticfriction.spatialdb"
+    ioFriction._configure()
+    dbFriction = SimpleDB()
+    dbFriction.inventory.iohandler = ioFriction
+    dbFriction.inventory.label = "friction"
+    dbFriction._configure()
+    
+    from pylith.friction.StaticFriction import StaticFriction
+    friction = StaticFriction()
+    friction.inventory.dbProperties = dbFriction
+    friction._configure()
+
+    # Setup fault
+    fault = FaultCohesiveDynL()
+    fault.inventory.output.inventory.writer._configure()
+    fault.inventory.output._configure()
+    fault.inventory.matId = 10
+    fault.inventory.faultLabel = "fault"
+    fault.inventory.upDir = [0, 0, 1]
+    fault.inventory.normalDir = [1, 0, 0]
+    fault.inventory.faultQuadrature = quadrature
+    fault.inventory.friction = friction
+    fault._configure()
+
+    nvertices = fault.numVertices(mesh)
+    firstFaultVertex = 0
+    firstLagrangeVertex = nvertices
+    firstFaultCell      = 2*nvertices
+    fault.adjustTopology(mesh, firstFaultVertex, firstLagrangeVertex,
+                         firstFaultCell)
+    fault.preinitialize(mesh)
+    fault.timeStep(dt)
+    fault.verifyConfiguration()
+    from pyre.units.time import s
+    fault.initialize(totalTime=0.0*s, numTimeSteps=1, normalizer=normalizer)
+
+    # Setup fields
+    from pylith.topology.SolutionFields import SolutionFields
+    fields = SolutionFields(mesh)
+    fields.add("residual", "residual")
+    fields.add("dispIncr(t->t+dt)", "displacement_increment")
+    fields.add("disp(t)", "displacement")
+    fields.solutionName("dispIncr(t->t+dt)")
+    residual = fields.get("residual")
+    residual.newSection(residual.VERTICES_FIELD, cs.spaceDim())
+    residual.allocate()
+    residual.zero()
+    fields.copyLayout("residual")
+    
+    return (mesh, fault, fields)
+
+
+# End of file 

Modified: short/3D/PyLith/trunk/unittests/pytests/faults/data/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/faults/data/Makefile.am	2010-02-03 13:38:45 UTC (rev 16222)
+++ short/3D/PyLith/trunk/unittests/pytests/faults/data/Makefile.am	2010-02-03 16:48:18 UTC (rev 16223)
@@ -15,7 +15,9 @@
 	tri3.mesh \
 	tri3_finalslip.spatialdb \
 	tri3_sliptime.spatialdb \
-	tri3_peakrate.spatialdb
+	tri3_peakrate.spatialdb \
+	tri3_initialtractions.spatialdb \
+	tri3_staticfriction.spatialdb
 
 noinst_TMP =
 

Added: short/3D/PyLith/trunk/unittests/pytests/faults/data/tri3_initialtractions.spatialdb
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/faults/data/tri3_initialtractions.spatialdb	                        (rev 0)
+++ short/3D/PyLith/trunk/unittests/pytests/faults/data/tri3_initialtractions.spatialdb	2010-02-03 16:48:18 UTC (rev 16223)
@@ -0,0 +1,15 @@
+#SPATIAL.ascii 1
+SimpleDB {
+  num-values = 2
+  value-names =  traction-shear traction-normal
+  value-units =  Pa   Pa
+  num-locs = 2
+  data-dim = 1
+  space-dim = 2
+  cs-data = cartesian {
+    to-meters = 1.0
+    space-dim = 2
+  }
+}
+0.0  +1.0   1.0   -2.0
+0.0  -1.0   1.1   -2.1

Added: short/3D/PyLith/trunk/unittests/pytests/faults/data/tri3_staticfriction.spatialdb
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/faults/data/tri3_staticfriction.spatialdb	                        (rev 0)
+++ short/3D/PyLith/trunk/unittests/pytests/faults/data/tri3_staticfriction.spatialdb	2010-02-03 16:48:18 UTC (rev 16223)
@@ -0,0 +1,15 @@
+#SPATIAL.ascii 1
+SimpleDB {
+  num-values = 1
+  value-names =  friction-coefficient
+  value-units =  none
+  num-locs = 2
+  data-dim = 1
+  space-dim = 2
+  cs-data = cartesian {
+    to-meters = 1.0
+    space-dim = 2
+  }
+}
+0.0   1.0   0.6
+0.0  -1.0   0.4

Modified: short/3D/PyLith/trunk/unittests/pytests/faults/testfaults.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/faults/testfaults.py	2010-02-03 13:38:45 UTC (rev 16222)
+++ short/3D/PyLith/trunk/unittests/pytests/faults/testfaults.py	2010-02-03 16:48:18 UTC (rev 16223)
@@ -77,6 +77,9 @@
     from TestFaultCohesiveKin import TestFaultCohesiveKin
     suite.addTest(unittest.makeSuite(TestFaultCohesiveKin))
 
+    from TestFaultCohesiveDynL import TestFaultCohesiveDynL
+    suite.addTest(unittest.makeSuite(TestFaultCohesiveDynL))
+
     from TestSingleRupture import TestSingleRupture
     suite.addTest(unittest.makeSuite(TestSingleRupture))
 

Added: short/3D/PyLith/trunk/unittests/pytests/friction/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/friction/Makefile.am	                        (rev 0)
+++ short/3D/PyLith/trunk/unittests/pytests/friction/Makefile.am	2010-02-03 16:48:18 UTC (rev 16223)
@@ -0,0 +1,28 @@
+# -*- Makefile -*-
+#
+# ----------------------------------------------------------------------
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+subpackage = friction
+include $(top_srcdir)/subpackage.am
+
+SUBDIRS = data
+
+TESTS = testfriction.py
+dist_check_SCRIPTS = testfriction.py
+
+TESTS_ENVIRONMENT = $(PYTHON)
+
+noinst_PYTHON = \
+	TestFrictionModel.py \
+	TestStaticFriction.py
+
+
+# End of file 

Added: short/3D/PyLith/trunk/unittests/pytests/friction/TestFrictionModel.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/friction/TestFrictionModel.py	                        (rev 0)
+++ short/3D/PyLith/trunk/unittests/pytests/friction/TestFrictionModel.py	2010-02-03 16:48:18 UTC (rev 16223)
@@ -0,0 +1,109 @@
+#!/usr/bin/env python
+#
+# ======================================================================
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# {LicenseText}
+#
+# ======================================================================
+#
+
+## @file unittests/pytests/friction/TestFrictionModel.py
+
+## @brief Unit testing of Material object.
+
+import unittest
+
+# ----------------------------------------------------------------------
+class TestFrictionModel(unittest.TestCase):
+  """
+  Unit testing of Material object.
+  """
+
+  def setUp(self):
+    """
+    Setup test subject.
+    """
+    from pylith.friction.StaticFriction import StaticFriction
+    self.friction = StaticFriction()
+    return
+    
+
+  def testLabel(self):
+    """
+    Test label().
+    """
+    label = "friction abc"
+    self.friction.label(label)
+    self.assertEqual(label, self.friction.label())
+    return
+
+
+  def testTimeStep(self):
+    """
+    Test timeStep().
+    """
+    dt = 0.5
+    self.friction.timeStep(dt)
+    self.assertEqual(dt, self.friction.timeStep())
+    return
+
+
+  def testDBProperties(self):
+    """
+    Test dbProperties().
+    """
+    from spatialdata.spatialdb.SimpleDB import SimpleDB
+    from spatialdata.spatialdb.SimpleIOAscii import SimpleIOAscii
+    iohandler = SimpleIOAscii()
+    iohandler.inventory.filename = "data/staticfriction.spatialdb"
+    iohandler._configure()
+    db = SimpleDB()
+    db.inventory.label = "friction properties"
+    db.inventory.iohandler = iohandler
+    db._configure()
+
+    self.friction.dbProperties(db)
+
+    # No test of result.
+    return
+
+
+  def testDBInitialState(self):
+    """
+    Test dbInitialState().
+    """
+    from spatialdata.spatialdb.SimpleDB import SimpleDB
+    from spatialdata.spatialdb.SimpleIOAscii import SimpleIOAscii
+    iohandler = SimpleIOAscii()
+    iohandler.inventory.filename = "data/staticfriction.spatialdb"
+    iohandler._configure()
+    db = SimpleDB()
+    db.inventory.label = "friction properties"
+    db.inventory.iohandler = iohandler
+    db._configure()
+
+    self.friction.dbInitialState(db)
+
+    # No test of result.
+    return
+
+
+  def testNormalizer(self):
+    """
+    Test normalizer().
+    """
+    from spatialdata.units.Nondimensional import Nondimensional
+    normalizer = Nondimensional()
+    normalizer._configure()
+
+
+    self.friction.normalizer(normalizer)
+
+    # No test of result.
+    return
+
+
+# End of file 

Added: short/3D/PyLith/trunk/unittests/pytests/friction/TestStaticFriction.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/friction/TestStaticFriction.py	                        (rev 0)
+++ short/3D/PyLith/trunk/unittests/pytests/friction/TestStaticFriction.py	2010-02-03 16:48:18 UTC (rev 16223)
@@ -0,0 +1,51 @@
+#!/usr/bin/env python
+#
+# ======================================================================
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# {LicenseText}
+#
+# ======================================================================
+#
+
+## @file unittests/pytests/friction/TestStaticFriction.py
+
+## @brief Unit testing of StaticFriction object.
+
+import unittest
+
+from pylith.friction.StaticFriction import StaticFriction
+
+# ----------------------------------------------------------------------
+class TestStaticFriction(unittest.TestCase):
+  """
+  Unit testing of StaticFriction object.
+  """
+
+  def setUp(self):
+    """
+    Setup test subject.
+    """
+    self.friction = StaticFriction()
+    return
+  
+
+  def test_constructor(self):
+    """
+    Test constructor.
+    """
+    return
+
+
+  def test_factory(self):
+    """
+    Test factory method.
+    """
+    from pylith.friction.StaticFriction import friction_model
+    m = friction_model()
+    return
+
+
+# End of file 

Added: short/3D/PyLith/trunk/unittests/pytests/friction/data/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/friction/data/Makefile.am	                        (rev 0)
+++ short/3D/PyLith/trunk/unittests/pytests/friction/data/Makefile.am	2010-02-03 16:48:18 UTC (rev 16223)
@@ -0,0 +1,30 @@
+# -*- Makefile -*-
+#
+# ----------------------------------------------------------------------
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+dist_noinst_DATA = \
+	staticfriction.spatialdb
+
+noinst_TMP =
+
+# 'export' the input files by performing a mock install
+export_datadir = $(top_builddir)/unittests/pytests/faults/data
+export-data: $(dist_noinst_DATA)
+	if [ "X$(top_srcdir)" != "X$(top_builddir)" ]; then for f in $(dist_noinst_DATA); do $(install_sh_DATA) $(srcdir)/$$f $(export_datadir); done; fi
+
+clean-data:
+	if [ "X$(top_srcdir)" != "X$(top_builddir)" ]; then for f in $(dist_noinst_DATA) $(noinst_TMP); do $(RM) $(RM_FLAGS) $(export_datadir)/$$f; done; fi
+
+BUILT_SOURCES = export-data
+clean-local: clean-data
+
+
+# End of file 

Added: short/3D/PyLith/trunk/unittests/pytests/friction/data/staticfriction.spatialdb
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/friction/data/staticfriction.spatialdb	                        (rev 0)
+++ short/3D/PyLith/trunk/unittests/pytests/friction/data/staticfriction.spatialdb	2010-02-03 16:48:18 UTC (rev 16223)
@@ -0,0 +1,15 @@
+#SPATIAL.ascii 1
+SimpleDB {
+  num-values = 1
+  value-names =  friction-coefficient
+  value-units =  none
+  num-locs = 2
+  data-dim = 1
+  space-dim = 2
+  cs-data = cartesian {
+    to-meters = 1.0
+    space-dim = 2
+  }
+}
+0.0   1.0   0.6
+0.0  -1.0   0.4

Added: short/3D/PyLith/trunk/unittests/pytests/friction/testfriction.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/friction/testfriction.py	                        (rev 0)
+++ short/3D/PyLith/trunk/unittests/pytests/friction/testfriction.py	2010-02-03 16:48:18 UTC (rev 16223)
@@ -0,0 +1,74 @@
+#!/usr/bin/env python
+#
+# ======================================================================
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# {LicenseText}
+#
+# ======================================================================
+#
+
+## @file unittests/friction/testfriction.py
+
+## @brief Python application for testing fault constitutive models.
+
+from pyre.applications.Script import Script
+
+import unittest
+
+class TestApp(Script):
+  """
+  Test application.
+  """
+
+  # PUBLIC METHODS /////////////////////////////////////////////////////
+
+  def __init__(self, name="testapp"):
+    """
+    Constructor.
+    """
+    Script.__init__(self, name)
+    return
+
+
+  def main(self):
+    """
+    Run the application.
+    """
+    from pylith.utils.PetscManager import PetscManager
+    petsc = PetscManager()
+    petsc.initialize()
+
+    unittest.TextTestRunner(verbosity=2).run(self._suite())
+
+    petsc.finalize()
+    return
+
+
+  # PRIVATE METHODS ////////////////////////////////////////////////////
+
+  def _suite(self):
+    """
+    Setup the test suite.
+    """
+
+    suite = unittest.TestSuite()
+
+    from TestStaticFriction import TestStaticFriction
+    suite.addTest(unittest.makeSuite(TestStaticFriction))
+
+    from TestFrictionModel import TestFrictionModel
+    suite.addTest(unittest.makeSuite(TestFrictionModel))
+
+    return suite
+
+
+# ----------------------------------------------------------------------
+if __name__ == '__main__':
+  app = TestApp()
+  app.run()
+
+
+# End of file 


Property changes on: short/3D/PyLith/trunk/unittests/pytests/friction/testfriction.py
___________________________________________________________________
Name: svn:executable
   + *



More information about the CIG-COMMITS mailing list