[cig-commits] r6639 - in short/3D/PyLith/trunk: libsrc/faults libsrc/feassemble unittests/libtests/faults

brad at geodynamics.org brad at geodynamics.org
Mon Apr 23 17:23:04 PDT 2007


Author: brad
Date: 2007-04-23 17:23:03 -0700 (Mon, 23 Apr 2007)
New Revision: 6639

Added:
   short/3D/PyLith/trunk/libsrc/faults/EqKinSrc.icc
Modified:
   short/3D/PyLith/trunk/libsrc/faults/BruneSlipFn.cc
   short/3D/PyLith/trunk/libsrc/faults/BruneSlipFn.hh
   short/3D/PyLith/trunk/libsrc/faults/BruneSlipFn.icc
   short/3D/PyLith/trunk/libsrc/faults/EqKinSrc.cc
   short/3D/PyLith/trunk/libsrc/faults/EqKinSrc.hh
   short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.cc
   short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.hh
   short/3D/PyLith/trunk/libsrc/faults/SlipTimeFn.hh
   short/3D/PyLith/trunk/libsrc/feassemble/ParameterManager.hh
   short/3D/PyLith/trunk/unittests/libtests/faults/TestFault.cc
   short/3D/PyLith/trunk/unittests/libtests/faults/TestFault.hh
Log:
Worked on implementing kinematic earthquake source. C++ portion of managing parameters and getting slip field for fault surface is finished but not tested.

Modified: short/3D/PyLith/trunk/libsrc/faults/BruneSlipFn.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/BruneSlipFn.cc	2007-04-23 20:01:02 UTC (rev 6638)
+++ short/3D/PyLith/trunk/libsrc/faults/BruneSlipFn.cc	2007-04-24 00:23:03 UTC (rev 6639)
@@ -14,9 +14,21 @@
 
 #include "BruneSlipFn.hh" // implementation of object methods
 
+#include "pylith/feassemble/ParameterManager.hh" // USES ParameterManager
+
+#include "spatialdata/spatialdb/SpatialDB.hh" // USES SpatialDB
+#include "spatialdata/geocoords/CoordSys.hh" // USES CoordSys
+
+#include <assert.h> // USES assert()
+#include <sstream> // USES std::ostringstream
+#include <stdexcept> // USES std::runtime_error
+
 // ----------------------------------------------------------------------
 // Default constructor.
-pylith::faults::BruneSlipFn::BruneSlipFn(void)
+pylith::faults::BruneSlipFn::BruneSlipFn(void) :
+  _dbFinalSlip(0),
+  _dbSlipTime(0),
+  _dbPeakRate(0)
 { // constructor
 } // constructor
 
@@ -24,14 +36,201 @@
 // Destructor.
 pylith::faults::BruneSlipFn::~BruneSlipFn(void)
 { // destructor
+  _dbFinalSlip = 0;
+  _dbSlipTime = 0;
+  _dbPeakRate = 0;
 } // destructor
 
 // ----------------------------------------------------------------------
 // Copy constructor.
 pylith::faults::BruneSlipFn::BruneSlipFn(const BruneSlipFn& f) :
-  SlipTimeFn(f)
+  SlipTimeFn(f),
+  _slipField(f._slipField),
+  _dbFinalSlip(f._dbFinalSlip),
+  _dbSlipTime(f._dbSlipTime),
+  _dbPeakRate(f._dbPeakRate)
 { // copy constructor
 } // copy constructor
 
+// ----------------------------------------------------------------------
+// Initialize slip time function.
+void
+pylith::faults::BruneSlipFn::initialize(const ALE::Obj<Mesh>& mesh,
+				   const spatialdata::geocoords::CoordSys* cs,
+				   const std::set<Mesh::point_type>& vertices)
+{ // initialize
+  assert(!mesh.isNull());
+  assert(0 != cs);
+  assert(0 != _dbFinalSlip);
+  assert(0 != _dbSlipTime);
+  assert(0 != _dbPeakRate);
 
+  // Create sections for fields
+  delete _parameters; _parameters = new feassemble::ParameterManager(mesh);
+  if (0 == _parameters)
+    throw std::runtime_error("Could not create manager for parameters of "
+			     "Brune slip time function.");
+  assert(0 != _parameters);
+  
+  // Parameter: final slip
+  _parameters->addReal("final slip");
+  const ALE::Obj<real_section_type>& finalSlip = 
+    _parameters->getReal("final slip");
+  assert(!finalSlip.isNull());
+
+  // Parameter: slip initiation time
+  _parameters->addReal("slip time");
+  const ALE::Obj<real_section_type>& slipTime = 
+    _parameters->getReal("slip time");
+  assert(!slipTime.isNull());
+
+  // Parameter: peak slip rate
+  _parameters->addReal("peak rate");
+  const ALE::Obj<real_section_type>& peakRate = 
+    _parameters->getReal("peak rate");
+  assert(!peakRate.isNull());
+  
+  // Allocate parameters
+  const std::set<Mesh::point_type>::const_iterator vBegin = vertices.begin();
+  const std::set<Mesh::point_type>::const_iterator vEnd = vertices.end();
+  for (std::set<Mesh::point_type>::const_iterator v_iter=vBegin;
+       v_iter != vEnd;
+       ++v_iter) {
+    finalSlip->setFiberDimension(*v_iter, 3);
+    slipTime->setFiberDimension(*v_iter, 1);
+    peakRate->setFiberDimension(*v_iter, 1);
+  } // for
+  mesh->allocate(finalSlip);
+  mesh->allocate(slipTime);
+  mesh->allocate(peakRate);
+
+  // Open databases and set query values
+  _dbFinalSlip->open();
+  const char* slipValues[] = {"strike-slip", "dip-slip", "fault-opening"};
+  _dbFinalSlip->queryVals(slipValues, 3);
+
+  _dbSlipTime->open();
+  const char* slipTimeValues[] = {"slip-time"};
+  _dbSlipTime->queryVals(slipTimeValues, 1);
+
+  _dbPeakRate->open();
+  const char* peakRateValues[] = {"slip-rate"};
+  _dbPeakRate->queryVals(peakRateValues, 1);
+
+  // Get coordinates of vertices
+  const ALE::Obj<real_section_type>& coordinates = 
+    mesh->getRealSection("coordinates");
+  assert(!coordinates.isNull());
+  const int spaceDim = cs->spaceDim();
+
+  // Query databases for parameters
+  double slipData[3];
+  double slipTimeData;
+  double peakRateData;
+  for (std::set<Mesh::point_type>::const_iterator v_iter=vBegin;
+       v_iter != vEnd;
+       ++v_iter) {
+    // Get coordinates of vertex
+    const real_section_type::value_type* vCoords = 
+      coordinates->restrictPoint(*v_iter);
+    
+    int err = _dbFinalSlip->query(&slipData[0], 3, vCoords, spaceDim, cs);
+    if (err) {
+      std::ostringstream msg;
+      msg << "Could not find final slip at (";
+      for (int i=0; i < spaceDim; ++i)
+	msg << "  " << vCoords[i];
+      msg << ") using spatial database " << _dbFinalSlip->label() << ".";
+      throw std::runtime_error(msg.str());
+    } // if
+    finalSlip->updatePoint(*v_iter, &slipData[0]);
+
+    err = _dbSlipTime->query(&slipTimeData, 1, vCoords, spaceDim, cs);
+    if (err) {
+      std::ostringstream msg;
+      msg << "Could not find slip initiation time at (";
+      for (int i=0; i < spaceDim; ++i)
+	msg << "  " << vCoords[i];
+      msg << ") using spatial database " << _dbSlipTime->label() << ".";
+      throw std::runtime_error(msg.str());
+    } // if
+    slipTime->updatePoint(*v_iter, &slipTimeData);
+
+    err = _dbPeakRate->query(&peakRateData, 1, vCoords, spaceDim, cs);
+    if (err) {
+      std::ostringstream msg;
+      msg << "Could not find peak slip rate at (";
+      for (int i=0; i < spaceDim; ++i)
+	msg << "  " << vCoords[i];
+      msg << ") using spatial database " << _dbPeakRate->label() << ".";
+      throw std::runtime_error(msg.str());
+    } // if
+    peakRate->updatePoint(*v_iter, &peakRateData);
+  } // for
+
+  // Close databases
+  _dbFinalSlip->close();
+  _dbSlipTime->close();
+  _dbPeakRate->close();
+
+  // Allocate slip field
+  for (std::set<Mesh::point_type>::const_iterator v_iter=vBegin;
+       v_iter != vEnd;
+       ++v_iter)
+    _slipField->setFiberDimension(*v_iter, 3);
+  mesh->allocate(_slipField);
+} // initialize
+
+// ----------------------------------------------------------------------
+// Get slip on fault surface at time t.
+const ALE::Obj<pylith::real_section_type>&
+pylith::faults::BruneSlipFn::slip(const double t,
+				  const std::set<Mesh::point_type>& vertices)
+{ // slip
+  assert(0 != _parameters);
+  assert(!_slipField.isNull());
+  
+  const ALE::Obj<real_section_type>& finalSlip = 
+    _parameters->getReal("final slip");
+  assert(!finalSlip.isNull());
+
+  const ALE::Obj<real_section_type>& slipTime = 
+    _parameters->getReal("slip time");
+  assert(!slipTime.isNull());
+
+  const ALE::Obj<real_section_type>& peakRate = 
+    _parameters->getReal("peak rate");
+  assert(!peakRate.isNull());
+
+  double slipValues[3];
+  const std::set<Mesh::point_type>::const_iterator vBegin = vertices.begin();
+  const std::set<Mesh::point_type>::const_iterator vEnd = vertices.end();
+  for (std::set<Mesh::point_type>::const_iterator v_iter=vBegin;
+       v_iter != vEnd;
+       ++v_iter) {
+    // Get values of parameters at vertex
+    const real_section_type::value_type* vFinalSlip = 
+      finalSlip->restrictPoint(*v_iter);
+    const real_section_type::value_type* vSlipTime = 
+      slipTime->restrictPoint(*v_iter);
+    const real_section_type::value_type* vPeakRate = 
+      peakRate->restrictPoint(*v_iter);
+
+    const double vFinalSlipMag = sqrt(vFinalSlip[0]*vFinalSlip[0] +
+				      vFinalSlip[1]*vFinalSlip[1] +
+				      vFinalSlip[2]*vFinalSlip[2]);
+    const double vSlip = _slip(t-vSlipTime[0], vFinalSlipMag, vPeakRate[0]);
+    const double scale = vSlip / vFinalSlipMag;
+    slipValues[0] = scale * vFinalSlip[0];
+    slipValues[1] = scale * vFinalSlip[1];
+    slipValues[2] = scale * vFinalSlip[2];
+
+    // Update field
+    _slipField->updatePoint(*v_iter, &slipValues[0]);
+  } // for
+
+  return _slipField;
+} // slip
+
+
 // End of file 

Modified: short/3D/PyLith/trunk/libsrc/faults/BruneSlipFn.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/BruneSlipFn.hh	2007-04-23 20:01:02 UTC (rev 6638)
+++ short/3D/PyLith/trunk/libsrc/faults/BruneSlipFn.hh	2007-04-24 00:23:03 UTC (rev 6639)
@@ -34,12 +34,19 @@
   } // faults
 } // pylith
 
+/// Namespace for spatialdata package
+namespace spatialdata {
+  namespace spatialdb {
+    class SpatialDB;
+  } // spatialdb
+} // spatialdata
+
 /// C++ implementation of Brune slip time function.
 class pylith::faults::BruneSlipFn : public SlipTimeFn
 { // class BruneSlipFn
   friend class TestBruneSlipFn; // unit testing
 
-  // PUBLIC METHODS /////////////////////////////////////////////////////
+// PUBLIC METHODS ///////////////////////////////////////////////////////
 public :
 
   /// Default constructor.
@@ -55,19 +62,43 @@
    */
   SlipTimeFn* clone(void) const;  
 
-  /** Compute slip using slip time function.
+  /** Set spatial database for final slip.
    *
-   * @param t Time relative to slip starting time at point
-   * @param finalSlip Final slip at point
-   * @param peakRate Peak slip rate at point
+   * @param db Spatial database
+   */
+  void dbFinalSlip(spatialdata::spatialdb::SpatialDB* const db);
+
+  /** Set spatial database for slip initiation time.
    *
-   * @returns Slip at point at time t
+   * @param db Spatial database
    */
-  double compute(const double t,
-		 const double finalSlip,
-		 const double peakRate) const;
+  void dbSlipTime(spatialdata::spatialdb::SpatialDB* const db);
 
-  // PROTECTED METHODS //////////////////////////////////////////////////
+  /** Set spatial database for peak slip rate.
+   *
+   * @param db Spatial database
+   */
+  void dbPeakRate(spatialdata::spatialdb::SpatialDB* const db);
+
+  /** Initialize slip time function.
+   *
+   * @param dbSlip Spatial database for slip.
+   * @param dbSlipTime Spatial database for slip initiation time.
+   * @param dbPeakRate Spatial database for peak slip rate.
+   */
+  void initialize(const ALE::Obj<Mesh>& mesh,
+		  const spatialdata::geocoords::CoordSys* cs,
+		  const std::set<Mesh::point_type>& vertices);
+
+  /** Get slip on fault surface at time t.
+   *
+   * @param t Time t.
+   * @param vertices Vertices on fault surface.
+   */
+  const ALE::Obj<real_section_type>& slip(const double t,
+				 const std::set<Mesh::point_type>& vertices);
+
+// PROTECTED METHODS ////////////////////////////////////////////////////
 protected :
 
   /** Copy constructor.
@@ -76,14 +107,44 @@
    */
   BruneSlipFn(const BruneSlipFn& m);
 
-  // NOT IMPLEMENTED ////////////////////////////////////////////////////
+// NOT IMPLEMENTED //////////////////////////////////////////////////////
 private :
 
   /// Not implemented
   const BruneSlipFn& operator=(const BruneSlipFn& f);
 
-}; // class FaultCohesiveKin
+// PRIVATE METHODS //////////////////////////////////////////////////////
+private :
 
+  /** Compute slip using slip time function.
+   *
+   * @param t Time relative to slip starting time at point
+   * @param finalSlip Final slip at point
+   * @param peakRate Peak slip rate at point
+   *
+   * @returns Slip at point at time t
+   */
+  static
+  double _slip(const double t,
+	       const double finalSlip,
+	       const double peakRate);
+
+// PRIVATE MEMBERS //////////////////////////////////////////////////////
+private :
+
+  ALE::Obj<real_section_type> _slipField; ///< Slip field on fault surface
+
+  /// Spatial database for final slip
+  spatialdata::spatialdb::SpatialDB* _dbFinalSlip;
+
+  /// Spatial database for slip time
+  spatialdata::spatialdb::SpatialDB* _dbSlipTime;
+
+   /// Spatial database for peak slip rate
+  spatialdata::spatialdb::SpatialDB* _dbPeakRate;
+
+}; // class BruneSlipFn
+
 #include "BruneSlipFn.icc" // inline methods
 
 #endif // pylith_faults_bruneslipfn_hh

Modified: short/3D/PyLith/trunk/libsrc/faults/BruneSlipFn.icc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/BruneSlipFn.icc	2007-04-23 20:01:02 UTC (rev 6638)
+++ short/3D/PyLith/trunk/libsrc/faults/BruneSlipFn.icc	2007-04-24 00:23:03 UTC (rev 6639)
@@ -24,12 +24,33 @@
   return new BruneSlipFn(*this);
 } // clone
 
+// Set spatial database for final slip.
+inline
+void
+pylith::faults::BruneSlipFn::dbFinalSlip(spatialdata::spatialdb::SpatialDB* const db) {
+  _dbFinalSlip = db;
+} // dbFinalSlip
+
+// Set spatial database for slip initiation time.
+inline
+void
+pylith::faults::BruneSlipFn::dbSlipTime(spatialdata::spatialdb::SpatialDB* const db) {
+  _dbSlipTime = db;
+} // dbSlipTime
+
+// Set spatial database for peak slip rate.
+inline
+void
+pylith::faults::BruneSlipFn::dbPeakRate(spatialdata::spatialdb::SpatialDB* const db) {
+  _dbPeakRate = db;
+} // dbPeakRate
+
 // Compute slip using slip time function.
 inline
 double
-pylith::faults::BruneSlipFn::compute(const double t,
-				     const double finalSlip,
-				     const double peakRate) const {
+pylith::faults::BruneSlipFn::_slip(const double t,
+				   const double finalSlip,
+				   const double peakRate) {
   double slip = 0.0;
   if (t > 0) {
     assert(peakRate > 0.0);
@@ -39,7 +60,7 @@
     slip = 1.0 - exp(-t/tau) * (1.0 + t/tau);
   } // if
   return slip;
-} // compute
+} // _slip
 
 
 // End of file 

Modified: short/3D/PyLith/trunk/libsrc/faults/EqKinSrc.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/EqKinSrc.cc	2007-04-23 20:01:02 UTC (rev 6638)
+++ short/3D/PyLith/trunk/libsrc/faults/EqKinSrc.cc	2007-04-24 00:23:03 UTC (rev 6639)
@@ -16,6 +16,8 @@
 
 #include "SlipTimeFn.hh" // USES SlipTimeFn
 
+#include <assert.h> // USES assert()
+
 // ----------------------------------------------------------------------
 // Default constructor.
 pylith::faults::EqKinSrc::EqKinSrc(void) :
@@ -39,5 +41,34 @@
     _slipfn = s._slipfn->clone();
 } // copy constructor
 
+// ----------------------------------------------------------------------
+// Set slip time function.
+void
+pylith::faults::EqKinSrc::slipfn(SlipTimeFn* slipfn)
+{ // slipfn
+  delete _slipfn; _slipfn = (0 != slipfn) ? slipfn->clone() : 0;
+} // slipfn
 
+// ----------------------------------------------------------------------
+// Initialize slip time function.
+void
+pylith::faults::EqKinSrc::initialize(const ALE::Obj<Mesh>& mesh,
+				   const spatialdata::geocoords::CoordSys* cs,
+				   const std::set<Mesh::point_type>& vertices)
+{ // initialize
+  assert(0 != _slipfn);
+  _slipfn->initialize(mesh, cs, vertices);
+} // initialize
+
+// ----------------------------------------------------------------------
+// Get slip on fault surface at time t.
+const ALE::Obj<pylith::real_section_type>&
+pylith::faults::EqKinSrc::slip(const double t,
+			       const std::set<Mesh::point_type>& vertices)
+{ // slip
+  assert(0 != _slipfn);
+  return _slipfn->slip(t, vertices);
+} // slip
+
+
 // End of file 

Modified: short/3D/PyLith/trunk/libsrc/faults/EqKinSrc.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/EqKinSrc.hh	2007-04-23 20:01:02 UTC (rev 6638)
+++ short/3D/PyLith/trunk/libsrc/faults/EqKinSrc.hh	2007-04-24 00:23:03 UTC (rev 6639)
@@ -12,7 +12,8 @@
 
 /** @file libsrc/faults/EqKinSrc.hh
  *
- * @brief C++ object for managing parameters for a kinematic earthquake source.
+ * @brief C++ object for managing parameters for a kinematic
+ * earthquake source.
  *
  * EqKinSrc is responsible for providing the value of slip at time t
  * over a fault surface.
@@ -21,13 +22,15 @@
 #if !defined(pylith_faults_eqkinsrc_hh)
 #define pylith_faults_eqkinsrc_hh
 
+#include "pylith/utils/sievetypes.hh" // USES PETSc Mesh
+
 /// Namespace for pylith package
 namespace pylith {
   namespace faults {
     class EqKinSrc;
     class TestEqKinSrc; // unit testing
 
-    class SlipTimeFn; /// HOLDSA SlipTimeFn
+    class SlipTimeFn; // HOLDSA SlipTimeFn
   } // faults
 } // pylith
 
@@ -36,6 +39,10 @@
   namespace spatialdb {
     class SpatialDB;
   } // spatialdb
+
+  namespace geocoords {
+    class CoordSys;
+  } // geocoords
 } // spatialdata
 
 /// C++ oject for managing parameters for a kinematic earthquake source.
@@ -50,19 +57,56 @@
   EqKinSrc(void);
 
   /// Destructor.
+  virtual
   ~EqKinSrc(void);
 
+  /** Create copy of fault.
+   *
+   * @returns Copy of fault.
+   */
+  virtual
+  EqKinSrc* clone(void) const;
+
+  /** Set slip time function.
+   *
+   * @param slipfn Slip time function.
+   */
+  void slipfn(SlipTimeFn* slipfn);
+
+  /** Initialize slip time function.
+   *
+   * @param dbSlip Spatial database for slip.
+   * @param dbSlipTime Spatial database for slip initiation time.
+   * @param dbPeakRate Spatial database for peak slip rate.
+   */
+  virtual
+  void initialize(const ALE::Obj<Mesh>& mesh,
+		  const spatialdata::geocoords::CoordSys* cs,
+		  const std::set<Mesh::point_type>& vertices);
+
+  /** Get slip on fault surface at time t.
+   *
+   * @param t Time t.
+   * @param vertices Vertices on fault surface.
+   */
+  virtual
+  const ALE::Obj<real_section_type>& slip(const double t,
+				const std::set<Mesh::point_type>& vertices);
+
+  // PROTECTED METHODS //////////////////////////////////////////////////
+protected :
+
   /** Copy constructor.
    *
-   * @param m Fault to copy
+   * @param s Source to copy
    */
-  EqKinSrc(const EqKinSrc& m);
+  EqKinSrc(const EqKinSrc& s);
 
   // NOT IMPLEMENTED ////////////////////////////////////////////////////
 private :
 
   /// Not implemented
-  const EqKinSrc& operator=(const EqKinSrc& m);
+  const EqKinSrc& operator=(const EqKinSrc& s);
 
   // PRIVATE MEMBERS ////////////////////////////////////////////////////
 private :
@@ -71,6 +115,8 @@
 
 }; // class EqKinSrc
 
+#include "EqKinSrc.icc" // inline methods
+
 #endif // pylith_faults_eqkinsrc_hh
 
 

Added: short/3D/PyLith/trunk/libsrc/faults/EqKinSrc.icc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/EqKinSrc.icc	2007-04-23 20:01:02 UTC (rev 6638)
+++ short/3D/PyLith/trunk/libsrc/faults/EqKinSrc.icc	2007-04-24 00:23:03 UTC (rev 6639)
@@ -0,0 +1,25 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#if !defined(pylith_faults_eqkinsrc_hh)
+#error "EqKinSrc.icc can only be included from EqKinSrc.hh"
+#endif
+
+// Create copy of fault.
+inline
+pylith::faults::EqKinSrc*
+pylith::faults::EqKinSrc::clone(void) const {
+  return new EqKinSrc(*this);
+} // clone
+
+
+// End of file 

Modified: short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.cc	2007-04-23 20:01:02 UTC (rev 6638)
+++ short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.cc	2007-04-24 00:23:03 UTC (rev 6639)
@@ -37,8 +37,16 @@
   _eqsrc(0)
 { // copy constructor
   if (0 != f._eqsrc)
-    _eqsrc = new EqKinSrc(*f._eqsrc);
+    _eqsrc = f._eqsrc->clone();
 } // copy constructor
 
+// ----------------------------------------------------------------------
+// Set kinematic earthquake source.
+void
+pylith::faults::FaultCohesiveKin::eqsrc(EqKinSrc* src)
+{ // eqsrc
+  delete _eqsrc; _eqsrc = (0 != src) ? src->clone() : 0;
+} // eqsrc
 
+
 // End of file 

Modified: short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.hh	2007-04-23 20:01:02 UTC (rev 6638)
+++ short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.hh	2007-04-24 00:23:03 UTC (rev 6639)
@@ -53,6 +53,12 @@
    */
   Fault* clone(void) const;  
 
+  /** Set kinematic earthquake source.
+   *
+   * @param src Kinematic earthquake source.
+   */
+  void eqsrc(EqKinSrc* src);
+
   // PROTECTED METHODS //////////////////////////////////////////////////
 protected :
 

Modified: short/3D/PyLith/trunk/libsrc/faults/SlipTimeFn.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/SlipTimeFn.hh	2007-04-23 20:01:02 UTC (rev 6638)
+++ short/3D/PyLith/trunk/libsrc/faults/SlipTimeFn.hh	2007-04-24 00:23:03 UTC (rev 6639)
@@ -20,14 +20,27 @@
 #if !defined(pylith_faults_sliptimefn_hh)
 #define pylith_faults_sliptimefn_hh
 
+#include "pylith/utils/sievetypes.hh" // USES PETSc Mesh
+
 /// Namespace for pylith package
 namespace pylith {
   namespace faults {
     class SlipTimeFn;
     class TestSlipTimeFn; // unit testing
   } // faults
+
+  namespace feassemble {
+    class ParameterManager; // HOLDSA ParameterManager
+  } // feassemble
 } // pylith
 
+/// Namespace for spatialdata package
+namespace spatialdata {
+  namespace geocoords {
+    class CoordSys;
+  } // geocoords
+} // spatialdata
+
 /// C++ abstract base class for Fault object.
 class pylith::faults::SlipTimeFn
 { // class SlipTimeFn
@@ -50,18 +63,25 @@
   virtual
   SlipTimeFn* clone(void) const = 0;
 
-  /** Compute slip using slip time function.
+  /** Initialize slip time function.
    *
-   * @param t Time relative to slip starting time at point
-   * @param finalSlip Final slip at point
-   * @param peakRate Peak slip rate at point
+   * @param dbSlip Spatial database for slip.
+   * @param dbSlipTime Spatial database for slip initiation time.
+   * @param dbPeakRate Spatial database for peak slip rate.
+   */
+  virtual
+  void initialize(const ALE::Obj<Mesh>& mesh,
+		  const spatialdata::geocoords::CoordSys* cs,
+		  const std::set<Mesh::point_type>& vertices) = 0;
+
+  /** Get slip on fault surface at time t.
    *
-   * @returns Slip at point at time t
+   * @param t Time t.
+   * @param vertices Vertices on fault surface.
    */
   virtual
-  double compute(const double t,
-		 const double finalSlip,
-		 const double peakRate) const = 0;
+  const ALE::Obj<real_section_type>& slip(const double t,
+			      const std::set<Mesh::point_type>& vertices) = 0;
 
   // PROTECTED METHODS //////////////////////////////////////////////////
 protected :
@@ -78,6 +98,12 @@
   /// Not implemented
   const SlipTimeFn& operator=(const SlipTimeFn& f);
 
+  // PROTECTED MEMBERS //////////////////////////////////////////////////
+protected :
+
+  /// Parameters for slip time function
+  feassemble::ParameterManager* _parameters;
+
 }; // class SlipTimeFn
 
 #endif // pylith_faults_sliptimefn_hh

Modified: short/3D/PyLith/trunk/libsrc/feassemble/ParameterManager.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/ParameterManager.hh	2007-04-23 20:01:02 UTC (rev 6638)
+++ short/3D/PyLith/trunk/libsrc/feassemble/ParameterManager.hh	2007-04-24 00:23:03 UTC (rev 6639)
@@ -60,7 +60,7 @@
    */
   const ALE::Obj<real_section_type>& getReal(const char* name);
 
-// PRIVATE METHODS //////////////////////////////////////////////////////
+// NOT IMPLEMENTED //////////////////////////////////////////////////////
 private :
 
   /// Not implemented

Modified: short/3D/PyLith/trunk/unittests/libtests/faults/TestFault.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/TestFault.cc	2007-04-23 20:01:02 UTC (rev 6638)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/TestFault.cc	2007-04-24 00:23:03 UTC (rev 6639)
@@ -46,6 +46,7 @@
   CPPUNIT_ASSERT_EQUAL(label, fault.label());
 } // testLabel
     
+#if 0
 // ----------------------------------------------------------------------
 // Test initialize()
 void
@@ -53,6 +54,7 @@
 { // testInitialize
   throw std::logic_error("Need to implement test.");
 } // testInitialize
+#endif
 
 
 // End of file 

Modified: short/3D/PyLith/trunk/unittests/libtests/faults/TestFault.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/TestFault.hh	2007-04-23 20:01:02 UTC (rev 6638)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/TestFault.hh	2007-04-24 00:23:03 UTC (rev 6639)
@@ -39,7 +39,9 @@
   CPPUNIT_TEST_SUITE( TestFault );
   CPPUNIT_TEST( testID );
   CPPUNIT_TEST( testLabel );
+#if 0
   CPPUNIT_TEST( testInitialize );
+#endif
   CPPUNIT_TEST_SUITE_END();
 
   // PUBLIC METHODS /////////////////////////////////////////////////////
@@ -51,8 +53,10 @@
   /// Test label()
   void testLabel(void);
 
+#if 0
   /// Test initialize()
   void testInitialize(void);
+#endif
 
 }; // class TestFault
 



More information about the cig-commits mailing list