[cig-commits] r6569 - in short/3D/PyLith/trunk: . libsrc libsrc/faults modulesrc modulesrc/faults pylith pylith/faults pylith/materials pylith/problems pylith/topology

brad at geodynamics.org brad at geodynamics.org
Fri Apr 13 17:26:31 PDT 2007


Author: brad
Date: 2007-04-13 17:26:30 -0700 (Fri, 13 Apr 2007)
New Revision: 6569

Added:
   short/3D/PyLith/trunk/libsrc/faults/
   short/3D/PyLith/trunk/libsrc/faults/Fault.cc
   short/3D/PyLith/trunk/libsrc/faults/Fault.hh
   short/3D/PyLith/trunk/libsrc/faults/Fault.icc
   short/3D/PyLith/trunk/libsrc/faults/FaultCohesive.cc
   short/3D/PyLith/trunk/libsrc/faults/FaultCohesive.hh
   short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.cc
   short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.hh
   short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.icc
   short/3D/PyLith/trunk/libsrc/faults/Makefile.am
   short/3D/PyLith/trunk/modulesrc/faults/
   short/3D/PyLith/trunk/modulesrc/faults/Makefile.am
   short/3D/PyLith/trunk/modulesrc/faults/faults.pyxe.src
   short/3D/PyLith/trunk/pylith/faults/
   short/3D/PyLith/trunk/pylith/faults/Fault.py
   short/3D/PyLith/trunk/pylith/faults/FaultCohesive.py
   short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py
   short/3D/PyLith/trunk/pylith/faults/FaultsBin.py
   short/3D/PyLith/trunk/pylith/faults/SingleFault.py
   short/3D/PyLith/trunk/pylith/faults/__init__.py
Modified:
   short/3D/PyLith/trunk/TODO
   short/3D/PyLith/trunk/configure.ac
   short/3D/PyLith/trunk/libsrc/Makefile.am
   short/3D/PyLith/trunk/modulesrc/Makefile.am
   short/3D/PyLith/trunk/pylith/Makefile.am
   short/3D/PyLith/trunk/pylith/PyLithApp.py
   short/3D/PyLith/trunk/pylith/materials/Material.py
   short/3D/PyLith/trunk/pylith/problems/EqDeformation.py
   short/3D/PyLith/trunk/pylith/topology/MeshGenerator.py
   short/3D/PyLith/trunk/pylith/topology/MeshImporter.py
Log:
Started implementing faults using cohesive elements.

Modified: short/3D/PyLith/trunk/TODO
===================================================================
--- short/3D/PyLith/trunk/TODO	2007-04-13 22:47:36 UTC (rev 6568)
+++ short/3D/PyLith/trunk/TODO	2007-04-14 00:26:30 UTC (rev 6569)
@@ -2,39 +2,48 @@
 MAIN PRIORITIES (Brad)
 ======================================================================
 
-0. Update unit testing.
-
-  b. Update MeshIOAscii tests (groups of vertices and cells)
-
-1. Finish implementing ExplicitElasticity and Explicit
-   a. Double check loops for calcConstant() and calcJacobian()
-   b. Create unit test (construction of constant term and Jacobian)
-
-2. Start implementing faults
+0. Start implementing faults
    a. Create Faults object
    b. Add creation of cohesive elements
    c. Start implementing integrator for faults
    d. Create unit tests at C++ level
    e. Create unit tests at Python level
 
+1. Finish implementing ExplicitElasticity and Explicit
+   a. Double check loops for calcConstant() and calcJacobian()
+   b. Create unit test (construction of constant term and Jacobian)
+
+2. Implement HDF5 output
+
+3. Implement PML boundary conditions
+
+4. Create suite of simple full test cases
+
 ======================================================================
 SECONDARY PRIORITIES
 ======================================================================
 
-1. Implement MeshIOHDF5 & HDF5
+1. Implement MeshIOCubit
    a. C++ objects
    b. unit tests at C++ level
-   c. Python object (MeshIOHDF5)
+   c. Python object (MeshIOCubit)
    d. bindings
    e. unit tests at Python level
 
-2. Implement MeshIOCubit
+2. Implement MeshIOLagrit
    a. C++ objects
    b. unit tests at C++ level
-   c. Python object (MeshIOCubit)
+   c. Python object (MeshIOLagrit)
    d. bindings
    e. unit tests at Python level
 
+3. Implement MeshIOHDF5 & HDF5
+   a. C++ objects
+   b. unit tests at C++ level
+   c. Python object (MeshIOHDF5)
+   d. bindings
+   e. unit tests at Python level
+
 ======================================================================
 UNRESOLVED ISSUES
 ======================================================================

Modified: short/3D/PyLith/trunk/configure.ac
===================================================================
--- short/3D/PyLith/trunk/configure.ac	2007-04-13 22:47:36 UTC (rev 6568)
+++ short/3D/PyLith/trunk/configure.ac	2007-04-14 00:26:30 UTC (rev 6569)
@@ -145,11 +145,13 @@
 		pylith/Makefile
                 libsrc/Makefile
                 libsrc/feassemble/Makefile
+		libsrc/faults/Makefile
                 libsrc/materials/Makefile
                 libsrc/meshio/Makefile
 		libsrc/utils/Makefile
 		libsrc/topology/Makefile
                 modulesrc/Makefile
+                modulesrc/faults/Makefile
                 modulesrc/feassemble/Makefile
                 modulesrc/materials/Makefile
                 modulesrc/meshio/Makefile

Modified: short/3D/PyLith/trunk/libsrc/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/libsrc/Makefile.am	2007-04-13 22:47:36 UTC (rev 6568)
+++ short/3D/PyLith/trunk/libsrc/Makefile.am	2007-04-14 00:26:30 UTC (rev 6569)
@@ -13,6 +13,7 @@
 SUBDIRS = \
 	utils \
 	feassemble \
+	faults \
 	materials \
 	meshio \
 	topology
@@ -20,6 +21,9 @@
 lib_LTLIBRARIES = libpylith.la
 
 libpylith_la_SOURCES = \
+	faults/Fault.cc \
+	faults/FaultCohesive.cc \
+	faults/FaultCohesiveKin.cc \
 	feassemble/ExplicitElasticity.cc \
 	feassemble/Integrator.cc \
 	feassemble/IntegratorExplicit.cc \

Added: short/3D/PyLith/trunk/libsrc/faults/Fault.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/Fault.cc	2007-04-13 22:47:36 UTC (rev 6568)
+++ short/3D/PyLith/trunk/libsrc/faults/Fault.cc	2007-04-14 00:26:30 UTC (rev 6569)
@@ -0,0 +1,40 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "Fault.hh" // implementation of object methods
+
+// ----------------------------------------------------------------------
+// Default constructor.
+pylith::faults::Fault::Fault(void) :
+  _id(0),
+  _label("")
+{ // constructor
+} // constructor
+
+// ----------------------------------------------------------------------
+// Destructor.
+pylith::faults::Fault::~Fault(void)
+{ // destructor
+} // destructor
+
+// ----------------------------------------------------------------------
+// Copy constructor.
+pylith::faults::Fault::Fault(const Fault& f) :
+  _id(f._id),
+  _label(f._label)
+{ // copy constructor
+} // copy constructor
+
+
+// End of file 

Added: short/3D/PyLith/trunk/libsrc/faults/Fault.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/Fault.hh	2007-04-13 22:47:36 UTC (rev 6568)
+++ short/3D/PyLith/trunk/libsrc/faults/Fault.hh	2007-04-14 00:26:30 UTC (rev 6569)
@@ -0,0 +1,115 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file libsrc/faults/Fault.hh
+ *
+ * @brief C++ abstract base class for Fault object.
+ *
+ * Interface definition for fault.
+ */
+
+#if !defined(pylith_faults_fault_hh)
+#define pylith_faults_fault_hh
+
+#include "pylith/utils/sievefwd.hh"
+#include <string> // HASA std::string
+
+/// Namespace for pylith package
+namespace pylith {
+  namespace faults {
+    class Fault;
+    class TestFault; // unit testing
+  } // faults
+} // pylith
+
+/// C++ abstract base class for Fault object.
+class pylith::faults::Fault
+{ // class Fault
+  friend class TestFault; // unit testing
+
+  // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+  /// Default constructor.
+  Fault(void);
+
+  /// Destructor.
+  virtual
+  ~Fault(void);
+
+  /** Create copy of fault.
+   *
+   * @returns Copy of fault.
+   */
+  virtual
+  Fault* clone(void) const = 0;
+
+  /** Set identifier of fault.
+   *
+   * @param value Fault identifier
+   */
+  void id(const int value);
+
+  /** Get identifier of fault.
+   *
+   * @returns Fault identifier
+   */
+  int id(void) const;
+
+  /** Set label of fault.
+   *
+   * @param value Label of fault
+   */
+  void label(const char* value);
+
+  /** Get label of fault.
+   *
+   * @returns Label of fault
+   */
+  const std::string& label(void) const;
+
+  /** Adjust mesh topology for fault implementation.
+   *
+   * @param mesh PETSc mesh
+   */
+  virtual
+  void adjustTopology(ALE::Obj<ALE::Mesh>* mesh) const = 0;
+
+  // PROTECTED METHODS //////////////////////////////////////////////////
+protected :
+
+  /** Copy constructor.
+   *
+   * @param m Fault to copy
+   */
+  Fault(const Fault& m);
+
+  // NOT IMPLEMENTED ////////////////////////////////////////////////////
+private :
+
+  /// Not implemented
+  const Fault& operator=(const Fault& m);
+
+  // PRIVATE MEMBERS ////////////////////////////////////////////////////
+private :
+
+  int _id; ///< Fault identifier
+  std::string _label; ///< Label of fault
+
+}; // class Fault
+
+#include "Fault.icc" // inline methods
+
+#endif // pylith_faults_fault_hh
+
+
+// End of file 

Added: short/3D/PyLith/trunk/libsrc/faults/Fault.icc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/Fault.icc	2007-04-13 22:47:36 UTC (rev 6568)
+++ short/3D/PyLith/trunk/libsrc/faults/Fault.icc	2007-04-14 00:26:30 UTC (rev 6569)
@@ -0,0 +1,46 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#if !defined(pylith_faults_fault_hh)
+#error "Fault.icc can only be included from Fault.hh"
+#endif
+
+// Set identifier of fault.
+inline
+void
+pylith::faults::Fault::id(const int value) {
+  _id = value;
+}
+
+// Get identifier of fault.
+inline
+int
+pylith::faults::Fault::id(void) const {
+  return _id;
+}
+
+// Set name of fault.
+inline
+void
+pylith::faults::Fault::label(const char* value) {
+  _label = value;
+}
+
+// Get label of fault.
+inline
+const std::string&
+pylith::faults::Fault::label(void) const {
+  return _label;
+}
+
+
+// End of file 

Added: short/3D/PyLith/trunk/libsrc/faults/FaultCohesive.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/FaultCohesive.cc	2007-04-13 22:47:36 UTC (rev 6568)
+++ short/3D/PyLith/trunk/libsrc/faults/FaultCohesive.cc	2007-04-14 00:26:30 UTC (rev 6569)
@@ -0,0 +1,44 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "FaultCohesive.hh" // implementation of object methods
+
+// ----------------------------------------------------------------------
+// Default constructor.
+pylith::faults::FaultCohesive::FaultCohesive(void)
+{ // constructor
+} // constructor
+
+// ----------------------------------------------------------------------
+// Destructor.
+pylith::faults::FaultCohesive::~FaultCohesive(void)
+{ // destructor
+} // destructor
+
+// ----------------------------------------------------------------------
+// Copy constructor.
+pylith::faults::FaultCohesive::FaultCohesive(const FaultCohesive& f) :
+  Fault(f)
+{ // copy constructor
+} // copy constructor
+
+// ----------------------------------------------------------------------
+// Adjust mesh topology for fault implementation.
+void
+pylith::faults::FaultCohesive::adjustTopology(ALE::Obj<ALE::Mesh>* mesh) const
+{ // adjustTopology
+} // adjustTopology
+
+
+// End of file 

Added: short/3D/PyLith/trunk/libsrc/faults/FaultCohesive.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/FaultCohesive.hh	2007-04-13 22:47:36 UTC (rev 6568)
+++ short/3D/PyLith/trunk/libsrc/faults/FaultCohesive.hh	2007-04-14 00:26:30 UTC (rev 6569)
@@ -0,0 +1,77 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file libsrc/faults/FaultCohesive.hh
+ *
+ * @brief C++ abstract base class for a fault surface implemented with
+ * cohesive elements.
+ */
+
+#if !defined(pylith_faults_faultcohesive_hh)
+#define pylith_faults_faultcohesive_hh
+
+#include "Fault.hh"
+
+/// Namespace for pylith package
+namespace pylith {
+  namespace faults {
+    class FaultCohesive;
+    class TestFaultCohesive; // unit testing
+  } // faults
+} // pylith
+
+/// C++ abstract base class for a fault surface implemented with
+/// cohesive elements.
+class pylith::faults::FaultCohesive : public Fault
+{ // class FaultCohesive
+  friend class TestFaultCohesive; // unit testing
+
+  // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+  /// Default constructor.
+  FaultCohesive(void);
+
+  /// Destructor.
+  virtual
+  ~FaultCohesive(void);
+
+  /** Adjust mesh topology for fault implementation.
+   *
+   * @param mesh PETSc mesh
+   */
+  void adjustTopology(ALE::Obj<ALE::Mesh>* mesh) const;
+
+  // PROTECTED METHODS //////////////////////////////////////////////////
+protected :
+
+  /** Copy constructor.
+   *
+   * @param m Fault to copy
+   */
+  FaultCohesive(const FaultCohesive& m);
+
+  // NOT IMPLEMENTED ////////////////////////////////////////////////////
+private :
+
+  /// Not implemented
+  const FaultCohesive& operator=(const FaultCohesive& m);
+
+  // PRIVATE MEMBERS ////////////////////////////////////////////////////
+private :
+
+}; // class FaultCohesive
+
+#endif // pylith_faults_faultcohesive_hh
+
+
+// End of file 

Added: short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.cc	2007-04-13 22:47:36 UTC (rev 6568)
+++ short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.cc	2007-04-14 00:26:30 UTC (rev 6569)
@@ -0,0 +1,37 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "FaultCohesiveKin.hh" // implementation of object methods
+
+// ----------------------------------------------------------------------
+// Default constructor.
+pylith::faults::FaultCohesiveKin::FaultCohesiveKin(void)
+{ // constructor
+} // constructor
+
+// ----------------------------------------------------------------------
+// Destructor.
+pylith::faults::FaultCohesiveKin::~FaultCohesiveKin(void)
+{ // destructor
+} // destructor
+
+// ----------------------------------------------------------------------
+// Copy constructor.
+pylith::faults::FaultCohesiveKin::FaultCohesiveKin(const FaultCohesiveKin& f) :
+  FaultCohesive(f)
+{ // copy constructor
+} // copy constructor
+
+
+// End of file 

Added: short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.hh	2007-04-13 22:47:36 UTC (rev 6568)
+++ short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.hh	2007-04-14 00:26:30 UTC (rev 6569)
@@ -0,0 +1,77 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file libsrc/faults/FaultCohesiveKin.hh
+ *
+ * @brief C++ abstract base class for a fault surface implemented with
+ * cohesive elements.
+ */
+
+#if !defined(pylith_faults_faultcphesivekin_hh)
+#define pylith_faults_faultchesivekin_hh
+
+#include "FaultCohesive.hh"
+
+/// Namespace for pylith package
+namespace pylith {
+  namespace faults {
+    class FaultCohesiveKin;
+    class TestFaultCohesiveKin; // unit testing
+  } // faults
+} // pylith
+
+/// C++ implementation for a fault surface with kinematic (prescribed)
+/// slip implemented with cohesive elements.
+class pylith::faults::FaultCohesiveKin : public FaultCohesive
+{ // class FaultCohesiveKin
+  friend class TestFaultCohesiveKin; // unit testing
+
+  // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+  /// Default constructor.
+  FaultCohesiveKin(void);
+
+  /// Destructor.
+  virtual
+  ~FaultCohesiveKin(void);
+
+  /** Create copy of fault.
+   *
+   * @returns Copy of fault.
+   */
+  Fault* clone(void) const;  
+
+  // PROTECTED METHODS //////////////////////////////////////////////////
+protected :
+
+  /** Copy constructor.
+   *
+   * @param m Fault to copy
+   */
+  FaultCohesiveKin(const FaultCohesiveKin& m);
+
+  // NOT IMPLEMENTED ////////////////////////////////////////////////////
+private :
+
+  /// Not implemented
+  const FaultCohesiveKin& operator=(const FaultCohesiveKin& m);
+
+  // PRIVATE MEMBERS ////////////////////////////////////////////////////
+private :
+
+}; // class FaultCohesiveKin
+
+#endif // pylith_faults_faultcohesivekin_hh
+
+
+// End of file 

Added: short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.icc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.icc	2007-04-13 22:47:36 UTC (rev 6568)
+++ short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.icc	2007-04-14 00:26:30 UTC (rev 6569)
@@ -0,0 +1,25 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#if !defined(pylith_faults_faultcohesivekin_hh)
+#error "Fault.icc can only be included from FaultCohesiveKin.hh"
+#endif
+
+// Create copy of fault.
+inline
+pylith::faults::Fault*
+pylith::faults::FaultCohesiveKin::clone(void) const {
+  return new FaultCohesiveKin(*this);
+} // clone
+
+
+// End of file 

Added: short/3D/PyLith/trunk/libsrc/faults/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/Makefile.am	2007-04-13 22:47:36 UTC (rev 6568)
+++ short/3D/PyLith/trunk/libsrc/faults/Makefile.am	2007-04-14 00:26:30 UTC (rev 6569)
@@ -0,0 +1,31 @@
+# -*- Makefile -*-
+#
+# ----------------------------------------------------------------------
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+subpackage = faults
+include $(top_srcdir)/subpackage.am
+
+subpkginclude_HEADERS = \
+	Fault.hh \
+	Fault.icc \
+	FaultCohesive.hh \
+	FaultCohesiveKin.hh \
+	FaultCohesiveKin.icc
+
+noinst_HEADERS =
+
+# export
+clean-local: clean-subpkgincludeHEADERS
+BUILT_SOURCES = export-subpkgincludeHEADERS
+CLEANFILES = export-subpkgincludeHEADERS
+
+
+# End of file 

Modified: short/3D/PyLith/trunk/modulesrc/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/modulesrc/Makefile.am	2007-04-13 22:47:36 UTC (rev 6568)
+++ short/3D/PyLith/trunk/modulesrc/Makefile.am	2007-04-14 00:26:30 UTC (rev 6569)
@@ -11,6 +11,7 @@
 #
 
 SUBDIRS = \
+	faults \
 	feassemble \
 	materials \
 	meshio \

Added: short/3D/PyLith/trunk/modulesrc/faults/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/modulesrc/faults/Makefile.am	2007-04-13 22:47:36 UTC (rev 6568)
+++ short/3D/PyLith/trunk/modulesrc/faults/Makefile.am	2007-04-14 00:26:30 UTC (rev 6569)
@@ -0,0 +1,43 @@
+# -*- Makefile -*-
+#
+# ----------------------------------------------------------------------
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+subpackage = faults
+include $(top_srcdir)/subpackage.am
+
+subpkgpyexec_LTLIBRARIES = faultsmodule.la
+
+faultsmodule_la_LDFLAGS = -module
+
+faultsmodule_la_SOURCES = faults.pyxe
+
+nodist_faultsmodule_la_SOURCES = \
+	faults.c faults_embed.cpp faults_embed.h
+
+faultsmodule_la_LIBADD = \
+	$(top_builddir)/libsrc/libpylith.la \
+	$(PETSC_LIB)
+
+INCLUDES += -I$(PYTHON_INCDIR) $(PETSC_INCLUDE)
+
+faults.pyx faults_embed.cpp  faults_embed.h: faults.pyxe
+	pyrexembed faults.pyxe
+faults.pyxe: $(srcdir)/faults.pyxe.src
+	cp $(srcdir)/faults.pyxe.src $@
+faults_embed.cpp: faults_embed.h
+faults_embed.h: faults.pyx
+
+.pyx.c:
+	pyrexc $<
+
+CLEANFILES = faults.pyxe faults.pyx faults.c *_embed.*
+
+# End of file 

Added: short/3D/PyLith/trunk/modulesrc/faults/faults.pyxe.src
===================================================================
--- short/3D/PyLith/trunk/modulesrc/faults/faults.pyxe.src	2007-04-13 22:47:36 UTC (rev 6568)
+++ short/3D/PyLith/trunk/modulesrc/faults/faults.pyxe.src	2007-04-14 00:26:30 UTC (rev 6569)
@@ -0,0 +1,199 @@
+# -*- Pyrex -*-
+#
+# ======================================================================
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# {LicenseText}
+#
+# ======================================================================
+#
+
+#header{
+#include "pylith/faults/Fault.hh"
+#include "pylith/faults/FaultCohesive.hh"
+#include "pylith/faults/FaultCohesiveKin.hh"
+
+#include <assert.h>
+#include <stdexcept>
+#include <Python.h>
+#}header
+
+# ----------------------------------------------------------------------
+cdef extern from "Python.h":
+  object PyCObject_FromVoidPtr(void*, void (*destruct)(void*))
+  void* PyCObject_AsVoidPtr(object)
+
+cdef void* ptrFromHandle(obj):
+  """Extract pointer from PyCObject."""
+  return PyCObject_AsVoidPtr(obj.handle)
+
+cdef extern from "stdlib.h":
+  ctypedef unsigned long size_t
+  void* malloc(size_t size)
+  void free(void* mem)
+
+cdef void Fault_destructor(void* obj):
+  """
+  Destroy Fault object.
+  """
+  # create shim for destructor
+  #embed{ void Fault_destructor_cpp(void* objVptr)
+  pylith::faults::Fault* pM = (pylith::faults::Fault*) objVptr;
+  delete pM;
+  #}embed
+  Fault_destructor_cpp(obj)
+  return
+
+
+# ----------------------------------------------------------------------
+cdef class Fault:
+
+  cdef void* thisptr # Pointer to C++ object
+  cdef readonly object handle # PyCObject holding pointer to C++ object
+  cdef readonly object name # Identifier for object base type
+
+  def __init__(self):
+    """
+    Constructor.
+    """
+    self.handle = None
+    self.thisptr = NULL
+    self.name = "pylith_faults_Fault"
+    return
+
+
+  def adjustTopology(self, mesh):
+    """
+    Adjust mesh topology for fault implementation.
+    """
+    # create shim for method 'adjustTopology'
+    #embed{ void Fault_adjustTopology(void* objVptr, void* meshVptr)
+    try {
+      assert(0 != objVptr);
+      ALE::Obj<ALE::Mesh>* mesh = (ALE::Obj<ALE::Mesh>*) meshVptr;
+      ((pylith::faults::Fault*) objVptr)->adjustTopology(mesh);
+    } catch (const std::exception& err) {
+    PyErr_SetString(PyExc_RuntimeError,
+                    const_cast<char*>(err.what()));
+    } catch (...) {
+    PyErr_SetString(PyExc_RuntimeError,
+                    "Caught unknown C++ exception.");
+    } // try/catch
+    #}embed
+    Fault_adjustTopology(self.thisptr, ptrFromHandle(mesh))
+    return
+
+
+  def _createHandle(self):
+    """
+    Wrap pointer to C++ object in PyCObject.
+    """
+    return PyCObject_FromVoidPtr(self.thisptr, Fault_destructor)
+
+
+  property id:
+    def __set__(self, value):
+      """
+      Set identifier of material.
+      """
+      # create shim for method 'id'
+      #embed{ void Fault_id_set(void* objVptr, int value)
+      try {
+        assert(0 != objVptr);
+        ((pylith::faults::Fault*) objVptr)->id(value);
+      } catch (const std::exception& err) {
+        PyErr_SetString(PyExc_RuntimeError,
+                        const_cast<char*>(err.what()));
+      } catch (...) {
+        PyErr_SetString(PyExc_RuntimeError,
+                        "Caught unknown C++ exception.");
+      } // try/catch
+      #}embed
+      Fault_id_set(self.thisptr, value)
+
+    def __get__(self):
+      """
+      Get identifier of material.
+      """
+      # create shim for method 'id'
+      #embed{ int Fault_id_get(void* objVptr)
+      int result = 0;
+      try {
+        assert(0 != objVptr);
+        result = ((pylith::faults::Fault*) objVptr)->id();
+      } catch (const std::exception& err) {
+        PyErr_SetString(PyExc_RuntimeError,
+                        const_cast<char*>(err.what()));
+      } catch (...) {
+        PyErr_SetString(PyExc_RuntimeError,
+                        "Caught unknown C++ exception.");
+      } // try/catch
+      return result;
+      #}embed
+      return Fault_id_get(self.thisptr)
+
+
+  property label:
+    def __set__(self, value):
+      """
+      Set label of material.
+      """
+      # create shim for method 'label'
+      #embed{ void Fault_label_set(void* objVptr, char* value)
+      try {
+        assert(0 != objVptr);
+        ((pylith::faults::Fault*) objVptr)->label(value);
+      } catch (const std::exception& err) {
+        PyErr_SetString(PyExc_RuntimeError,
+                        const_cast<char*>(err.what()));
+      } catch (...) {
+        PyErr_SetString(PyExc_RuntimeError,
+                        "Caught unknown C++ exception.");
+      } // try/catch
+      #}embed
+      Fault_label_set(self.thisptr, value)
+
+
+# ----------------------------------------------------------------------
+cdef class FaultCohesive(Fault):
+
+  def __init__(self):
+    """
+    Constructor.
+    """
+    Fault.__init__(self)
+    return
+
+
+# ----------------------------------------------------------------------
+cdef class FaultCohesiveKin(FaultCohesive):
+
+  def __init__(self):
+    """
+    Constructor.
+    """
+    # create shim for constructor
+    #embed{ void* FaultCohesiveKin_constructor()
+    void* result = 0;
+    try {
+      result = (void*)(new pylith::faults::FaultCohesiveKin);
+      assert(0 != result);
+    } catch (const std::exception& err) {
+      PyErr_SetString(PyExc_RuntimeError,
+                      const_cast<char*>(err.what()));
+    } catch (...) {
+      PyErr_SetString(PyExc_RuntimeError,
+                      "Caught unknown C++ exception.");
+    } // try/catch
+    return result;
+    #}embed
+
+    FaultCohesive.__init__(self)
+    self.thisptr = FaultCohesiveKin_constructor()
+    self.handle = self._createHandle()
+    return
+
+
+# End of file 

Modified: short/3D/PyLith/trunk/pylith/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/pylith/Makefile.am	2007-04-13 22:47:36 UTC (rev 6568)
+++ short/3D/PyLith/trunk/pylith/Makefile.am	2007-04-14 00:26:30 UTC (rev 6569)
@@ -13,6 +13,12 @@
 nobase_pkgpyexec_PYTHON = \
 	PyLithApp.py \
 	__init__.py \
+	faults/__init__.py \
+	faults/FaultsBin.py \
+	faults/Fault.py \
+	faults/FaultCohesive.py \
+	faults/FaultCohesiveKin.py \
+	faults/SingleFault.py \
 	feassemble/__init__.py \
 	feassemble/ExplicitElasticity.py \
 	feassemble/FIATCell.py \

Modified: short/3D/PyLith/trunk/pylith/PyLithApp.py
===================================================================
--- short/3D/PyLith/trunk/pylith/PyLithApp.py	2007-04-13 22:47:36 UTC (rev 6568)
+++ short/3D/PyLith/trunk/pylith/PyLithApp.py	2007-04-14 00:26:30 UTC (rev 6569)
@@ -79,11 +79,18 @@
     """
     Run the application.
     """
+    self.petsc.initialize()
 
-    self.petsc.initialize()
-    mesh = self.mesher.create()
+    # Create mesh (adjust to account for faults if necessary)
+    faults = None
+    if faults in dir(self.problem):
+      faults = self.problem.faults
+    mesh = self.mesher.create(faults)
+
+    # Initialize problem and then run
     self.problem.initialize(mesh.distribute())
     self.problem.run(self)
+    
     self.petsc.finalize()
     return
   

Added: short/3D/PyLith/trunk/pylith/faults/Fault.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/Fault.py	2007-04-13 22:47:36 UTC (rev 6568)
+++ short/3D/PyLith/trunk/pylith/faults/Fault.py	2007-04-14 00:26:30 UTC (rev 6569)
@@ -0,0 +1,120 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file pylith/faults/Fault.py
+##
+
+## @brief Python abstract base class for a fault surface.
+##
+## This implementation of a fault associates both physical
+## properties and a quadrature scheme with the fault.
+##
+## Factory: fault
+
+from pyre.components.Component import Component
+
+# Fault class
+class Fault(Component):
+  """
+  Python abstract base class for a fault surface.
+
+  This implementation of a fault associates both physical
+  properties and a quadrature scheme with the fault.
+
+  Factory: fault
+  """
+
+  # INVENTORY //////////////////////////////////////////////////////////
+
+  class Inventory(Component.Inventory):
+    """
+    Python object for managing Fault facilities and properties.
+    """
+    
+    ## @class Inventory
+    ## Python object for managing Fault facilities and properties.
+    ##
+    ## \b Properties
+    ## @li \b id Fault identifier
+    ## @li \b name Name of fault
+    ##
+    ## \b Facilities
+    ## @li \b quadrature Quadrature object for numerical integration
+
+    import pyre.inventory
+
+    id = pyre.inventory.int("id", default=100)
+    id.meta['tip'] = "Fault identifier (must be unique across all faults " \
+                     "and materials)."
+
+    label = pyre.inventory.str("label", default="")
+    label.meta['tip'] = "Name of material."
+
+    from pylith.feassemble.quadrature.Quadrature import Quadrature
+    quadrature = pyre.inventory.facility("quadrature", factory=Quadrature)
+    quadrature.meta['tip'] = "Quadrature object for numerical integration."
+
+
+  # PUBLIC METHODS /////////////////////////////////////////////////////
+
+  def __init__(self, name="fault"):
+    """
+    Constructor.
+    """
+    Component.__init__(self, name, facility="fault")
+    self.cppHandle = None
+    return
+
+
+  def adjustTopology(self, mesh):
+    """
+    Adjust mesh topology for fault implementation.
+    """
+    self.cppHandle.id = self.id
+    self.cppHandle.label = self.label
+    self.cppHandle.adjustTopology(mesh.cppHandle)
+    return
+
+
+  def initialize(self, mesh):
+    """
+    Initialize material property manager.
+    """
+    self._info.log("Initializing fault '%s'." % self.label)
+
+    if 2 != self.quadrature.cell.cellDim:
+      raise ValueError, \
+            "Quadrature is incompatible with fault surface.\n" \
+            "Dimensions for quadrature: %d, dimensions for surface: 2" % \
+            self.quadrature.cell.cellDim
+
+    #self.cppHandle.id = self.id
+    #self.cppHandle.label = self.label
+    #self.cppHandle.initialize(mesh.cppHandle, mesh.coordsys.cppHandle,
+    #                          self.quadrature.cppHandle)
+    return
+
+
+  # PRIVATE METHODS ////////////////////////////////////////////////////
+
+  def _configure(self):
+    """
+    Setup members using inventory.
+    """
+    Component._configure(self)
+    self.id = self.inventory.id
+    self.label = self.inventory.label
+    self.quadrature = self.inventory.quadrature
+    return
+
+  
+# End of file 

Added: short/3D/PyLith/trunk/pylith/faults/FaultCohesive.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/FaultCohesive.py	2007-04-13 22:47:36 UTC (rev 6568)
+++ short/3D/PyLith/trunk/pylith/faults/FaultCohesive.py	2007-04-14 00:26:30 UTC (rev 6569)
@@ -0,0 +1,52 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file pylith/faults/FaultCohesive.py
+##
+
+## @brief Python abstract base class for a fault surface implemented
+## with cohesive elements.
+##
+## Factory: fault
+
+from Fault import Fault
+
+# FaultCohesive class
+class FaultCohesive(Fault):
+  """
+  Python abstract base class for a fault surface implemeted with
+  cohesive elements.
+
+  Factory: fault
+  """
+
+  # PUBLIC METHODS /////////////////////////////////////////////////////
+
+  def __init__(self, name="faultcohesive"):
+    """
+    Constructor.
+    """
+    Fault.__init__(self, name)
+    return
+
+
+  # PRIVATE METHODS ////////////////////////////////////////////////////
+
+  def _configure(self):
+    """
+    Setup members using inventory.
+    """
+    Fault._configure(self)
+    return
+
+  
+# End of file 

Added: short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py	2007-04-13 22:47:36 UTC (rev 6568)
+++ short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py	2007-04-14 00:26:30 UTC (rev 6569)
@@ -0,0 +1,72 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file pylith/faults/FaultCohesiveKin.py
+##
+
+## @brief Python object for a fault surface with kinematic
+## (prescribed) slip implemented with cohesive elements.
+##
+## Factory: fault
+
+from FaultCohesive import FaultCohesive
+
+# FaultCohesiveKin class
+class FaultCohesiveKin(Fault):
+  """
+  Python object for a fault surface with kinematic (prescribed) slip
+  implemented with cohesive elements.
+
+  Factory: fault
+  """
+
+  # INVENTORY //////////////////////////////////////////////////////////
+
+  class Inventory(FaultCohesive.Inventory):
+    """
+    Python object for managing FaultCohesiveKin facilities and properties.
+    """
+    
+    ## @class Inventory
+    ## Python object for managing FaultCohesiveKin facilities and properties.
+    ##
+    ## \b Properties
+    ## @li None
+    ##
+    ## \b Facilities
+    ## @li None
+
+    import pyre.inventory
+
+  # PUBLIC METHODS /////////////////////////////////////////////////////
+
+  def __init__(self, name="faultcohesivekin"):
+    """
+    Constructor.
+    """
+    FaultCohesive.__init__(self, name)
+    import pylith.faults.faults as bindings
+    self.cppHandle = bindings.FaultCohesiveKin()
+    return
+
+
+  # PRIVATE METHODS ////////////////////////////////////////////////////
+
+  def _configure(self):
+    """
+    Setup members using inventory.
+    """
+    FaultCohesive._configure(self)
+    return
+
+  
+# End of file 

Added: short/3D/PyLith/trunk/pylith/faults/FaultsBin.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/FaultsBin.py	2007-04-13 22:47:36 UTC (rev 6568)
+++ short/3D/PyLith/trunk/pylith/faults/FaultsBin.py	2007-04-14 00:26:30 UTC (rev 6569)
@@ -0,0 +1,40 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file pylith/faults/FaultsBin.py
+##
+## @brief Python container for faults.
+##
+## Factory: faults_bin
+
+from pyre.components.Component import Component
+
+# FaultsBin class
+class FaultsBin(Component):
+  """
+  Python container for faults.
+
+  Factory: faults_bin
+  """
+
+  # PUBLIC METHODS /////////////////////////////////////////////////////
+
+  def __init__(self, name="faultsbin"):
+    """
+    Constructor.
+    """
+    Component.__init__(self, name, facility="faults_bin")
+    self.faults = []
+    return
+
+
+# End of file 

Added: short/3D/PyLith/trunk/pylith/faults/SingleFault.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/SingleFault.py	2007-04-13 22:47:36 UTC (rev 6568)
+++ short/3D/PyLith/trunk/pylith/faults/SingleFault.py	2007-04-14 00:26:30 UTC (rev 6569)
@@ -0,0 +1,82 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file pylith/faults/SingleFault.py
+##
+## @brief Python faults container with one fault.
+##
+## Factory: faults_bin
+
+from FaultsBin import FaultsBin
+
+# SingleFault class
+class SingleFault(FaultsBin):
+  """
+  Python faults container with one material.
+
+  Factory: faults_bin
+  """
+
+  # INVENTORY //////////////////////////////////////////////////////////
+
+  class Inventory(FaultsBin.Inventory):
+    """
+    Python object for managing SingleFault facilities and properties.
+    """
+    
+    ## @class Inventory
+    ## Python object for managing SingleFault facilities and properties.
+    ##
+    ## \b Properties
+    ## @li None
+    ##
+    ## \b Facilities
+    ## @li \b fault Fault in problem
+
+    import pyre.inventory
+
+    from Fault import Fault
+    fault = pyre.inventory.facility("fault", family="fault", factory=Fault)
+    fault.meta['tip'] = "Fault in problem."
+
+
+  # PUBLIC METHODS /////////////////////////////////////////////////////
+
+  def __init__(self, name="fault"):
+    """
+    Constructor.
+    """
+    FaultsBin.__init__(self, name)
+    return
+
+
+  # PRIVATE METHODS ////////////////////////////////////////////////////
+
+  def _configure(self):
+    """
+    Set attributes from inventory.
+    """
+    FaultsBin._configure(self)
+    self.faults = [self.inventory.fault]
+    return
+
+  
+# FACTORIES ////////////////////////////////////////////////////////////
+
+def faults_bin():
+  """
+  Factory associated with SingleFault.
+  """
+  return SingleFault()
+
+
+# End of file 

Added: short/3D/PyLith/trunk/pylith/faults/__init__.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/__init__.py	2007-04-13 22:47:36 UTC (rev 6568)
+++ short/3D/PyLith/trunk/pylith/faults/__init__.py	2007-04-14 00:26:30 UTC (rev 6569)
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file pylith/faults/__init__.py
+##
+## @brief Python PyLith faults module initialization
+
+__all__ = ['FaultsBin',
+           'Fault',
+           'FaultCohesive',
+           'FaultCohesiveKin']
+
+
+# End of file

Modified: short/3D/PyLith/trunk/pylith/materials/Material.py
===================================================================
--- short/3D/PyLith/trunk/pylith/materials/Material.py	2007-04-13 22:47:36 UTC (rev 6568)
+++ short/3D/PyLith/trunk/pylith/materials/Material.py	2007-04-14 00:26:30 UTC (rev 6569)
@@ -20,7 +20,7 @@
 ## properties and a quadrature scheme with the material. Thus,
 ## applying different quadrature schemes within a region with the same
 ## physical property database requires two "materials", which can use
-## the same database.  a material.
+## the same database.
 ##
 ## Factory: material
 
@@ -35,7 +35,7 @@
   properties and a quadrature scheme with the material. Thus, applying
   different quadrature schemes within a region with the same physical
   property database requires two 'materials', which can use the same
-  database.  a material.
+  database.
   """
 
   # INVENTORY //////////////////////////////////////////////////////////

Modified: short/3D/PyLith/trunk/pylith/problems/EqDeformation.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/EqDeformation.py	2007-04-13 22:47:36 UTC (rev 6568)
+++ short/3D/PyLith/trunk/pylith/problems/EqDeformation.py	2007-04-14 00:26:30 UTC (rev 6569)
@@ -46,10 +46,10 @@
 
     import pyre.inventory
 
-    #from Faults import Faults
-    #faults = pyre.inventory.facility("faults", family="faults",
-    #                                 factory=Faults)
-    #faults.meta['tip'] = "Faults or interior slip surfaces."
+    from pylith.faults.FaultsBin import FaultsBin
+    faults = pyre.inventory.facility("faults", family="faults",
+                                     factory=FaultsBin)
+    faults.meta['tip'] = "Faults or interior slip surfaces."
 
 
   # PUBLIC METHODS /////////////////////////////////////////////////////
@@ -73,7 +73,7 @@
           "EqDeformation::checkpoint() not implemented."
 
     # Save state of children
-    #self.faults.checkpoint()
+    self.faults.checkpoint()
     return
   
 
@@ -84,7 +84,7 @@
     Set members based using inventory.
     """
     TimeDependent._configure(self)
-    #self.faults = self.inventory.faults
+    self.faults = self.inventory.faults
     return
 
 

Modified: short/3D/PyLith/trunk/pylith/topology/MeshGenerator.py
===================================================================
--- short/3D/PyLith/trunk/pylith/topology/MeshGenerator.py	2007-04-13 22:47:36 UTC (rev 6568)
+++ short/3D/PyLith/trunk/pylith/topology/MeshGenerator.py	2007-04-14 00:26:30 UTC (rev 6569)
@@ -64,7 +64,7 @@
     return
 
 
-  def create(self):
+  def create(self, faults):
     """
     Hook for creating mesh.
     """
@@ -84,4 +84,14 @@
     return
 
 
+  def _adjustTopology(self, mesh, faults):
+    """
+    Adjust topology for fault implementation.
+    """
+    if not faults is None:
+      for fault in faults:
+        fault.adjustTopology(mesh)
+    return
+  
+
 # End of file 

Modified: short/3D/PyLith/trunk/pylith/topology/MeshImporter.py
===================================================================
--- short/3D/PyLith/trunk/pylith/topology/MeshImporter.py	2007-04-13 22:47:36 UTC (rev 6568)
+++ short/3D/PyLith/trunk/pylith/topology/MeshImporter.py	2007-04-14 00:26:30 UTC (rev 6569)
@@ -59,11 +59,12 @@
     return
 
 
-  def create(self):
+  def create(self, faults):
     """
     Hook for creating mesh.
     """
     mesh = self.importer.read(self.debug, self.interpolate)
+    self._adjustTopology(mesh, faults)
     return mesh
 
 



More information about the cig-commits mailing list