[cig-commits] r7295 - short/3D/PyLith/trunk/pylith/faults

brad at geodynamics.org brad at geodynamics.org
Mon Jun 18 19:37:35 PDT 2007


Author: brad
Date: 2007-06-18 19:37:34 -0700 (Mon, 18 Jun 2007)
New Revision: 7295

Modified:
   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
Log:
Fixed initialization problems. Need to move creation of C++ handles out of __init__ and into other member functions. They should be created before they are used, not during configuration, etc. which is when __init__ is called.

Modified: short/3D/PyLith/trunk/pylith/faults/BruneSlipFn.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/BruneSlipFn.py	2007-06-19 00:57:55 UTC (rev 7294)
+++ short/3D/PyLith/trunk/pylith/faults/BruneSlipFn.py	2007-06-19 02:37:34 UTC (rev 7295)
@@ -72,8 +72,6 @@
     Constructor.
     """
     SlipTimeFn.__init__(self, name)
-    import pylith.faults.faults as bindings
-    self.cppHandle = bindings.BruneSlipFn()
     return
 
 
@@ -81,6 +79,9 @@
     """
     Initialize.
     """
+    import pylith.faults.faults as bindings
+    self.cppHandle = bindings.BruneSlipFn()
+
     SlipTimeFn.initialize(self)
 
     self.slip.initialize()

Modified: short/3D/PyLith/trunk/pylith/faults/EqKinSrc.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/EqKinSrc.py	2007-06-19 00:57:55 UTC (rev 7294)
+++ short/3D/PyLith/trunk/pylith/faults/EqKinSrc.py	2007-06-19 02:37:34 UTC (rev 7295)
@@ -72,8 +72,8 @@
     Initialize.
     """
     assert(None != self.cppHandle)
+    self.slipfn.initialize()
     self.cppHandle.slipfn = self.slipfn.cppHandle
-    self.slipfn.initialize()
     return
 
 

Modified: short/3D/PyLith/trunk/pylith/faults/Fault.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/Fault.py	2007-06-19 00:57:55 UTC (rev 7294)
+++ short/3D/PyLith/trunk/pylith/faults/Fault.py	2007-06-19 02:37:34 UTC (rev 7295)
@@ -115,6 +115,8 @@
     """
     Adjust mesh topology for fault implementation.
     """
+    self._createCppHandle()
+    
     assert(None != self.cppHandle)
     self.cppHandle.id = self.id
     self.cppHandle.label = self.label

Modified: short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py	2007-06-19 00:57:55 UTC (rev 7294)
+++ short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py	2007-06-19 02:37:34 UTC (rev 7295)
@@ -55,13 +55,12 @@
 
   # PUBLIC METHODS /////////////////////////////////////////////////////
 
-  def __init__(self, name="faultcohesivekin"):
+  def _init(self):
     """
-    Constructor.
+    
     """
-    FaultCohesive.__init__(self, name)
-    import pylith.faults.faults as bindings
-    self.cppHandle = bindings.FaultCohesiveKin()
+    self.name = "faultcohesivekin"
+    FaultCohesive._init(self)
     return
 
 
@@ -154,6 +153,15 @@
     self.eqsrc = self.inventory.eqsrc
     return
 
+
+  def _createCppHandle(self):
+    """
+    Create handle to C++ FaultCohesiveKin.
+    """
+    import pylith.faults.faults as bindings
+    self.cppHandle = bindings.FaultCohesiveKin()
+    return
+    
   
 # FACTORIES ////////////////////////////////////////////////////////////
 



More information about the cig-commits mailing list