[cig-commits] r6804 - in short/3D/PyLith/trunk: . pylith/faults unittests/libtests/faults unittests/libtests/feassemble unittests/libtests/materials

brad at geodynamics.org brad at geodynamics.org
Tue May 8 17:46:03 PDT 2007


Author: brad
Date: 2007-05-08 17:46:03 -0700 (Tue, 08 May 2007)
New Revision: 6804

Modified:
   short/3D/PyLith/trunk/TODO
   short/3D/PyLith/trunk/pylith/faults/BruneSlipFn.py
   short/3D/PyLith/trunk/pylith/faults/EqKinSrc.py
   short/3D/PyLith/trunk/pylith/faults/Fault.py
   short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py
   short/3D/PyLith/trunk/pylith/faults/SlipTimeFn.py
   short/3D/PyLith/trunk/unittests/libtests/faults/Makefile.am
   short/3D/PyLith/trunk/unittests/libtests/feassemble/Makefile.am
   short/3D/PyLith/trunk/unittests/libtests/materials/Makefile.am
Log:
Worked on filling in Python implementation of kinematic earthquake source. Fixed linking of C++ unit tests.

Modified: short/3D/PyLith/trunk/TODO
===================================================================
--- short/3D/PyLith/trunk/TODO	2007-05-08 23:33:52 UTC (rev 6803)
+++ short/3D/PyLith/trunk/TODO	2007-05-09 00:46:03 UTC (rev 6804)
@@ -53,17 +53,11 @@
 2. Implement MeshIOLagrit
    b. unit tests at C++ level
      BinaryIO
-     GMVFileAscii
-     GMVFileBinary
-     PsetFileAscii
-     PsetFileBinary
-     MeshIOLagrit
-   e. unit tests at Python level
-     MeshIOLagrit
+     Check unit tests on big endian machine.
 
 3. Implement HDF5 output
 
-4. Implement PML boundary conditions
+4. Implement absorbing boundary conditions
 
 5. Create suite of simple full test cases
 
@@ -71,16 +65,9 @@
 SECONDARY PRIORITIES
 ======================================================================
 
-1. Implement MeshIOCubit
+1. Implement MeshIOHDF5 & HDF5 (helper class)
    a. C++ objects
    b. unit tests at C++ level
-   c. Python object (MeshIOCubit)
-   d. bindings
-   e. unit tests at Python level
-
-2. Implement MeshIOHDF5 & HDF5 (helper class)
-   a. C++ objects
-   b. unit tests at C++ level
    c. Python object (MeshIOHDF5)
    d. bindings
    e. unit tests at Python level

Modified: short/3D/PyLith/trunk/pylith/faults/BruneSlipFn.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/BruneSlipFn.py	2007-05-08 23:33:52 UTC (rev 6803)
+++ short/3D/PyLith/trunk/pylith/faults/BruneSlipFn.py	2007-05-09 00:46:03 UTC (rev 6804)
@@ -42,12 +42,23 @@
     ## @li None
     ##
     ## \b Facilities
+    ## @li \b slip Spatial database of final slip
+    ## @li \b slip_time Spatial database of slip initiation time
     ## @li \b slip_rate Spatial database of peak slip rate
 
     import pyre.inventory
 
     from spatialdata.spatialdb.SimpleDB import SimpleDB
 
+    slip = pyre.inventory.facility("slip", family="spatial_database",
+                                   factory=SimpleDB, args=["slip"])
+    slip.meta['tip'] = "Spatial database of slip."
+
+    slipTime = pyre.inventory.facility("slip_time", family="spatial_database",
+                                       factory=SimpleDB,
+                                       args=["slip time"])
+    slipTime.meta['tip'] = "Spatial database of slip initiation time."
+
     slipRate = pyre.inventory.facility("slip_rate", family="spatial_database",
                                        factory=SimpleDB,
                                        args=["slip rate"])
@@ -66,6 +77,22 @@
     return
 
 
+  def initialize(self):
+    """
+    Initialize.
+    """
+    SlipTimeFn.initialize(self)
+
+    self.slip.initialize()
+    self.slipTime.initialize()
+    self.slipRate.initialize()
+
+    self.cppHandle.dbSlip = self.slip.cppHandle
+    self.cppHandle.dbSlipTime = self.slipTime.cppHandle
+    self.cppHandle.dbSlipRate = self.slipRate.cppHandle
+    return
+
+
   # PRIVATE METHODS ////////////////////////////////////////////////////
 
   def _configure(self):
@@ -73,6 +100,8 @@
     Setup members using inventory.
     """
     SlipTimeFn._configure(self)
+    self.slip = self.inventory.slip
+    self.slipTime = self.inventory.slipTime
     self.slipRate = self.inventory.slipRate
     return
 

Modified: short/3D/PyLith/trunk/pylith/faults/EqKinSrc.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/EqKinSrc.py	2007-05-08 23:33:52 UTC (rev 6803)
+++ short/3D/PyLith/trunk/pylith/faults/EqKinSrc.py	2007-05-09 00:46:03 UTC (rev 6804)
@@ -45,7 +45,7 @@
     ## @li None
     ##
     ## \b Facilities
-    ## @li \b slip_function Analytical form for slip time function
+    ## @li \b slip_function Slip time history function.
 
     import pyre.inventory
 
@@ -65,11 +65,11 @@
     return
 
 
-  def initialize(self, mesh):
+  def initialize(self):
     """
-    Initialize cohesive elements.
+    Initialize.
     """
-    Component.initialize(self, mesh)
+    self.slipFn.initialize()
     return
 
 

Modified: short/3D/PyLith/trunk/pylith/faults/Fault.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/Fault.py	2007-05-08 23:33:52 UTC (rev 6803)
+++ short/3D/PyLith/trunk/pylith/faults/Fault.py	2007-05-09 00:46:03 UTC (rev 6804)
@@ -22,6 +22,23 @@
 
 from pyre.components.Component import Component
 
+# Validator for up-direction
+def validateUpDir(value):
+  """
+  Validate up-direction.
+  """
+  msg = "Up-direction must be a 3 component vector (list)."
+  if not isinstance(value, list):
+    raise ValueError(msg)
+  if 3 != len(list):
+    raise ValueError(msg)
+  try:
+    nums = map(float, value)
+  except:
+    raise ValueError(msg)
+  return value
+
+
 # Fault class
 class Fault(Component):
   """
@@ -46,6 +63,8 @@
     ## \b Properties
     ## @li \b id Fault identifier
     ## @li \b name Name of fault
+    ## @li \b up-dir Up-dip or up direction
+    ##   (perpendicular to along-strike and not collinear with fault normal)
     ##
     ## \b Facilities
     ## @li \b quadrature Quadrature object for numerical integration
@@ -59,6 +78,12 @@
     label = pyre.inventory.str("label", default="")
     label.meta['tip'] = "Name of material."
 
+    upDir = pyre.inventory.list("up-dir", default=[0, 0, 1],
+                                validator=validateUpDir)
+    upDir.meta['tip'] = "Up-dip or up direction " \
+                        "(perpendicular to along-strike and not collinear " \
+                        "with fault normal)."
+
     from pylith.feassemble.quadrature.Quadrature import Quadrature
     quadrature = pyre.inventory.facility("quadrature", factory=Quadrature)
     quadrature.meta['tip'] = "Quadrature object for numerical integration."
@@ -99,8 +124,8 @@
 
     self.cppHandle.id = self.id
     self.cppHandle.label = self.label
-    #self.cppHandle.initialize(mesh.cppHandle, mesh.coordsys.cppHandle,
-    #                          self.quadrature.cppHandle)
+    self.cppHandle.quadrature = self.quadrature.cppHandle
+    self.cppHandle.initialize(mesh.cppHandle, mesh.coordsys.cppHandle)
     return
 
 

Modified: short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py	2007-05-08 23:33:52 UTC (rev 6803)
+++ short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py	2007-05-09 00:46:03 UTC (rev 6804)
@@ -69,8 +69,8 @@
     """
     Initialize cohesive elements.
     """
+    self.eqSrc.initialize()
     FaultCohesive.initialize(self, mesh)
-    self.slip.initialize()
     return
 
 

Modified: short/3D/PyLith/trunk/pylith/faults/SlipTimeFn.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/SlipTimeFn.py	2007-05-08 23:33:52 UTC (rev 6803)
+++ short/3D/PyLith/trunk/pylith/faults/SlipTimeFn.py	2007-05-09 00:46:03 UTC (rev 6804)
@@ -27,37 +27,6 @@
   Factory: slip_time_fn
   """
 
-  # INVENTORY //////////////////////////////////////////////////////////
-
-  class Inventory(Component.Inventory):
-    """
-    Python object for managing Component facilities and properties.
-    """
-    
-    ## @class Inventory
-    ## Python object for managing Component facilities and properties.
-    ##
-    ## \b Properties
-    ## @li None
-    ##
-    ## \b Facilities
-    ## @li \b slip Spatial database of final slip
-    ## @li \b slip_time Spatial database of slip initiation time
-
-    import pyre.inventory
-
-    from spatialdata.spatialdb.SimpleDB import SimpleDB
-
-    slip = pyre.inventory.facility("slip", family="spatial_database",
-                                   factory=SimpleDB, args=["slip"])
-    slip.meta['tip'] = "Spatial database of slip."
-
-    slipTime = pyre.inventory.facility("slip_time", family="spatial_database",
-                                       factory=SimpleDB,
-                                       args=["slip time"])
-    slipTime.meta['tip'] = "Spatial database of slip initiation time."
-
-
   # PUBLIC METHODS /////////////////////////////////////////////////////
 
   def __init__(self, name="sliptimefn"):
@@ -69,6 +38,13 @@
     return
 
 
+  def initialize(self):
+    """
+    Initialize.
+    """
+    return
+
+
   # PRIVATE METHODS ////////////////////////////////////////////////////
 
   def _configure(self):
@@ -76,8 +52,6 @@
     Setup members using inventory.
     """
     Component._configure(self)
-    self.slip = self.inventory.slip
-    self.slipTime = self.inventory.slipTime
     return
 
   

Modified: short/3D/PyLith/trunk/unittests/libtests/faults/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/Makefile.am	2007-05-08 23:33:52 UTC (rev 6803)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/Makefile.am	2007-05-09 00:46:03 UTC (rev 6804)
@@ -56,7 +56,7 @@
 	data/CohesiveDataTet4.hh \
 	data/CohesiveDataTet4Lagrange.hh
 
-testfaults_LDFLAGS = $(PETSC_LIB)
+testfaults_LDFLAGS = $(PETSC_LIB) $(PYTHON_BLDLIBRARY)
 
 AM_CPPFLAGS = $(PETSC_SIEVE_FLAGS) $(PETSC_INCLUDE)
 
@@ -65,5 +65,9 @@
 	$(top_builddir)/libsrc/libpylith.la \
 	-lspatialdata
 
+if ENABLE_CUBIT
+  testfaults_LDADD += -lnetcdf_c++ -lnetcdf
+endif
 
+
 # End of file 

Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/Makefile.am	2007-05-08 23:33:52 UTC (rev 6803)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/Makefile.am	2007-05-09 00:46:03 UTC (rev 6804)
@@ -99,7 +99,7 @@
 	data/QuadratureData3DLinear.hh \
 	data/QuadratureData3DQuadratic.hh
 
-testfeassemble_LDFLAGS = $(PETSC_LIB)
+testfeassemble_LDFLAGS = $(PETSC_LIB) $(PYTHON_BLDLIBRARY)
 
 AM_CPPFLAGS = $(PETSC_SIEVE_FLAGS) $(PETSC_INCLUDE)
 
@@ -107,4 +107,9 @@
 	-lcppunit -ldl \
 	$(top_builddir)/libsrc/libpylith.la
 
+if ENABLE_CUBIT
+  testfeassemble_LDADD += -lnetcdf_c++ -lnetcdf
+endif
+
+
 # End of file 

Modified: short/3D/PyLith/trunk/unittests/libtests/materials/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/materials/Makefile.am	2007-05-08 23:33:52 UTC (rev 6803)
+++ short/3D/PyLith/trunk/unittests/libtests/materials/Makefile.am	2007-05-09 00:46:03 UTC (rev 6804)
@@ -53,7 +53,7 @@
 	data/ElasticStress1DData.hh \
 	data/header.hh
 
-testmaterials_LDFLAGS = $(PETSC_LIB)
+testmaterials_LDFLAGS = $(PETSC_LIB) $(PYTHON_BLDLIBRARY)
 
 AM_CPPFLAGS = $(PETSC_SIEVE_FLAGS) $(PETSC_INCLUDE)
 
@@ -62,5 +62,9 @@
 	$(top_builddir)/libsrc/libpylith.la \
 	-lspatialdata
 
+if ENABLE_CUBIT
+  testmaterials_LDADD += -lnetcdf_c++ -lnetcdf
+endif
 
+
 # End of file 



More information about the cig-commits mailing list