[cig-commits] r6651 - short/3D/PyLith/trunk/libsrc/faults

brad at geodynamics.org brad at geodynamics.org
Tue Apr 24 11:19:33 PDT 2007


Author: brad
Date: 2007-04-24 11:19:33 -0700 (Tue, 24 Apr 2007)
New Revision: 6651

Modified:
   short/3D/PyLith/trunk/libsrc/faults/BruneSlipFn.cc
   short/3D/PyLith/trunk/libsrc/faults/BruneSlipFn.hh
   short/3D/PyLith/trunk/libsrc/faults/CohesiveTopology.cc
   short/3D/PyLith/trunk/libsrc/faults/CohesiveTopology.hh
   short/3D/PyLith/trunk/libsrc/faults/EqKinSrc.cc
   short/3D/PyLith/trunk/libsrc/faults/EqKinSrc.hh
   short/3D/PyLith/trunk/libsrc/faults/FaultCohesive.cc
   short/3D/PyLith/trunk/libsrc/faults/FaultCohesive.hh
   short/3D/PyLith/trunk/libsrc/faults/SlipTimeFn.hh
Log:
Added storage of fault mesh in FaultCohesive object. Cleaned up interface for kinematic earthquake source initialization and slip field construction. Switched to using fault mesh instead of set of vertices.

Modified: short/3D/PyLith/trunk/libsrc/faults/BruneSlipFn.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/BruneSlipFn.cc	2007-04-24 18:18:26 UTC (rev 6650)
+++ short/3D/PyLith/trunk/libsrc/faults/BruneSlipFn.cc	2007-04-24 18:19:33 UTC (rev 6651)
@@ -56,15 +56,19 @@
 // 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)
+					const ALE::Obj<Mesh>& faultMesh,
+					const spatialdata::geocoords::CoordSys* cs)
 { // initialize
   assert(!mesh.isNull());
+  assert(!faultMesh.isNull());
   assert(0 != cs);
   assert(0 != _dbFinalSlip);
   assert(0 != _dbSlipTime);
   assert(0 != _dbPeakRate);
 
+  // Get fault vertices
+  const ALE::Obj<Mesh::label_sequence>& vertices = faultMesh->depthStratum(0);
+
   // Create sections for fields
   delete _parameters; _parameters = new feassemble::ParameterManager(mesh);
   if (0 == _parameters)
@@ -91,9 +95,9 @@
   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;
+  const Mesh::label_sequence::iterator vBegin = vertices->begin();
+  const Mesh::label_sequence::iterator vEnd = vertices->end();
+  for (Mesh::label_sequence::iterator v_iter=vBegin;
        v_iter != vEnd;
        ++v_iter) {
     finalSlip->setFiberDimension(*v_iter, 3);
@@ -127,7 +131,7 @@
   double slipData[3];
   double slipTimeData;
   double peakRateData;
-  for (std::set<Mesh::point_type>::const_iterator v_iter=vBegin;
+  for (Mesh::label_sequence::iterator v_iter=vBegin; 
        v_iter != vEnd;
        ++v_iter) {
     // Get coordinates of vertex
@@ -174,7 +178,7 @@
   _dbPeakRate->close();
 
   // Allocate slip field
-  for (std::set<Mesh::point_type>::const_iterator v_iter=vBegin;
+  for (Mesh::label_sequence::iterator v_iter=vBegin;
        v_iter != vEnd;
        ++v_iter)
     _slipField->setFiberDimension(*v_iter, 3);
@@ -185,11 +189,15 @@
 // 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)
+				  const ALE::Obj<Mesh>& faultMesh)
 { // slip
   assert(0 != _parameters);
   assert(!_slipField.isNull());
   
+  // Get fault vertices
+  const ALE::Obj<Mesh::label_sequence>& vertices = faultMesh->depthStratum(0);
+
+  // Get parameters
   const ALE::Obj<real_section_type>& finalSlip = 
     _parameters->getReal("final slip");
   assert(!finalSlip.isNull());
@@ -203,9 +211,9 @@
   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;
+  const Mesh::label_sequence::iterator vBegin = vertices->begin();
+  const Mesh::label_sequence::iterator vEnd = vertices->end();
+  for (Mesh::label_sequence::iterator v_iter=vBegin;
        v_iter != vEnd;
        ++v_iter) {
     // Get values of parameters at vertex

Modified: short/3D/PyLith/trunk/libsrc/faults/BruneSlipFn.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/BruneSlipFn.hh	2007-04-24 18:18:26 UTC (rev 6650)
+++ short/3D/PyLith/trunk/libsrc/faults/BruneSlipFn.hh	2007-04-24 18:19:33 UTC (rev 6651)
@@ -82,21 +82,21 @@
 
   /** 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.
+   * @param mesh Finite-element mesh.
+   * @param faultMesh Fault finite-element mesh.
+   * @param cs Coordinate system for mesh
    */
   void initialize(const ALE::Obj<Mesh>& mesh,
-		  const spatialdata::geocoords::CoordSys* cs,
-		  const std::set<Mesh::point_type>& vertices);
+		  const ALE::Obj<Mesh>& faultMesh,
+		  const spatialdata::geocoords::CoordSys* cs);
 
   /** Get slip on fault surface at time t.
    *
    * @param t Time t.
-   * @param vertices Vertices on fault surface.
+   * @param mesh Fault finite-element mesh.
    */
   const ALE::Obj<real_section_type>& slip(const double t,
-				 const std::set<Mesh::point_type>& vertices);
+					  const ALE::Obj<Mesh>& faultMesh);
 
 // PROTECTED METHODS ////////////////////////////////////////////////////
 protected :

Modified: short/3D/PyLith/trunk/libsrc/faults/CohesiveTopology.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/CohesiveTopology.cc	2007-04-24 18:18:26 UTC (rev 6650)
+++ short/3D/PyLith/trunk/libsrc/faults/CohesiveTopology.cc	2007-04-24 18:19:33 UTC (rev 6651)
@@ -20,10 +20,13 @@
 
 // ----------------------------------------------------------------------
 void
-pylith::faults::CohesiveTopology::create(const ALE::Obj<Mesh>& mesh,
+pylith::faults::CohesiveTopology::create(ALE::Obj<Mesh>* fault,
+					 const ALE::Obj<Mesh>& mesh,
 					 const ALE::Obj<Mesh::int_section_type>& groupField,
 					 const int materialId)
 { // create
+  assert(0 != fault);
+
   typedef std::vector<Mesh::point_type> PointArray;
   typedef ALE::SieveAlg<Mesh> sieveAlg;
 
@@ -40,7 +43,7 @@
   } // for
 
   const ALE::Obj<sieve_type>& sieve = mesh->getSieve();
-  const ALE::Obj<Mesh> fault = new Mesh(mesh->comm(), mesh->debug());
+  *fault = new Mesh(mesh->comm(), mesh->debug());
   const ALE::Obj<sieve_type> faultSieve = new sieve_type(sieve->comm(), 
 						    sieve->debug());
   const std::set<Mesh::point_type>::const_iterator fvBegin = 
@@ -120,14 +123,14 @@
       } // if
     } // for
   } // for
-  fault->setSieve(faultSieve);
-  fault->stratify();
+  (*fault)->setSieve(faultSieve);
+  (*fault)->stratify();
   faultCells.clear();
   if (debug)
-    fault->view("Fault mesh");
+    (*fault)->view("Fault mesh");
 
   // Add new shadow vertices
-  const ALE::Obj<Mesh::label_sequence>& fVertices = fault->depthStratum(0);
+  const ALE::Obj<Mesh::label_sequence>& fVertices = (*fault)->depthStratum(0);
   const ALE::Obj<Mesh::label_sequence>& vertices = mesh->depthStratum(0);
   const ALE::Obj<std::set<std::string> >& groupNames = mesh->getIntSections();
   Mesh::point_type newPoint = sieve->base()->size() + sieve->cap()->size();
@@ -152,7 +155,7 @@
   } // for
 
   // Split the mesh along the fault sieve and create cohesive elements
-  const ALE::Obj<Mesh::label_sequence>& faces = fault->depthStratum(1);
+  const ALE::Obj<Mesh::label_sequence>& faces = (*fault)->depthStratum(1);
   const ALE::Obj<Mesh::label_type>& material = mesh->getLabel("material-id");
   PointArray newVertices;
   
@@ -218,7 +221,7 @@
   // Fix coordinates
   const ALE::Obj<real_section_type>& coordinates = 
     mesh->getRealSection("coordinates");
-  const ALE::Obj<Mesh::label_sequence>& fVertices2 = fault->depthStratum(0);
+  const ALE::Obj<Mesh::label_sequence>& fVertices2 = (*fault)->depthStratum(0);
 
   for(Mesh::label_sequence::iterator v_iter = fVertices2->begin();
       v_iter != fVertices2->end();

Modified: short/3D/PyLith/trunk/libsrc/faults/CohesiveTopology.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/CohesiveTopology.hh	2007-04-24 18:18:26 UTC (rev 6650)
+++ short/3D/PyLith/trunk/libsrc/faults/CohesiveTopology.hh	2007-04-24 18:19:33 UTC (rev 6651)
@@ -36,13 +36,15 @@
 
   /** Create cohesive cells.
    *
+   * @param fault Finite-element mesh of fault (output)
    * @param mesh Finite-element mesh
    * @param faultVertices Vertices assocated with faces of cells defining 
    *   fault surface
    * @param materialId Material id for cohesive elements.
    */
   static
-  void create(const ALE::Obj<Mesh>& mesh,
+  void create(ALE::Obj<Mesh>* fault,
+              const ALE::Obj<Mesh>& mesh,
               const ALE::Obj<Mesh::int_section_type>& groupField,
 	      const int materialId);
 

Modified: short/3D/PyLith/trunk/libsrc/faults/EqKinSrc.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/EqKinSrc.cc	2007-04-24 18:18:26 UTC (rev 6650)
+++ short/3D/PyLith/trunk/libsrc/faults/EqKinSrc.cc	2007-04-24 18:19:33 UTC (rev 6651)
@@ -53,21 +53,22 @@
 // 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)
+				     const ALE::Obj<Mesh>& faultMesh,
+				     
+				   const spatialdata::geocoords::CoordSys* cs)
 { // initialize
   assert(0 != _slipfn);
-  _slipfn->initialize(mesh, cs, vertices);
+  _slipfn->initialize(mesh, faultMesh, cs);
 } // 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)
+			       const ALE::Obj<Mesh>& faultMesh)
 { // slip
   assert(0 != _slipfn);
-  return _slipfn->slip(t, vertices);
+  return _slipfn->slip(t, faultMesh);
 } // slip
 
 

Modified: short/3D/PyLith/trunk/libsrc/faults/EqKinSrc.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/EqKinSrc.hh	2007-04-24 18:18:26 UTC (rev 6650)
+++ short/3D/PyLith/trunk/libsrc/faults/EqKinSrc.hh	2007-04-24 18:19:33 UTC (rev 6651)
@@ -75,23 +75,23 @@
 
   /** 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.
+   * @param mesh Finite-element mesh.
+   * @param faultMesh Fault finite-element mesh.
+   * @param cs Coordinate system for mesh
    */
   virtual
   void initialize(const ALE::Obj<Mesh>& mesh,
-		  const spatialdata::geocoords::CoordSys* cs,
-		  const std::set<Mesh::point_type>& vertices);
+		  const ALE::Obj<Mesh>& faultMesh,
+		  const spatialdata::geocoords::CoordSys* cs);
 
   /** Get slip on fault surface at time t.
    *
    * @param t Time t.
-   * @param vertices Vertices on fault surface.
+   * @param mesh Fault finite-element mesh.
    */
   virtual
   const ALE::Obj<real_section_type>& slip(const double t,
-				const std::set<Mesh::point_type>& vertices);
+					  const ALE::Obj<Mesh>& faultMesh);
 
   // PROTECTED METHODS //////////////////////////////////////////////////
 protected :

Modified: short/3D/PyLith/trunk/libsrc/faults/FaultCohesive.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/FaultCohesive.cc	2007-04-24 18:18:26 UTC (rev 6650)
+++ short/3D/PyLith/trunk/libsrc/faults/FaultCohesive.cc	2007-04-24 18:19:33 UTC (rev 6651)
@@ -24,7 +24,8 @@
 
 // ----------------------------------------------------------------------
 // Default constructor.
-pylith::faults::FaultCohesive::FaultCohesive(void)
+pylith::faults::FaultCohesive::FaultCohesive(void) :
+  _faultMesh(new ALE::Obj<ALE::Mesh>)
 { // constructor
 } // constructor
 
@@ -32,13 +33,16 @@
 // Destructor.
 pylith::faults::FaultCohesive::~FaultCohesive(void)
 { // destructor
+  delete _faultMesh; _faultMesh = 0;
 } // destructor
 
 // ----------------------------------------------------------------------
 // Copy constructor.
 pylith::faults::FaultCohesive::FaultCohesive(const FaultCohesive& f) :
-  Fault(f)
+  Fault(f),
+  _faultMesh(new ALE::Obj<ALE::Mesh>)
 { // copy constructor
+  *_faultMesh = *f._faultMesh;
 } // copy constructor
 
 // ----------------------------------------------------------------------
@@ -54,7 +58,7 @@
     (*mesh)->getIntSection(label());
   assert(!groupField.isNull());
 
-  CohesiveTopology::create(*mesh, groupField, id());
+  CohesiveTopology::create(_faultMesh, *mesh, groupField, id());
 } // adjustTopology
 
 

Modified: short/3D/PyLith/trunk/libsrc/faults/FaultCohesive.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/FaultCohesive.hh	2007-04-24 18:18:26 UTC (rev 6650)
+++ short/3D/PyLith/trunk/libsrc/faults/FaultCohesive.hh	2007-04-24 18:19:33 UTC (rev 6651)
@@ -21,6 +21,8 @@
 
 #include "Fault.hh"
 
+#include "pylith/utils/sievefwd.hh" // HOLDSA PETSc Mesh
+
 /// Namespace for pylith package
 namespace pylith {
   namespace faults {
@@ -69,6 +71,8 @@
   // PRIVATE MEMBERS ////////////////////////////////////////////////////
 private :
 
+  ALE::Obj<ALE::Mesh>* _faultMesh;
+
 }; // class FaultCohesive
 
 #endif // pylith_faults_faultcohesive_hh

Modified: short/3D/PyLith/trunk/libsrc/faults/SlipTimeFn.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/SlipTimeFn.hh	2007-04-24 18:18:26 UTC (rev 6650)
+++ short/3D/PyLith/trunk/libsrc/faults/SlipTimeFn.hh	2007-04-24 18:19:33 UTC (rev 6651)
@@ -65,23 +65,23 @@
 
   /** 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.
+   * @param mesh Finite-element mesh.
+   * @param faultMesh Fault finite-element mesh.
+   * @param cs Coordinate system for mesh
    */
   virtual
   void initialize(const ALE::Obj<Mesh>& mesh,
-		  const spatialdata::geocoords::CoordSys* cs,
-		  const std::set<Mesh::point_type>& vertices) = 0;
+		  const ALE::Obj<Mesh>& faultMesh,
+		  const spatialdata::geocoords::CoordSys* cs) = 0;
 
   /** Get slip on fault surface at time t.
    *
    * @param t Time t.
-   * @param vertices Vertices on fault surface.
+   * @param mesh Fault finite-element mesh.
    */
   virtual
   const ALE::Obj<real_section_type>& slip(const double t,
-			      const std::set<Mesh::point_type>& vertices) = 0;
+					  const ALE::Obj<Mesh>& faultMesh) = 0;
 
   // PROTECTED METHODS //////////////////////////////////////////////////
 protected :



More information about the cig-commits mailing list