[cig-commits] r8321 - in short/3D/PyLith/trunk: . pylith/bc pylith/faults pylith/feassemble pylith/materials

brad at geodynamics.org brad at geodynamics.org
Sat Nov 24 13:53:37 PST 2007


Author: brad
Date: 2007-11-24 13:53:36 -0800 (Sat, 24 Nov 2007)
New Revision: 8321

Modified:
   short/3D/PyLith/trunk/TODO
   short/3D/PyLith/trunk/pylith/bc/AbsorbingDampers.py
   short/3D/PyLith/trunk/pylith/bc/Dirichlet.py
   short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py
   short/3D/PyLith/trunk/pylith/feassemble/Constraint.py
   short/3D/PyLith/trunk/pylith/feassemble/Integrator.py
   short/3D/PyLith/trunk/pylith/materials/Material.py
Log:
Added specfication of family for db facility to Python Material object.

Modified: short/3D/PyLith/trunk/TODO
===================================================================
--- short/3D/PyLith/trunk/TODO	2007-11-22 03:08:26 UTC (rev 8320)
+++ short/3D/PyLith/trunk/TODO	2007-11-24 21:53:36 UTC (rev 8321)
@@ -17,13 +17,28 @@
 
 Release 1.1
 
-  1. Finish Neumann BC.
+  1. EventLogging
+   
+     Is FaultCohesiveKin an integrator?
+     Neumann
+  
+  2. Optimization of restrict()/update()
 
-  2. Finish velocity Dirichlet BC.
+     Add tags management to FieldsManager
 
-  3. Generalized Maxwell viscoelastic model
+     a. Fault
+     b. Absorbing BC
+     c. Neumann BC
 
-  4. Reimplement SolutionIO.
+  3. Nonisoparametric cells
+
+  4. Finish Neumann BC.
+
+  5. Finish velocity Dirichlet BC.
+
+  6. Generalized Maxwell viscoelastic model
+
+  7. Reimplement SolutionIO.
      a. Reimplement SolutionIOVTK
      b. Implement SolutionIOHDF5
 

Modified: short/3D/PyLith/trunk/pylith/bc/AbsorbingDampers.py
===================================================================
--- short/3D/PyLith/trunk/pylith/bc/AbsorbingDampers.py	2007-11-22 03:08:26 UTC (rev 8320)
+++ short/3D/PyLith/trunk/pylith/bc/AbsorbingDampers.py	2007-11-24 21:53:36 UTC (rev 8321)
@@ -78,8 +78,12 @@
     """
     Initialize AbsorbingDampers boundary condition.
     """
+    logEvent = "%sinit" % self._loggingPrefix
+
+    self._logger.eventBegin(logEvent)
     self.cppHandle.quadrature = self.quadrature.cppHandle
     BoundaryCondition.initialize(self)
+    self._logger.eventEnd(logEvent)
     return
   
 
@@ -119,6 +123,18 @@
     return
   
 
+  def _setupLogging(self):
+    """
+    Setup event logging.
+    """
+    Integrator._setupLogging(self)
+
+    events = ["init"]
+    for event in events:
+      self._logger.registerEvent("%s%s" % (self._loggingPrefix, event))
+    return
+  
+
 # FACTORIES ////////////////////////////////////////////////////////////
 
 def boundary_condition():

Modified: short/3D/PyLith/trunk/pylith/bc/Dirichlet.py
===================================================================
--- short/3D/PyLith/trunk/pylith/bc/Dirichlet.py	2007-11-22 03:08:26 UTC (rev 8320)
+++ short/3D/PyLith/trunk/pylith/bc/Dirichlet.py	2007-11-24 21:53:36 UTC (rev 8321)
@@ -77,6 +77,7 @@
     """
     BoundaryCondition.__init__(self, name)
     Constraint.__init__(self)
+    self._loggingPrefix = "DiBC "
     self.fixedDOF = []
     return
 
@@ -86,6 +87,7 @@
     Do pre-initialization setup.
     """
     BoundaryCondition.preinitialize(self, mesh)
+    Constraint.preinitialize(self, mesh)
     self.cppHandle.fixedDOF = self.fixedDOF    
     return
 
@@ -94,7 +96,11 @@
     """
     Initialize Dirichlet boundary condition.
     """
+    logEvent = "%sinit" % self._loggingPrefix
+
+    self._logger.eventBegin(logEvent)    
     BoundaryCondition.initialize(self)
+    self._logger.eventEnd(logEvent)    
     return
   
 
@@ -119,6 +125,18 @@
     return
   
 
+  def _setupLogging(self):
+    """
+    Setup event logging.
+    """
+    Constraint._setupLogging(self)
+
+    events = ["init"]
+    for event in events:
+      self._logger.registerEvent("%s%s" % (self._loggingPrefix, event))
+    return
+  
+
 # FACTORIES ////////////////////////////////////////////////////////////
 
 def boundary_condition():

Modified: short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py	2007-11-22 03:08:26 UTC (rev 8320)
+++ short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py	2007-11-24 21:53:36 UTC (rev 8321)
@@ -19,9 +19,10 @@
 ## Factory: fault
 
 from FaultCohesive import FaultCohesive
+from pylith.feassemble.Integrator import Integrator
 
 # FaultCohesiveKin class
-class FaultCohesiveKin(FaultCohesive):
+class FaultCohesiveKin(FaultCohesive, Integrator):
   """
   Python object for a fault surface with kinematic (prescribed) slip
   implemented with cohesive elements.
@@ -60,6 +61,8 @@
     Initialize configuration.
     """
     FaultCohesive.__init__(self, name)
+    Integrator.__init((self, name)
+    self._loggingPrefix = "FaCK "
     return
 
 
@@ -69,6 +72,7 @@
     """
     self._info.log("Pre-initializing fault '%s'." % self.label)
     FaultCohesive.preinitialize(self, mesh)
+    Integrator.preinitialize(self, mesh)
     assert(None != self.cppHandle)
     self.eqsrc.preinitialize()
     self.cppHandle.eqsrc = self.eqsrc.cppHandle
@@ -80,8 +84,7 @@
     Verify compatibility of configuration.
     """
     FaultCohesive.verifyConfiguration(self)
-    assert(None != self.cppHandle)
-    self.cppHandle.verifyConfiguration(self.mesh.cppHandle)
+    Integrator.verifyConfiguration(self)
     return
 
 
@@ -95,81 +98,6 @@
     return
 
 
-  def timeStep(self, dt):
-    """
-    Set time step for advancing from time t to time t+dt.
-    """
-    self._createCppHandle()
-    self.cppHandle.timeStep = dt.value
-    return
-
-
-  def stableTimeStep(self):
-    """
-    Get stable time step for advancing from time t to time t+dt.
-    """
-    assert(None != self.cppHandle)
-    from pyre.units.time import second
-    return self.cppHandle.stableTimeStep*second
-
-
-  def integrateResidual(self, residual, t, fields):
-    """
-    Integrate contributions to residual term at time t.
-    """
-    self._info.log("Integrating residual for fault '%s'." % self.label)
-    assert(None != self.cppHandle)
-    self.cppHandle.integrateResidual(residual, t.value, fields.cppHandle,
-                                     self.mesh.cppHandle)
-    return
-
-
-  def needNewJacobian(self):
-    """
-    Returns true if we need to recompute Jacobian matrix for operator,
-    false otherwise.
-    """
-    self._createCppHandle()
-    return self.cppHandle.needNewJacobian
-
-
-  def useSolnIncr(self, flag):
-    """
-    Set flag indicating whether using total soluton field of increment.
-    """
-    self._createCppHandle()
-    self.cppHandle.useSolnIncr = flag
-    return
-
-
-  def integrateJacobian(self, jacobian, t, fields):
-    """
-    Integrate contributions to Jacobian term at time t.
-    """
-    self._info.log("Integrating Jacobian for fault '%s'." % self.label)
-    assert(None != self.cppHandle)
-    self.cppHandle.integrateJacobian(jacobian, t.value, fields.cppHandle,
-                                     self.mesh.cppHandle)
-    return
-
-
-  def updateState(self, t, field):
-    """
-    Update state variables as needed.
-    """
-    self._info.log("Updating state for fault '%s'." % self.label)
-    assert(None != self.cppHandle)
-    self.cppHandle.updateState(t.value, field, self.mesh.cppHandle)
-    return
-    
-
-  def finalize(self):
-    """
-    Cleanup after time stepping.
-    """
-    return
-  
-
   # PRIVATE METHODS ////////////////////////////////////////////////////
 
   def _configure(self):

Modified: short/3D/PyLith/trunk/pylith/feassemble/Constraint.py
===================================================================
--- short/3D/PyLith/trunk/pylith/feassemble/Constraint.py	2007-11-22 03:08:26 UTC (rev 8320)
+++ short/3D/PyLith/trunk/pylith/feassemble/Constraint.py	2007-11-24 21:53:36 UTC (rev 8321)
@@ -58,6 +58,7 @@
     Setup constraint.
     """
     self.mesh = mesh
+    self._setupLogging()
     return
 
 
@@ -65,6 +66,7 @@
     """
     Verify compatibility of configuration.
     """
+    logEvent = "%sverify" % self._loggingPrefix
     return
 
 
@@ -81,8 +83,12 @@
     """
     Set constraint sizes in field.
     """
+    logEvent = "%ssetSizes" % self._loggingPrefix
+
     assert(None != self.cppHandle)
+    self._logger.eventBegin(logEvent)
     self.cppHandle.setConstraintSizes(field, self.mesh.cppHandle)
+    self._logger.eventEnd(logEvent)
     return
 
 
@@ -90,8 +96,12 @@
     """
     Set constraints for field.
     """
+    logEvent = "%sconstraints" % self._loggingPrefix
+
     assert(None != self.cppHandle)
+    self._logger.eventBegin(logEvent)
     self.cppHandle.setConstraints(field, self.mesh.cppHandle)
+    self._logger.eventEnd(logEvent)
     return
 
 
@@ -108,8 +118,12 @@
     """
     Set constrained values in field at time t.
     """
+    logEvent = "%ssetField" % self._loggingPrefix
+
     assert(None != self.cppHandle)
+    self._logger.eventBegin(logEvent)
     self.cppHandle.setField(t.value, field, self.mesh.cppHandle)
+    self._logger.eventEnd(logEvent)
     return
 
 
@@ -120,4 +134,30 @@
     return
   
 
+  # PRIVATE METHODS ////////////////////////////////////////////////////
+
+  def _setupLogging(self):
+    """
+    Setup event logging.
+    """
+    if None == self._loggingPrefix:
+      self._loggingPrefix = ""
+
+    from pylith.utils.EventLogger import EventLogger
+    logger = EventLogger()
+    logger.setClassName("FE Constraint")
+    logger.initialize()
+
+    events = ["verify",
+              "setSizes",
+              "constraints",
+              "setField",
+              "finalize"]
+    for event in events:
+      logger.registerEvent("%s%s" % (self._loggingPrefix, event))
+
+    self._logger = logger
+    return
+  
+
 # End of file 

Modified: short/3D/PyLith/trunk/pylith/feassemble/Integrator.py
===================================================================
--- short/3D/PyLith/trunk/pylith/feassemble/Integrator.py	2007-11-22 03:08:26 UTC (rev 8320)
+++ short/3D/PyLith/trunk/pylith/feassemble/Integrator.py	2007-11-24 21:53:36 UTC (rev 8321)
@@ -52,8 +52,6 @@
     """
     self.quadrature = None
     self.mesh = None
-    from pylith.utils.EventLogger import EventLogger
-
     return
 
 

Modified: short/3D/PyLith/trunk/pylith/materials/Material.py
===================================================================
--- short/3D/PyLith/trunk/pylith/materials/Material.py	2007-11-22 03:08:26 UTC (rev 8320)
+++ short/3D/PyLith/trunk/pylith/materials/Material.py	2007-11-24 21:53:36 UTC (rev 8321)
@@ -65,7 +65,8 @@
     label.meta['tip'] = "Name of material."
 
     from spatialdata.spatialdb.SimpleDB import SimpleDB
-    db = pyre.inventory.facility("db", factory=SimpleDB,
+    db = pyre.inventory.facility("db", family="spatial_database",
+                                 factory=SimpleDB,
                                  args=["db"])
     db.meta['tip'] = "Database of material property parameters."
     



More information about the cig-commits mailing list