[cig-commits] r14813 - in short/3D/PyLith/branches/pylith-swig/modulesrc: . faults
brad at geodynamics.org
brad at geodynamics.org
Tue Apr 28 21:11:17 PDT 2009
Author: brad
Date: 2009-04-28 21:11:16 -0700 (Tue, 28 Apr 2009)
New Revision: 14813
Added:
short/3D/PyLith/branches/pylith-swig/modulesrc/faults/BruneSlipFn.i
short/3D/PyLith/branches/pylith-swig/modulesrc/faults/ConstRateSlipFn.i
short/3D/PyLith/branches/pylith-swig/modulesrc/faults/EqKinSrc.i
short/3D/PyLith/branches/pylith-swig/modulesrc/faults/Fault.i
short/3D/PyLith/branches/pylith-swig/modulesrc/faults/FaultCohesive.i
short/3D/PyLith/branches/pylith-swig/modulesrc/faults/FaultCohesiveDyn.i
short/3D/PyLith/branches/pylith-swig/modulesrc/faults/FaultCohesiveKin.i
short/3D/PyLith/branches/pylith-swig/modulesrc/faults/LiuCosSlipFn.i
short/3D/PyLith/branches/pylith-swig/modulesrc/faults/SlipTimeFn.i
short/3D/PyLith/branches/pylith-swig/modulesrc/faults/StepSlipFn.i
short/3D/PyLith/branches/pylith-swig/modulesrc/faults/faults.i
Modified:
short/3D/PyLith/branches/pylith-swig/modulesrc/Makefile.am
short/3D/PyLith/branches/pylith-swig/modulesrc/faults/
short/3D/PyLith/branches/pylith-swig/modulesrc/faults/Makefile.am
Log:
Worked on SWIG stuff for faults.
Modified: short/3D/PyLith/branches/pylith-swig/modulesrc/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-swig/modulesrc/Makefile.am 2009-04-29 00:49:04 UTC (rev 14812)
+++ short/3D/PyLith/branches/pylith-swig/modulesrc/Makefile.am 2009-04-29 04:11:16 UTC (rev 14813)
@@ -12,6 +12,7 @@
SUBDIRS = \
bc \
+ faults \
feassemble \
materials \
meshio \
@@ -20,6 +21,5 @@
topology \
utils
-# faults
# End of file
Property changes on: short/3D/PyLith/branches/pylith-swig/modulesrc/faults
___________________________________________________________________
Name: svn:ignore
+ Makefile.in
faults.py
faults_wrap.cxx
Added: short/3D/PyLith/branches/pylith-swig/modulesrc/faults/BruneSlipFn.i
===================================================================
--- short/3D/PyLith/branches/pylith-swig/modulesrc/faults/BruneSlipFn.i (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/modulesrc/faults/BruneSlipFn.i 2009-04-29 04:11:16 UTC (rev 14813)
@@ -0,0 +1,102 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file modulesrc/faults/BruneSlipFn.hh
+ *
+ * @brief Python interface to C++ Fault object.
+ */
+
+namespace pylith {
+ namespace faults {
+
+ class BruneSlipFn : public SlipTimeFn
+ { // class BruneSlipFn
+
+ // PUBLIC METHODS /////////////////////////////////////////////////
+ public :
+
+ /// Default constructor.
+ BruneSlipFn(void);
+
+ /// Destructor.
+ ~BruneSlipFn(void);
+
+ /** Set spatial database for final slip.
+ *
+ * @param db Spatial database
+ */
+ void dbFinalSlip(spatialdata::spatialdb::SpatialDB* const db);
+
+ /** Set spatial database for slip initiation time.
+ *
+ * @param db Spatial database
+ */
+ void dbSlipTime(spatialdata::spatialdb::SpatialDB* const db);
+
+ /** Set spatial database for rise time (0 -> 0.95 final slip).
+ *
+ * @param db Spatial database
+ */
+ void dbRiseTime(spatialdata::spatialdb::SpatialDB* const db);
+
+ /** Initialize slip time function.
+ *
+ * @param faultMesh Finite-element mesh of fault.
+ * @param cs Coordinate system for mesh
+ * @param normalizer Nondimensionalization of scales.
+ * @param originTime Origin time for earthquake source.
+ */
+ void initialize(const pylith::topology::SubMesh& faultMesh,
+ const spatialdata::units::Nondimensional& normalizer,
+ const double originTime =0.0);
+
+ /** Get slip on fault surface at time t.
+ *
+ * @param slipField Slip field over fault surface.
+ * @param t Time t.
+ *
+ * @returns Slip vector as left-lateral/reverse/normal.
+ */
+ void slip(pylith::topology::Field<pylith::topology::SubMesh>* const slipField,
+ const double t);
+
+ /** Get slip increment on fault surface between time t0 and t1.
+ *
+ * @param slipField Slip field over fault surface.
+ * @param t0 Time t.
+ * @param t1 Time t+dt.
+ *
+ * @returns Increment in slip vector as left-lateral/reverse/normal.
+ */
+ void slipIncr(pylith::topology::Field<pylith::topology::SubMesh>* slipField,
+ const double t0,
+ const double t1);
+
+ /** Get final slip.
+ *
+ * @returns Final slip.
+ */
+ const pylith::topology::Field<pylith::topology::SubMesh>& finalSlip(void);
+
+ /** Get time when slip begins at each point.
+ *
+ * @returns Time when slip begins.
+ */
+ const pylith::topology::Field<pylith::topology::SubMesh>& slipTime(void);
+
+ }; // class BruneSlipFn
+
+ } // faults
+} // pylith
+
+
+// End of file
Added: short/3D/PyLith/branches/pylith-swig/modulesrc/faults/ConstRateSlipFn.i
===================================================================
--- short/3D/PyLith/branches/pylith-swig/modulesrc/faults/ConstRateSlipFn.i (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/modulesrc/faults/ConstRateSlipFn.i 2009-04-29 04:11:16 UTC (rev 14813)
@@ -0,0 +1,96 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file modulesrc/faults/ConstRateSlipFn.i
+ *
+ * @brief Python interface to C++ Fault object.
+ */
+
+namespace pylith {
+ namespace faults {
+
+ class ConstRateSlipFn : public SlipTimeFn
+ { // class ConstRateSlipFn
+
+ // PUBLIC METHODS /////////////////////////////////////////////////
+ public :
+
+ /// Default constructor.
+ ConstRateSlipFn(void);
+
+ /// Destructor.
+ ~ConstRateSlipFn(void);
+
+ /** Set spatial database for slip rate.
+ *
+ * @param db Spatial database
+ */
+ void dbSlipRate(spatialdata::spatialdb::SpatialDB* const db);
+
+ /** Set spatial database for slip initiation time.
+ *
+ * @param db Spatial database
+ */
+ void dbSlipTime(spatialdata::spatialdb::SpatialDB* const db);
+
+ /** Initialize slip time function.
+ *
+ * @param faultMesh Finite-element mesh of fault.
+ * @param cs Coordinate system for mesh
+ * @param normalizer Nondimensionalization of scales.
+ * @param originTime Origin time for earthquake source.
+ */
+ void initialize(const pylith::topology::SubMesh& faultMesh,
+ const spatialdata::units::Nondimensional& normalizer,
+ const double originTime =0.0);
+
+ /** Get slip on fault surface at time t.
+ *
+ * @param slipField Slip field over fault surface.
+ * @param t Time t.
+ *
+ * @returns Slip vector as left-lateral/reverse/normal.
+ */
+ void slip(pylith::topology::Field<pylith::topology::SubMesh>* const slipField,
+ const double t);
+
+ /** Get slip increment on fault surface between time t0 and t1.
+ *
+ * @param slipField Slip field over fault surface.
+ * @param t0 Time t.
+ * @param t1 Time t+dt.
+ *
+ * @returns Increment in slip vector as left-lateral/reverse/normal.
+ */
+ void slipIncr(pylith::topology::Field<pylith::topology::SubMesh>* slipField,
+ const double t0,
+ const double t1);
+
+ /** Get final slip.
+ *
+ * @returns Final slip.
+ */
+ const pylith::topology::Field<pylith::topology::SubMesh>& finalSlip(void);
+
+ /** Get time when slip begins at each point.
+ *
+ * @returns Time when slip begins.
+ */
+ const pylith::topology::Field<pylith::topology::SubMesh>& slipTime(void);
+
+ }; // class ConstRateSlipFn
+
+ } // faults
+} // pylith
+
+
+// End of file
Added: short/3D/PyLith/branches/pylith-swig/modulesrc/faults/EqKinSrc.i
===================================================================
--- short/3D/PyLith/branches/pylith-swig/modulesrc/faults/EqKinSrc.i (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/modulesrc/faults/EqKinSrc.i 2009-04-29 04:11:16 UTC (rev 14813)
@@ -0,0 +1,95 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file modulesrc/faults/EqKinSrc.i
+ *
+ * @brief Python interface to C++ EqKinSrc object.
+ */
+
+namespace pylith {
+ namespace faults {
+
+ class EqKinSrc
+ { // class EqKinSrc
+
+ // PUBLIC METHODS /////////////////////////////////////////////////
+ public :
+
+ /// Default constructor.
+ EqKinSrc(void);
+
+ /// Destructor.
+ ~EqKinSrc(void);
+
+ /** Set origin time for earthquake source.
+ *
+ * @param value Origin time for earthquake source.
+ */
+ void originTime(const double value);
+
+ /** Get origin time for earthquake source.
+ *
+ * @returns Origin time for earthquake source.
+ */
+ double originTime(void) const;
+
+ /** Set slip time function.
+ *
+ * @param slipfn Slip time function.
+ */
+ void slipfn(SlipTimeFn* slipfn);
+
+ /** Initialize slip time function.
+ *
+ * @param faultMesh Finite-element mesh of fault.
+ * @param normalizer Nondimensionalization of scales.
+ */
+ void initialize(const pylith::topology::SubMesh& faultMesh,
+ const spatialdata::units::Nondimensional& normalizer);
+
+ /** Get slip on fault surface at time t.
+ *
+ * @param slipField Slip field over fault mesh.
+ * @param t Time t.
+ */
+ void slip(pylith::topology::Field<pylith::topology::SubMesh>* const slipField,
+ const double t);
+
+ /** Get increment of slip on fault surface between time t0 and t1.
+ *
+ * @param slipField Slip increment field over fault mesh.
+ * @param t0 Time for start of slip increment.
+ * @param t1 Time for end of slip increment.
+ */
+ void slipIncr(pylith::topology::Field<pylith::topology::SubMesh>* const slipField,
+ const double t0,
+ const double t1);
+
+ /** Get final slip.
+ *
+ * @returns Final slip.
+ */
+ const pylith::topology::Field<pylith::topology::SubMesh>& finalSlip(void) const;
+
+ /** Get time when slip begins at each point.
+ *
+ * @returns Time when slip begins.
+ */
+ const pylith::topology::Field<pylith::topology::SubMesh>& slipTime(void) const;
+
+ }; // class EqKinSrc
+
+ } // faults
+} // pylith
+
+
+// End of file
Added: short/3D/PyLith/branches/pylith-swig/modulesrc/faults/Fault.i
===================================================================
--- short/3D/PyLith/branches/pylith-swig/modulesrc/faults/Fault.i (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/modulesrc/faults/Fault.i 2009-04-29 04:11:16 UTC (rev 14813)
@@ -0,0 +1,120 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file modulesrc/faults/Fault.i
+ *
+ * @brief Python interface to C++ Fault object.
+ */
+
+namespace pylith {
+ namespace faults {
+
+ class Fault
+ { // class Fault
+
+ // PUBLIC METHODS /////////////////////////////////////////////////
+ public :
+
+ /// Default constructor.
+ Fault(void);
+
+ /// Destructor.
+ virtual
+ ~Fault(void);
+
+ /** Set material identifier of fault.
+ *
+ * @param value Fault identifier
+ */
+ void id(const int value);
+
+ /** Get material identifier of fault.
+ *
+ * @returns Fault identifier
+ */
+ int id(void) const;
+
+ /** Set label of group of vertices associated with fault.
+ *
+ * @param value Label of fault
+ */
+ void label(const char* value);
+
+ /** Get label of group of vertices associated with fault.
+ *
+ * @returns Label of fault
+ */
+ const char* label(void) const;
+
+ /** Adjust mesh topology for fault implementation.
+ *
+ * @param mesh PETSc mesh
+ */
+ virtual
+ void adjustTopology(pylith::topology::Mesh* mesh,
+ const bool flipFault =false) = 0;
+
+ /** Initialize fault. Determine orientation and setup boundary
+ * condition parameters.
+ *
+ * @param mesh PETSc mesh
+ * @param cs Coordinate system for mesh
+ * @param upDir Direction perpendicular to along-strike direction that is
+ * not collinear with fault normal (usually "up" direction but could
+ * be up-dip direction; only applies to fault surfaces in a 3-D domain).
+ * @param normalDir General preferred direction for fault normal
+ * (used to pick which of two possible normal directions for
+ * interface; only applies to fault surfaces in a 3-D domain).
+ * @param matDB Database of bulk elastic properties for fault region
+ * (used to improve conditioning of Jacobian matrix)
+ */
+ virtual
+ void initialize(const pylith::topology::Mesh& mesh,
+ const double upDir[3],
+ const double normalDir[3],
+ spatialdata::spatialdb::SpatialDB* matDB) = 0;
+
+ /** Get mesh associated with fault fields.
+ *
+ * @returns PETSc mesh object
+ */
+ const pylith::topology::SubMesh& faultMesh(void) const;
+
+ /** Get vertex field associated with integrator.
+ *
+ * @param name Name of vertex field.
+ * @param fields Solution fields.
+ * @returns Vertex field.
+ */
+ virtual
+ const pylith::topology::Field<pylith::topology::SubMesh>&
+ vertexField(const char* name,
+ const pylith::topology::SolutionFields& fields) = 0;
+
+ /** Get cell field associated with integrator.
+ *
+ * @param name Name of cell field.
+ * @param fields Solution fields.
+ * @returns Cell field.
+ */
+ virtual
+ const pylith::topology::Field<pylith::topology::SubMesh>&
+ cellField(const char* name,
+ const pylith::topology::SolutionFields& fields) = 0;
+
+ }; // class Fault
+
+ } // faults
+} // pylith
+
+
+// End of file
Added: short/3D/PyLith/branches/pylith-swig/modulesrc/faults/FaultCohesive.i
===================================================================
--- short/3D/PyLith/branches/pylith-swig/modulesrc/faults/FaultCohesive.i (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/modulesrc/faults/FaultCohesive.i 2009-04-29 04:11:16 UTC (rev 14813)
@@ -0,0 +1,73 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file modulesrc/faults/FaultCohesive.i
+ *
+ * @brief Python interface to C++ FaultCohesive object.
+ */
+
+namespace pylith {
+ namespace faults {
+
+ class FaultCohesive : public Fault
+ { // class FaultCohesive
+
+ // PUBLIC METHODS /////////////////////////////////////////////////
+ public :
+
+ /// Default constructor.
+ FaultCohesive(void);
+
+ /// Destructor.
+ virtual
+ ~FaultCohesive(void);
+
+ /** Set flag for using fault mesh or group of vertices to define
+ * fault surface.
+ *
+ * @param flag True if using fault mesh, false if using vertices.
+ */
+ void useFaultMesh(const bool flag);
+
+ // TEMPORARY
+ /** Set filename of UCD file for fault mesh.
+ *
+ * @param filename Filename for UCD file.
+ */
+ void faultMeshFilename(const char* filename);
+
+ /** Adjust mesh topology for fault implementation.
+ *
+ * @param mesh PETSc mesh.
+ * @param flipFault Flip fault orientation.
+ */
+ void adjustTopology(pylith::topology::Mesh* const mesh,
+ const bool flipFault =false);
+
+ // PROTECTED METHODS //////////////////////////////////////////////////
+ protected :
+
+ /** Cohesive cells use Lagrange multiplier constraints?
+ *
+ * @returns True if implementation using Lagrange multiplier
+ * constraints, false otherwise.
+ */
+ virtual
+ bool _useLagrangeConstraints(void) const = 0;
+
+ }; // class FaultCohesive
+
+ } // faults
+} // pylith
+
+
+// End of file
Added: short/3D/PyLith/branches/pylith-swig/modulesrc/faults/FaultCohesiveDyn.i
===================================================================
--- short/3D/PyLith/branches/pylith-swig/modulesrc/faults/FaultCohesiveDyn.i (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/modulesrc/faults/FaultCohesiveDyn.i 2009-04-29 04:11:16 UTC (rev 14813)
@@ -0,0 +1,108 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file modulesrc/faults/FaultCohesiveDyn.i
+ *
+ * @brief Python interface to C++ FaultCohesiveDyn object.
+ */
+
+namespace pylith {
+ namespace faults {
+
+ class FaultCohesiveDyn : public FaultCohesive,
+ public pylith::feassemble::Integrator<pylith::feassemble::Quadrature<pylith::topology::SubMesh> >
+ { // class FaultCohesiveDyn
+
+ // PUBLIC METHODS /////////////////////////////////////////////////
+ public :
+
+ /// Default constructor.
+ FaultCohesiveDyn(void);
+
+ /// Destructor.
+ virtual
+ ~FaultCohesiveDyn(void);
+
+ /** Initialize fault. Determine orientation and setup boundary
+ * condition parameters.
+ *
+ * @param mesh Finite-element mesh.
+ * @param upDir Direction perpendicular to along-strike direction that is
+ * not collinear with fault normal (usually "up" direction but could
+ * be up-dip direction; only applies to fault surfaces in a 3-D domain).
+ * @param normalDir General preferred direction for fault normal
+ * (used to pick which of two possible normal directions for
+ * interface; only applies to fault surfaces in a 3-D domain).
+ * @param matDB Database of bulk elastic properties for fault region
+ * (used to improve conditioning of Jacobian matrix)
+ */
+ void initialize(const pylith::topology::Mesh& mesh,
+ const double upDir[3],
+ const double normalDir[3],
+ spatialdata::spatialdb::SpatialDB* matDB);
+
+ /** Integrate contribution of cohesive cells to residual term.
+ *
+ * @param residual Field containing values for residual
+ * @param t Current time
+ * @param fields Solution fields
+ */
+ void integrateResidual(const pylith::topology::Field<pylith::topology::Mesh>& residual,
+ const double t,
+ pylith::topology::SolutionFields* const fields);
+
+ /** Integrate contributions to Jacobian matrix (A) associated with
+ * operator.
+ *
+ * @param jacobian Sparse matrix for Jacobian of system.
+ * @param t Current time
+ * @param fields Solution fields
+ */
+ void integrateJacobian(pylith::topology::Jacobian* jacobian,
+ const double t,
+ pylith::topology::SolutionFields* const fields);
+
+ /** Verify configuration is acceptable.
+ *
+ * @param mesh Finite-element mesh
+ */
+ void verifyConfiguration(const pylith::topology::Mesh& mesh) const;
+
+ /** Get vertex field associated with integrator.
+ *
+ * @param name Name of vertex field.
+ * @param fields Solution fields.
+ *
+ * @returns Vertex field.
+ */
+ const pylith::topology::Field<pylith::topology::SubMesh>&
+ vertexField(const char* name,
+ const pylith::topology::SolutionFields& fields);
+
+ /** Get cell field associated with integrator.
+ *
+ * @param name Name of cell field.
+ * @param fields Solution fields.
+ *
+ * @returns Cell field.
+ */
+ const pylith::topology::Field<pylith::topology::SubMesh>&
+ cellField(const char* name,
+ const pylith::topology::SolutionFields& fields);
+
+ }; // class FaultCohesiveDyn
+
+ } // faults
+} // pylith
+
+
+// End of file
Added: short/3D/PyLith/branches/pylith-swig/modulesrc/faults/FaultCohesiveKin.i
===================================================================
--- short/3D/PyLith/branches/pylith-swig/modulesrc/faults/FaultCohesiveKin.i (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/modulesrc/faults/FaultCohesiveKin.i 2009-04-29 04:11:16 UTC (rev 14813)
@@ -0,0 +1,139 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file modulesrc/faults/FaultCohesiveKin.i
+ *
+ * @brief Python interface to C++ FaultCohesiveKin object.
+ */
+
+namespace pylith {
+ namespace faults {
+
+ class FaultCohesiveKin : public FaultCohesive,
+ public pylith::feassemble::Integrator<pylith::feassemble::Quadrature<pylith::topology::SubMesh> >
+ { // class FaultCohesiveKin
+
+ // PUBLIC METHODS /////////////////////////////////////////////////
+ public :
+
+ /// Default constructor.
+ FaultCohesiveKin(void);
+
+ /// Destructor.
+ virtual
+ ~FaultCohesiveKin(void);
+
+ /** Set kinematic earthquake sources.
+ *
+ * @param names Array of kinematic earthquake source names.
+ * @param sources Array of kinematic earthquake sources.
+ * @param numSources Number of earthquake sources
+ */
+ void eqsrcs(const char** names,
+ EqKinSrc** sources,
+ const int numSources);
+
+ /** Initialize fault. Determine orientation and setup boundary
+ * condition parameters.
+ *
+ * @param mesh Finite-element mesh.
+ * @param upDir Direction perpendicular to along-strike direction that is
+ * not collinear with fault normal (usually "up" direction but could
+ * be up-dip direction; only applies to fault surfaces in a 3-D domain).
+ * @param normalDir General preferred direction for fault normal
+ * (used to pick which of two possible normal directions for
+ * interface; only applies to fault surfaces in a 3-D domain).
+ * @param matDB Database of bulk elastic properties for fault region
+ * (used to improve conditioning of Jacobian matrix)
+ */
+ void initialize(const pylith::topology::Mesh& mesh,
+ const double upDir[3],
+ const double normalDir[3],
+ spatialdata::spatialdb::SpatialDB* matDB);
+
+ /** Integrate contributions to residual term (r) for operator that
+ * require assembly across processors.
+ *
+ * @param residual Field containing values for residual
+ * @param t Current time
+ * @param fields Solution fields
+ */
+ void integrateResidual(const pylith::topology::Field<pylith::topology::Mesh>& residual,
+ const double t,
+ pylith::topology::SolutionFields* const fields);
+
+ /** Integrate contributions to residual term (r) for operator that
+ * do not require assembly across cells, vertices, or processors.
+ *
+ * @param residual Field containing values for residual
+ * @param t Current time
+ * @param fields Solution fields
+ */
+ void integrateResidualAssembled(const pylith::topology::Field<pylith::topology::Mesh>& residual,
+ const double t,
+ pylith::topology::SolutionFields* const fields);
+
+ /** Integrate contributions to Jacobian matrix (A) associated with
+ * operator that do not require assembly across cells, vertices, or
+ * processors.
+ *
+ * @param mat Sparse matrix
+ * @param t Current time
+ * @param fields Solution fields
+ * @param mesh Finite-element mesh
+ */
+ void integrateJacobianAssembled(pylith::topology::Jacobian* jacobian,
+ const double t,
+ pylith::topology::SolutionFields* const fields);
+
+ /** Update state variables as needed.
+ *
+ * @param t Current time
+ * @param fields Solution fields
+ * @param mesh Finite-element mesh
+ */
+ void updateStateVars(const double t,
+ pylith::topology::SolutionFields* const fields);
+
+ /** Verify configuration is acceptable.
+ *
+ * @param mesh Finite-element mesh
+ */
+ void verifyConfiguration(const pylith::topology::Mesh& mesh) const;
+
+ /** Get vertex field associated with integrator.
+ *
+ * @param name Name of cell field.
+ * @param fields Solution fields.
+ * @returns Vertex field.
+ */
+ const pylith::topology::Field<pylith::topology::SubMesh>&
+ vertexField(const char* name,
+ const pylith::topology::SolutionFields& fields);
+
+ /** Get cell field associated with integrator.
+ *
+ * @param name Name of cell field.
+ * @param fields Solution fields.
+ * @returns Cell field.
+ */
+ const pylith::topology::Field<pylith::topology::SubMesh>&
+ cellField(const char* name,
+ const pylith::topology::SolutionFields& fields);
+
+ }; // class FaultCohesiveKin
+
+ } // faults
+} // pylith
+
+
+// End of file
Added: short/3D/PyLith/branches/pylith-swig/modulesrc/faults/LiuCosSlipFn.i
===================================================================
--- short/3D/PyLith/branches/pylith-swig/modulesrc/faults/LiuCosSlipFn.i (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/modulesrc/faults/LiuCosSlipFn.i 2009-04-29 04:11:16 UTC (rev 14813)
@@ -0,0 +1,104 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file modulesrc/faults/LiuCosSlipFn.i
+ *
+ * @brief Python interface to C++ Fault object.
+ */
+
+namespace pylith {
+ namespace faults {
+
+ class LiuCosSlipFn : public SlipTimeFn
+ { // class LiuCosSlipFn
+
+ // PUBLIC METHODS /////////////////////////////////////////////////
+ public :
+
+ /// Default constructor.
+ LiuCosSlipFn(void);
+
+ /// Destructor.
+ ~LiuCosSlipFn(void);
+
+ /** Set spatial database for final slip.
+ *
+ * @param db Spatial database
+ */
+ void dbFinalSlip(spatialdata::spatialdb::SpatialDB* const db);
+
+ /** Set spatial database for slip initiation time.
+ *
+ * @param db Spatial database
+ */
+ void dbSlipTime(spatialdata::spatialdb::SpatialDB* const db);
+
+ /** Set spatial database for rise time. The rise time is the time it
+ * takes for the slip to increase from 0.0 to 0.95 of the final
+ * value.
+ *
+ * @param db Spatial database
+ */
+ void dbRiseTime(spatialdata::spatialdb::SpatialDB* const db);
+
+ /** Initialize slip time function.
+ *
+ * @param faultMesh Finite-element mesh of fault.
+ * @param cs Coordinate system for mesh
+ * @param normalizer Nondimensionalization of scales.
+ * @param originTime Origin time for earthquake source.
+ */
+ void initialize(const pylith::topology::SubMesh& faultMesh,
+ const spatialdata::units::Nondimensional& normalizer,
+ const double originTime =0.0);
+
+ /** Get slip on fault surface at time t.
+ *
+ * @param slipField Slip field over fault surface.
+ * @param t Time t.
+ *
+ * @returns Slip vector as left-lateral/reverse/normal.
+ */
+ void slip(pylith::topology::Field<pylith::topology::SubMesh>* const slipField,
+ const double t);
+
+ /** Get slip increment on fault surface between time t0 and t1.
+ *
+ * @param slipField Slip field over fault surface.
+ * @param t0 Time t.
+ * @param t1 Time t+dt.
+ *
+ * @returns Increment in slip vector as left-lateral/reverse/normal.
+ */
+ void slipIncr(pylith::topology::Field<pylith::topology::SubMesh>* slipField,
+ const double t0,
+ const double t1);
+
+ /** Get final slip.
+ *
+ * @returns Final slip.
+ */
+ const pylith::topology::Field<pylith::topology::SubMesh>& finalSlip(void);
+
+ /** Get time when slip begins at each point.
+ *
+ * @returns Time when slip begins.
+ */
+ const pylith::topology::Field<pylith::topology::SubMesh>& slipTime(void);
+
+ }; // class LiuCosSlipFn
+
+ } // faults
+} // pylith
+
+
+// End of file
Modified: short/3D/PyLith/branches/pylith-swig/modulesrc/faults/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-swig/modulesrc/faults/Makefile.am 2009-04-29 00:49:04 UTC (rev 14812)
+++ short/3D/PyLith/branches/pylith-swig/modulesrc/faults/Makefile.am 2009-04-29 04:11:16 UTC (rev 14813)
@@ -13,40 +13,54 @@
subpackage = faults
include $(top_srcdir)/subpackage.am
-subpkgpyexec_LTLIBRARIES = faultsmodule.la
+subpkgpyexec_LTLIBRARIES = _faultsmodule.la
-faultsmodule_la_LDFLAGS = -module -avoid-version \
+subpkgpyexec_PYTHON = faults.py
+
+swig_sources = \
+ faults.i \
+ SlipTimeFn.i \
+ ConstRateSlipFn.i \
+ StepSlipFn.i \
+ BruneSlipFn.i \
+ LiuCosSlipFn.i \
+ EqKinSrc.i \
+ Fault.i \
+ FaultCohesive.i \
+ FaultCohesiveDyn.i \
+ FaultCohesiveKin.i \
+ ../feassemble/Integrator.i
+
+swig_generated = \
+ faults_wrap.cxx \
+ faults.py
+
+_faultsmodule_la_LDFLAGS = -module -avoid-version \
$(AM_LDFLAGS) $(PYTHON_LA_LDFLAGS)
-dist_faultsmodule_la_SOURCES = faults.pyxe.src
-nodist_faultsmodule_la_SOURCES = \
- faults.pyxe \
- faults.c faults_embed.cpp faults_embed.h
+dist__faultsmodule_la_SOURCES = $(swig_sources) $(swig_generated)
-faultsmodule_la_LIBADD = \
+_faultsmodule_la_LIBADD = \
$(top_builddir)/libsrc/libpylith.la \
-lspatialdata \
- $(PETSC_LIB)
-
+ $(PETSC_LIBS)
if ENABLE_CUBIT
- faultsmodule_la_LIBADD += -lnetcdf_c++ -lnetcdf
+ _faultsmodule_la_LIBADD += -lnetcdf_c++ -lnetcdf
endif
if NO_UNDEFINED
- faultsmodule_la_LIBADD += $(PYTHON_BLDLIBRARY) $(PYTHON_LIBS) $(PYTHON_SYSLIBS)
+_faultsmodule_la_LIBADD += \
+ $(PYTHON_BLDLIBRARY) $(PYTHON_LIBS) $(PYTHON_SYSLIBS)
endif
-INCLUDES += -I$(PYTHON_INCDIR) $(PETSC_INCLUDE)
+INCLUDES += $(PYTHON_EGG_CPPFLAGS) -I$(NUMPY_INCDIR) -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
+$(srcdir)/faults_wrap.cxx $(srcdir)/faults.py: $(swig_sources)
+ $(SWIG) -Wall -c++ -python $<
-.pyx.c:
- pyrexc $<
-CLEANFILES = faults.pyxe faults.pyx faults.c *_embed.*
+MAINTAINERCLEANFILES = \
+ $(srcdir)/faults_wrap.cxx \
+ $(srcdir)/faults.py
+
# End of file
Added: short/3D/PyLith/branches/pylith-swig/modulesrc/faults/SlipTimeFn.i
===================================================================
--- short/3D/PyLith/branches/pylith-swig/modulesrc/faults/SlipTimeFn.i (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/modulesrc/faults/SlipTimeFn.i 2009-04-29 04:11:16 UTC (rev 14813)
@@ -0,0 +1,90 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file modulesrc/faults/SlipTimeFn.i
+ *
+ * @brief Python interface to C++ Fault object.
+ */
+
+namespace pylith {
+ namespace faults {
+
+ class SlipTimeFn
+ { // class SlipTimeFn
+
+ // PUBLIC METHODS /////////////////////////////////////////////////
+ public :
+
+ /// Default constructor.
+ SlipTimeFn(void);
+
+ /// Destructor.
+ virtual
+ ~SlipTimeFn(void);
+
+ /** Initialize slip time function.
+ *
+ * @param faultMesh Finite-element mesh of fault.
+ * @param cs Coordinate system for mesh
+ * @param normalizer Nondimensionalization of scales.
+ * @param originTime Origin time for earthquake source.
+ */
+ virtual
+ void initialize(const pylith::topology::SubMesh& faultMesh,
+ const spatialdata::units::Nondimensional& normalizer,
+ const double originTime =0.0) = 0;
+
+ /** Get slip on fault surface at time t.
+ *
+ * @param slipField Slip field over fault surface.
+ * @param t Time t.
+ *
+ * @returns Slip vector as left-lateral/reverse/normal.
+ */
+ virtual
+ void slip(pylith::topology::Field<pylith::topology::SubMesh>* const slipField,
+ const double t) = 0;
+
+ /** Get slip increment on fault surface between time t0 and t1.
+ *
+ * @param slipField Slip field over fault surface.
+ * @param t0 Time t.
+ * @param t1 Time t+dt.
+ *
+ * @returns Increment in slip vector as left-lateral/reverse/normal.
+ */
+ virtual
+ void slipIncr(pylith::topology::Field<pylith::topology::SubMesh>* slipField,
+ const double t0,
+ const double t1) = 0;
+
+ /** Get final slip.
+ *
+ * @returns Final slip.
+ */
+ virtual
+ const pylith::topology::Field<pylith::topology::SubMesh>& finalSlip(void) = 0;
+
+ /** Get time when slip begins at each point.
+ *
+ * @returns Time when slip begins.
+ */
+ virtual
+ const pylith::topology::Field<pylith::topology::SubMesh>& slipTime(void) = 0;
+
+ }; // class SlipTimeFn
+
+ } // faults
+} // pylith
+
+
+// End of file
Added: short/3D/PyLith/branches/pylith-swig/modulesrc/faults/StepSlipFn.i
===================================================================
--- short/3D/PyLith/branches/pylith-swig/modulesrc/faults/StepSlipFn.i (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/modulesrc/faults/StepSlipFn.i 2009-04-29 04:11:16 UTC (rev 14813)
@@ -0,0 +1,96 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file modulesrc/faults/StepSlipFn.i
+ *
+ * @brief Python interface to C++ Fault object.
+ */
+
+namespace pylith {
+ namespace faults {
+
+ class StepSlipFn : public SlipTimeFn
+ { // class StepSlipFn
+
+ // PUBLIC METHODS /////////////////////////////////////////////////
+ public :
+
+ /// Default constructor.
+ StepSlipFn(void);
+
+ /// Destructor.
+ ~StepSlipFn(void);
+
+ /** Set spatial database for final slip.
+ *
+ * @param db Spatial database
+ */
+ void dbFinalSlip(spatialdata::spatialdb::SpatialDB* const db);
+
+ /** Set spatial database for slip initiation time.
+ *
+ * @param db Spatial database
+ */
+ void dbSlipTime(spatialdata::spatialdb::SpatialDB* const db);
+
+ /** Initialize slip time function.
+ *
+ * @param faultMesh Finite-element mesh of fault.
+ * @param cs Coordinate system for mesh
+ * @param normalizer Nondimensionalization of scales.
+ * @param originTime Origin time for earthquake source.
+ */
+ void initialize(const pylith::topology::SubMesh& faultMesh,
+ const spatialdata::units::Nondimensional& normalizer,
+ const double originTime =0.0);
+
+ /** Get slip on fault surface at time t.
+ *
+ * @param slipField Slip field over fault surface.
+ * @param t Time t.
+ *
+ * @returns Slip vector as left-lateral/reverse/normal.
+ */
+ void slip(pylith::topology::Field<pylith::topology::SubMesh>* const slipField,
+ const double t);
+
+ /** Get slip increment on fault surface between time t0 and t1.
+ *
+ * @param slipField Slip field over fault surface.
+ * @param t0 Time t.
+ * @param t1 Time t+dt.
+ *
+ * @returns Increment in slip vector as left-lateral/reverse/normal.
+ */
+ void slipIncr(pylith::topology::Field<pylith::topology::SubMesh>* slipField,
+ const double t0,
+ const double t1);
+
+ /** Get final slip.
+ *
+ * @returns Final slip.
+ */
+ const pylith::topology::Field<pylith::topology::SubMesh>& finalSlip(void);
+
+ /** Get time when slip begins at each point.
+ *
+ * @returns Time when slip begins.
+ */
+ const pylith::topology::Field<pylith::topology::SubMesh>& slipTime(void);
+
+ }; // class StepSlipFn
+
+ } // faults
+} // pylith
+
+
+// End of file
Added: short/3D/PyLith/branches/pylith-swig/modulesrc/faults/faults.i
===================================================================
--- short/3D/PyLith/branches/pylith-swig/modulesrc/faults/faults.i (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/modulesrc/faults/faults.i 2009-04-29 04:11:16 UTC (rev 14813)
@@ -0,0 +1,68 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+// SWIG interface
+%module faults
+
+// Header files for module C++ code
+%{
+#include "pylith/faults/SlipTimeFn.hh"
+#include "pylith/faults/StepSlipFn.hh"
+#include "pylith/faults/ConstRateSlipFn.hh"
+#include "pylith/faults/BruneSlipFn.hh"
+#include "pylith/faults/LiuCosSlipFn.hh"
+#include "pylith/faults/EqKinSrc.hh"
+#include "pylith/faults/Fault.hh"
+#include "pylith/faults/FaultCohesive.hh"
+#include "pylith/faults/FaultCohesiveDyn.hh"
+#include "pylith/faults/FaultCohesiveKin.hh"
+%}
+
+%include "exception.i"
+%exception {
+ try {
+ $action
+ } catch (const std::exception& err) {
+ SWIG_exception(SWIG_RuntimeError, err.what());
+ } // try/catch
+ } // exception
+
+%include "typemaps.i"
+%include "../include/doublearray.i"
+
+// Numpy interface stuff
+%{
+#define SWIG_FILE_WITH_INIT
+%}
+%include "../include/numpy.i"
+%init %{
+import_array();
+%}
+
+// Interfaces
+%include "../feassemble/Quadrature.i" // ISA Quadrature
+%include "../feassemble/Integrator.i" // ISA Integrator
+
+%include "SlipTimeFn.i"
+%include "StepSlipFn.i"
+%include "ConstRateSlipFn.i"
+%include "BruneSlipFn.i"
+%include "LiuCosSlipFn.i"
+%include "EqKinSrc.i"
+%include "Fault.i"
+%include "FaultCohesive.i"
+%include "FaultCohesiveDyn.i"
+%include "FaultCohesiveKin.i"
+
+
+// End of file
+
More information about the CIG-COMMITS
mailing list