[cig-commits] r6001 - in short/3D/PyLith/trunk: applications
examples/twotri3 libsrc libsrc/feassemble libsrc/meshio
modulesrc/feassemble pylith pylith/feassemble
pylith/materials pylith/problems pylith/utils
brad at geodynamics.org
brad at geodynamics.org
Sat Feb 10 19:37:47 PST 2007
Author: brad
Date: 2007-02-10 19:37:45 -0800 (Sat, 10 Feb 2007)
New Revision: 6001
Added:
short/3D/PyLith/trunk/libsrc/feassemble/ExplicitElasticity.cc
short/3D/PyLith/trunk/libsrc/feassemble/ExplicitElasticity.hh
short/3D/PyLith/trunk/libsrc/feassemble/ExplicitElasticity.icc
short/3D/PyLith/trunk/libsrc/feassemble/IntegratorExplicit.cc
short/3D/PyLith/trunk/libsrc/feassemble/IntegratorExplicit.hh
short/3D/PyLith/trunk/pylith/feassemble/ExplicitElasticity.py
short/3D/PyLith/trunk/pylith/feassemble/IntegratorExplicit.py
short/3D/PyLith/trunk/pylith/problems/TimeDependent.py
short/3D/PyLith/trunk/pylith/utils/CheckpointTimer.py
Removed:
short/3D/PyLith/trunk/libsrc/feassemble/DynExplicitElasticity.cc
short/3D/PyLith/trunk/libsrc/feassemble/DynExplicitElasticity.hh
short/3D/PyLith/trunk/libsrc/feassemble/DynExplicitElasticity.icc
short/3D/PyLith/trunk/libsrc/feassemble/IntegratorDynExplicit.cc
short/3D/PyLith/trunk/libsrc/feassemble/IntegratorDynExplicit.hh
short/3D/PyLith/trunk/libsrc/feassemble/IntegratorElasticity3D.cc
short/3D/PyLith/trunk/libsrc/feassemble/IntegratorElasticity3D.hh
short/3D/PyLith/trunk/libsrc/feassemble/IntegratorElasticity3D.icc
short/3D/PyLith/trunk/pylith/feassemble/IntegratorElasticity.py
short/3D/PyLith/trunk/pylith/feassemble/IntegratorInertia.py
short/3D/PyLith/trunk/pylith/problems/Dynamic.py
short/3D/PyLith/trunk/pylith/problems/DynamicExplicit.py
short/3D/PyLith/trunk/pylith/problems/QuasiStatic.py
Modified:
short/3D/PyLith/trunk/applications/pylithic.py.in
short/3D/PyLith/trunk/examples/twotri3/pylithapp.cfg
short/3D/PyLith/trunk/libsrc/Makefile.am
short/3D/PyLith/trunk/libsrc/feassemble/Integrator.cc
short/3D/PyLith/trunk/libsrc/feassemble/Integrator.hh
short/3D/PyLith/trunk/libsrc/feassemble/Makefile.am
short/3D/PyLith/trunk/libsrc/feassemble/ParameterManager.cc
short/3D/PyLith/trunk/libsrc/feassemble/ParameterManager.hh
short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc
short/3D/PyLith/trunk/modulesrc/feassemble/feassemble.pyxe.src
short/3D/PyLith/trunk/pylith/Makefile.am
short/3D/PyLith/trunk/pylith/PyLithApp.py
short/3D/PyLith/trunk/pylith/feassemble/Integrator.py
short/3D/PyLith/trunk/pylith/feassemble/__init__.py
short/3D/PyLith/trunk/pylith/materials/Material.py
short/3D/PyLith/trunk/pylith/materials/MaterialsBin.py
short/3D/PyLith/trunk/pylith/materials/__init__.py
short/3D/PyLith/trunk/pylith/problems/EqDeformation.py
short/3D/PyLith/trunk/pylith/problems/Explicit.py
short/3D/PyLith/trunk/pylith/problems/Problem.py
short/3D/PyLith/trunk/pylith/problems/__init__.py
short/3D/PyLith/trunk/pylith/utils/__init__.py
Log:
More reorgranization of top-level Python code. Moved time loop to TimeDepedent object because some problems (Green's fns) may not have time loop. Reverted to non-MPI application. Top-level code runs through time-loop but can't read mesh without PETSc Initialize/Finalize (requires functioning MPI app). Started working on implementing calculation of inertial terms in ExplicitElasticity.
Modified: short/3D/PyLith/trunk/applications/pylithic.py.in
===================================================================
--- short/3D/PyLith/trunk/applications/pylithic.py.in 2007-02-10 19:01:25 UTC (rev 6000)
+++ short/3D/PyLith/trunk/applications/pylithic.py.in 2007-02-11 03:37:45 UTC (rev 6001)
@@ -27,13 +27,13 @@
sys.path.insert(1, directory)
site.addsitedir(directory)
- import journal
- journal.info('coordinates').activate()
-
from pylith.PyLithApp import PyLithApp
- from pyre.applications import start
- start(applicationClass=PyLithApp)
+ app = PyLithApp()
+ app.run()
+ #from pyre.applications import start
+ #start(applicationClass=PyLithApp)
+
# End of file
Modified: short/3D/PyLith/trunk/examples/twotri3/pylithapp.cfg
===================================================================
--- short/3D/PyLith/trunk/examples/twotri3/pylithapp.cfg 2007-02-10 19:01:25 UTC (rev 6000)
+++ short/3D/PyLith/trunk/examples/twotri3/pylithapp.cfg 2007-02-11 03:37:45 UTC (rev 6001)
@@ -1,6 +1,22 @@
[pylithapp]
-# MPI options
+
+# ----------------------------------------------------------------------
+# Journal
+# ----------------------------------------------------------------------
+journal.info.eqdeformation = 1
+
+# ----------------------------------------------------------------------
+# MPI
+# ----------------------------------------------------------------------
#launcher.command = mpiexec
-# Mesh generator options
+# ----------------------------------------------------------------------
+# Mesh
+# ----------------------------------------------------------------------
mesh_generator.importer.filename = twotri3.mesh
+
+# ----------------------------------------------------------------------
+# Solution
+# ----------------------------------------------------------------------
+eqdeformation.total_time = 1.0*s
+eqdeformation.default_dt = 1.0*s
\ No newline at end of file
Modified: short/3D/PyLith/trunk/libsrc/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/libsrc/Makefile.am 2007-02-10 19:01:25 UTC (rev 6000)
+++ short/3D/PyLith/trunk/libsrc/Makefile.am 2007-02-11 03:37:45 UTC (rev 6001)
@@ -20,9 +20,9 @@
lib_LTLIBRARIES = libpylith.la
libpylith_la_SOURCES = \
- feassemble/DynExplicitElasticity.cc \
+ feassemble/ExplicitElasticity.cc \
feassemble/Integrator.cc \
- feassemble/IntegratorDynExplicit.cc \
+ feassemble/IntegratorExplicit.cc \
feassemble/Quadrature.cc \
feassemble/Quadrature1D.cc \
feassemble/Quadrature1Din2D.cc \
Deleted: short/3D/PyLith/trunk/libsrc/feassemble/DynExplicitElasticity.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/DynExplicitElasticity.cc 2007-02-10 19:01:25 UTC (rev 6000)
+++ short/3D/PyLith/trunk/libsrc/feassemble/DynExplicitElasticity.cc 2007-02-11 03:37:45 UTC (rev 6001)
@@ -1,359 +0,0 @@
-// -*- C++ -*-
-//
-// ======================================================================
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ======================================================================
-//
-
-#include <portinfo>
-
-#include "DynExplicitElasticity.hh" // implementation of class methods
-
-#include "Quadrature.hh" // USES Quadrature
-
-#include "petscmat.h" // USES PetscMat
-#include "spatialdata/spatialdb/SpatialDB.hh"
-
-#include <assert.h> // USES assert()
-#include <stdexcept> // USES std::runtime_error
-
-// ----------------------------------------------------------------------
-// Constructor
-pylith::feassemble::DynExplicitElasticity::DynExplicitElasticity(void)
-{ // constructor
-} // constructor
-
-// ----------------------------------------------------------------------
-// Destructor
-pylith::feassemble::DynExplicitElasticity::~DynExplicitElasticity(void)
-{ // destructor
-} // destructor
-
-// ----------------------------------------------------------------------
-// Copy constructor.
-pylith::feassemble::DynExplicitElasticity::DynExplicitElasticity(const DynExplicitElasticity& i) :
- IntegratorDynExplicit(i)
-{ // copy constructor
-} // copy constructor
-
-// ----------------------------------------------------------------------
-// Integrate residual term (b) for dynamic elasticity term for 3-D
-// finite elements.
-void
-pylith::feassemble::DynExplicitElasticity::integrateResidual(
- const ALE::Obj<real_section_type>& residual,
- const ALE::Obj<real_section_type>& dispT,
- const ALE::Obj<real_section_type>& dispTmdt,
- const ALE::Obj<real_section_type>& coordinates)
-{ // integrateResidual
- assert(0 != _quadrature);
-
- // Get information about section
- const topology_type::patch_type patch = 0;
- const ALE::Obj<topology_type>& topology = dispT->getTopology();
- const ALE::Obj<topology_type::label_sequence>& cells =
- topology->heightStratum(patch, 0);
- const topology_type::label_sequence::iterator cellsEnd = cells->end();
-
- // Allocate vector for cell values (if necessary)
- _initCellVector();
-
- for (topology_type::label_sequence::iterator cellIter=cells->begin();
- cellIter != cellsEnd;
- ++cellIter) {
- // Compute geometry information for current cell
- _quadrature->computeGeometry(coordinates, *cellIter);
-
- // Reset element vector to zero
- _resetCellVector();
-
- // Restrict input fields to cell
- const real_section_type::value_type* dispTCell =
- dispT->restrict(patch, *cellIter);
- const real_section_type::value_type* dispTmdtCell =
- dispTmdt->restrict(patch, *cellIter);
-
- // Get cell geometry information
- const int numQuadPts = _quadrature->numQuadPts();
- const double* basis = _quadrature->basis();
- const double* quadPts = _quadrature->quadPts();
- const double* quadWts = _quadrature->quadWts();
- const double* jacobianDet = _quadrature->jacobianDet();
- const int numBasis = _quadrature->numCorners();
- const int spaceDim = _quadrature->spaceDim();
-
- // Restrict material properties material database to quadrature
- // points for this cell
-#if 0
- // :QUESTION: Not sure where we will store the density section
- const real_section_type::value_type* density =
- _density->restrict(patch, *cellIter);
-#else
- const double density = 1.0;
-#endif
-
- // Compute action for cell
- // :TODO: Start with inertia terms, then add elastic term
- for (int iQuad=0; iQuad < numQuadPts; ++iQuad) {
- const double wt = quadWts[iQuad] * jacobianDet[iQuad] * density;
- for (int iBasis=0, iQ=iQuad*numBasis; iBasis < numBasis; ++iBasis) {
- const int iBlock = iBasis * spaceDim;
- const double valI = wt*basis[iQ+iBasis];
- for (int jBasis=0; jBasis < numBasis; ++jBasis) {
- const int jBlock = jBasis * spaceDim;
- const double val = valI * basis[iQ+jBasis];
- for (int iDim=0; iDim < spaceDim; ++iDim)
- _cellVector[iBlock+iDim] += val * dispTCell[jBlock+iDim];
- } // for
- } // for
- } // for
- PetscErrorCode err =
- PetscLogFlops(numQuadPts*(2+numBasis*(1+numBasis*(1+2*spaceDim))));
- if (err)
- throw std::runtime_error("Logging PETSc flops failed.");
-
- // Assemble cell contribution into field
- residual->updateAdd(patch, *cellIter, _cellVector);
- } // for
-} // integrateResidual
-
-// ----------------------------------------------------------------------
-// Compute matrix associated with operator.
-void
-pylith::feassemble::DynExplicitElasticity::integrateJacobian(
- PetscMat* mat,
- const ALE::Obj<real_section_type>& dispT,
- const ALE::Obj<real_section_type>& coordinates)
-{ // integrateJacobian
- assert(0 != mat);
- assert(0 != _quadrature);
- PetscErrorCode err;
-
- // Get information about section
- const topology_type::patch_type patch = 0;
- const ALE::Obj<topology_type>& topology = coordinates->getTopology();
- const ALE::Obj<topology_type::label_sequence>& cells =
- topology->heightStratum(patch, 0);
- const topology_type::label_sequence::iterator cellsEnd = cells->end();
- const ALE::Obj<ALE::Mesh::order_type>& globalOrder =
- ALE::New::NumberingFactory<topology_type>::singleton(
- topology->debug())->getGlobalOrder(topology, patch,
- dispT->getName(),
- dispT->getAtlas());
-
- // Setup symmetric, sparse matrix
- // :TODO: This needs to be moved outside Integrator object, because
- // integrator object will be specific to cell type and material type
- int localSize = globalOrder->getLocalSize();
- int globalSize = globalOrder->getGlobalSize();
- err = MatCreate(topology->comm(), mat);
- err = MatSetSizes(*mat, localSize, localSize, globalSize, globalSize);
- err = MatSetFromOptions(*mat);
- err = preallocateMatrix(topology, dispT->getAtlas(), globalOrder, *mat);
-
- // Allocate matrix for cell values (if necessary)
- _initCellMatrix();
-
- for (topology_type::label_sequence::iterator cellIter=cells->begin();
- cellIter != cellsEnd;
- ++cellIter) {
- // Compute geometry information for current cell
- _quadrature->computeGeometry(coordinates, *cellIter);
-
- // Reset element matrix to zero
- _resetCellMatrix();
-
- // Get cell geometry information
- const int numQuadPts = _quadrature->numQuadPts();
- const double* basis = _quadrature->basis();
- const double* quadPts = _quadrature->quadPts();
- const double* quadWts = _quadrature->quadWts();
- const double* jacobianDet = _quadrature->jacobianDet();
- const int numBasis = _quadrature->numCorners();
- const int spaceDim = _quadrature->spaceDim();
-
- // Restrict material properties material database to quadrature
- // points for this cell
-#if 0
- // :QUESTION: Not sure where we will store the density section
- const real_section_type::value_type* density =
- _density->restrict(patch, *cellIter);
-#else
- const double density = 1.0;
-#endif
-
- // Integrate cell
- for (int iQuad=0; iQuad < numQuadPts; ++iQuad) {
- const double wt = quadWts[iQuad] * jacobianDet[iQuad] * density;
- for (int iBasis=0, iQ=iQuad*numBasis; iBasis < numBasis; ++iBasis) {
- const int iBlock = iBasis * spaceDim;
- const double valI = wt*basis[iQ+iBasis];
- for (int jBasis=0; jBasis < numBasis; ++jBasis) {
- const int jBlock = jBasis * spaceDim;
- const double val = valI * basis[iQ+jBasis];
- for (int iDim=0; iDim < spaceDim; ++iDim)
- _cellMatrix[(iBlock+iDim)*(numBasis*spaceDim)+jBlock+iDim] += val;
- } // for
- } // for
- } // for
- err = PetscLogFlops(numQuadPts*(2+numBasis*(1+numBasis*(1+spaceDim))));
- if (err)
- throw std::runtime_error("Logging PETSc flops failed.");
-
- // Assemble cell contribution into sparse matrix
- err = updateOperator(*mat, dispT, globalOrder, *cellIter, _cellMatrix,
- ADD_VALUES);
- } // for
-} // integrateResidual
-
-// ----------------------------------------------------------------------
-// Compute lumped matrix associated with operator.
-void
-pylith::feassemble::DynExplicitElasticity::integrateJacobian(
- const ALE::Obj<real_section_type>& fieldOut,
- const ALE::Obj<real_section_type>& dispT,
- const ALE::Obj<real_section_type>& coordinates)
-{ // integrateJacobian
- assert(0 != _quadrature);
-
- // Get information about section
- const topology_type::patch_type patch = 0;
- const ALE::Obj<topology_type>& topology = coordinates->getTopology();
- const ALE::Obj<topology_type::label_sequence>& cells =
- topology->heightStratum(patch, 0);
- const topology_type::label_sequence::iterator cellsEnd = cells->end();
-
- // Allocate matrix for cell values (if necessary)
- _initCellVector();
-
- for (topology_type::label_sequence::iterator cellIter=cells->begin();
- cellIter != cellsEnd;
- ++cellIter) {
- // Compute geometry information for current cell
- _quadrature->computeGeometry(coordinates, *cellIter);
-
- // Reset element matrix to zero
- _resetCellVector();
-
- // Get cell geometry information
- const int numQuadPts = _quadrature->numQuadPts();
- const double* basis = _quadrature->basis();
- const double* quadPts = _quadrature->quadPts();
- const double* quadWts = _quadrature->quadWts();
- const double* jacobianDet = _quadrature->jacobianDet();
- const int numBasis = _quadrature->numCorners();
- const int spaceDim = _quadrature->spaceDim();
-
- // Restrict material properties material database to quadrature
- // points for this cell
-#if 0
- // :QUESTION: Not sure where we will store the density section
- const real_section_type::value_type* density =
- _density->restrict(patch, *cellIter);
-#else
- const double density = 1.0;
-#endif
-
- // Compute lumped mass matrix for cell
- for (int iQuad=0; iQuad < numQuadPts; ++iQuad) {
- const double wt = quadWts[iQuad] * jacobianDet[iQuad] * density;
- for (int iBasis=0, iQ=iQuad*numBasis; iBasis < numBasis; ++iBasis) {
- const int iBlock = iBasis * spaceDim;
- const double valI = wt*basis[iQ+iBasis];
- for (int jBasis=0; jBasis < numBasis; ++jBasis) {
- const int jBlock = jBasis * spaceDim;
- const double val = valI*basis[iQ+jBasis];
- for (int iDim=0; iDim < spaceDim; ++iDim)
- _cellVector[iBlock+iDim] += val;
- } // for
- } // for
- } // for
-
- PetscErrorCode err =
- PetscLogFlops(numQuadPts*(2+numBasis*(1+numBasis*(1+spaceDim))));
- if (err)
- throw std::runtime_error("Logging PETSc flops failed.");
-
- // Assemble cell contribution into field
- fieldOut->updateAdd(patch, *cellIter, _cellVector);
- } // for
-} // integrateLumped
-
-// ----------------------------------------------------------------------
-// Setup material property parameters by querying database.
-void
-pylith::feassemble::DynExplicitElasticity::setupMatProp(
- ALE::Obj<ALE::Mesh>& mesh,
- spatialdata::geocoords::CoordSys* cs,
- spatialdata::spatialdb::SpatialDB* db)
-{ // setupMatProp
- assert(0 != cs);
- assert(0 != db);
-
- typedef ALE::Mesh::real_section_type real_section_type;
- typedef ALE::Mesh::topology_type topology_type;
-
- // :QUESTION: Where should we store and
- // create the density section. Perhaps one level up.
-
- // Create density section
- const int numQuadPts = _quadrature->numQuadPts();
- const ALE::Mesh::int_section_type::patch_type patch = 0;
-#if 0
- _density = mesh->getRealSection("density");
- const int fiberDim = numQuadPts; // number of values in field per cell
- _density->setName("density");
- _density->setFiberDimensionByDepth(patch, 0, fiberDim);
- _density->allocate();
-#endif
-
- // Open database
- db->open();
- const int numVals = 1;
- const char* names[numVals];
- names[0] = "density";
- db->queryVals(names, numVals);
-
- const ALE::Obj<real_section_type>& coordinates =
- mesh->getRealSection("coordinates");
- const ALE::Obj<topology_type>& topology = coordinates->getTopology();
- const ALE::Obj<topology_type::label_sequence>& cells =
- topology->heightStratum(patch, 0);
- const topology_type::label_sequence::iterator cellsEnd = cells->end();
-
- // Loop over cells
- double* cellDensity = (numQuadPts > 0) ? new double[numQuadPts] : 0;
- for (topology_type::label_sequence::iterator cellIter=cells->begin();
- cellIter != cellsEnd;
- ++cellIter) {
- // Compute geometry information for current cell
- _quadrature->computeGeometry(coordinates, *cellIter);
-
- const double* quadPts = _quadrature->quadPts();
- const int spaceDim = _quadrature->spaceDim();
-
- // Loop over quadrature points in cell and query database
- for (int iQuadPt=0, index=0;
- iQuadPt < numQuadPts;
- ++iQuadPt, index+=spaceDim)
- // account for differences in spaceDim
- const int err = db->query(&cellDensity[iQuadPt], numVals,
- &quadPts[index], spaceDim, cs);
- // Assemble cell contribution into field
-#if 0
- _density->updateAdd(patch, *cellIter, cellDensity);
-#endif
- } // for
- delete[] cellDensity; cellDensity = 0;
-
- // Close database
- db->close();
-} // setupMatProp
-
-
-// End of file
Deleted: short/3D/PyLith/trunk/libsrc/feassemble/DynExplicitElasticity.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/DynExplicitElasticity.hh 2007-02-10 19:01:25 UTC (rev 6000)
+++ short/3D/PyLith/trunk/libsrc/feassemble/DynExplicitElasticity.hh 2007-02-11 03:37:45 UTC (rev 6001)
@@ -1,138 +0,0 @@
-// -*- C++ -*-
-//
-// ======================================================================
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ======================================================================
-//
-
-/**
- * @file pylith/feassemble/DynExplicitElasticity.hh
- *
- * @brief Explicit time integration of dynamic elasticity equation
- * using finite-elements.
- *
- * Note: This object operates on a single finite-element family, which
- * is defined by the quadrature and a database of material property
- * parameters.
- *
- * Computes contributions to terms A and b in A(t) u(t+dt) = b(u(t),
- * u(t-dt)), where A(t) is a sparse matrix or vector, u(t+dt) is the
- * field we want to compute at time t+dt and b is a vector that
- * depends on the field at time t and t-dt.
- *
- * Contributions from elasticity include the intertial and stiffness
- * terms, so this object computes the following portions of A and b:
- *
- * A = 1/(dt*dt) [M]
- *
- * b = 2/(dt*dt)[M]{u(t)} - 1/(dt*dt)[M]{u(t-dt)} - [K]{u(t)}
- */
-
-#if !defined(pylith_feassemble_dynexplicitelasticity_hh)
-#define pylith_feassemble_dynexplicitelasticity_hh
-
-#include "IntegratorDynExplicit.hh" // ISA IntegratorDynExplicit
-
-namespace pylith {
- namespace feassemble {
- class DynExplicitElasticity;
- class TestDynExplicitElasticity;
- } // feassemble
-} // pylith
-
-namespace spatialdata {
- namespace spatialdb {
- class SpatialDB; // USES SpatialDB
- } // spatialdb
- namespace geocoords {
- class CoordSys; // USES CoordSys
- } // geocoords
-} // spatialdata
-
-class pylith::feassemble::DynExplicitElasticity : public IntegratorDynExplicit
-{ // DynExplicitElasticity
- friend class TestDynExplicitElasticity; // unit testing
-
-// PUBLIC MEMBERS ///////////////////////////////////////////////////////
-public :
-
- /// Constructor
- DynExplicitElasticity(void);
-
- /// Destructor
- ~DynExplicitElasticity(void);
-
- /// Create a copy of this object.
- IntegratorDynExplicit* clone(void) const;
-
- /** Integrate residual term (b) for dynamic elasticity term
- * for 3-D finite elements.
- *
- * @param residual Residual field (output)
- * @param dispT Displacement field at time t
- * @param dispTmdt Displacement field at time t-dt
- * @param coordinates Field of cell vertex coordinates
- */
- void integrateResidual(const ALE::Obj<real_section_type>& residual,
- const ALE::Obj<real_section_type>& dispT,
- const ALE::Obj<real_section_type>& dispTmdt,
- const ALE::Obj<real_section_type>& coordinates);
-
- /** Compute matrix (A) associated with operator.
- *
- * @param mat Sparse matrix
- * @param dispT Displacement at time t
- * @param coordinates Field of cell vertex coordinates
- */
- void integrateJacobian(PetscMat* mat,
- const ALE::Obj<real_section_type>& dispT,
- const ALE::Obj<real_section_type>& coordinates);
-
- /** Compute field (A) associated with lumped operator.
- *
- * @param fieldOut Output Jacobian field
- * @param dispT Displacement at time t
- * @param coordinates Field of cell vertex coordinates
- */
- void integrateJacobian(const ALE::Obj<real_section_type>& fieldOut,
- const ALE::Obj<real_section_type>& dispT,
- const ALE::Obj<real_section_type>& coordinates);
-
- /** Setup material property parameters by querying database.
- *
- * @param mesh PETSc mesh
- * @param cs Pointer to coordinate system of vertices
- * @param db Pointer to spatial database with material property parameters
- */
- void setupMatProp(ALE::Obj<ALE::Mesh>& mesh,
- spatialdata::geocoords::CoordSys* cs,
- spatialdata::spatialdb::SpatialDB* db);
-
-// PROTECTED METHODS ////////////////////////////////////////////////////
-protected :
-
- /** Copy constructor.
- *
- * @param i Integrator to copy
- */
- DynExplicitElasticity(const DynExplicitElasticity& i);
-
-// PRIVATE METHODS //////////////////////////////////////////////////////
-private :
-
- /// Not implemented
- const DynExplicitElasticity& operator=(const DynExplicitElasticity&);
-
-}; // DynExplicitElasticity
-
-#include "DynExplicitElasticity.icc" // inline methods
-
-#endif // pylith_feassemble_dynexplicitelasticity_hh
-
-
-// End of file
Deleted: short/3D/PyLith/trunk/libsrc/feassemble/DynExplicitElasticity.icc
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/DynExplicitElasticity.icc 2007-02-10 19:01:25 UTC (rev 6000)
+++ short/3D/PyLith/trunk/libsrc/feassemble/DynExplicitElasticity.icc 2007-02-11 03:37:45 UTC (rev 6001)
@@ -1,27 +0,0 @@
-// -*- C++ -*-
-//
-// ======================================================================
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ======================================================================
-//
-
-#if !defined(pylith_feassemble_dynexplicitelasticity_hh)
-#error "DynExplicitElasticity.icc must be included only from DynExplicitElasticity.hh"
-#else
-
-// Create a copy of this object.
-inline
-pylith::feassemble::IntegratorDynExplicit*
-pylith::feassemble::DynExplicitElasticity::clone(void) const {
- return new DynExplicitElasticity(*this);
-} // clone
-
-#endif
-
-
-// End of file
Copied: short/3D/PyLith/trunk/libsrc/feassemble/ExplicitElasticity.cc (from rev 5995, short/3D/PyLith/trunk/libsrc/feassemble/DynExplicitElasticity.cc)
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/DynExplicitElasticity.cc 2007-02-10 00:37:05 UTC (rev 5995)
+++ short/3D/PyLith/trunk/libsrc/feassemble/ExplicitElasticity.cc 2007-02-11 03:37:45 UTC (rev 6001)
@@ -0,0 +1,360 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#include <portinfo>
+
+#include "ExplicitElasticity.hh" // implementation of class methods
+
+#include "Quadrature.hh" // USES Quadrature
+#include "ParameterManager.hh" // USES ParameterManager
+
+#include "petscmat.h" // USES PetscMat
+#include "spatialdata/spatialdb/SpatialDB.hh"
+
+#include <assert.h> // USES assert()
+#include <stdexcept> // USES std::runtime_error
+
+// ----------------------------------------------------------------------
+// Constructor
+pylith::feassemble::ExplicitElasticity::ExplicitElasticity(void)
+{ // constructor
+} // constructor
+
+// ----------------------------------------------------------------------
+// Destructor
+pylith::feassemble::ExplicitElasticity::~ExplicitElasticity(void)
+{ // destructor
+} // destructor
+
+// ----------------------------------------------------------------------
+// Copy constructor.
+pylith::feassemble::ExplicitElasticity::ExplicitElasticity(const ExplicitElasticity& i) :
+ IntegratorExplicit(i)
+{ // copy constructor
+} // copy constructor
+
+// ----------------------------------------------------------------------
+// Integrate residual term (b) for dynamic elasticity term for 3-D
+// finite elements.
+void
+pylith::feassemble::ExplicitElasticity::integrateResidual(
+ const ALE::Obj<real_section_type>& residual,
+ const ALE::Obj<real_section_type>& dispT,
+ const ALE::Obj<real_section_type>& dispTmdt,
+ const ALE::Obj<real_section_type>& coordinates)
+{ // integrateResidual
+ assert(0 != _quadrature);
+
+ // Get information about section
+ const topology_type::patch_type patch = 0;
+ const ALE::Obj<topology_type>& topology = dispT->getTopology();
+ const ALE::Obj<topology_type::label_sequence>& cells =
+ topology->heightStratum(patch, 0);
+ const topology_type::label_sequence::iterator cellsEnd = cells->end();
+
+
+ // Get parameters used in integration.
+ const double dt = _dt;
+ const ALE::Obj<real_section_type>& density = _parameters->getReal("density");
+
+ // Allocate vector for cell values (if necessary)
+ _initCellVector();
+
+ for (topology_type::label_sequence::iterator cellIter=cells->begin();
+ cellIter != cellsEnd;
+ ++cellIter) {
+ // Compute geometry information for current cell
+ _quadrature->computeGeometry(coordinates, *cellIter);
+
+ // Reset element vector to zero
+ _resetCellVector();
+
+ // Restrict input fields to cell
+ const real_section_type::value_type* dispTCell =
+ dispT->restrict(patch, *cellIter);
+ const real_section_type::value_type* dispTmdtCell =
+ dispTmdt->restrict(patch, *cellIter);
+
+ // Get cell geometry information
+ const int numQuadPts = _quadrature->numQuadPts();
+ const double* basis = _quadrature->basis();
+ const double* quadPts = _quadrature->quadPts();
+ const double* quadWts = _quadrature->quadWts();
+ const double* jacobianDet = _quadrature->jacobianDet();
+ const int numBasis = _quadrature->numCorners();
+ const int spaceDim = _quadrature->spaceDim();
+
+ // Restrict material properties material database to quadrature
+ // points for this cell
+ const real_section_type::value_type* densityCell =
+ density->restrict(patch, *cellIter);
+
+ // Compute action for cell
+
+ // Compute action for inertial terms
+ const double dt2 = dt*dt;
+ for (int iQuad=0; iQuad < numQuadPts; ++iQuad) {
+ const double wt =
+ quadWts[iQuad] * jacobianDet[iQuad] * densityCell[iQuad] / dt2;
+ for (int iBasis=0, iQ=iQuad*numBasis; iBasis < numBasis; ++iBasis) {
+ const int iBlock = iBasis * spaceDim;
+ const double valI = wt*basis[iQ+iBasis];
+ for (int jBasis=0; jBasis < numBasis; ++jBasis) {
+ const int jBlock = jBasis * spaceDim;
+ const double valIJ = valI * basis[iQ+jBasis];
+ for (int iDim=0; iDim < spaceDim; ++iDim)
+ _cellVector[iBlock+iDim] +=
+ valIJ * 2.0 * (dispTCell[jBlock+iDim] -
+ dispTmdtCell[jBlock+iDim]);
+ } // for
+ } // for
+ } // for
+
+ // Compute action for elastic terms
+ // ADD STUFF HERE
+
+ PetscErrorCode err =
+ PetscLogFlops(numQuadPts*(3+numBasis*(1+numBasis*(1+4*spaceDim))));
+ if (err)
+ throw std::runtime_error("Logging PETSc flops failed.");
+
+ // Assemble cell contribution into field
+ residual->updateAdd(patch, *cellIter, _cellVector);
+ } // for
+} // integrateResidual
+
+// ----------------------------------------------------------------------
+// Compute matrix associated with operator.
+void
+pylith::feassemble::ExplicitElasticity::integrateJacobian(
+ PetscMat* mat,
+ const ALE::Obj<real_section_type>& dispT,
+ const ALE::Obj<real_section_type>& coordinates)
+{ // integrateJacobian
+ assert(0 != mat);
+ assert(0 != _quadrature);
+ PetscErrorCode err;
+
+ // Get information about section
+ const topology_type::patch_type patch = 0;
+ const ALE::Obj<topology_type>& topology = coordinates->getTopology();
+ const ALE::Obj<topology_type::label_sequence>& cells =
+ topology->heightStratum(patch, 0);
+ const topology_type::label_sequence::iterator cellsEnd = cells->end();
+ const ALE::Obj<ALE::Mesh::order_type>& globalOrder =
+ ALE::New::NumberingFactory<topology_type>::singleton(
+ topology->debug())->getGlobalOrder(topology, patch,
+ dispT->getName(),
+ dispT->getAtlas());
+
+ // Setup symmetric, sparse matrix
+ // :TODO: This needs to be moved outside Integrator object, because
+ // integrator object will be specific to cell type and material type
+ int localSize = globalOrder->getLocalSize();
+ int globalSize = globalOrder->getGlobalSize();
+ err = MatCreate(topology->comm(), mat);
+ err = MatSetSizes(*mat, localSize, localSize, globalSize, globalSize);
+ err = MatSetFromOptions(*mat);
+ err = preallocateMatrix(topology, dispT->getAtlas(), globalOrder, *mat);
+
+ // Get parameters used in integration.
+ const ALE::Obj<real_section_type>& density = _parameters->getReal("density");
+
+ // Allocate matrix for cell values (if necessary)
+ _initCellMatrix();
+
+ for (topology_type::label_sequence::iterator cellIter=cells->begin();
+ cellIter != cellsEnd;
+ ++cellIter) {
+ // Compute geometry information for current cell
+ _quadrature->computeGeometry(coordinates, *cellIter);
+
+ // Reset element matrix to zero
+ _resetCellMatrix();
+
+ // Get cell geometry information
+ const int numQuadPts = _quadrature->numQuadPts();
+ const double* basis = _quadrature->basis();
+ const double* quadPts = _quadrature->quadPts();
+ const double* quadWts = _quadrature->quadWts();
+ const double* jacobianDet = _quadrature->jacobianDet();
+ const int numBasis = _quadrature->numCorners();
+ const int spaceDim = _quadrature->spaceDim();
+
+ // Restrict material properties material database to quadrature
+ // points for this cell
+ const real_section_type::value_type* densityCell =
+ density->restrict(patch, *cellIter);
+
+ // Integrate cell
+ for (int iQuad=0; iQuad < numQuadPts; ++iQuad) {
+ const double wt =
+ quadWts[iQuad] * jacobianDet[iQuad] * densityCell[iQuad];
+ for (int iBasis=0, iQ=iQuad*numBasis; iBasis < numBasis; ++iBasis) {
+ const int iBlock = iBasis * spaceDim;
+ const double valI = wt*basis[iQ+iBasis];
+ for (int jBasis=0; jBasis < numBasis; ++jBasis) {
+ const int jBlock = jBasis * spaceDim;
+ const double val = valI * basis[iQ+jBasis];
+ for (int iDim=0; iDim < spaceDim; ++iDim)
+ _cellMatrix[(iBlock+iDim)*(numBasis*spaceDim)+jBlock+iDim] += val;
+ } // for
+ } // for
+ } // for
+ err = PetscLogFlops(numQuadPts*(2+numBasis*(1+numBasis*(1+spaceDim))));
+ if (err)
+ throw std::runtime_error("Logging PETSc flops failed.");
+
+ // Assemble cell contribution into sparse matrix
+ err = updateOperator(*mat, dispT, globalOrder, *cellIter, _cellMatrix,
+ ADD_VALUES);
+ } // for
+} // integrateResidual
+
+// ----------------------------------------------------------------------
+// Compute lumped matrix associated with operator.
+void
+pylith::feassemble::ExplicitElasticity::integrateJacobian(
+ const ALE::Obj<real_section_type>& fieldOut,
+ const ALE::Obj<real_section_type>& dispT,
+ const ALE::Obj<real_section_type>& coordinates)
+{ // integrateJacobian
+ assert(0 != _quadrature);
+ assert(0 != _parameters);
+
+ // Get information about section
+ const topology_type::patch_type patch = 0;
+ const ALE::Obj<topology_type>& topology = coordinates->getTopology();
+ const ALE::Obj<topology_type::label_sequence>& cells =
+ topology->heightStratum(patch, 0);
+ const topology_type::label_sequence::iterator cellsEnd = cells->end();
+
+ const ALE::Obj<real_section_type>& density = _parameters->getReal("density");
+
+ // Allocate matrix for cell values (if necessary)
+ _initCellVector();
+
+ for (topology_type::label_sequence::iterator cellIter=cells->begin();
+ cellIter != cellsEnd;
+ ++cellIter) {
+ // Compute geometry information for current cell
+ _quadrature->computeGeometry(coordinates, *cellIter);
+
+ // Reset element matrix to zero
+ _resetCellVector();
+
+ // Get cell geometry information
+ const int numQuadPts = _quadrature->numQuadPts();
+ const double* basis = _quadrature->basis();
+ const double* quadPts = _quadrature->quadPts();
+ const double* quadWts = _quadrature->quadWts();
+ const double* jacobianDet = _quadrature->jacobianDet();
+ const int numBasis = _quadrature->numCorners();
+ const int spaceDim = _quadrature->spaceDim();
+
+ // Restrict material properties material database to quadrature
+ // points for this cell
+ const real_section_type::value_type* densityCell =
+ density->restrict(patch, *cellIter);
+
+ // Compute lumped mass matrix for cell
+ for (int iQuad=0; iQuad < numQuadPts; ++iQuad) {
+ const double wt =
+ quadWts[iQuad] * jacobianDet[iQuad] * densityCell[iQuad];
+ for (int iBasis=0, iQ=iQuad*numBasis; iBasis < numBasis; ++iBasis) {
+ const int iBlock = iBasis * spaceDim;
+ const double valI = wt*basis[iQ+iBasis];
+ for (int jBasis=0; jBasis < numBasis; ++jBasis) {
+ const int jBlock = jBasis * spaceDim;
+ const double val = valI*basis[iQ+jBasis];
+ for (int iDim=0; iDim < spaceDim; ++iDim)
+ _cellVector[iBlock+iDim] += val;
+ } // for
+ } // for
+ } // for
+
+ PetscErrorCode err =
+ PetscLogFlops(numQuadPts*(2+numBasis*(1+numBasis*(1+spaceDim))));
+ if (err)
+ throw std::runtime_error("Logging PETSc flops failed.");
+
+ // Assemble cell contribution into field
+ fieldOut->updateAdd(patch, *cellIter, _cellVector);
+ } // for
+} // integrateLumped
+
+// ----------------------------------------------------------------------
+// Setup material property parameters by querying database.
+void
+pylith::feassemble::ExplicitElasticity::setupMatProp(ALE::Obj<ALE::Mesh>& mesh,
+ spatialdata::geocoords::CoordSys* cs,
+ spatialdata::spatialdb::SpatialDB* db)
+{ // setupMatProp
+ assert(0 != cs);
+ assert(0 != db);
+ assert(0 != _parameters);
+
+ typedef ALE::Mesh::real_section_type real_section_type;
+ typedef ALE::Mesh::topology_type topology_type;
+
+ _parameters->addReal("density");
+ const ALE::Obj<real_section_type>& density = _parameters->getReal("density");
+
+ const int numQuadPts = _quadrature->numQuadPts();
+ const ALE::Mesh::int_section_type::patch_type patch = 0;
+ const int fiberDim = numQuadPts; // number of values in field per cell
+ density->setFiberDimensionByDepth(patch, 0, fiberDim);
+ density->allocate();
+
+ // Open database
+ db->open();
+ const int numVals = 1;
+ const char* names[numVals];
+ names[0] = "density";
+ db->queryVals(names, numVals);
+
+ const ALE::Obj<real_section_type>& coordinates =
+ mesh->getRealSection("coordinates");
+ const ALE::Obj<topology_type>& topology = coordinates->getTopology();
+ const ALE::Obj<topology_type::label_sequence>& cells =
+ topology->heightStratum(patch, 0);
+ const topology_type::label_sequence::iterator cellsEnd = cells->end();
+
+ // Loop over cells
+ double* cellDensity = (numQuadPts > 0) ? new double[numQuadPts] : 0;
+ for (topology_type::label_sequence::iterator cellIter=cells->begin();
+ cellIter != cellsEnd;
+ ++cellIter) {
+ // Compute geometry information for current cell
+ _quadrature->computeGeometry(coordinates, *cellIter);
+
+ const double* quadPts = _quadrature->quadPts();
+ const int spaceDim = _quadrature->spaceDim();
+
+ // Loop over quadrature points in cell and query database
+ for (int iQuadPt=0, index=0;
+ iQuadPt < numQuadPts;
+ ++iQuadPt, index+=spaceDim)
+ // account for differences in spaceDim
+ const int err = db->query(&cellDensity[iQuadPt], numVals,
+ &quadPts[index], spaceDim, cs);
+ // Assemble cell contribution into field
+ density->updateAdd(patch, *cellIter, cellDensity);
+ } // for
+ delete[] cellDensity; cellDensity = 0;
+
+ // Close database
+ db->close();
+} // setupMatProp
+
+
+// End of file
Copied: short/3D/PyLith/trunk/libsrc/feassemble/ExplicitElasticity.hh (from rev 5995, short/3D/PyLith/trunk/libsrc/feassemble/DynExplicitElasticity.hh)
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/DynExplicitElasticity.hh 2007-02-10 00:37:05 UTC (rev 5995)
+++ short/3D/PyLith/trunk/libsrc/feassemble/ExplicitElasticity.hh 2007-02-11 03:37:45 UTC (rev 6001)
@@ -0,0 +1,156 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+/**
+ * @file pylith/feassemble/ExplicitElasticity.hh
+ *
+ * @brief Explicit time integration of dynamic elasticity equation
+ * using finite-elements.
+ *
+ * Note: This object operates on a single finite-element family, which
+ * is defined by the quadrature and a database of material property
+ * parameters.
+ *
+ * Computes contributions to terms A and b in A(t) u(t+dt) = b(u(t),
+ * u(t-dt)), where A(t) is a sparse matrix or vector, u(t+dt) is the
+ * field we want to compute at time t+dt and b is a vector that
+ * depends on the field at time t and t-dt.
+ *
+ * Contributions from elasticity include the intertial and stiffness
+ * terms, so this object computes the following portions of A and b:
+ *
+ * A = 1/(dt*dt) [M]
+ *
+ * b = 2/(dt*dt)[M]{u(t)} - 1/(dt*dt)[M]{u(t-dt)} - [K]{u(t)}
+ *
+ * Translational inertia.
+ * - Residual action over cell
+ * \f[
+ * \int_{V^e} \rho N^p \sum_q N^q u_i^q \, dV
+ * \f]
+ * - Jacobian action over cell
+ * \f[
+ * \int_{V^e} (\rho N^q N^q)_i \, dV
+ * \f]
+ * - Integrate and lump to form lumped matrix (field)
+ *
+ * See governing equations section of user manual for more
+ * information.
+ */
+
+#if !defined(pylith_feassemble_explicitelasticity_hh)
+#define pylith_feassemble_explicitelasticity_hh
+
+#include "IntegratorExplicit.hh" // ISA IntegratorExplicit
+
+namespace pylith {
+ namespace feassemble {
+ class ExplicitElasticity;
+ class TestExplicitElasticity;
+ } // feassemble
+} // pylith
+
+namespace spatialdata {
+ namespace spatialdb {
+ class SpatialDB; // USES SpatialDB
+ } // spatialdb
+ namespace geocoords {
+ class CoordSys; // USES CoordSys
+ } // geocoords
+} // spatialdata
+
+class pylith::feassemble::ExplicitElasticity : public IntegratorExplicit
+{ // ExplicitElasticity
+ friend class TestExplicitElasticity; // unit testing
+
+// PUBLIC MEMBERS ///////////////////////////////////////////////////////
+public :
+
+ /// Constructor
+ ExplicitElasticity(void);
+
+ /// Destructor
+ ~ExplicitElasticity(void);
+
+ /// Create a copy of this object.
+ IntegratorExplicit* clone(void) const;
+
+ /** Integrate residual term (b) for dynamic elasticity term
+ * for 3-D finite elements.
+ *
+ * Compute b = 2/(dt*dt)[M]{u(t) - 1/(dt*dt)[M]{u(t-dt)} - [K]{u(t)}, where
+ * [M] = density * [N]^T [N]
+ *
+ *
+ * @param residual Residual field (output)
+ * @param dispT Displacement field at time t
+ * @param dispTmdt Displacement field at time t-dt
+ * @param coordinates Field of cell vertex coordinates
+ */
+ void integrateResidual(const ALE::Obj<real_section_type>& residual,
+ const ALE::Obj<real_section_type>& dispT,
+ const ALE::Obj<real_section_type>& dispTmdt,
+ const ALE::Obj<real_section_type>& coordinates);
+
+ /** Compute matrix (A) associated with operator.
+ *
+ * @param mat Sparse matrix
+ * @param dispT Displacement at time t
+ * @param coordinates Field of cell vertex coordinates
+ */
+ void integrateJacobian(PetscMat* mat,
+ const ALE::Obj<real_section_type>& dispT,
+ const ALE::Obj<real_section_type>& coordinates);
+
+ /** Compute field (A) associated with lumped operator.
+ *
+ * @param fieldOut Output Jacobian field
+ * @param dispT Displacement at time t
+ * @param coordinates Field of cell vertex coordinates
+ */
+ void integrateJacobian(const ALE::Obj<real_section_type>& fieldOut,
+ const ALE::Obj<real_section_type>& dispT,
+ const ALE::Obj<real_section_type>& coordinates);
+
+ /** Setup material property parameters by querying database.
+ *
+ * @param mesh PETSc mesh
+ * @param cs Pointer to coordinate system of vertices
+ * @param db Pointer to spatial database with material property parameters
+ */
+ void setupMatProp(ALE::Obj<ALE::Mesh>& mesh,
+ spatialdata::geocoords::CoordSys* cs,
+ spatialdata::spatialdb::SpatialDB* db);
+
+// PROTECTED METHODS ////////////////////////////////////////////////////
+protected :
+
+ /** Copy constructor.
+ *
+ * @param i Integrator to copy
+ */
+ ExplicitElasticity(const ExplicitElasticity& i);
+
+// PRIVATE METHODS //////////////////////////////////////////////////////
+private :
+
+ /// Not implemented
+ const ExplicitElasticity& operator=(const ExplicitElasticity&);
+
+}; // ExplicitElasticity
+
+#include "ExplicitElasticity.icc" // inline methods
+
+#endif // pylith_feassemble_explicitelasticity_hh
+
+
+// End of file
Copied: short/3D/PyLith/trunk/libsrc/feassemble/ExplicitElasticity.icc (from rev 5995, short/3D/PyLith/trunk/libsrc/feassemble/DynExplicitElasticity.icc)
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/DynExplicitElasticity.icc 2007-02-10 00:37:05 UTC (rev 5995)
+++ short/3D/PyLith/trunk/libsrc/feassemble/ExplicitElasticity.icc 2007-02-11 03:37:45 UTC (rev 6001)
@@ -0,0 +1,27 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#if !defined(pylith_feassemble_explicitelasticity_hh)
+#error "ExplicitElasticity.icc must be included only from ExplicitElasticity.hh"
+#else
+
+// Create a copy of this object.
+inline
+pylith::feassemble::IntegratorExplicit*
+pylith::feassemble::ExplicitElasticity::clone(void) const {
+ return new ExplicitElasticity(*this);
+} // clone
+
+#endif
+
+
+// End of file
Modified: short/3D/PyLith/trunk/libsrc/feassemble/Integrator.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/Integrator.cc 2007-02-10 19:01:25 UTC (rev 6000)
+++ short/3D/PyLith/trunk/libsrc/feassemble/Integrator.cc 2007-02-11 03:37:45 UTC (rev 6001)
@@ -15,6 +15,7 @@
#include "Integrator.hh" // implementation of class methods
#include "Quadrature.hh" // USES Quadrature
+#include "ParameterManager.hh" // USES ParameterManager
#include <assert.h> // USES assert()
@@ -22,6 +23,7 @@
// Constructor
pylith::feassemble::Integrator::Integrator(void) :
_quadrature(0),
+ _parameters(0),
_cellVector(0),
_cellMatrix(0)
{ // constructor
@@ -32,6 +34,7 @@
pylith::feassemble::Integrator::~Integrator(void)
{ // destructor
delete _quadrature; _quadrature = 0;
+ delete _parameters; _parameters = 0;
delete[] _cellVector; _cellVector = 0;
delete[] _cellMatrix; _cellMatrix = 0;
} // destructor
@@ -39,6 +42,8 @@
// ----------------------------------------------------------------------
// Copy constructor
pylith::feassemble::Integrator::Integrator(const Integrator& i) :
+ _quadrature(0),
+ _parameters(0),
_cellVector(0),
_cellMatrix(0)
{ // copy constructor
@@ -60,6 +65,14 @@
} // quadrature
// ----------------------------------------------------------------------
+// Create parameter manager.
+void
+pylith::feassemble::Integrator::createParameters(const ALE::Obj<ALE::Mesh>& mesh)
+{ // createParameters
+ delete _parameters; _parameters = new ParameterManager(mesh);
+} // createParameters
+
+// ----------------------------------------------------------------------
// Initialize vector containing result of integration action for cell.
void
pylith::feassemble::Integrator::_initCellVector(void)
Modified: short/3D/PyLith/trunk/libsrc/feassemble/Integrator.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/Integrator.hh 2007-02-10 19:01:25 UTC (rev 6000)
+++ short/3D/PyLith/trunk/libsrc/feassemble/Integrator.hh 2007-02-11 03:37:45 UTC (rev 6001)
@@ -32,6 +32,7 @@
class TestIntegrator;
class Quadrature; // HOLDSA Quadrature
+ class ParameterManager; // HOLDSA ParameterManager
} // feassemble
} // pylith
@@ -62,6 +63,12 @@
*/
void quadrature(const Quadrature* q);
+ /** Create manager for parameters.
+ *
+ * @param mesh PETSc mesh associated with integrator.
+ */
+ void createParameters(const ALE::Obj<ALE::Mesh>& mesh);
+
// PROTECTED METHODS ////////////////////////////////////////////////////
protected :
@@ -94,6 +101,9 @@
Quadrature* _quadrature; ///< Quadrature for integrating finite-element
+ /// Manager for parameters needed by integrator
+ ParameterManager* _parameters;
+
/// Vector local to cell containing result of integration action
real_section_type::value_type* _cellVector;
Deleted: short/3D/PyLith/trunk/libsrc/feassemble/IntegratorDynExplicit.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/IntegratorDynExplicit.cc 2007-02-10 19:01:25 UTC (rev 6000)
+++ short/3D/PyLith/trunk/libsrc/feassemble/IntegratorDynExplicit.cc 2007-02-11 03:37:45 UTC (rev 6001)
@@ -1,37 +0,0 @@
-// -*- C++ -*-
-//
-// ======================================================================
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ======================================================================
-//
-
-#include <portinfo>
-
-#include "IntegratorDynExplicit.hh" // implementation of class methods
-
-// ----------------------------------------------------------------------
-// Constructor
-pylith::feassemble::IntegratorDynExplicit::IntegratorDynExplicit(void)
-{ // constructor
-} // constructor
-
-// ----------------------------------------------------------------------
-// Destructor
-pylith::feassemble::IntegratorDynExplicit::~IntegratorDynExplicit(void)
-{ // destructor
-} // destructor
-
-// ----------------------------------------------------------------------
-// Copy constructor
-pylith::feassemble::IntegratorDynExplicit::IntegratorDynExplicit(const IntegratorDynExplicit& i) :
- Integrator(i)
-{ // copy constructor
-} // copy constructor
-
-
-// End of file
Deleted: short/3D/PyLith/trunk/libsrc/feassemble/IntegratorDynExplicit.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/IntegratorDynExplicit.hh 2007-02-10 19:01:25 UTC (rev 6000)
+++ short/3D/PyLith/trunk/libsrc/feassemble/IntegratorDynExplicit.hh 2007-02-11 03:37:45 UTC (rev 6001)
@@ -1,117 +0,0 @@
-// -*- C++ -*-
-//
-// ======================================================================
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ======================================================================
-//
-
-/**
- * @file pylith/feassemble/IntegratorDynExplicit.hh
- *
- * @brief Abstract base class for explicit time integration of
- * finite-element actions.
- *
- * Note: This object operates on a single finite-element family, which
- * is defined by the quadrature and a database of material property
- * parameters.
- *
- * Computes terms A and b in A(t) u(t+dt) = b(u(t), u(t-dt)), where
- * A(t) is a sparse matrix or vector, u(t+dt) is the field we want to
- * compute at time t+dt and b is a vector that depends on the field at
- * time t and t-dt.
- */
-
-#if !defined(pylith_feassemble_integratordynexplicit_hh)
-#define pylith_feassemble_integratordynexplicit_hh
-
-#include "pylith/utils/petscfwd.h" // USES PetscMat
-
-#include "Integrator.hh" // ISA Integrator
-
-namespace pylith {
- namespace feassemble {
- class IntegratorDynExplicit;
- class TestIntegratorDynExplicit;
- } // feassemble
-} // pylith
-
-class pylith::feassemble::IntegratorDynExplicit : public Integrator
-{ // Integrator
- friend class TestIntegratorDynExplicit; // unit testing
-
-// PUBLIC MEMBERS ///////////////////////////////////////////////////////
-public :
-
- /// Constructor
- IntegratorDynExplicit(void);
-
- /// Destructor
- virtual
- ~IntegratorDynExplicit(void);
-
- /// Create a copy of this object.
- virtual
- IntegratorDynExplicit* clone(void) const = 0;
-
- /** Integrate residual term (b) for dynamic elasticity term
- * for 3-D finite elements.
- *
- * @param residual Residual field (output)
- * @param fieldInT Input field at time t
- * @param fieldInTmdt Input field at time t-dt
- * @param coordinates Field of cell vertex coordinates
- */
- virtual
- void integrateResidual(const ALE::Obj<real_section_type>& residual,
- const ALE::Obj<real_section_type>& fieldInT,
- const ALE::Obj<real_section_type>& fieldInTmdt,
- const ALE::Obj<real_section_type>& coordinates) = 0;
-
- /** Compute matrix (A) associated with operator.
- *
- * @param mat Sparse matrix
- * @param fieldIn Input field at time t
- * @param coordinates Field of cell vertex coordinates
- */
- virtual
- void integrateJacobian(PetscMat* mat,
- const ALE::Obj<real_section_type>& fieldIn,
- const ALE::Obj<real_section_type>& coordinates) = 0;
-
- /** Compute field (A) associated with lumped operator.
- *
- * @param fieldOut Output Jacobian field
- * @param fieldIn Input field at time t
- * @param coordinates Field of cell vertex coordinates
- */
- virtual
- void integrateJacobian(const ALE::Obj<real_section_type>& fieldOut,
- const ALE::Obj<real_section_type>& fieldIn,
- const ALE::Obj<real_section_type>& coordinates) = 0;
-
-// PROTECTED METHODS ////////////////////////////////////////////////////
-protected :
-
- /** Copy constructor.
- *
- * @param i Integrator to copy
- */
- IntegratorDynExplicit(const IntegratorDynExplicit& i);
-
-// PRIVATE METHODS //////////////////////////////////////////////////////
-private :
-
- /// Not implemented
- const IntegratorDynExplicit& operator=(const IntegratorDynExplicit&);
-
-}; // IntegratorDynExplicit
-
-#endif // pylith_feassemble_integratordynexplicit_hh
-
-
-// End of file
Deleted: short/3D/PyLith/trunk/libsrc/feassemble/IntegratorElasticity3D.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/IntegratorElasticity3D.cc 2007-02-10 19:01:25 UTC (rev 6000)
+++ short/3D/PyLith/trunk/libsrc/feassemble/IntegratorElasticity3D.cc 2007-02-11 03:37:45 UTC (rev 6001)
@@ -1,69 +0,0 @@
-// -*- C++ -*-
-//
-// ======================================================================
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ======================================================================
-//
-
-#include <portinfo>
-
-#include "IntegratorElasticity3D.hh" // implementation of class methods
-
-#include "petscmat.h" // USES PetscMat
-
-#include <assert.h> // USES assert()
-
-// ----------------------------------------------------------------------
-// Constructor
-pylith::feassemble::IntegratorElasticity3D::IntegratorElasticity3D(void)
-{ // constructor
-} // constructor
-
-// ----------------------------------------------------------------------
-// Destructor
-pylith::feassemble::IntegratorElasticity3D::~IntegratorElasticity3D(void)
-{ // destructor
-} // destructor
-
-// ----------------------------------------------------------------------
-// Copy constructor.
-pylith::feassemble::IntegratorElasticity3D::IntegratorElasticity3D(const IntegratorElasticity3D& i) :
- Integrator(i)
-{ // copy constructor
-} // copy constructor
-
-// ----------------------------------------------------------------------
-// Integrate elasticity term for 3-D finite elements.
-void
-pylith::feassemble::IntegratorElasticity3D::integrateAction(const ALE::Obj<ALE::Mesh::real_section_type>& fieldOut,
- const ALE::Obj<ALE::Mesh::real_section_type>& fieldIn,
- const ALE::Obj<ALE::Mesh::real_section_type>& coordinates)
-{ // integrateAction
-} // integrateAction
-
-// ----------------------------------------------------------------------
-// Compute matrix associated with operator.
-void
-pylith::feassemble::IntegratorElasticity3D::integrate(PetscMat* mat,
- const ALE::Obj<ALE::Mesh::real_section_type>& fieldIn,
- const ALE::Obj<ALE::Mesh::real_section_type>& coordinates)
-{ // integrate
-} // integrate
-
-// ----------------------------------------------------------------------
-// Compute matrix associated with operator.
-void
-pylith::feassemble::IntegratorElasticity3D::initialize(
- ALE::Obj<ALE::Mesh>& mesh,
- spatialdata::geocoords::CoordSys* cs,
- spatialdata::spatialdb::SpatialDB* db)
-{ // initialize
-} // initialize
-
-
-// End of file
Deleted: short/3D/PyLith/trunk/libsrc/feassemble/IntegratorElasticity3D.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/IntegratorElasticity3D.hh 2007-02-10 19:01:25 UTC (rev 6000)
+++ short/3D/PyLith/trunk/libsrc/feassemble/IntegratorElasticity3D.hh 2007-02-11 03:37:45 UTC (rev 6001)
@@ -1,97 +0,0 @@
-// -*- C++ -*-
-//
-// ======================================================================
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ======================================================================
-//
-
-/**
- * @file pylith/feassemble/IntegratorElasticity3D.hh
- *
- * @brief Integrate elasticity term for 3-D finite elements.
- */
-
-#if !defined(pylith_feassemble_integratorelasticity3d_hh)
-#define pylith_feassemble_integratorelasticity3d_hh
-
-#include "Integrator.hh"
-
-namespace pylith {
- namespace feassemble {
- class IntegratorElasticity3D;
- class TestIntegratorElasticity3D;
- } // feassemble
-} // pylith
-
-class pylith::feassemble::IntegratorElasticity3D : public Integrator
-{ // Integrator1D
- friend class TestIntegratorElasticity3D; // unit testing
-
-// PUBLIC MEMBERS ///////////////////////////////////////////////////////
-public :
-
- /// Constructor
- IntegratorElasticity3D(void);
-
- /// Destructor
- ~IntegratorElasticity3D(void);
-
- /// Create a copy of this object.
- Integrator* clone(void) const;
-
- /** Integrate elasticity term for 3-D finite elements.
- *
- * @param fieldOut Output field
- * @param fieldIn Input field
- * @param coordinates Field of cell vertex coordinates
- */
- void integrateAction(const ALE::Obj<ALE::Mesh::real_section_type>& fieldOut,
- const ALE::Obj<ALE::Mesh::real_section_type>& fieldIn,
- const ALE::Obj<ALE::Mesh::real_section_type>& coordinates);
-
- /** Compute matrix associated with operator.
- *
- * @param mat Sparse matrix
- * @param coordinates Field of cell vertex coordinates
- */
- void integrate(PetscMat* mat,
- const ALE::Obj<ALE::Mesh::real_section_type>& fieldIn,
- const ALE::Obj<ALE::Mesh::real_section_type>& coordinates);
-
- /** Initialize, get material property parameters from database.
- *
- * @param mesh PETSc mesh
- * @param cs Pointer to coordinate system of vertices
- * @param db Pointer to spatial database with material property parameters
- */
- void initialize(ALE::Obj<ALE::Mesh>& mesh,
- spatialdata::geocoords::CoordSys* cs,
- spatialdata::spatialdb::SpatialDB* db);
-
-// PROTECTED METHODS ////////////////////////////////////////////////////
-protected :
-
- /** Copy constructor.
- *
- * @param i Integrator to copy
- */
- IntegratorElasticity3D(const IntegratorElasticity3D& i);
-
-// PRIVATE METHODS //////////////////////////////////////////////////////
-private :
-
- /// Not implemented
- const IntegratorElasticity3D& operator=(const IntegratorElasticity3D&);
-
-}; // IntegratorElasticity3D
-
-#include "IntegratorElasticity3D.icc" // inline methods
-
-#endif // pylith_feassemble_integratorelasticity3d_hh
-
-// End of file
Deleted: short/3D/PyLith/trunk/libsrc/feassemble/IntegratorElasticity3D.icc
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/IntegratorElasticity3D.icc 2007-02-10 19:01:25 UTC (rev 6000)
+++ short/3D/PyLith/trunk/libsrc/feassemble/IntegratorElasticity3D.icc 2007-02-11 03:37:45 UTC (rev 6001)
@@ -1,26 +0,0 @@
-// -*- C++ -*-
-//
-// ======================================================================
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ======================================================================
-//
-
-#if !defined(pylith_feassemble_integratorelasticity3d_hh)
-#error "IntegratorElasticity3D.icc must be included only from IntegratorElasticity3D.hh"
-#else
-
-// Create a copy of this object.
-inline
-pylith::feassemble::Integrator*
-pylith::feassemble::IntegratorElasticity3D::clone(void) const {
- return new IntegratorElasticity3D(*this);
-} // clone
-
-#endif
-
-// End of file
Copied: short/3D/PyLith/trunk/libsrc/feassemble/IntegratorExplicit.cc (from rev 5995, short/3D/PyLith/trunk/libsrc/feassemble/IntegratorDynExplicit.cc)
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/IntegratorDynExplicit.cc 2007-02-10 00:37:05 UTC (rev 5995)
+++ short/3D/PyLith/trunk/libsrc/feassemble/IntegratorExplicit.cc 2007-02-11 03:37:45 UTC (rev 6001)
@@ -0,0 +1,62 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#include <portinfo>
+
+#include "IntegratorExplicit.hh" // implementation of class methods
+
+#include <assert.h> // USES assert()
+
+// ----------------------------------------------------------------------
+// Constructor
+pylith::feassemble::IntegratorExplicit::IntegratorExplicit(void) :
+ _dt(0.0),
+ _dtm1(0.0)
+{ // constructor
+} // constructor
+
+// ----------------------------------------------------------------------
+// Destructor
+pylith::feassemble::IntegratorExplicit::~IntegratorExplicit(void)
+{ // destructor
+} // destructor
+
+// ----------------------------------------------------------------------
+// Copy constructor
+pylith::feassemble::IntegratorExplicit::IntegratorExplicit(const IntegratorExplicit& i) :
+ Integrator(i),
+ _dt(i._dt),
+ _dtm1(i._dtm1)
+{ // copy constructor
+} // copy constructor
+
+// ----------------------------------------------------------------------
+// Set time step for advancing from time t to time t+dt.
+void
+pylith::feassemble::IntegratorExplicit::timeStep(const double dt)
+{ // timeStep
+ _dtm1 = _dt;
+ _dt = dt;
+ assert(_dt == _dtm1);
+} // timeStep
+
+// ----------------------------------------------------------------------
+// Get stable time step for advancing from time t to time t+dt.
+double
+pylith::feassemble::IntegratorExplicit::stableTimeStep(void) const
+{ // stableTimeStep
+ // Default is current time step
+ return _dt;
+} // stableTimeStep
+
+
+// End of file
Copied: short/3D/PyLith/trunk/libsrc/feassemble/IntegratorExplicit.hh (from rev 5995, short/3D/PyLith/trunk/libsrc/feassemble/IntegratorDynExplicit.hh)
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/IntegratorDynExplicit.hh 2007-02-10 00:37:05 UTC (rev 5995)
+++ short/3D/PyLith/trunk/libsrc/feassemble/IntegratorExplicit.hh 2007-02-11 03:37:45 UTC (rev 6001)
@@ -0,0 +1,138 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+/**
+ * @file pylith/feassemble/IntegratorExplicit.hh
+ *
+ * @brief Abstract base class for explicit time integration of
+ * finite-element actions.
+ *
+ * Note: This object operates on a single finite-element family, which
+ * is defined by the quadrature and a database of material property
+ * parameters.
+ *
+ * Computes terms A and b in A(t) u(t+dt) = b(u(t), u(t-dt)), where
+ * A(t) is a sparse matrix or vector, u(t+dt) is the field we want to
+ * compute at time t+dt and b is a vector that depends on the field at
+ * time t and t-dt.
+ */
+
+#if !defined(pylith_feassemble_integratorexplicit_hh)
+#define pylith_feassemble_integratorexplicit_hh
+
+#include "pylith/utils/petscfwd.h" // USES PetscMat
+
+#include "Integrator.hh" // ISA Integrator
+
+namespace pylith {
+ namespace feassemble {
+ class IntegratorExplicit;
+ class TestIntegratorExplicit;
+ } // feassemble
+} // pylith
+
+class pylith::feassemble::IntegratorExplicit : public Integrator
+{ // Integrator
+ friend class TestIntegratorExplicit; // unit testing
+
+// PUBLIC MEMBERS ///////////////////////////////////////////////////////
+public :
+
+ /// Constructor
+ IntegratorExplicit(void);
+
+ /// Destructor
+ virtual
+ ~IntegratorExplicit(void);
+
+ /// Create a copy of this object.
+ virtual
+ IntegratorExplicit* clone(void) const = 0;
+
+ /** Set time step for advancing from time t to time t+dt.
+ *
+ * @param dt Time step
+ */
+ void timeStep(const double dt);
+
+ /** Get stable time step for advancing from time t to time t+dt.
+ *
+ * Default is current time step.
+ *
+ * @returns Time step
+ */
+ virtual
+ double stableTimeStep(void) const;
+
+ /** Integrate residual term (b) for dynamic elasticity term
+ * for finite elements.
+ *
+ * @param residual Residual field (output)
+ * @param fieldInT Input field at time t
+ * @param fieldInTmdt Input field at time t-dt
+ * @param coordinates Field of cell vertex coordinates
+ */
+ virtual
+ void integrateResidual(const ALE::Obj<real_section_type>& residual,
+ const ALE::Obj<real_section_type>& fieldInT,
+ const ALE::Obj<real_section_type>& fieldInTmdt,
+ const ALE::Obj<real_section_type>& coordinates) = 0;
+
+ /** Compute matrix (A) associated with operator.
+ *
+ * @param mat Sparse matrix
+ * @param fieldIn Input field at time t
+ * @param coordinates Field of cell vertex coordinates
+ */
+ virtual
+ void integrateJacobian(PetscMat* mat,
+ const ALE::Obj<real_section_type>& fieldIn,
+ const ALE::Obj<real_section_type>& coordinates) = 0;
+
+ /** Compute field (A) associated with lumped operator.
+ *
+ * @param fieldOut Output Jacobian field
+ * @param fieldInT Input field at time t
+ * @param coordinates Field of cell vertex coordinates
+ */
+ virtual
+ void integrateJacobian(const ALE::Obj<real_section_type>& fieldOut,
+ const ALE::Obj<real_section_type>& fieldInT,
+ const ALE::Obj<real_section_type>& coordinates) = 0;
+
+// PROTECTED METHODS ////////////////////////////////////////////////////
+protected :
+
+ /** Copy constructor.
+ *
+ * @param i Integrator to copy
+ */
+ IntegratorExplicit(const IntegratorExplicit& i);
+
+// PRIVATE METHODS //////////////////////////////////////////////////////
+private :
+
+ /// Not implemented
+ const IntegratorExplicit& operator=(const IntegratorExplicit&);
+
+// PROTECTED MEMBERS ////////////////////////////////////////////////////
+protected :
+
+ double _dt; ///< Time step for t -> t+dt
+ double _dtm1; ///< Time step for t-dt1 -> t
+
+}; // IntegratorExplicit
+
+#endif // pylith_feassemble_integratorexplicit_hh
+
+
+// End of file
Modified: short/3D/PyLith/trunk/libsrc/feassemble/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/Makefile.am 2007-02-10 19:01:25 UTC (rev 6000)
+++ short/3D/PyLith/trunk/libsrc/feassemble/Makefile.am 2007-02-11 03:37:45 UTC (rev 6001)
@@ -14,10 +14,10 @@
include $(top_srcdir)/subpackage.am
subpkginclude_HEADERS = \
- DynExplicitElasticity.hh \
- DynExplicitElasticity.icc \
+ ExplicitElasticity.hh \
+ ExplicitElasticity.icc \
Integrator.hh \
- IntegratorDynExplicit.hh \
+ IntegratorExplicit.hh \
Quadrature.hh \
Quadrature.icc \
Quadrature1D.hh \
Modified: short/3D/PyLith/trunk/libsrc/feassemble/ParameterManager.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/ParameterManager.cc 2007-02-10 19:01:25 UTC (rev 6000)
+++ short/3D/PyLith/trunk/libsrc/feassemble/ParameterManager.cc 2007-02-11 03:37:45 UTC (rev 6001)
@@ -20,7 +20,9 @@
// ----------------------------------------------------------------------
// Constructor
-pylith::feassemble::ParameterManager::ParameterManager(void)
+pylith::feassemble::ParameterManager::ParameterManager(
+ const ALE::Obj<Mesh>& mesh) :
+ _mesh(mesh)
{ // constructor
} // constructor
@@ -43,13 +45,9 @@
throw std::runtime_error(msg.str());
} // if
- // :QUESTION:
- // How do we get the topology information we need here?
-
-#if 0
- ALE::Obj<real_section_type> parameter = new real_section_type(_topology);
+ ALE::Obj<real_section_type> parameter =
+ new real_section_type(_mesh->getTopology());
_real[name] = parameter;
-#endif
} // addReal
// ----------------------------------------------------------------------
Modified: short/3D/PyLith/trunk/libsrc/feassemble/ParameterManager.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/ParameterManager.hh 2007-02-10 19:01:25 UTC (rev 6000)
+++ short/3D/PyLith/trunk/libsrc/feassemble/ParameterManager.hh 2007-02-11 03:37:45 UTC (rev 6001)
@@ -56,7 +56,7 @@
public :
/// Constructor
- ParameterManager(void);
+ ParameterManager(const ALE::Obj<Mesh>& mesh);
/// Destructor
~ParameterManager(void);
@@ -91,6 +91,9 @@
// PRIVATE MEMBERS //////////////////////////////////////////////////////
private :
+ /// PETSc mesh associated with fields
+ const ALE::Obj<ALE::Mesh>& _mesh;
+
/// Map for parameters stored as real fields
map_real_type _real;
Modified: short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc 2007-02-10 19:01:25 UTC (rev 6000)
+++ short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc 2007-02-11 03:37:45 UTC (rev 6001)
@@ -39,8 +39,6 @@
{ // read
assert(0 == _mesh);
- std::cout << "mesh: " << mesh << std::endl;
-
_mesh = mesh;
_read();
_mesh = 0;
Modified: short/3D/PyLith/trunk/modulesrc/feassemble/feassemble.pyxe.src
===================================================================
--- short/3D/PyLith/trunk/modulesrc/feassemble/feassemble.pyxe.src 2007-02-10 19:01:25 UTC (rev 6000)
+++ short/3D/PyLith/trunk/modulesrc/feassemble/feassemble.pyxe.src 2007-02-11 03:37:45 UTC (rev 6001)
@@ -20,8 +20,8 @@
#include "pylith/feassemble/Quadrature3D.hh"
#include "pylith/feassemble/Integrator.hh"
-#include "pylith/feassemble/IntegratorDynExplicit.hh"
-#include "pylith/feassemble/DynExplicitElasticity.hh"
+#include "pylith/feassemble/IntegratorExplicit.hh"
+#include "pylith/feassemble/ExplicitElasticity.hh"
#}header
# ----------------------------------------------------------------------
@@ -285,8 +285,26 @@
return
+ def createParameters(self, mesh):
+ """
+ Create manager for parameters.
+ """
+ # create shim for method 'createParameters'
+ #embed{ void Integrator_createParameters(void* pObj, void* pMeshObj)
+ const ALE::Obj<ALE::Mesh>* pMesh = (ALE::Obj<ALE::Mesh>*) pMeshObj;
+ ((pylith::feassemble::Integrator*) pObj)->createParameters(*pMesh);
+ #}embed
+ if not mesh.name == "pylith_topology_Mesh":
+ raise TypeError, \
+ "Argument must be extension module type 'Mesh'."
+ Integrator_createParameters(self.thisptr, ptrFromHandle(mesh))
+ return
+
+
def _createHandle(self):
- """Wrap pointer to C++ object in PyCObject."""
+ """
+ Wrap pointer to C++ object in PyCObject.
+ """
# create shim for destructor
#embed{ void Integrator_destructor(void* pObj)
pylith::feassemble::Integrator* pQ =
@@ -298,7 +316,9 @@
property quadrature:
def __set__(self, q):
- """Set quadrature."""
+ """
+ Set quadrature.
+ """
# create shim for method 'quadrature'
#embed{ void Integrator_quadrature_set(void* pObj, void* qObj)
pylith::feassemble::Quadrature* quadrature =
@@ -312,7 +332,7 @@
# ----------------------------------------------------------------------
-cdef class IntegratorDynExplicit(Integrator):
+cdef class IntegratorExplicit(Integrator):
def __init__(self):
"""
@@ -321,45 +341,59 @@
Integrator.__init__(self)
return
- def integrateResidual(residual, fieldInT, fieldInTmdt, coordinates):
+
+ def integrateResidualLumped(residual, fieldInT, fieldInTmdt, coords):
"""
Integrate residual term (b) for dynamic elasticity term for 3-D
finite elemtnts.
"""
- print "WARNING: IntegratorDynExplicit::integrateResidual not implemented."
+ print "WARNING: IntegratorExplicit::integrateResidualLumped not implemented."
return
- def integrateJacobianMat(mat, fieldIn, coordinates):
+
+ def integrateResidual(residual, fieldInT, fieldInTmdt, coords):
"""
+ Integrate residual term (b) for dynamic elasticity term for 3-D
+ finite elemtnts.
+ """
+ print "WARNING: IntegratorExplicit::integrateResidual not implemented."
+ return
+
+
+ def integrateJacobianLumped(mat, fieldIn, coords):
+ """
Compute matrix (A) associated with operator.
"""
- print "WARNING: IntegratorDynExplicit::integrateJacobian not implemented."
+ print "WARNING: IntegratorExplicit::integrateJacobianLumped not implemented."
return
- def integrateJacobianField(fieldOut, fieldIn, coordinates):
+
+ def integrateJacobianField(fieldOut, fieldIn, coords):
"""
Compute field (A) associated with operator.
"""
- print "WARNING: IntegratorDynExplicit::integrateJacobian not implemented."
+ print "WARNING: IntegratorExplicit::integrateJacobian not implemented."
return
+
# ----------------------------------------------------------------------
-cdef class DynExplicitElasticity(IntegratorDynExplicit):
+cdef class ExplicitElasticity(IntegratorExplicit):
def __init__(self):
"""
Constructor.
"""
# create shim for constructor
- #embed{ void* DynExplicitElasticity_constructor()
- return (void*)(new pylith::feassemble::DynExplicitElasticity);
+ #embed{ void* ExplicitElasticity_constructor()
+ return (void*)(new pylith::feassemble::ExplicitElasticity);
#}embed
- IntegratorDynExplicit.__init__(self)
- self.thisptr = DynExplicitElasticity_constructor()
+ IntegratorExplicit.__init__(self)
+ self.thisptr = ExplicitElasticity_constructor()
self.handle = self._createHandle()
return
+
def setupMatProp(self, mesh, cs, db):
"""
Initialize integrator.
@@ -369,13 +403,13 @@
@param db Database of material properties
"""
# create shim for method 'setupMatProp'
- #embed{ void DynExplicitElasticity_setupMatProp(void* pObj, void* meshObj, void* csObj, void* dbObj)
+ #embed{ void ExplicitElasticity_setupMatProp(void* pObj, void* meshObj, void* csObj, void* dbObj)
ALE::Obj<ALE::Mesh>* mesh = (ALE::Obj<ALE::Mesh>*) meshObj;
spatialdata::geocoords::CoordSys* cs =
(spatialdata::geocoords::CoordSys*) csObj;
spatialdata::spatialdb::SpatialDB* db =
(spatialdata::spatialdb::SpatialDB*) dbObj;
- ((pylith::feassemble::DynExplicitElasticity*) pObj)->setupMatProp(*mesh, cs, db);
+ ((pylith::feassemble::ExplicitElasticity*) pObj)->setupMatProp(*mesh, cs, db);
#}embed
if not mesh.name == "pylith_topology_Mesh":
@@ -392,7 +426,7 @@
"'spatialdata::spatialdb::SpatialDB'."
cdef void* meshObj
meshObj = <void*> PyCObject_AsVoidPtr(mesh)
- DynExplicitElasticity_setupMatProp(self.thisptr, meshObj,
+ ExplicitElasticity_setupMatProp(self.thisptr, meshObj,
ptrFromHandle(cs), ptrFromHandle(db))
return
Modified: short/3D/PyLith/trunk/pylith/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/pylith/Makefile.am 2007-02-10 19:01:25 UTC (rev 6000)
+++ short/3D/PyLith/trunk/pylith/Makefile.am 2007-02-11 03:37:45 UTC (rev 6001)
@@ -14,9 +14,11 @@
PyLithApp.py \
__init__.py \
feassemble/__init__.py \
+ feassemble/ExplicitElasticity.py \
feassemble/FIATCell.py \
feassemble/FIATSimplex.py \
feassemble/Integrator.py \
+ feassemble/IntegratorExplicit.py \
feassemble/Quadrature.py \
feassemble/ReferenceCell.py \
materials/__init__.py \
@@ -32,6 +34,7 @@
problems/Explicit.py \
problems/Formulation.py \
problems/Problem.py \
+ problems/TimeDependent.py \
solver/__init__.py \
solver/Solver.py \
topology/__init__.py \
@@ -39,6 +42,7 @@
topology/MeshGenerator.py \
topology/MeshImporter.py \
utils/__init__.py \
+ utils/CheckpointTimer.py \
utils/CppData.py \
utils/importing.py \
utils/testarray.py
Modified: short/3D/PyLith/trunk/pylith/PyLithApp.py
===================================================================
--- short/3D/PyLith/trunk/pylith/PyLithApp.py 2007-02-10 19:01:25 UTC (rev 6000)
+++ short/3D/PyLith/trunk/pylith/PyLithApp.py 2007-02-11 03:37:45 UTC (rev 6001)
@@ -11,9 +11,11 @@
#
## @file pylith/PyLithApp.py
+
## @brief Python PyLith application
-from mpi.Application import Application
+#from mpi.Application import Application
+from pyre.applications.Script import Script as Application
# PyLithApp class
class PyLithApp(Application):
@@ -32,7 +34,7 @@
## Python object for managing PyLithApp facilities and properties.
##
## \b Properties
- ## @li totalTime Time duration for simulation
+ ## @li None
##
## \b Facilities
## @li \b mesher Generates or imports the computational mesh.
@@ -53,6 +55,7 @@
problem = pyre.inventory.facility("problem", factory=EqDeformation)
problem.meta['tip'] = "Computational problem to solve."
+
# PUBLIC METHODS /////////////////////////////////////////////////////
def main(self):
@@ -60,18 +63,9 @@
Run the application.
"""
- mesh = self.mesher.create()
+ #mesh = self.mesher.create()
#self.problem.mesh = mesh.distribute()
- #self.problem.initialize()
-
- from pyre.units.time import second
- t = 0.0*second
- while t.value < self.totalTime.value:
- self.problem.prestep()
- dt = self.problem.stableTimestep()
- self.problem.step(dt)
- self.poststep(t+dt)
- t += dt
+ self.problem.run(self)
return
@@ -80,7 +74,6 @@
Constructor.
"""
Application.__init__(self, name)
- self.totalTime = None
self.mesher = None
self.problem = None
return
@@ -93,7 +86,6 @@
Setup members using inventory.
"""
Application._configure(self)
- self.totalTime = self.inventory.totalTime
self.mesher = self.inventory.mesher
self.problem = self.inventory.problem
return
Copied: short/3D/PyLith/trunk/pylith/feassemble/ExplicitElasticity.py (from rev 5995, short/3D/PyLith/trunk/pylith/feassemble/IntegratorInertia.py)
===================================================================
--- short/3D/PyLith/trunk/pylith/feassemble/IntegratorInertia.py 2007-02-10 00:37:05 UTC (rev 5995)
+++ short/3D/PyLith/trunk/pylith/feassemble/ExplicitElasticity.py 2007-02-11 03:37:45 UTC (rev 6001)
@@ -0,0 +1,82 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file pylith/feassemble/ExplicitElasticity.py
+
+## @brief Python object for explicit time integration of dynamic
+## elasticity equation using finite-elements.
+
+from IntegratorExplicit import IntegratorExplicit
+
+# ExplicitElasticity class
+class ExplicitElasticity(IntegratorExplicit):
+ """
+ Python object for explicit time integration of dynamic elasticity
+ equation using finite-elements.
+ """
+
+ # INVENTORY //////////////////////////////////////////////////////////
+
+ class Inventory(IntegratorExplicit.Inventory):
+ """
+ Python object for managing ExplicitElasticity facilities and properties.
+ """
+
+ ## @class Inventory
+ ## Python object for managing ExplicitElasticity facilities and properties.
+ ##
+ ## \b Properties
+ ## @li None
+ ##
+ ## \b Facilities
+ ## @li \b db Database for material property parameters.
+
+ import pyre.inventory
+
+ from spatialdata.spatialdb.SimpleDB import SimpleDB
+ db = pyre.inventory.facility("db", factory=SimpleDB)
+ db.meta['tip'] = "Database for material property parameters."
+
+
+ # PUBLIC METHODS /////////////////////////////////////////////////////
+
+ def initialize(self, mesh):
+ """
+ Initialize integrator.
+ """
+ self.cppHandle.setupMatProp(mesh.cppHandle, mesh.coordsys, db.cppHandle)
+ return
+
+
+ def __init__(self, name="explicitelasticity"):
+ """
+ Constructor.
+ """
+ IntegratorExplicit.__init__(self, name)
+
+ import pylith.feassemble.feassemble as bindings
+ self.cppHandle = bindings.ExplicitElasticity()
+ return
+
+
+ # PRIVATE METHODS ////////////////////////////////////////////////////
+
+ def _configure(self):
+ """
+ Set members based using inventory.
+ """
+ IntegratorExplicit._configure(self)
+ self.db = self.inventory.db
+ return
+
+
+# End of file
Modified: short/3D/PyLith/trunk/pylith/feassemble/Integrator.py
===================================================================
--- short/3D/PyLith/trunk/pylith/feassemble/Integrator.py 2007-02-10 19:01:25 UTC (rev 6000)
+++ short/3D/PyLith/trunk/pylith/feassemble/Integrator.py 2007-02-11 03:37:45 UTC (rev 6001)
@@ -47,11 +47,6 @@
quadrature = pyre.inventory.facility("quadrature", factory=Quadrature)
quadrature.meta['tip'] = "Quadrature object for integration."
- from spatialdata.spatialdb.SimpleDB import SimpleDB
- db = pyre.inventory.facility("db", factory=SimpleDB)
- db.meta['tip'] = "Database for material properties."
-
-
# PUBLIC METHODS /////////////////////////////////////////////////////
def __init__(self, name="integrator"):
@@ -71,8 +66,7 @@
q = self.quadrature
q.initialize()
self.cppHandle.quadrature = q.cppHandle
- self.cppHandle.initialize(mesh.cppHandle, mesh.coordsys.cppHandle,
- self.db)
+ self.cppHandle.createParameters(mesh.cppHandle)
return
Deleted: short/3D/PyLith/trunk/pylith/feassemble/IntegratorElasticity.py
===================================================================
--- short/3D/PyLith/trunk/pylith/feassemble/IntegratorElasticity.py 2007-02-10 19:01:25 UTC (rev 6000)
+++ short/3D/PyLith/trunk/pylith/feassemble/IntegratorElasticity.py 2007-02-11 03:37:45 UTC (rev 6001)
@@ -1,68 +0,0 @@
-#!/usr/bin/env python
-#
-# ----------------------------------------------------------------------
-#
-# Brad T. Aagaard
-# U.S. Geological Survey
-#
-# <LicenseText>
-#
-# ----------------------------------------------------------------------
-#
-
-## @file pyre/feassemble/IntegratorElasticity.py
-## @brief Python finite-element integrator for elasticity.
-
-from Integrator import Integrator
-
-# IntegratorElasticity class
-class IntegratorElasticity(Integrator):
- """Python finite-element integrator for elasticity."""
-
- # PUBLIC METHODS /////////////////////////////////////////////////////
-
- def integrateResidual(self, element, state):
- """Integrate residual for element."""
-
- (v0, jacobian, inv, detJ) = self.mesh.elementGeometry(element)
-
- return residual
-
-
- def integrateJacobian(self, element, state):
- """Integrate the Jacobian weak form over an element using the given
- quadrature."""
-
- (v0, jacobian, inv, detJ) = self.mesh.elementGeometry(element)
-
- # This is the inhomogeneous, anisotropic
- for q, point, weight in zip(range(len(self.quadrature.weights)),
- self.quadrature.points,
- self.quadrature.weights):
- u_q = 0.0
- for j in len(self.elementJac):
- u_q += u[j]*self.basis[q,j]
- D_q = material.elasticityConsts(point, u_q)
- for j in len(self.elementJac):
- t_der[0] = invJ[0]*self.basisDer[q,j,0] + invJ[2]*self.basisDer[q,j,1]
- t_der[1] = invJ[1]*self.basisDer[q,j,0] + invJ[3]*self.basisDer[q,j,1]
- for k in len(self.elementJac[0]):
- b_der[0] = invJ[0]*self.basisDer[q,k,0] + \
- invJ[2]*self.basisDer[q,k,1]
- b_der[1] = invJ[1]*self.basisDer[q,k,0] + \
- invJ[3]*self.basisDer[q,k,1]
- self.elementJac[j,k] += (t_der[0]*b_der[0] +
- t_der[1]*b_der[1])*D_q*weight*detJ
- return elementJac
-
-
- def __init__(self, name="integratorelasticity"):
- """Constructor."""
- Integrator.__init__(self, name)
- return
-
-
-# version
-__id__ = "$Id$"
-
-# End of file
Added: short/3D/PyLith/trunk/pylith/feassemble/IntegratorExplicit.py
===================================================================
--- short/3D/PyLith/trunk/pylith/feassemble/IntegratorExplicit.py 2007-02-10 19:01:25 UTC (rev 6000)
+++ short/3D/PyLith/trunk/pylith/feassemble/IntegratorExplicit.py 2007-02-11 03:37:45 UTC (rev 6001)
@@ -0,0 +1,84 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file pylith/feassemble/IntegratorInertia.py
+
+## @brief Python object for integration of inertial operator
+## actions with finite-elements.
+
+from Integrator import Integrator
+
+# IntegratorInertia class
+class IntegratorInertia(Integrator):
+ """
+ Python object for integration of inertial operator actions with
+ finite-elements.
+ """
+
+
+ # PUBLIC METHODS /////////////////////////////////////////////////////
+
+ def timeStep(self, t):
+ """
+ Set time step for advancing from time t to time t+dt.
+ """
+ self.cppHandle.timeStep(t.value)
+ return
+
+
+ def stableTimeStep(self):
+ """
+ Get stable time step for advancing from time t to time t+dt.
+ """
+ return self.cppHandle.getStableTimeStep()
+
+
+ def initialize(self, mesh):
+ """
+ Initialize integrator.
+ """
+ return
+
+
+ def integrateResidual(self,
+ residual, fieldInT, fieldInTmdt, coords, lumpJacobian):
+ """
+ Integrate residual term for dynamic elasticity terms for finite-elements.
+ """
+ if lumpJacobian:
+ self.cppHandle.integrateResidualLumped(residual,
+ fieldInT, fieldInTmdt, coords)
+ else:
+ self.cppHandle.integrateResidual(residual, fieldInT, fieldInTmdt, coords)
+ return
+
+
+ def integrateJacobian(self, jacobian, fieldInT, coords, lumpJacobian):
+ """
+ Integrate Jacobian term for dynamic elasticity terms for finite-elements.
+ """
+ if lumpJacobian:
+ self.cppHandle.integrateJacobianLumped(jacobian, fieldInT, coords)
+ else:
+ self.cppHandle.integrateJacobian(jacobian, fieldInT, coords)
+ return
+
+
+ def __init__(self, name="integratorexplicit"):
+ """
+ Constructor.
+ """
+ Integrator.__init__(self, name)
+ return
+
+
+# End of file
Deleted: short/3D/PyLith/trunk/pylith/feassemble/IntegratorInertia.py
===================================================================
--- short/3D/PyLith/trunk/pylith/feassemble/IntegratorInertia.py 2007-02-10 19:01:25 UTC (rev 6000)
+++ short/3D/PyLith/trunk/pylith/feassemble/IntegratorInertia.py 2007-02-11 03:37:45 UTC (rev 6001)
@@ -1,40 +0,0 @@
-#!/usr/bin/env python
-#
-# ----------------------------------------------------------------------
-#
-# Brad T. Aagaard
-# U.S. Geological Survey
-#
-# <LicenseText>
-#
-# ----------------------------------------------------------------------
-#
-
-## @file pylith/feassemble/IntegratorInertia.py
-
-## @brief Python object for integration of inertial operator
-## actions with finite-elements.
-
-from Integrator import Integrator
-
-# IntegratorInertia class
-class IntegratorInertia(Integrator):
- """
- Python object for integration of inertial operator actions with
- finite-elements.
- """
-
- # PUBLIC METHODS /////////////////////////////////////////////////////
-
- def __init__(self, name="integratorinertia"):
- """
- Constructor.
- """
- Integrator.__init__(self, name)
-
- import pylith.feassemble.feassemble as bindings
- self.cppHandle = bindings.IntegratorInertia()
- return
-
-
-# End of file
Modified: short/3D/PyLith/trunk/pylith/feassemble/__init__.py
===================================================================
--- short/3D/PyLith/trunk/pylith/feassemble/__init__.py 2007-02-10 19:01:25 UTC (rev 6000)
+++ short/3D/PyLith/trunk/pylith/feassemble/__init__.py 2007-02-11 03:37:45 UTC (rev 6001)
@@ -11,11 +11,17 @@
#
## @file pylith/feassemble/__init__.py
+
## @brief Python PyLith finite-element assembler module initialization
-all = ['Assembler', 'Integrator', 'IntegratorElasticity']
+all = ['ExplicitElasticity',
+ 'FIATCell',
+ 'FIATLagrange',
+ 'FIATSimplex',
+ 'Integrator',
+ 'IntegratorExplicit',
+ 'Quadrature',
+ 'ReferenceCell']
-# version
-__id__ = "$Id$"
# End of file
Modified: short/3D/PyLith/trunk/pylith/materials/Material.py
===================================================================
--- short/3D/PyLith/trunk/pylith/materials/Material.py 2007-02-10 19:01:25 UTC (rev 6000)
+++ short/3D/PyLith/trunk/pylith/materials/Material.py 2007-02-11 03:37:45 UTC (rev 6001)
@@ -17,12 +17,16 @@
# Material class
class Material(Component):
- """Python material property manager."""
+ """
+ Python material property manager.
+ """
# INVENTORY //////////////////////////////////////////////////////////
class Inventory(Component.Inventory):
- """Python object for managing Material facilities and properties."""
+ """
+ Python object for managing Material facilities and properties.
+ """
## @class Inventory
## Python object for managing Material facilities and properties.
@@ -45,13 +49,15 @@
from spatialdata.spatialdb.SpatialDB import SpatialDB
db = pyre.inventory.facility("db", factory=SpatialDB,
args=["db"])
- db.meta['tip'] = "Database of material properties."
+ db.meta['tip'] = "Database of material property parameters."
# PUBLIC METHODS /////////////////////////////////////////////////////
def initialize(self):
- """Initialize material property manager."""
+ """
+ Initialize material property manager.
+ """
self._info.log("Initializing material '%s'." % self.name)
self.db.initialize()
@@ -59,7 +65,9 @@
def openDB(self):
- """Open material property database."""
+ """
+ Open material property database.
+ """
self._info.line("Material '%s' opening property database." % self.name)
self._info.log(" Setting up query for values: %s." % valNames)
@@ -68,7 +76,9 @@
def closeDB(self):
- """Close material property database."""
+ """
+ Close material property database.
+ """
self._info.log("Material '%s' closing property database." % self.name)
self.db.close()
@@ -76,7 +86,9 @@
def __init__(self, name="material"):
- """Constructor."""
+ """
+ Constructor.
+ """
Component.__init__(self, name, facility="material")
return
@@ -92,7 +104,4 @@
return
- # version
-__id__ = "$Id$"
-
# End of file
Modified: short/3D/PyLith/trunk/pylith/materials/MaterialsBin.py
===================================================================
--- short/3D/PyLith/trunk/pylith/materials/MaterialsBin.py 2007-02-10 19:01:25 UTC (rev 6000)
+++ short/3D/PyLith/trunk/pylith/materials/MaterialsBin.py 2007-02-11 03:37:45 UTC (rev 6001)
@@ -17,12 +17,16 @@
# MaterialsBin class
class MaterialsBin(Component):
- """Python container for materials."""
+ """
+ Python container for materials.
+ """
# PUBLIC METHODS /////////////////////////////////////////////////////
def initialize(self):
- """Initialize material property manager."""
+ """
+ Initialize material property manager.
+ """
self._info.log("Initializing materials '%s'." % self.name)
for material in self.materials:
@@ -31,14 +35,13 @@
def __init__(self, name="materialsbin"):
- """Constructor."""
+ """
+ Constructor.
+ """
Component.__init__(self, name, facility="materialsbin")
self.materials = []
return
- # version
-__id__ = "$Id$"
-
# End of file
Modified: short/3D/PyLith/trunk/pylith/materials/__init__.py
===================================================================
--- short/3D/PyLith/trunk/pylith/materials/__init__.py 2007-02-10 19:01:25 UTC (rev 6000)
+++ short/3D/PyLith/trunk/pylith/materials/__init__.py 2007-02-11 03:37:45 UTC (rev 6001)
@@ -10,12 +10,11 @@
# ----------------------------------------------------------------------
#
-## @file pylith/__init__.py
-## @brief Python top-level PyLith module initialization
+## @file pylith/materials/__init__.py
+## @brief Python PyLith materials module initialization
-all = ['PyLithApp']
+all = ['Material',
+ 'MaterialsBin']
-# version
-__id__ = "$Id$"
# End of file
Deleted: short/3D/PyLith/trunk/pylith/problems/Dynamic.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Dynamic.py 2007-02-10 19:01:25 UTC (rev 6000)
+++ short/3D/PyLith/trunk/pylith/problems/Dynamic.py 2007-02-11 03:37:45 UTC (rev 6001)
@@ -1,130 +0,0 @@
-#!/usr/bin/env python
-#
-# ----------------------------------------------------------------------
-#
-# Brad T. Aagaard
-# U.S. Geological Survey
-#
-# <LicenseText>
-#
-# ----------------------------------------------------------------------
-#
-
-## @file pylith/problems/Dynamic.py
-## @brief Python Dynamic for dynamic crustal dynamics simulations.
-
-from Problem import Problem
-
-# Dynamic class
-class Dynamic(Problem):
- """
- Python Dynamic for dynamic crustal dynamics simulations.
- """
-
- # INVENTORY //////////////////////////////////////////////////////////
-
- class Inventory(Problem.Inventory):
- """
- Python object for managing Dynamic facilities and properties.
- """
-
- ## @class Inventory
- ## Python object for managing Dynamic facilities and properties.
- ##
- ## \b Properties
- ## @li None
- ##
- ## \b Facilities
- ## @li \b solver Algebraic solver.
- ## @li \b disp_tpdt Displacement at time t+dt
- ## @li \b disp_t Displacement at time t
- ## @li \b disp_tmdt Displacement at time t-dt
-
- import pyre.inventory
-
- from pylith.solver.SolverTSE import SolverTSE
- solver = pyre.inventory.facility("solver", factory=SolverTSE)
- solver.meta['tip'] = "Algebraic solver."
-
- from pylith.feassemble.Field import Field
- disptpdt = pyre.inventory.facility("disp_tpdt", factory=Field,
- args=["disptpdt"])
- disptpdt.meta['tip'] = "Displacement at time t+dt."
-
- dispt = pyre.inventory.facility("disp_t", factory=Field,
- args=["dispt"])
- dispt.meta['tip'] = "Displacement at time t."
-
- disptmdt = pyre.inventory.facility("disp_tmdt", factory=Field,
- args=["disptmdt"])
- disptmdt.meta['tip'] = "Displacement at time t-dt."
-
-
- # PUBLIC METHODS /////////////////////////////////////////////////////
-
- def initialize(self):
- Problem.initialize(self)
-
- self.disptpdt.initialize()
- self.dispt.initialize()
- self.disptmdt.initialize()
- return
-
-
- def step(self, dt):
- raise NotImplementedError, "Dynamic::step() not implemented."
- return
-
-
- def poststep(self):
- raise NotImplementedError, "Dynamic::poststep() not implemented."
- return
-
-
- def stableTimestep(self):
- raise NotImplementedError, "Dynamic::stableTimestep() not implemented."
- return
-
-
- def checkpoint(self):
- raise NotImplementedError, "Dynamic::checkpoint() not implemented."
- return
-
-
- def __init__(self, name="dynamic"):
- """Constructor."""
- Problem.__init__(self, name)
- return
-
-
- # PRIVATE METHODS ////////////////////////////////////////////////////
-
- def _configure(self):
- """Set members based using inventory."""
- Problem._configure(self)
- self.solver = self.inventory.solver
- self.disptpdt = self.inventory.disptpdt
- self.dispt = self.inventory.dispt
- self.disptmdt = self.inventory.disptmdt
- return
-
-
- def _calcResidual(self):
- """Compute solution residual."""
- return
-
-
- def _calcJacobian(self):
- """Calculation Jacobian."""
- return
-
-
- def _convergenceTest(self):
- """Test for convergence."""
- return
-
-
-# version
-__id__ = "$Id$"
-
-# End of file
Deleted: short/3D/PyLith/trunk/pylith/problems/DynamicExplicit.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/DynamicExplicit.py 2007-02-10 19:01:25 UTC (rev 6000)
+++ short/3D/PyLith/trunk/pylith/problems/DynamicExplicit.py 2007-02-11 03:37:45 UTC (rev 6001)
@@ -1,140 +0,0 @@
-#!/usr/bin/env python
-#
-# ----------------------------------------------------------------------
-#
-# Brad T. Aagaard
-# U.S. Geological Survey
-#
-# <LicenseText>
-#
-# ----------------------------------------------------------------------
-#
-
-## @file pylith/problems/DynamicExplicit.py
-
-## @brief Python DynamicExplicit for dynamic simulations with explicit solver.
-
-from Problem import Problem
-
-# Dynamic class
-class DynamicExplicit(Problem):
- """
- Python DynamicExplicit for dynamic simulations with explicit solver.
- """
-
- # INVENTORY //////////////////////////////////////////////////////////
-
- class Inventory(Problem.Inventory):
- """
- Python object for managing Dynamic facilities and properties.
- """
-
- ## @class Inventory
- ## Python object for managing Dynamic facilities and properties.
- ##
- ## \b Properties
- ## @li None
- ##
- ## \b Facilities
- ## @li \b solver Algebraic solver.
- ## @li \b disp_tpdt Displacement at time t+dt
- ## @li \b disp_t Displacement at time t
- ## @li \b disp_tmdt Displacement at time t-dt
-
- import pyre.inventory
-
- from pylith.solver.SolverTSE import SolverTSE
- solver = pyre.inventory.facility("solver", factory=SolverTSE)
- solver.meta['tip'] = "Algebraic solver."
-
- from pylith.feassemble.Field import Field
- disptpdt = pyre.inventory.facility("disp_tpdt", factory=Field,
- args=["disptpdt"])
- disptpdt.meta['tip'] = "Displacement at time t+dt."
-
- dispt = pyre.inventory.facility("disp_t", factory=Field,
- args=["dispt"])
- dispt.meta['tip'] = "Displacement at time t."
-
- disptmdt = pyre.inventory.facility("disp_tmdt", factory=Field,
- args=["disptmdt"])
- disptmdt.meta['tip'] = "Displacement at time t-dt."
-
-
- # PUBLIC METHODS /////////////////////////////////////////////////////
-
- def initialize(self):
- """
- Create domain, bounday conditions, fields, and setup time loop.
- """
- Problem.initialize(self)
-
- #self.disptpdt.initialize()
- #self.dispt.initialize()
- #self.disptmdt.initialize()
- return
-
-
- def prestep(self):
- """
- User hook for doing stuff before advancing time step.
- """
- self._info.log("WARNING: DynamicExplicit::prestep not implemented.")
- return
-
-
- def step(self, dt):
- """
- Advance to next time step.
- """
- self._info.log("WARNING: DynamicExplicit::step not implemented.")
- return
-
-
- def poststep(self):
- """
- Update time and storage.
- """
- self._info.log("WARNING: DynamicExplicit::poststep not implemented.")
- return
-
-
- def stableTimestep(self):
- """
- Determine stable time step for problem.
- """
- self._info.log("WARNING: DynamicExplicit::stableTimestep not implemented.")
- return
-
-
- def checkpoint(self):
- """
- Save problem state for restart.
- """
- self._info.log("WARNING: DynamicExplicit::checkpoint not implemented.")
- return
-
-
- def __init__(self, name="dynamic"):
- """
- Constructor.
- """
- Problem.__init__(self, name)
- return
-
-
- # PRIVATE METHODS ////////////////////////////////////////////////////
-
- def _configure(self):
- """
- Set members based using inventory.
- """
- Problem._configure(self)
- self.solver = self.inventory.solver
- self.disptpdt = self.inventory.disptpdt
- self.dispt = self.inventory.dispt
- self.disptmdt = self.inventory.disptmdt
- return
-
-
-# End of file
Modified: short/3D/PyLith/trunk/pylith/problems/EqDeformation.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/EqDeformation.py 2007-02-10 19:01:25 UTC (rev 6000)
+++ short/3D/PyLith/trunk/pylith/problems/EqDeformation.py 2007-02-11 03:37:45 UTC (rev 6001)
@@ -15,10 +15,10 @@
## @brief Python EqDeformation for computing deformation associated
## with earthquakes.
-from Problem import Problem
+from TimeDependent import TimeDependent
# EqDeformation class
-class EqDeformation(Problem):
+class EqDeformation(TimeDependent):
"""
Python EqDeformation for computing deformation associated with
earthquakes.
@@ -26,7 +26,7 @@
# INVENTORY //////////////////////////////////////////////////////////
- class Inventory(Problem.Inventory):
+ class Inventory(TimeDependent.Inventory):
"""
Python object for managing EqDeformation facilities and properties.
"""
@@ -49,53 +49,18 @@
# PUBLIC METHODS /////////////////////////////////////////////////////
- def initialize(self):
- """
- Setup formulation for solving PDE.
- """
- Problem.initialize(self)
-
- self._info.log("WARNING: EqDeofmraiton::initialize not implemented.")
- return
-
-
- def prestep(self):
- """
- User hook for doing stuff before advancing time step.
- """
- self._info.log("WARNING: EqDeformation::prestep not implemented.")
- return
-
-
- def step(self, dt):
- """
- Advance to next time step.
- """
- self._info.log("WARNING: EqDeformation::step not implemented.")
- return
-
-
- def poststep(self):
- """
- Update time and storage.
- """
- self._info.log("WARNING: EqDeformation::poststep not implemented.")
- return
-
-
- def stableTimestep(self):
- """
- Determine stable time step for problem.
- """
- self._info.log("WARNING: EqDeformation::stableTimestep not implemented.")
- return
-
-
def checkpoint(self):
"""
Save problem state for restart.
"""
- self._info.log("WARNING: EqDeformation::checkpoint not implemented.")
+ TimeDependent.checkpoint() # Save state of parent
+
+ # Save state of this object
+ raise NotImplementedError, \
+ "EqDeformation::checkpoint() not implemented."
+
+ # Save state of children
+ #self.faults.checkpoint()
return
@@ -103,7 +68,7 @@
"""
Constructor.
"""
- Problem.__init__(self, name)
+ TimeDependent.__init__(self, name)
return
@@ -113,7 +78,7 @@
"""
Set members based using inventory.
"""
- Problem._configure(self)
+ TimeDependent._configure(self)
#self.faults = self.inventory.faults
return
Modified: short/3D/PyLith/trunk/pylith/problems/Explicit.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Explicit.py 2007-02-10 19:01:25 UTC (rev 6000)
+++ short/3D/PyLith/trunk/pylith/problems/Explicit.py 2007-02-11 03:37:45 UTC (rev 6001)
@@ -40,16 +40,31 @@
## Python object for managing Explicit facilities and properties.
##
## \b Properties
- ## @li None
+ ## @li \b lump_jacobian Flag for indicating to use lumped
+ ## formulation for Jacobian matrix
##
## \b Facilities
## @li None
- #import pyre.inventory
+ import pyre.inventory
+ lumpJacobian = pyre.inventory.bool("lump_jacobian", default=True)
+ lumpJacobian.meta['tip'] = "Flag for indicating to use lumped " \
+ "formulation for Jacobian matrix."
+
# PUBLIC METHODS /////////////////////////////////////////////////////
+ def stableTimeStep(self):
+ """
+ Get stable time step for advancing forward in time.
+ """
+ self._info.log("WARNING: Explicit::stableTimeStep() not implemented.")
+ from pyre.units.time import second
+ dt = 0.0*second
+ return dt
+
+
def initialize(self):
"""
Initialize explicit formulation.
@@ -65,6 +80,7 @@
self._info.log("WARNING: Explicit::calcResidual not implemented.")
return
+
def calcJacobian(self):
"""
Compute Jacobian, [A(t)].
@@ -88,6 +104,7 @@
Set members based using inventory.
"""
Formulation._configure(self)
+ self.lumpJacobian = self.inventory.lumpJacobian
return
Modified: short/3D/PyLith/trunk/pylith/problems/Problem.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Problem.py 2007-02-10 19:01:25 UTC (rev 6000)
+++ short/3D/PyLith/trunk/pylith/problems/Problem.py 2007-02-11 03:37:45 UTC (rev 6001)
@@ -11,6 +11,7 @@
#
## @file pylith/problems/Problem.py
+
## @brief Python abstract base class for crustal dynamics problems.
from pyre.components.Component import Component
@@ -37,7 +38,6 @@
## \b Facilities
## @li \b materials Materials in problem.
## @li \b bc Boundary conditions.
- ## @li \b formulation Formulation for solving PDE
import pyre.inventory
@@ -49,48 +49,17 @@
#bc = pyre.inventory.facility("bc", factory=BoundaryConditions)
#bc.meta['tip'] = "Boundary conditions."
- from Explicit import Explicit
- formulation = pyre.inventory.facility("formulation", factory=Explicit)
- formulation.meta['tip'] = "Formulation for solving PDE."
# PUBLIC METHODS /////////////////////////////////////////////////////
- def initialize(self):
+ def run(self, app):
"""
- Initialize problem by getting mesh, setting up boundary conditions, etc.
+ Solve the problem.
"""
+ raise NotImplementedError, "Problem::run() not implemented."
return
- def prestep(self):
- """
- User hook for doing stuff before advancing time step.
- """
- return
-
-
- def step(self, dt):
- """
- Advance to next time step.
- """
- return
-
-
- def poststep(self):
- """
- Update time and storage.
- """
- return
-
-
- def stableTimestep(self):
- """
- Determine stable time step for problem.
- """
- raise NotImplementedError, "Problem::stableTimestep() not implemented."
- return
-
-
def checkpoint(self):
"""
Save problem state for restart.
@@ -104,7 +73,7 @@
Constructor.
"""
Component.__init__(self, name, facility="problem")
- mesh = None
+ self.mesh = None
return
Deleted: short/3D/PyLith/trunk/pylith/problems/QuasiStatic.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/QuasiStatic.py 2007-02-10 19:01:25 UTC (rev 6000)
+++ short/3D/PyLith/trunk/pylith/problems/QuasiStatic.py 2007-02-11 03:37:45 UTC (rev 6001)
@@ -1,115 +0,0 @@
-#!/usr/bin/env python
-#
-# ----------------------------------------------------------------------
-#
-# Brad T. Aagaard
-# U.S. Geological Survey
-#
-# <LicenseText>
-#
-# ----------------------------------------------------------------------
-#
-
-## @file pyre/problems/QuasiStatic.py
-## @brief Python QuasiStatic application driver
-
-from Problem import Problem
-
-# QuasiStatic class
-class QuasiStatic(Problem):
- """Python QuasiStatic for quasi-static crustal dynamics simulations."""
-
- # INVENTORY //////////////////////////////////////////////////////////
-
- class Inventory(Problem.Inventory):
- """Python object for managing QuasiStatic facilities and properties."""
-
- ## @class Inventory
- ## Python object for managing QuasiStatic facilities and properties.
- ##
- ## \b Properties
- ## @li None
- ##
- ## \b Facilities
- ## @li \b solver Algebraic solver.
- ## @li \b disp Displacement at time t
- ## @li \b dispIncr Displacement increment at time t (t -> t+dt)
-
- import pyre.inventory
-
- from pylith.solver.SolverTSI import SolverTSI
- solver = pyre.inventory.facility("solver", factory=SolverTSI)
- solver.meta['tip'] = "Algebraic solver."
-
- from pylith.feassemble.Field import Field
- disp = pyre.inventory.facility("disp", factory=Field,
- args=["disp"])
- disp.meta['tip'] = "Displacement at time t."
-
- dispIncr = pyre.inventory.facility("disp_incr", factory=Field,
- args=["dispincr"])
-
- # PUBLIC METHODS /////////////////////////////////////////////////////
-
- def initialize(self):
- Problem.initialize(self)
- self.disp.initialize()
- self.dispIncr.initialize()
- return
-
-
- def step(self, dt):
- raise NotImplementedError, "QuasiStatic::step() not implemented."
- return
-
-
- def poststep(self):
- raise NotImplementedError, "QuasiStatic::poststep() not implemented."
- return
-
-
- def stableTimestep(self):
- #raise NotImplementedError, "QuasiStatic::stableTimestep() not implemented."
- return 1.0
-
-
- def checkpoint(self):
- raise NotImplementedError, "QuasiStatic::checkpoint() not implemented."
- return
-
-
- def __init__(self, name="quasistatic"):
- """Constructor."""
- Problem.__init__(self, name)
- return
-
-
- # PRIVATE METHODS /////////////////////////////////////////////////////
-
- def _configure(self):
- """Set members based using inventory."""
- Problem._configure(self)
- self.solver = self.inventory.solver
- self.disp = self.inventory.disp
- self.dispIncr = self.inventory.dispIncr
- return
-
- def _calcResidual(self):
- """Compute solution residual."""
- return
-
-
- def _calcJacobian(self):
- """Calculation Jacobian."""
- return
-
-
- def _convergenceTest(self):
- """Test for convergence."""
- return
-
-
-# version
-__id__ = "$Id$"
-
-# End of file
Added: short/3D/PyLith/trunk/pylith/problems/TimeDependent.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/TimeDependent.py 2007-02-10 19:01:25 UTC (rev 6000)
+++ short/3D/PyLith/trunk/pylith/problems/TimeDependent.py 2007-02-11 03:37:45 UTC (rev 6001)
@@ -0,0 +1,160 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file pylith/problems/TimeDependent.py
+
+## @brief Python abstract base class for time dependent crustal
+## dynamics problems.
+
+from Problem import Problem
+
+# TimeDependent class
+class TimeDependent(Problem):
+ """
+ Python abstract base class for time dependent crustal dynamics problems.
+ """
+
+ # INVENTORY //////////////////////////////////////////////////////////
+
+ class Inventory(Problem.Inventory):
+ """
+ Python object for managing TimeDependent facilities and properties.
+ """
+
+ ## @class Inventory
+ ## Python object for managing TimeDependent facilities and properties.
+ ##
+ ## \b Properties
+ ## @li \b total_time Time duration for simulation.
+ ## @li \b default_dt Default time step.
+ ##
+ ## \b Facilities
+ ## @li \b formulation Formulation for solving PDE.
+ ## @li \b checkpoint Checkpoint manager.
+
+ import pyre.inventory
+
+ from pyre.units.time import second
+ totalTime = pyre.inventory.dimensional("total_time", default=0.0*second,
+ validator=pyre.inventory.greaterEqual(0.0*second))
+ totalTime.meta['tip'] = "Time duration for simulation."
+
+ dt = pyre.inventory.dimensional("default_dt", default=1.0*second,
+ validator=pyre.inventory.greater(0.0*second))
+ dt.meta['tip'] = "Default time step for simulation."
+
+ from Explicit import Explicit
+ formulation = pyre.inventory.facility("formulation", factory=Explicit)
+ formulation.meta['tip'] = "Formulation for solving PDE."
+
+ from pylith.utils.CheckpointTimer import CheckpointTimer
+ checkpointTimer = pyre.inventory.facility("checkpoint",
+ factory=CheckpointTimer)
+ checkpointTimer.meta['tip'] = "Checkpoint manager."
+
+
+ # PUBLIC METHODS /////////////////////////////////////////////////////
+
+ def run(self, app):
+ """
+ Solve time dependent problem.
+ """
+ self.checkpointTimer.toplevel = app # Set handle for saving state
+
+ from pyre.units.time import second
+ t = 0.0*second
+ while t.value <= self.totalTime.value:
+ self._info.log("Main time loop, t=%s" % t)
+
+ # Checkpoint if necessary
+ self.checkpointTimer.update(t)
+
+ # Do stuff before advancing time step
+ self._prestep()
+
+ # Get stable time step
+ dt = self.formulation.stableTimeStep()
+ if dt.value == 0.0:
+ # If formulation returns 0.0, use default time step
+ dt = self.dt
+
+ # Advance in time
+ self._step(dt)
+
+ # Do stuff after advancing time step
+ self._poststep(t+dt)
+
+ # Update time stamp
+ t += dt
+ return
+
+
+ def checkpoint(self):
+ """
+ Save problem state for restart.
+ """
+ Problem.checkpoint()
+
+ # Save state of this object
+ raise NotImplementedError, "TimeDependent::checkpoint() not implemented."
+
+ # Save state of children
+ self.formulation.checkpoint()
+ return
+
+
+ def __init__(self, name="timedependent"):
+ """
+ Constructor.
+ """
+ Problem.__init__(self, name)
+ return
+
+
+ # PRIVATE METHODS ////////////////////////////////////////////////////
+
+ def _configure(self):
+ """
+ Set members based using inventory.
+ """
+ self.totalTime = self.inventory.totalTime
+ self.dt = self.inventory.dt
+ self.formulation = self.inventory.formulation
+ self.checkpointTimer = self.inventory.checkpointTimer
+ return
+
+
+ def _prestep(self):
+ """
+ Hook for doing stuff before advancing time step.
+ """
+ self._info.log("WARNING: TimeDependent::_prestep() not implemented.")
+ return
+
+
+ def _step(self, dt):
+ """
+ Advance to next time step.
+ """
+ self._info.log("WARNING: TimeDependent::_step() not implemented.")
+ return
+
+
+ def _poststep(self, t):
+ """
+ Hook for doing stuff after advancing time step.
+ """
+ self._info.log("WARNING: TimeDependent::_poststep() not implemented.")
+ return
+
+
+# End of file
Modified: short/3D/PyLith/trunk/pylith/problems/__init__.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/__init__.py 2007-02-10 19:01:25 UTC (rev 6000)
+++ short/3D/PyLith/trunk/pylith/problems/__init__.py 2007-02-11 03:37:45 UTC (rev 6001)
@@ -14,10 +14,10 @@
## @brief Python PyLith crustal dynamics problems module initialization
-all = ['Problem',
- 'EqDeformation',
- 'Formulation',
- 'Explicit']
+all = ['EqDeformation',
+ 'Explicit',
+ 'Problem',
+ 'TimeDependent']
# End of file
Added: short/3D/PyLith/trunk/pylith/utils/CheckpointTimer.py
===================================================================
--- short/3D/PyLith/trunk/pylith/utils/CheckpointTimer.py 2007-02-10 19:01:25 UTC (rev 6000)
+++ short/3D/PyLith/trunk/pylith/utils/CheckpointTimer.py 2007-02-11 03:37:45 UTC (rev 6001)
@@ -0,0 +1,96 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file pylith/CheckpointTimer.py
+
+## @brief Python CheckpointTimer object for managing checkpointing.
+
+## USAGE:
+##
+## @li Set toplevel attribute to top-level object that contains a
+## checkpoint() method.
+##
+## @li Call update() every time step to checkpoint at desired frequency.
+
+from pyre.components.Component import Component
+
+# CheckpointTimer class
+class CheckpointTimer(Component):
+ """
+ Python CheckpointTimer object for managing checkpointing.
+ """
+
+ # INVENTORY //////////////////////////////////////////////////////////
+
+ class Inventory(Component.Inventory):
+ """
+ Python object for managing CheckpointTimer facilities and properties.
+ """
+
+ ## @class Inventory
+ ## Python object for managing CheckpointTimer facilities and properties.
+ ##
+ ## \b Properties
+ ## @li dt Simulation time between checkpoints.
+ ##
+ ## \b Facilities
+ ## @li None
+
+ import pyre.inventory
+
+ from pyre.units.time import second
+ dt = pyre.inventory.dimensional("dt", default=9.9e+99*second,
+ validator=pyre.inventory.greater(0.0*second))
+ dt.meta['tip'] = "Simulation time between checkpoints."
+
+
+ # PUBLIC METHODS /////////////////////////////////////////////////////
+
+ def update(self, t):
+ """
+ CheckpointTimer if necessary.
+ """
+
+ if t.value > self.t.value + self.dt.value:
+ if app is None:
+ raise ValueError, "Atttempting to checkpoint without " \
+ "setting toplevel attribute in CheckpointTimer."
+ self.toplevel.checkpoint()
+ self.t = t
+ return
+
+
+ def __init__(self, name="checkpoint"):
+ """
+ Constructor.
+ """
+ Component.__init__(self, name, facility="checkpoint")
+
+ from pyre.units.time import second
+ self.t = -8.9e+99*second
+
+ self.toplevel = None
+ return
+
+
+ # PRIVATE METHODS ////////////////////////////////////////////////////
+
+ def _configure(self):
+ """
+ Setup members using inventory.
+ """
+ Component._configure(self)
+ self.dt = self.inventory.dt
+ return
+
+
+# End of file
Modified: short/3D/PyLith/trunk/pylith/utils/__init__.py
===================================================================
--- short/3D/PyLith/trunk/pylith/utils/__init__.py 2007-02-10 19:01:25 UTC (rev 6000)
+++ short/3D/PyLith/trunk/pylith/utils/__init__.py 2007-02-11 03:37:45 UTC (rev 6001)
@@ -10,6 +10,10 @@
# ----------------------------------------------------------------------
#
-all = ['CppData', 'testarray', 'importing']
+all = ['CheckpointTimer',
+ 'CppData',
+ 'testarray',
+ 'importing']
+
# End of file
More information about the cig-commits
mailing list