[cig-commits] [commit] knepley/upgrade-petsc-interface: Added edge identifier to Fault for marking buried fault edges. (ddb7dc0)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Wed Oct 23 14:52:40 PDT 2013


Repository : ssh://geoshell/pylith

On branch  : knepley/upgrade-petsc-interface
Link       : https://github.com/geodynamics/pylith/compare/cccfaaa10734bc0409546669b1d8b30be2cb327a...ddb7dc095d61126af7b9e9472eba6fc95befd757

>---------------------------------------------------------------

commit ddb7dc095d61126af7b9e9472eba6fc95befd757
Author: Brad Aagaard <baagaard at usgs.gov>
Date:   Wed Oct 23 14:54:36 2013 -0700

    Added edge identifier to Fault for marking buried fault edges.


>---------------------------------------------------------------

ddb7dc095d61126af7b9e9472eba6fc95befd757
 libsrc/pylith/faults/Fault.cc                    |  1 +
 libsrc/pylith/faults/Fault.hh                    | 15 ++++++++++++++-
 libsrc/pylith/faults/Fault.icc                   | 18 ++++++++++++++++--
 modulesrc/faults/Fault.i                         | 12 ++++++++++++
 pylith/faults/Fault.py                           |  4 ++++
 unittests/libtests/faults/TestFault.cc           | 17 +++++++++++++++++
 unittests/libtests/faults/TestFault.hh           |  6 ++++++
 unittests/pytests/faults/TestFaultCohesiveKin.py |  3 +++
 8 files changed, 73 insertions(+), 3 deletions(-)

diff --git a/libsrc/pylith/faults/Fault.cc b/libsrc/pylith/faults/Fault.cc
index 8710ff3..3781559 100644
--- a/libsrc/pylith/faults/Fault.cc
+++ b/libsrc/pylith/faults/Fault.cc
@@ -27,6 +27,7 @@
 pylith::faults::Fault::Fault(void) :
   _id(0),
   _label(""),
+  _edge(""),
   _faultMesh(0)
 { // constructor
 } // constructor
diff --git a/libsrc/pylith/faults/Fault.hh b/libsrc/pylith/faults/Fault.hh
index edecca3..35d0d7f 100644
--- a/libsrc/pylith/faults/Fault.hh
+++ b/libsrc/pylith/faults/Fault.hh
@@ -85,6 +85,18 @@ public :
    */
   const char* label(void) const;
 
+  /** Set label of group of vertices defining buried edge of fault.
+   *
+   * @param value Label of fault
+   */
+  void edge(const char* value);
+
+  /** Get label of group of vertices defining buried edge of fault.
+   *
+   * @returns Label of fault
+   */
+  const char* edge(void) const;
+
   /** Get dimension of mesh.
    *
    * @returns Dimension of mesh.
@@ -183,7 +195,8 @@ protected :
 private :
 
   int _id; ///< Fault identifier
-  std::string _label; ///< Label of fault
+  std::string _label; ///< Label for points associated with fault.
+  std::string _edge; ///< Label for points defining edge of fault.
 
 }; // class Fault
 
diff --git a/libsrc/pylith/faults/Fault.icc b/libsrc/pylith/faults/Fault.icc
index e50d0d8..60e9f96 100644
--- a/libsrc/pylith/faults/Fault.icc
+++ b/libsrc/pylith/faults/Fault.icc
@@ -34,18 +34,32 @@ pylith::faults::Fault::id(void) const {
   return _id;
 }
 
-// Set name of fault.
+// Set label of group of vertices associated with fault.
 inline
 void
 pylith::faults::Fault::label(const char* value) {
   _label = value;
 }
 
-// Get label of fault.
+// Get label of group of vertices associated with fault.
 inline
 const char*
 pylith::faults::Fault::label(void) const {
   return _label.c_str();
 }
 
+// Set label of group of vertices defining buried edge of fault.
+inline
+void
+pylith::faults::Fault::edge(const char* value) {
+  _edge = value;
+}
+
+// Get label of group of vertices defining buried edge of fault.
+inline
+const char*
+pylith::faults::Fault::edge(void) const {
+  return _edge.c_str();
+}
+
 // End of file 
diff --git a/modulesrc/faults/Fault.i b/modulesrc/faults/Fault.i
index 10b2609..6fbc03b 100644
--- a/modulesrc/faults/Fault.i
+++ b/modulesrc/faults/Fault.i
@@ -65,6 +65,18 @@ namespace pylith {
        */
       const char* label(void) const;
 
+      /** Set label of group of vertices defining buried edge of fault.
+       *
+       * @param value Label of fault
+       */
+      void edge(const char* value);
+      
+      /** Get label of group of vertices defining buried edge of fault.
+       *
+       * @returns Label of fault
+       */
+      const char* edge(void) const;
+
       /** Get dimension of mesh.
        *
        * @returns Dimension of mesh.
diff --git a/pylith/faults/Fault.py b/pylith/faults/Fault.py
index 3eea57e..ac00dcc 100644
--- a/pylith/faults/Fault.py
+++ b/pylith/faults/Fault.py
@@ -90,6 +90,9 @@ class Fault(PetscComponent, ModuleFault):
   faultLabel = pyre.inventory.str("label", default="", validator=validateLabel)
   faultLabel.meta['tip'] = "Label identifier for fault."
   
+  faultEdge = pyre.inventory.str("edge", default="")
+  faultEdge.meta['tip'] = "Label identifier for fault edge."
+  
   upDir = pyre.inventory.list("up_dir", default=[0, 0, 1],
                               validator=validateDir)
   upDir.meta['tip'] = "Up-dip or up direction " \
@@ -236,6 +239,7 @@ class Fault(PetscComponent, ModuleFault):
       self.upDir = map(float, self.inventory.upDir)
       ModuleFault.id(self, self.inventory.matId)
       ModuleFault.label(self, self.inventory.faultLabel)
+      ModuleFault.edge(self, self.inventory.faultEdge)
       self.perfLogger = self.inventory.perfLogger
     except ValueError, err:
       aliases = ", ".join(self.aliases)
diff --git a/unittests/libtests/faults/TestFault.cc b/unittests/libtests/faults/TestFault.cc
index 5193ff2..e4e5b24 100644
--- a/unittests/libtests/faults/TestFault.cc
+++ b/unittests/libtests/faults/TestFault.cc
@@ -62,4 +62,21 @@ pylith::faults::TestFault::testLabel(void)
 } // testLabel
     
 
+// ----------------------------------------------------------------------
+// Test edge()
+void
+pylith::faults::TestFault::testEdge(void)
+{ // testLabel
+  PYLITH_METHOD_BEGIN;
+
+  const std::string edge = "the_edge";
+  FaultCohesiveKin fault;
+  fault.edge(edge.c_str());
+  
+  CPPUNIT_ASSERT_EQUAL(edge, std::string(fault.edge()));
+
+  PYLITH_METHOD_END;
+} // testEdge
+    
+
 // End of file 
diff --git a/unittests/libtests/faults/TestFault.hh b/unittests/libtests/faults/TestFault.hh
index 14fd1d5..d7a274a 100644
--- a/unittests/libtests/faults/TestFault.hh
+++ b/unittests/libtests/faults/TestFault.hh
@@ -42,8 +42,11 @@ class pylith::faults::TestFault : public CppUnit::TestFixture
 
   // CPPUNIT TEST SUITE /////////////////////////////////////////////////
   CPPUNIT_TEST_SUITE( TestFault );
+
   CPPUNIT_TEST( testID );
   CPPUNIT_TEST( testLabel );
+  CPPUNIT_TEST( testEdge );
+
   CPPUNIT_TEST_SUITE_END();
 
   // PUBLIC METHODS /////////////////////////////////////////////////////
@@ -55,6 +58,9 @@ public :
   /// Test label()
   void testLabel(void);
 
+  /// Test edge()
+  void testEdge(void);
+
 }; // class TestFault
 
 #endif // pylith_faults_testfault_hh
diff --git a/unittests/pytests/faults/TestFaultCohesiveKin.py b/unittests/pytests/faults/TestFaultCohesiveKin.py
index 710e970..df09e0b 100644
--- a/unittests/pytests/faults/TestFaultCohesiveKin.py
+++ b/unittests/pytests/faults/TestFaultCohesiveKin.py
@@ -47,6 +47,7 @@ class TestFaultCohesiveKin(unittest.TestCase):
     """
     fault = FaultCohesiveKin()
     fault.inventory.faultLabel = "fault group"
+    fault.inventory.faultEdge = "fault edge"
     fault._configure()
     return
 
@@ -100,6 +101,7 @@ class TestFaultCohesiveKin(unittest.TestCase):
     fault = FaultCohesiveKin()
     fault.inventory.matId = 10
     fault.inventory.faultLabel = "fault"
+    fault.inventory.faultEdge = "fault_edge"
     fault._configure()
 
     nvertices = fault.numVerticesNoMesh(mesh)
@@ -313,6 +315,7 @@ class TestFaultCohesiveKin(unittest.TestCase):
     fault.inventory.output._configure()
     fault.inventory.matId = 10
     fault.inventory.faultLabel = "fault"
+    fault.inventory.faultEdge = "fault_edge"
     fault.inventory.upDir = [0, 0, 1]
     fault.inventory.faultQuadrature = quadrature
     fault._configure()



More information about the CIG-COMMITS mailing list