[cig-commits] r11190 - in short/3D/PyLith/trunk: libsrc/meshio pylith pylith/bc pylith/faults pylith/feassemble pylith/materials pylith/meshio pylith/problems pylith/solver
brad at geodynamics.org
brad at geodynamics.org
Tue Feb 19 21:47:32 PST 2008
Author: brad
Date: 2008-02-19 21:47:32 -0800 (Tue, 19 Feb 2008)
New Revision: 11190
Removed:
short/3D/PyLith/trunk/libsrc/meshio/SolutionIO.cc
short/3D/PyLith/trunk/libsrc/meshio/SolutionIO.hh
short/3D/PyLith/trunk/libsrc/meshio/SolutionIOVTK.cc
short/3D/PyLith/trunk/libsrc/meshio/SolutionIOVTK.hh
short/3D/PyLith/trunk/libsrc/meshio/SolutionIOVTK.icc
short/3D/PyLith/trunk/pylith/bc/BCIntegrator.py
short/3D/PyLith/trunk/pylith/meshio/SolutionIO.py
short/3D/PyLith/trunk/pylith/meshio/SolutionIOVTK.py
Modified:
short/3D/PyLith/trunk/pylith/Makefile.am
short/3D/PyLith/trunk/pylith/bc/AbsorbingDampers.py
short/3D/PyLith/trunk/pylith/bc/DirichletBoundary.py
short/3D/PyLith/trunk/pylith/bc/DirichletPoints.py
short/3D/PyLith/trunk/pylith/bc/Neumann.py
short/3D/PyLith/trunk/pylith/bc/__init__.py
short/3D/PyLith/trunk/pylith/faults/BruneSlipFn.py
short/3D/PyLith/trunk/pylith/faults/EqKinSrc.py
short/3D/PyLith/trunk/pylith/faults/Fault.py
short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py
short/3D/PyLith/trunk/pylith/faults/SlipTimeFn.py
short/3D/PyLith/trunk/pylith/feassemble/Constraint.py
short/3D/PyLith/trunk/pylith/feassemble/Integrator.py
short/3D/PyLith/trunk/pylith/materials/ElasticIsotropic3D.py
short/3D/PyLith/trunk/pylith/materials/ElasticPlaneStrain.py
short/3D/PyLith/trunk/pylith/materials/ElasticPlaneStress.py
short/3D/PyLith/trunk/pylith/materials/ElasticStrain1D.py
short/3D/PyLith/trunk/pylith/materials/ElasticStress1D.py
short/3D/PyLith/trunk/pylith/materials/GenMaxwellIsotropic3D.py
short/3D/PyLith/trunk/pylith/materials/Material.py
short/3D/PyLith/trunk/pylith/materials/MaxwellIsotropic3D.py
short/3D/PyLith/trunk/pylith/problems/Explicit.py
short/3D/PyLith/trunk/pylith/problems/Formulation.py
short/3D/PyLith/trunk/pylith/problems/Implicit.py
short/3D/PyLith/trunk/pylith/problems/Problem.py
short/3D/PyLith/trunk/pylith/solver/Solver.py
short/3D/PyLith/trunk/pylith/solver/SolverLinear.py
short/3D/PyLith/trunk/pylith/solver/SolverNonlinear.py
Log:
Adding more logging (improved consistency across parent/children classes). Removed some old unused files.
Deleted: short/3D/PyLith/trunk/libsrc/meshio/SolutionIO.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/SolutionIO.cc 2008-02-20 04:30:42 UTC (rev 11189)
+++ short/3D/PyLith/trunk/libsrc/meshio/SolutionIO.cc 2008-02-20 05:47:32 UTC (rev 11190)
@@ -1,42 +0,0 @@
-// -*- C++ -*-
-//
-// ======================================================================
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ======================================================================
-//
-
-#include <portinfo>
-
-#include "SolutionIO.hh" // implementation of class methods
-
-#include "spatialdata/geocoords/CoordSys.hh" // USES CoordSys
-
-// ----------------------------------------------------------------------
-// Constructor
-pylith::meshio::SolutionIO::SolutionIO(void) :
- _cs(0)
-{ // constructor
-} // constructor
-
-// ----------------------------------------------------------------------
-// Destructor
-pylith::meshio::SolutionIO::~SolutionIO(void)
-{ // destructor
- delete _cs; _cs = 0;
-} // destructor
-
-// ----------------------------------------------------------------------
-// Set coordinate system for output.
-void
-pylith::meshio::SolutionIO::coordsys(const spatialdata::geocoords::CoordSys* cs)
-{ // coordsys
- delete _cs; _cs = (0 != cs) ? cs->clone() : 0;
-} // coordsys
-
-
-// End of file
Deleted: short/3D/PyLith/trunk/libsrc/meshio/SolutionIO.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/SolutionIO.hh 2008-02-20 04:30:42 UTC (rev 11189)
+++ short/3D/PyLith/trunk/libsrc/meshio/SolutionIO.hh 2008-02-20 05:47:32 UTC (rev 11190)
@@ -1,122 +0,0 @@
-// -*- C++ -*-
-//
-// ======================================================================
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ======================================================================
-//
-
-/**
- * @file pylith/meshio/SolutionIO.hh
- *
- * @brief Abstract base class for writing finite-element solution to file.
- *
- * :TODO: Replace this implementation with one that extracts data from
- * Sieve and calls virtual functions to write data to file (similar to
- * interface for MeshIO), so that children of SolutionIO don't
- * replicate code. This will also make it easier to implement
- * exporters for various formats (HDF5, OpenDX, etc).
- */
-
-#if !defined(pylith_meshio_solutionio_hh)
-#define pylith_meshio_solutionio_hh
-
-#include "pylith/utils/sievetypes.hh" // USES ALE::Obj, ALE::Mesh, real_section_type
-
-namespace pylith {
- namespace meshio {
- class SolutionIO;
- } // meshio
-} // pylith
-
-namespace spatialdata {
- namespace geocoords {
- class CoordSys; // HOLDSA CoordSys
- } // geocoords
-} // spatialdata
-
-class pylith::meshio::SolutionIO
-{ // SolutionIO
-
-// PUBLIC METHODS ///////////////////////////////////////////////////////
-public :
-
- /// Constructor
- SolutionIO(void);
-
- /// Destructor
- virtual
- ~SolutionIO(void);
-
- /** Set coordinate system for output.
- *
- * @param cs Coordinate system
- */
- void coordsys(const spatialdata::geocoords::CoordSys* cs);
-
- /** Open output files.
- *
- * @param mesh PETSc mesh object
- */
- virtual
- void open(const ALE::Obj<ALE::Mesh>& mesh) = 0;
-
- /// Close output files.
- virtual
- void close(void) = 0;
-
- /** Prepare file for data at a new time step.
- *
- * @param t Time stamp for new data
- * @param mesh PETSc mesh object
- * @param csMesh Coordinate system of mesh geometry
- */
- virtual
- void openTimeStep(const double t,
- const ALE::Obj<ALE::Mesh>& mesh,
- const spatialdata::geocoords::CoordSys* csMesh) = 0;
-
- /// Cleanup after writing data for a time step.
- virtual
- void closeTimeStep(void) = 0;
-
- /** Write field over vertices to file.
- *
- * @param t Time associated with field.
- * @param name Name of field.
- * @param field PETSc field over vertices.
- * @param mesh PETSc mesh object.
- */
- virtual
- void writeVertexField(const double t,
- const char* name,
- const ALE::Obj<real_section_type>& field,
- const ALE::Obj<ALE::Mesh>& mesh) = 0;
-
- /** Write field over cells to file.
- *
- * @param t Time associated with field.
- * @param name Name of field.
- * @param field PETSc field over cells.
- * @param mesh PETSc mesh object.
- */
- virtual
- void writeCellField(const double t,
- const char* name,
- const ALE::Obj<real_section_type>& field,
- const ALE::Obj<ALE::Mesh>& mesh) = 0;
-
-// PROTECTED MEMBERS ////////////////////////////////////////////////////
-public :
-
- spatialdata::geocoords::CoordSys* _cs; ///< Coordinate system for output
-
-}; // SolutionIO
-
-#endif // pylith_meshio_solutionio_hh
-
-// End of file
Deleted: short/3D/PyLith/trunk/libsrc/meshio/SolutionIOVTK.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/SolutionIOVTK.cc 2008-02-20 04:30:42 UTC (rev 11189)
+++ short/3D/PyLith/trunk/libsrc/meshio/SolutionIOVTK.cc 2008-02-20 05:47:32 UTC (rev 11190)
@@ -1,221 +0,0 @@
-// -*- C++ -*-
-//
-// ======================================================================
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ======================================================================
-//
-
-/* For now, we write each time step to a different file, so we throw
- * the whole implementation into writeField().
- */
-
-#include <portinfo>
-
-#include "SolutionIOVTK.hh" // implementation of class methods
-
-#include <petscmesh_viewers.hh> // USES VTKViewer
-#include <assert.h> // USES assert()
-#include <sstream> // USES std::ostringstream
-#include <stdexcept> // USES std::runtime_error
-
-// ----------------------------------------------------------------------
-// Constructor
-pylith::meshio::SolutionIOVTK::SolutionIOVTK(void) :
- _filename("output.vtk"),
- _timeFormat("%f"),
- _viewer(0)
-{ // constructor
-} // constructor
-
-// ----------------------------------------------------------------------
-// Destructor
-pylith::meshio::SolutionIOVTK::~SolutionIOVTK(void)
-{ // destructor
- if (_viewer)
- PetscViewerDestroy(_viewer);
- _viewer = NULL;
-} // destructor
-
-// ----------------------------------------------------------------------
-// Open output files.
-void
-pylith::meshio::SolutionIOVTK::open(const ALE::Obj<ALE::Mesh>& mesh)
-{ // open
-#if 0
- PetscErrorCode err;
-
- err = PetscViewerCreate(mesh->comm(), &_viewer);
- err = PetscViewerSetType(_viewer, PETSC_VIEWER_ASCII);
- err = PetscViewerSetFormat(_viewer, PETSC_VIEWER_ASCII_VTK);
- err = PetscViewerFileSetName(_viewer, _filename.c_str());
- if (err) {
- std::ostringstream msg;
- msg << "Could not open VTK file '" << _filename
- << "' for solution output.\n";
- throw std::runtime_error(msg.str());
- } // if
-
-#endif
-} // open
-
-// ----------------------------------------------------------------------
-// Close output files.
-void
-pylith::meshio::SolutionIOVTK::close(void)
-{ // close
- if
- (_viewer) PetscViewerDestroy(_viewer);
- _viewer = NULL;
-} // close
-
-// ----------------------------------------------------------------------
-// Prepare file for data at a new time step.
-void
-pylith::meshio::SolutionIOVTK::openTimeStep(
- const double t,
- const ALE::Obj<ALE::Mesh>& mesh,
- const spatialdata::geocoords::CoordSys* csMesh)
-{ // openTimeStep
-} // openTimeStep
-
-// ----------------------------------------------------------------------
-// Cleanup after writing data for a time step.
-void
-pylith::meshio::SolutionIOVTK::closeTimeStep(void)
-{ // closeTimeStep
-} // closeTimeStep
-
-// ----------------------------------------------------------------------
-// Write field over vertices to file.
-void
-pylith::meshio::SolutionIOVTK::writeVertexField(
- const double t,
- const char* name,
- const ALE::Obj<real_section_type>& field,
- const ALE::Obj<ALE::Mesh>& mesh)
-{ // writeVertexField
-
- try {
- PetscErrorCode err;
-
- std::ostringstream buffer;
- const int indexExt = _filename.find(".vtk");
- char sbuffer[256];
- sprintf(sbuffer, _timeFormat.c_str(), t);
- std::string timestamp(sbuffer);
-
- const int pos = timestamp.find(".");
- if (pos != timestamp.length())
- timestamp.erase(pos, 1);
- buffer
- << std::string(_filename, 0, indexExt) << "_t" << timestamp << ".vtk";
-
- err = PetscViewerCreate(mesh->comm(), &_viewer);
- err = PetscViewerSetType(_viewer, PETSC_VIEWER_ASCII);
- err = PetscViewerSetFormat(_viewer, PETSC_VIEWER_ASCII_VTK);
- err = PetscViewerFileSetName(_viewer, buffer.str().c_str());
- if (err) {
- std::ostringstream msg;
- msg << "Could not open VTK file '" << buffer.str()
- << "' for solution output.\n";
- throw std::runtime_error(msg.str());
- } // if
-
- err = VTKViewer::writeHeader(_viewer);
- err = VTKViewer::writeVertices(mesh, _viewer);
- err = VTKViewer::writeElements(mesh, _viewer);
-
- buffer.str("");
- buffer << name << "_t" << timestamp;
-
- // Now we are enforcing a 3D solution
- // Perhaps we need to push this argument higher
- err = SectionView_Sieve_Ascii(mesh, field, buffer.str().c_str(), _viewer, 3);
- buffer.str("");
- buffer << name << "_verify_t" << t;
- err = SectionView_Sieve_Ascii(mesh, field, buffer.str().c_str(), _viewer, -4);
- if (mesh->hasRealSection("replacedCells")) {
- err = PetscViewerPushFormat(_viewer, PETSC_VIEWER_ASCII_VTK_CELL);
- err = SectionView_Sieve_Ascii(mesh, mesh->getRealSection("replacedCells"), "replacedCells", _viewer);
- err = PetscViewerPopFormat(_viewer);
- }
- } catch (const std::exception& err) {
- std::ostringstream msg;
- msg << "Error while writing field '" << name << "' at time "
- << t << " to VTK file '" << _filename << "'.\n" << err.what();
- throw std::runtime_error(msg.str());
- } catch (...) {
- std::ostringstream msg;
- msg << "Error while writing field '" << name << "' at time "
- << t << " to VTK file '" << _filename << "'.\n";
- throw std::runtime_error(msg.str());
- } // try/catch
-} // writeVertexField
-
-// ----------------------------------------------------------------------
-// Write field over cells to file.
-void
-pylith::meshio::SolutionIOVTK::writeCellField(
- const double t,
- const char* name,
- const ALE::Obj<real_section_type>& field,
- const ALE::Obj<ALE::Mesh>& mesh)
-{ // writeVertexField
-
- try {
- PetscErrorCode err;
-
- std::ostringstream buffer;
- const int indexExt = _filename.find(".vtk");
- char timestamp[256];
- sprintf(timestamp, _timeFormat.c_str(), t);
- buffer
- << std::string(_filename, 0, indexExt) << "_t" << timestamp << ".vtk";
-
- err = PetscViewerCreate(mesh->comm(), &_viewer);
- err = PetscViewerSetType(_viewer, PETSC_VIEWER_ASCII);
- err = PetscViewerSetFormat(_viewer, PETSC_VIEWER_ASCII_VTK);
- err = PetscViewerFileSetName(_viewer, buffer.str().c_str());
- if (err) {
- std::ostringstream msg;
- msg << "Could not open VTK file '" << buffer.str()
- << "' for solution output.\n";
- throw std::runtime_error(msg.str());
- } // if
-
- err = VTKViewer::writeHeader(_viewer);
- err = VTKViewer::writeVertices(mesh, _viewer);
- err = VTKViewer::writeElements(mesh, _viewer);
-
- buffer.str("");
- buffer << name << "_t" << timestamp;
-
- err = PetscViewerPushFormat(_viewer, PETSC_VIEWER_ASCII_VTK_CELL);
-
- // Get fiber dimension of first cell
- const ALE::Obj<Mesh::label_sequence>& cells = mesh->heightStratum(0);
- const int fiberDim = field->getFiberDimension(*cells->begin());
- err = SectionView_Sieve_Ascii(mesh, field, buffer.str().c_str(), _viewer, fiberDim);
- buffer.str("");
- buffer << name << "_verify_t" << t;
- err = SectionView_Sieve_Ascii(mesh, field, buffer.str().c_str(), _viewer, -4);
- } catch (const std::exception& err) {
- std::ostringstream msg;
- msg << "Error while writing field '" << name << "' at time "
- << t << " to VTK file '" << _filename << "'.\n" << err.what();
- throw std::runtime_error(msg.str());
- } catch (...) {
- std::ostringstream msg;
- msg << "Error while writing field '" << name << "' at time "
- << t << " to VTK file '" << _filename << "'.\n";
- throw std::runtime_error(msg.str());
- } // try/catch
-} // writeCellField
-
-
-// End of file
Deleted: short/3D/PyLith/trunk/libsrc/meshio/SolutionIOVTK.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/SolutionIOVTK.hh 2008-02-20 04:30:42 UTC (rev 11189)
+++ short/3D/PyLith/trunk/libsrc/meshio/SolutionIOVTK.hh 2008-02-20 05:47:32 UTC (rev 11190)
@@ -1,122 +0,0 @@
-// -*- C++ -*-
-//
-// ======================================================================
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ======================================================================
-//
-
-#if !defined(pylith_solutionio_solutioniovtk_hh)
-#define pylith_solutionio_solutioniovtk_hh
-
-#include "SolutionIO.hh" // ISA SolutionIO
-
-#include <iosfwd> // HOLDSA std::ofstream
-
-namespace pylith {
- namespace meshio {
- class SolutionIOVTK;
- } // meshio
-} // pylith
-
-class pylith::meshio::SolutionIOVTK : public SolutionIO
-{ // SolutionIOVTK
-
-// PUBLIC METHODS ///////////////////////////////////////////////////////
-public :
-
- /// Constructor
- SolutionIOVTK(void);
-
- /// Destructor
- ~SolutionIOVTK(void);
-
- /** Set filename for VTK file.
- *
- * @param filename Name of VTK file.
- */
- void filename(const char* filename);
-
- /** Get filename of VTK file.
- *
- * @returns filename Name of VTK file.
- */
- const char* filename(void) const;
-
- /** Set time format for time stamp in name of VTK file.
- *
- * @param format C style time format for filename.
- */
- void timeFormat(const char* format);
-
- /** Get time format for time stamp in name of VTK file.
- *
- * @returns C Style time format for filename.
- */
- const char* timeFormat(void) const;
-
- /** Open output files.
- *
- * @param mesh PETSc mesh object
- */
- void open(const ALE::Obj<ALE::Mesh>& mesh);
-
- /// Close output files.
- void close(void);
-
- /** Prepare file for data at a new time step.
- *
- * @param t Time stamp for new data
- * @param mesh PETSc mesh object
- * @param csMesh Coordinate system of mesh geometry
- */
- void openTimeStep(const double t,
- const ALE::Obj<ALE::Mesh>& mesh,
- const spatialdata::geocoords::CoordSys* csMesh);
-
- /// Cleanup after writing data for a time step.
- void closeTimeStep(void);
-
- /** Write field over vertices to file.
- *
- * @param t Time associated with field.
- * @param name Name of field.
- * @param field PETSc field over vertices.
- * @param mesh PETSc mesh object.
- */
- void writeVertexField(const double t,
- const char* name,
- const ALE::Obj<real_section_type>& field,
- const ALE::Obj<ALE::Mesh>& mesh);
-
- /** Write field over cells to file.
- *
- * @param t Time associated with field.
- * @param name Name of field.
- * @param field PETSc field over cells.
- * @param mesh PETSc mesh object.
- */
- void writeCellField(const double t,
- const char* name,
- const ALE::Obj<real_section_type>& field,
- const ALE::Obj<ALE::Mesh>& mesh);
-
-// PRIVATE MEMBERS //////////////////////////////////////////////////////
-public :
-
- std::string _filename; ///< Name of VTK file.
- std::string _timeFormat; ///< C style time format for time stamp.
-
- PetscViewer _viewer; ///< Output file
-
-}; // SolutionIOVTK
-
-#include "SolutionIOVTK.icc" // inline methods
-
-#endif // pylith_solutionio_solutioniovtk_hh
-
-// End of file
Deleted: short/3D/PyLith/trunk/libsrc/meshio/SolutionIOVTK.icc
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/SolutionIOVTK.icc 2008-02-20 04:30:42 UTC (rev 11189)
+++ short/3D/PyLith/trunk/libsrc/meshio/SolutionIOVTK.icc 2008-02-20 05:47:32 UTC (rev 11190)
@@ -1,47 +0,0 @@
-// -*- C++ -*-
-//
-// ======================================================================
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ======================================================================
-//
-
-#if !defined(pylith_meshio_solutionio_hh)
-#error "SolutionIOVTK.icc must be included only from SolutionIOVTK.hh"
-#else
-
-// Set filename for VTK file.
-inline
-void
-pylith::meshio::SolutionIOVTK::filename(const char* filename) {
- _filename = filename;
-}
-
-// Get filename of VTK file.
-inline
-const char*
-pylith::meshio::SolutionIOVTK::filename(void) const {
- return _filename.c_str();
-}
-
-// Set time format for time stamp in name of VTK file.
-inline
-void
-pylith::meshio::SolutionIOVTK::timeFormat(const char* format) {
- _timeFormat = format;
-}
-
-// Get time format for time stamp in name of VTK file.
-inline
-const char*
-pylith::meshio::SolutionIOVTK::timeFormat(void) const {
- return _timeFormat.c_str();
-}
-
-#endif
-
-// End of file
Modified: short/3D/PyLith/trunk/pylith/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/pylith/Makefile.am 2008-02-20 04:30:42 UTC (rev 11189)
+++ short/3D/PyLith/trunk/pylith/Makefile.am 2008-02-20 05:47:32 UTC (rev 11190)
@@ -15,7 +15,6 @@
__init__.py \
bc/__init__.py \
bc/AbsorbingDampers.py \
- bc/BCIntegrator.py \
bc/BoundaryCondition.py \
bc/DirichletPoints.py \
bc/DirichletBoundary.py \
Modified: short/3D/PyLith/trunk/pylith/bc/AbsorbingDampers.py
===================================================================
--- short/3D/PyLith/trunk/pylith/bc/AbsorbingDampers.py 2008-02-20 04:30:42 UTC (rev 11189)
+++ short/3D/PyLith/trunk/pylith/bc/AbsorbingDampers.py 2008-02-20 05:47:32 UTC (rev 11190)
@@ -78,6 +78,9 @@
"""
Verify compatibility of configuration.
"""
+ logEvent = "%sverify" % self._loggingPrefix
+ self._logger.eventBegin(logEvent)
+
BoundaryCondition.verifyConfiguration(self)
Integrator.verifyConfiguration(self)
if self.quadrature.cellDim != self.mesh.dimension()-1:
@@ -87,6 +90,8 @@
"Dimension of mesh boundary '%s': %d" % \
(self.quadrature.cellDim,
self.label, self.mesh.dimension()-1)
+
+ self._logger.eventEnd(logEvent)
return
Deleted: short/3D/PyLith/trunk/pylith/bc/BCIntegrator.py
===================================================================
--- short/3D/PyLith/trunk/pylith/bc/BCIntegrator.py 2008-02-20 04:30:42 UTC (rev 11189)
+++ short/3D/PyLith/trunk/pylith/bc/BCIntegrator.py 2008-02-20 05:47:32 UTC (rev 11190)
@@ -1,100 +0,0 @@
-#!/usr/bin/env python
-#
-# ----------------------------------------------------------------------
-#
-# Brad T. Aagaard
-# U.S. Geological Survey
-#
-# <LicenseText>
-#
-# ----------------------------------------------------------------------
-#
-
-## @file pylith/bc/BCIntegrator.py
-##
-## @brief Python abstract base class for managing a boundary condition
-## that requires integration.
-##
-## This implementation of a boundary condition applies to a single
-## face of a domain and associates both a quadrature scheme with a
-## physical boundary condition. Thus, applying different quadrature
-## schemes along a face with the same physical boundary condition
-## requires two boundary condition integrators, which can use the same
-## database.
-##
-## Factory: boundary_condition
-
-from BoundaryCondition import BoundaryCondition
-from pylith.feassemble.Integrator import Integrator
-
-# BCIntegrator class
-class BCIntegrator(BoundaryCondition, Integrator):
- """
- Python abstract base class for managing a boundary condition that
- requires integration.
-
- This implementation of a boundary condition applies to a single face
- of a domain and associates both a quadrature scheme with a physical
- boundary condition. Thus, applying different quadrature schemes
- along a face with the same physical boundary condition requires two
- boundary condition integrators, which can use the same database.
-
- Factory: boundary_condition
- """
-
- # INVENTORY //////////////////////////////////////////////////////////
-
- class Inventory(BoundaryCondition.Inventory):
- """
- Python object for managing BCIntegrator facilities and properties.
- """
-
- ## @class Inventory
- ## Python object for managing BCIntegrator facilities and properties.
- ##
- ## \b Properties
- ## @li None
- ##
- ## \b Facilities
- ## @li \b quadrature Quadrature object for numerical integration
-
- import pyre.inventory
-
- from pylith.feassemble.quadrature.Quadrature import Quadrature
- quadrature = pyre.inventory.facility("quadrature", factory=Quadrature)
- quadrature.meta['tip'] = "Quadrature object for numerical integration."
-
-
- # PUBLIC METHODS /////////////////////////////////////////////////////
-
- def __init__(self, name="bcintegrator"):
- """
- Constructor.
- """
- BoundaryCondition.__init__(self, name)
- Integrator.__init__(self)
- return
-
-
- def initialize(self, mesh):
- """
- Initialize boundary condition.
- """
- assert(None != self.cppHandle)
- Integrator.initQuadrature(self, self.quadrature)
- BoundaryCondition.initialize(self, mesh)
- return
-
-
- # PRIVATE METHODS ////////////////////////////////////////////////////
-
- def _configure(self):
- """
- Setup members using inventory.
- """
- BoundaryCondition._configure(self)
- self.quadrature = self.inventory.quadrature
- return
-
-
-# End of file
Modified: short/3D/PyLith/trunk/pylith/bc/DirichletBoundary.py
===================================================================
--- short/3D/PyLith/trunk/pylith/bc/DirichletBoundary.py 2008-02-20 04:30:42 UTC (rev 11189)
+++ short/3D/PyLith/trunk/pylith/bc/DirichletBoundary.py 2008-02-20 05:47:32 UTC (rev 11190)
@@ -125,9 +125,14 @@
"""
Verify compatibility of configuration.
"""
+ logEvent = "%sverify" % self._loggingPrefix
+ self._logger.eventBegin(logEvent)
+
BoundaryCondition.verifyConfiguration(self)
Constraint.verifyConfiguration(self)
self.output.verifyConfiguration()
+
+ self._logger.eventEnd(logEvent)
return
Modified: short/3D/PyLith/trunk/pylith/bc/DirichletPoints.py
===================================================================
--- short/3D/PyLith/trunk/pylith/bc/DirichletPoints.py 2008-02-20 04:30:42 UTC (rev 11189)
+++ short/3D/PyLith/trunk/pylith/bc/DirichletPoints.py 2008-02-20 05:47:32 UTC (rev 11190)
@@ -111,8 +111,13 @@
"""
Verify compatibility of configuration.
"""
+ logEvent = "%sverify" % self._loggingPrefix
+ self._logger.eventBegin(logEvent)
+
BoundaryCondition.verifyConfiguration(self)
Constraint.verifyConfiguration(self)
+
+ self._logger.eventEnd(logEvent)
return
Modified: short/3D/PyLith/trunk/pylith/bc/Neumann.py
===================================================================
--- short/3D/PyLith/trunk/pylith/bc/Neumann.py 2008-02-20 04:30:42 UTC (rev 11189)
+++ short/3D/PyLith/trunk/pylith/bc/Neumann.py 2008-02-20 05:47:32 UTC (rev 11190)
@@ -90,6 +90,9 @@
"""
Verify compatibility of configuration.
"""
+ logEvent = "%sverify" % self._loggingPrefix
+ self._logger.eventBegin(logEvent)
+
BoundaryCondition.verifyConfiguration(self)
Integrator.verifyConfiguration(self)
if self.quadrature.cellDim != self.mesh.dimension()-1:
@@ -100,6 +103,8 @@
(self.quadrature.cellDim,
self.label, self.mesh.dimension()-1)
self.output.verifyConfiguration()
+
+ self._logger.eventEnd(logEvent)
return
Modified: short/3D/PyLith/trunk/pylith/bc/__init__.py
===================================================================
--- short/3D/PyLith/trunk/pylith/bc/__init__.py 2008-02-20 04:30:42 UTC (rev 11189)
+++ short/3D/PyLith/trunk/pylith/bc/__init__.py 2008-02-20 05:47:32 UTC (rev 11190)
@@ -20,7 +20,6 @@
'BCSixSides',
'BCTwoSides',
'BoundaryCondition',
- 'BCIntegrator',
'DirichletPoints']
Modified: short/3D/PyLith/trunk/pylith/faults/BruneSlipFn.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/BruneSlipFn.py 2008-02-20 04:30:42 UTC (rev 11189)
+++ short/3D/PyLith/trunk/pylith/faults/BruneSlipFn.py 2008-02-20 05:47:32 UTC (rev 11190)
@@ -70,22 +70,17 @@
Constructor.
"""
SlipTimeFn.__init__(self, name)
+ self._loggingPrefix = "BrSF "
return
- def preinitialize(self):
- """
- Do pre-initialization setup.
- """
- self._createCppHandle()
- SlipTimeFn.preinitialize(self)
- return
-
-
def initialize(self):
"""
Initialize.
"""
+ logEvent = "%sinit" % self._loggingPrefix
+ self._logger.eventBegin(logEvent)
+
self.slip.initialize()
self.slipTime.initialize()
self.slipRate.initialize()
@@ -94,6 +89,8 @@
self.cppHandle.dbFinalSlip = self.slip.cppHandle
self.cppHandle.dbSlipTime = self.slipTime.cppHandle
self.cppHandle.dbPeakRate = self.slipRate.cppHandle
+
+ self._logger.eventEnd(logEvent)
return
Modified: short/3D/PyLith/trunk/pylith/faults/EqKinSrc.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/EqKinSrc.py 2008-02-20 04:30:42 UTC (rev 11189)
+++ short/3D/PyLith/trunk/pylith/faults/EqKinSrc.py 2008-02-20 05:47:32 UTC (rev 11190)
@@ -63,6 +63,7 @@
"""
Component.__init__(self, name, facility="eqkinsrc")
self.cppHandle = None
+ self._loggingPrefix = "EqKi "
return
@@ -70,6 +71,7 @@
"""
Do pre-initialization setup.
"""
+ self._setupLogging()
self._createCppHandle()
self.slipfn.preinitialize()
self.cppHandle.slipfn = self.slipfn.cppHandle
@@ -80,7 +82,12 @@
"""
Verify compatibility of configuration.
"""
+ logEvent = "%sverify" % self._loggingPrefix
+ self._logger.eventBegin(logEvent)
+
self.slipfn.verifyConfiguration()
+
+ self._logger.eventEnd(logEvent)
return
@@ -88,7 +95,12 @@
"""
Initialize.
"""
+ logEvent = "%sinit" % self._loggingPrefix
+ self._logger.eventBegin(logEvent)
+
self.slipfn.initialize()
+
+ self._logger.eventEnd(logEvent)
return
@@ -113,6 +125,27 @@
return
+ def _setupLogging(self):
+ """
+ Setup event logging.
+ """
+ if not "_loggingPrefix" in dir(self):
+ self._loggingPrefix = ""
+
+ from pylith.utils.EventLogger import EventLogger
+ logger = EventLogger()
+ logger.setClassName("FE Constraint")
+ logger.initialize()
+
+ events = ["verify",
+ "init"]
+ for event in events:
+ logger.registerEvent("%s%s" % (self._loggingPrefix, event))
+
+ self._logger = logger
+ return
+
+
# FACTORIES ////////////////////////////////////////////////////////////
def eq_kinematic_src():
Modified: short/3D/PyLith/trunk/pylith/faults/Fault.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/Fault.py 2008-02-20 04:30:42 UTC (rev 11189)
+++ short/3D/PyLith/trunk/pylith/faults/Fault.py 2008-02-20 05:47:32 UTC (rev 11190)
@@ -156,6 +156,9 @@
"""
Verify compatibility of configuration.
"""
+ logEvent = "%sverify" % self._loggingPrefix
+ self._logger.eventBegin(logEvent)
+
faultDim = self.mesh.dimension() - 1
if faultDim != self.quadrature.cell.cellDim:
raise ValueError, \
@@ -168,6 +171,7 @@
if None != self.output:
self.output.verifyConfiguration()
+ self._logger.eventEnd(logEvent)
return
@@ -175,6 +179,9 @@
"""
Initialize fault.
"""
+ logEvent = "%sinit" % self._loggingPrefix
+ self._logger.eventBegin(logEvent)
+
self.quadrature.initialize()
self.matDB.initialize()
@@ -193,6 +200,7 @@
self.output.writeInfo()
self.output.open(totalTime, numTimeSteps)
+ self._logger.eventEnd(logEvent)
return
@@ -200,8 +208,13 @@
"""
Hook for doing stuff after advancing time step.
"""
+ logEvent = "%spoststep" % self._loggingPrefix
+ self._logger.eventBegin(logEvent)
+
self._info.log("Writing fault data.")
self.output.writeData(t+dt, fields)
+
+ self._logger.eventEnd(logEvent)
return
Modified: short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py 2008-02-20 04:30:42 UTC (rev 11189)
+++ short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py 2008-02-20 05:47:32 UTC (rev 11190)
@@ -106,8 +106,13 @@
"""
Verify compatibility of configuration.
"""
+ logEvent = "%sverify" % self._loggingPrefix
+ self._logger.eventBegin(logEvent)
+
FaultCohesive.verifyConfiguration(self)
Integrator.verifyConfiguration(self)
+
+ self._logger.eventEnd(logEvent)
return
Modified: short/3D/PyLith/trunk/pylith/faults/SlipTimeFn.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/SlipTimeFn.py 2008-02-20 04:30:42 UTC (rev 11189)
+++ short/3D/PyLith/trunk/pylith/faults/SlipTimeFn.py 2008-02-20 05:47:32 UTC (rev 11190)
@@ -42,6 +42,8 @@
"""
Do pre-initialization setup.
"""
+ self._setupLogging()
+ self._createCppHandle()
return
@@ -49,6 +51,10 @@
"""
Verify compatibility of configuration.
"""
+ logEvent = "%sverify" % self._loggingPrefix
+ self._logger.eventBegin(logEvent)
+
+ self._logger.eventEnd(logEvent)
return
@@ -56,6 +62,10 @@
"""
Initialize.
"""
+ logEvent = "%sinit" % self._loggingPrefix
+ self._logger.eventBegin(logEvent)
+
+ self._logger.eventEnd(logEvent)
return
@@ -69,4 +79,33 @@
return
+ def _createCppHandle(self):
+ """
+ Create handle to C++ object.
+ """
+ raise NotImplementedError("Please implement _createCppHandle().")
+ return
+
+
+ def _setupLogging(self):
+ """
+ Setup event logging.
+ """
+ if not "_loggingPrefix" in dir(self):
+ self._loggingPrefix = ""
+
+ from pylith.utils.EventLogger import EventLogger
+ logger = EventLogger()
+ logger.setClassName("FE Constraint")
+ logger.initialize()
+
+ events = ["verify",
+ "init"]
+ for event in events:
+ logger.registerEvent("%s%s" % (self._loggingPrefix, event))
+
+ self._logger = logger
+ return
+
+
# End of file
Modified: short/3D/PyLith/trunk/pylith/feassemble/Constraint.py
===================================================================
--- short/3D/PyLith/trunk/pylith/feassemble/Constraint.py 2008-02-20 04:30:42 UTC (rev 11189)
+++ short/3D/PyLith/trunk/pylith/feassemble/Constraint.py 2008-02-20 05:47:32 UTC (rev 11190)
@@ -73,6 +73,10 @@
"""
Verify compatibility of configuration.
"""
+ logEvent = "%sverify" % self._loggingPrefix
+ self._logger.eventBegin(logEvent)
+
+ self._logger.eventEnd(logEvent)
return
@@ -80,6 +84,10 @@
"""
Do initialization.
"""
+ logEvent = "%sinit" % self._loggingPrefix
+ self._logger.eventBegin(logEvent)
+
+ self._logger.eventEnd(logEvent)
return
@@ -97,10 +105,11 @@
Set constraint sizes in field.
"""
logEvent = "%ssetSizes" % self._loggingPrefix
+ self._logger.eventBegin(logEvent)
assert(None != self.cppHandle)
- self._logger.eventBegin(logEvent)
self.cppHandle.setConstraintSizes(field, self.mesh.cppHandle)
+
self._logger.eventEnd(logEvent)
return
@@ -110,10 +119,11 @@
Set constraints for field.
"""
logEvent = "%sconstraints" % self._loggingPrefix
+ self._logger.eventBegin(logEvent)
assert(None != self.cppHandle)
- self._logger.eventBegin(logEvent)
self.cppHandle.setConstraints(field, self.mesh.cppHandle)
+
self._logger.eventEnd(logEvent)
return
@@ -122,8 +132,13 @@
"""
Set behavior for using total field solution or incremental field solution.
"""
+ logEvent = "%ssolnIncr" % self._loggingPrefix
+ self._logger.eventBegin(logEvent)
+
assert(None != self.cppHandle)
self.cppHandle.useSolnIncr = flag
+
+ self._logger.eventEnd(logEvent)
return
@@ -145,6 +160,10 @@
"""
Hook for doing stuff after advancing time step.
"""
+ logEvent = "%spoststep" % self._loggingPrefix
+ self._logger.eventBegin(logEvent)
+
+ self._logger.eventEnd(logEvent)
return
@@ -152,6 +171,10 @@
"""
Cleanup after time stepping.
"""
+ logEvent = "%sfinalize" % self._loggingPrefix
+ self._logger.eventBegin(logEvent)
+
+ self._logger.eventEnd(logEvent)
return
@@ -171,6 +194,7 @@
events = ["verify",
"init",
+ "solnIncr",
"setSizes",
"constraints",
"setField",
Modified: short/3D/PyLith/trunk/pylith/feassemble/Integrator.py
===================================================================
--- short/3D/PyLith/trunk/pylith/feassemble/Integrator.py 2008-02-20 04:30:42 UTC (rev 11189)
+++ short/3D/PyLith/trunk/pylith/feassemble/Integrator.py 2008-02-20 05:47:32 UTC (rev 11190)
@@ -86,6 +86,10 @@
"""
Do initialization.
"""
+ logEvent = "%sinit" % self._loggingPrefix
+ self._logger.eventBegin(logEvent)
+
+ self._logger.eventEnd(logEvent)
return
@@ -117,8 +121,13 @@
"""
Set behavior for using total field solution or incremental field solution.
"""
+ logEvent = "%ssolnIncr" % self._loggingPrefix
+ self._logger.eventBegin(logEvent)
+
assert(None != self.cppHandle)
self.cppHandle.useSolnIncr = flag
+
+ self._logger.eventEnd(logEvent)
return
@@ -202,6 +211,7 @@
events = ["verify",
"init",
"timestep",
+ "solnIncr",
"residual",
"newJacobian",
"jacobian",
Modified: short/3D/PyLith/trunk/pylith/materials/ElasticIsotropic3D.py
===================================================================
--- short/3D/PyLith/trunk/pylith/materials/ElasticIsotropic3D.py 2008-02-20 04:30:42 UTC (rev 11189)
+++ short/3D/PyLith/trunk/pylith/materials/ElasticIsotropic3D.py 2008-02-20 05:47:32 UTC (rev 11190)
@@ -40,6 +40,7 @@
'cell': \
{'info': ["mu", "lambda", "density"],
'data': ["total-strain", "stress"]}}
+ self._loggingPrefix = "MaEl3D "
return
Modified: short/3D/PyLith/trunk/pylith/materials/ElasticPlaneStrain.py
===================================================================
--- short/3D/PyLith/trunk/pylith/materials/ElasticPlaneStrain.py 2008-02-20 04:30:42 UTC (rev 11189)
+++ short/3D/PyLith/trunk/pylith/materials/ElasticPlaneStrain.py 2008-02-20 05:47:32 UTC (rev 11190)
@@ -42,6 +42,7 @@
'cell': \
{'info': ["mu", "lambda", "density"],
'data': ["total-strain", "stress"]}}
+ self._loggingPrefix = "MaPlSn "
return
Modified: short/3D/PyLith/trunk/pylith/materials/ElasticPlaneStress.py
===================================================================
--- short/3D/PyLith/trunk/pylith/materials/ElasticPlaneStress.py 2008-02-20 04:30:42 UTC (rev 11189)
+++ short/3D/PyLith/trunk/pylith/materials/ElasticPlaneStress.py 2008-02-20 05:47:32 UTC (rev 11190)
@@ -42,6 +42,7 @@
'cell': \
{'info': ["mu", "lambda", "density"],
'data': ["total-strain", "stress"]}}
+ self._loggingPrefix = "MaPlSt "
return
Modified: short/3D/PyLith/trunk/pylith/materials/ElasticStrain1D.py
===================================================================
--- short/3D/PyLith/trunk/pylith/materials/ElasticStrain1D.py 2008-02-20 04:30:42 UTC (rev 11189)
+++ short/3D/PyLith/trunk/pylith/materials/ElasticStrain1D.py 2008-02-20 05:47:32 UTC (rev 11190)
@@ -41,6 +41,7 @@
'cell': \
{'info': ["mu", "lambda", "density"],
'data': ["total-strain", "stress"]}}
+ self._loggingPrefix = "MaSt1D "
return
Modified: short/3D/PyLith/trunk/pylith/materials/ElasticStress1D.py
===================================================================
--- short/3D/PyLith/trunk/pylith/materials/ElasticStress1D.py 2008-02-20 04:30:42 UTC (rev 11189)
+++ short/3D/PyLith/trunk/pylith/materials/ElasticStress1D.py 2008-02-20 05:47:32 UTC (rev 11190)
@@ -41,6 +41,7 @@
'cell': \
{'info': ["mu", "lambda", "density"],
'data': ["total-strain", "stress"]}}
+ self._loggingPrefix = "MaSn1D "
return
Modified: short/3D/PyLith/trunk/pylith/materials/GenMaxwellIsotropic3D.py
===================================================================
--- short/3D/PyLith/trunk/pylith/materials/GenMaxwellIsotropic3D.py 2008-02-20 04:30:42 UTC (rev 11189)
+++ short/3D/PyLith/trunk/pylith/materials/GenMaxwellIsotropic3D.py 2008-02-20 05:47:32 UTC (rev 11190)
@@ -40,6 +40,7 @@
'cell': \
{'info': ["mu", "lambda", "density", "shear-ratio", "Maxwell-time"],
'data': ["total-strain", "viscous-strain", "stress"]}}
+ self._loggingPrefix = "MaGM3D "
return
Modified: short/3D/PyLith/trunk/pylith/materials/Material.py
===================================================================
--- short/3D/PyLith/trunk/pylith/materials/Material.py 2008-02-20 04:30:42 UTC (rev 11189)
+++ short/3D/PyLith/trunk/pylith/materials/Material.py 2008-02-20 05:47:32 UTC (rev 11190)
@@ -95,6 +95,7 @@
self.cppHandle.id = self.id
self.cppHandle.label = self.label
self.quadrature.preinitialize()
+ self._setupLogging()
return
@@ -102,6 +103,9 @@
"""
Verify compatibility of configuration.
"""
+ logEvent = "%sverify" % self._loggingPrefix
+ self._logger.eventBegin(logEvent)
+
if self.quadrature.spaceDim != self.dimension:
raise ValueError, \
"Quadrature scheme and material are incompatible.\n" \
@@ -113,6 +117,7 @@
# fact that any given processor may only have a subset of the
# materials)
+ self._logger.eventEnd(logEvent)
return
@@ -120,6 +125,9 @@
"""
Initialize material property manager.
"""
+ logEvent = "%sinit" % self._loggingPrefix
+ self._logger.eventBegin(logEvent)
+
self._info.log("Initializing material '%s'." % self.label)
self.mesh = mesh
assert(None != self.cppHandle)
@@ -128,6 +136,7 @@
self.cppHandle.initialize(mesh.cppHandle, mesh.coordsys.cppHandle,
self.quadrature.cppHandle)
+ self._logger.eventEnd(logEvent)
return
@@ -160,4 +169,25 @@
"derived class.")
+ def _setupLogging(self):
+ """
+ Setup event logging.
+ """
+ if None == self._loggingPrefix:
+ self._loggingPrefix = ""
+
+ from pylith.utils.EventLogger import EventLogger
+ logger = EventLogger()
+ logger.setClassName("FE Material")
+ logger.initialize()
+
+ events = ["verify",
+ "init"]
+ for event in events:
+ logger.registerEvent("%s%s" % (self._loggingPrefix, event))
+
+ self._logger = logger
+ return
+
+
# End of file
Modified: short/3D/PyLith/trunk/pylith/materials/MaxwellIsotropic3D.py
===================================================================
--- short/3D/PyLith/trunk/pylith/materials/MaxwellIsotropic3D.py 2008-02-20 04:30:42 UTC (rev 11189)
+++ short/3D/PyLith/trunk/pylith/materials/MaxwellIsotropic3D.py 2008-02-20 05:47:32 UTC (rev 11190)
@@ -40,6 +40,7 @@
'cell': \
{'info': ["mu", "lambda", "density", "Maxwell-time"],
'data': ["total-strain", "viscous-strain", "stress"]}}
+ self._loggingPrefix = "MaMx3D "
return
Deleted: short/3D/PyLith/trunk/pylith/meshio/SolutionIO.py
===================================================================
--- short/3D/PyLith/trunk/pylith/meshio/SolutionIO.py 2008-02-20 04:30:42 UTC (rev 11189)
+++ short/3D/PyLith/trunk/pylith/meshio/SolutionIO.py 2008-02-20 05:47:32 UTC (rev 11190)
@@ -1,275 +0,0 @@
-#!/usr/bin/env python
-#
-# ----------------------------------------------------------------------
-#
-# Brad T. Aagaard
-# U.S. Geological Survey
-#
-# <LicenseText>
-#
-# ----------------------------------------------------------------------
-#
-
-## @file pyre/meshio/SolutionIO.py
-##
-## @brief Python abstract base class for I/O of the finite-element
-## solution.
-##
-## Factory: solution_io
-
-from pyre.components.Component import Component
-
-# SolutionIO class
-class SolutionIO(Component):
- """
- Python abstract base class for finite-element mesh I/O.
- """
-
- # INVENTORY //////////////////////////////////////////////////////////
-
- class Inventory(Component.Inventory):
- """
- Python object for managing SolutionIOVTK facilities and properties.
- """
-
- ## @class Inventory
- ## Python object for managing SolutionIOVTK facilities and properties.
- ##
- ## \b Properties
- ## @li \b output_freq Flag indicating whether to use 'time_step' or 'skip'
- ## to set frequency of solution output.
- ## @li \b time_step Time step between solution output.
- ## @li \b skip Number of time steps to skip between solution output.
- ##
- ## \b Facilities
- ## @li \b coordsys Coordinate system for output.
-
- import pyre.inventory
-
- outputFreq = pyre.inventory.str("output_freq", default="skip",
- validator=pyre.inventory.choice(["skip", "time_step"]))
- outputFreq.meta['tip'] = "Flag indicating whether to use 'time_step' " \
- "or 'skip' to set frequency of solution output."
-
- from pyre.units.time import s
- dt = pyre.inventory.dimensional("time_step", default=1.0*s)
- dt.meta['tip'] = "Time step between solution output."
-
- skip = pyre.inventory.int("skip", default=0,
- validator=pyre.inventory.greaterEqual(0))
- skip.meta['tip'] = "Number of time steps to skip between solution output."
-
- from spatialdata.geocoords.CSCart import CSCart
- coordsys = pyre.inventory.facility("coordsys", family="coordsys",
- factory=CSCart)
- coordsys.meta['tip'] = "Coordinate system for output."
-
-
- # PUBLIC METHODS /////////////////////////////////////////////////////
-
- def __init__(self, name="solutionio"):
- """
- Constructor.
- """
- Component.__init__(self, name, facility="solution_io")
- self.cppHandle = None
- self.coordsys = None
- self.mesh = None
- self.t = None
- self.istep = None
- return
-
-
- def verifyConfiguration(self):
- """
- Verify compatibility of configuration.
- """
- return
-
-
- def open(self, mesh):
- """
- Open files for solution.
- """
- self._setupLogging()
- logEvent = "%sopen" % self._loggingPrefix
- self._logger.eventBegin(logEvent)
-
- self._info.log("Opening files for output of solution.")
- self.mesh = mesh
-
- # Set flags
- self._sync()
-
- # Initialize coordinate system
- if self.coordsys is None:
- raise ValueError, "Coordinate system for output is unknown."
- self.coordsys.initialize()
-
- assert(self.cppHandle != None)
- self.cppHandle.open(mesh.cppHandle)
-
- self._logger.eventEnd(logEvent)
- return
-
-
- def close(self):
- """
- Close files for solution.
- """
- logEvent = "%sclose" % self._loggingPrefix
- self._logger.eventBegin(logEvent)
- self._info.log("Closing files for output of solution.")
-
- # Set flags
- self._sync()
-
- assert(self.cppHandle != None)
- self.cppHandle.close()
-
- self._logger.eventEnd(logEvent)
- return
-
-
- def openTimeStep(self, t, istep):
- """
- Prepare for writing solution to file.
- """
- logEvent = "%sopenStep" % self._loggingPrefix
- self._logger.eventBegin(logEvent)
- self._info.log("Preparing for writing solution to file.")
-
- write = False
- if self.istep == None or not "value" in dir(self.t):
- write = True
- elif self.outputFreq == "skip":
- if istep > self.istep + self.skip:
- write = True
- elif t >= self.t + self.dt:
- write = True
- self.writeFlag = write
-
- assert(self.cppHandle != None)
- assert(self.mesh.cppHandle != None)
- assert(self.mesh.coordsys.cppHandle != None)
- self.cppHandle.openTimeStep(t.value,
- self.mesh.cppHandle,
- self.mesh.coordsys.cppHandle)
-
- self._logger.eventEnd(logEvent)
- return
-
-
- def closeTimeStep(self):
- """
- Cleanup after writing solution to file.
- """
- logEvent = "%scloseStep" % self._loggingPrefix
- self._logger.eventBegin(logEvent)
- self._info.log("Cleaning up afterwriting solution to file.")
-
- self.writeFlag = False
- assert(self.cppHandle != None)
- self.cppHandle.closeTimeStep()
-
- self._logger.eventEnd(logEvent)
- return
-
-
- def writeVertexField(self, t, istep, name, field):
- """
- Write field over vertices at time t to file.
- """
- logEvent = "%swriteVertex" % self._loggingPrefix
- self._logger.eventBegin(logEvent)
-
- if self.writeFlag:
- self._info.log("Writing solution field '%s'." % name)
- assert(self.cppHandle != None)
- assert(self.mesh.cppHandle != None)
- self.cppHandle.writeVertexField(t.value, name, field,
- self.mesh.cppHandle)
- self.istep = istep
- self.t = t
-
- self._logger.eventEnd(logEvent)
- return
-
-
- def writeCellField(self, t, istep, name, field):
- """
- Write field over cells at time t to file.
- """
- logEvent = "%swriteCell" % self._loggingPrefix
- self._logger.eventBegin(logEvent)
-
- if self.writeFlag:
- self._info.log("Writing solution field '%s'." % name)
- assert(self.cppHandle != None)
- assert(self.mesh.cppHandle != None)
- self.cppHandle.writeCellField(t.value, name, field,
- self.mesh.cppHandle)
- self.istep = istep
- self.t = t
-
- self._logger.eventEnd(logEvent)
- return
-
-
- # PRIVATE METHODS ////////////////////////////////////////////////////
-
- def _configure(self):
- """
- Set members based using inventory.
- """
- Component._configure(self)
- self.outputFreq = self.inventory.outputFreq
- self.dt = self.inventory.dt
- self.skip = self.inventory.skip
- self.coordsys = self.inventory.coordsys
- return
-
-
- def _sync(self):
- """
- Force synchronization between Python and C++.
- """
- self._createCppHandle()
- self.cppHandle.coordsys = self.coordsys.cppHandle
- return
-
-
- def _createCppHandle(self):
- """
- Create handle to corresponding C++ object.
- """
- raise NotImplementedError("Please implement _createCppHandle() in " \
- "derived class.")
-
-
- def _setupLogging(self):
- """
- Setup event logging.
- """
- if not "_loggingPrefix" in dir(self):
- self._loggingPrefix = ""
-
- from pylith.utils.EventLogger import EventLogger
- logger = EventLogger()
- logger.setClassName("FE Output")
- logger.initialize()
-
- events = ["open",
- "close",
- "openStep",
- "closeStep",
- "writeVertex",
- "writeCell"]
- for event in events:
- logger.registerEvent("%s%s" % (self._loggingPrefix, event))
-
- self._logger = logger
- return
-
-
-# End of file
Deleted: short/3D/PyLith/trunk/pylith/meshio/SolutionIOVTK.py
===================================================================
--- short/3D/PyLith/trunk/pylith/meshio/SolutionIOVTK.py 2008-02-20 04:30:42 UTC (rev 11189)
+++ short/3D/PyLith/trunk/pylith/meshio/SolutionIOVTK.py 2008-02-20 05:47:32 UTC (rev 11190)
@@ -1,108 +0,0 @@
-#!/usr/bin/env python
-#
-# ----------------------------------------------------------------------
-#
-# Brad T. Aagaard
-# U.S. Geological Survey
-#
-# <LicenseText>
-#
-# ----------------------------------------------------------------------
-#
-
-## @file pyre/meshio/SolutionIOVTK.py
-##
-## @brief Python object for writing solution of finite-element problem
-## to VTK file.
-##
-## Factory: solution_io
-
-from SolutionIO import SolutionIO
-
-# SolutionIOVTK class
-class SolutionIOVTK(SolutionIO):
- """
- Python object for writing solution of finite-element problem to VTK file.
-
- Factory: solution_io
- """
-
- # INVENTORY //////////////////////////////////////////////////////////
-
- class Inventory(SolutionIO.Inventory):
- """
- Python object for managing SolutionIOVTK facilities and properties.
- """
-
- ## @class Inventory
- ## Python object for managing SolutionIOVTK facilities and properties.
- ##
- ## \b Properties
- ## @li \b filename Name of mesh file.
- ## @li \b timeFormat C style format string for time stamp in filename.
- ##
- ## \b Facilities
- ## @li None
-
- import pyre.inventory
-
- filename = pyre.inventory.str("filename", default="output.vtk")
- filename.meta['tip'] = "Name of VTK file."
-
- timeFormat = pyre.inventory.str("time_format", default="%f")
- timeFormat.meta['tip'] = "C style format string for time stamp in filename."
-
-
- # PUBLIC METHODS /////////////////////////////////////////////////////
-
- def __init__(self, name="solutioniovtk"):
- """
- Constructor.
- """
- SolutionIO.__init__(self, name)
- self._loggingPrefix = "VTKo "
- return
-
-
- # PRIVATE METHODS ////////////////////////////////////////////////////
-
- def _configure(self):
- """
- Set members based using inventory.
- """
- SolutionIO._configure(self)
- self.filename = self.inventory.filename
- self.timeFormat = self.inventory.timeFormat
- return
-
-
- def _sync(self):
- """
- Force synchronization between Python and C++.
- """
- SolutionIO._sync(self)
- self.cppHandle.filename = self.filename
- self.cppHandle.timeFormat = self.timeFormat
- return
-
-
- def _createCppHandle(self):
- """
- Create handle to corresponding C++ object.
- """
- if None == self.cppHandle:
- import pylith.meshio.meshio as bindings
- self.cppHandle = bindings.SolutionIOVTK()
- return
-
-
-# FACTORIES ////////////////////////////////////////////////////////////
-
-def solution_io():
- """
- Factory associated with SolutionIOVTK.
- """
- return SolutionIOVTK()
-
-
-# End of file
Modified: short/3D/PyLith/trunk/pylith/problems/Explicit.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Explicit.py 2008-02-20 04:30:42 UTC (rev 11189)
+++ short/3D/PyLith/trunk/pylith/problems/Explicit.py 2008-02-20 05:47:32 UTC (rev 11190)
@@ -63,13 +63,13 @@
"""
Initialize problem for explicit time integration.
"""
+ logEvent = "%sinit" % self._loggingPrefix
+ self._logger.eventBegin(logEvent)
+
from pyre.units.time import second
t = 0.0*second
Formulation.initialize(self, dimension, totalTime, dt)
- logEvent = "%sinit" % self._loggingPrefix
- self._logger.eventBegin(logEvent)
-
self._info.log("Creating other fields and matrices.")
self.fields.addReal("dispTpdt")
self.fields.addReal("dispTmdt")
Modified: short/3D/PyLith/trunk/pylith/problems/Formulation.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Formulation.py 2008-02-20 04:30:42 UTC (rev 11189)
+++ short/3D/PyLith/trunk/pylith/problems/Formulation.py 2008-02-20 05:47:32 UTC (rev 11190)
@@ -191,6 +191,10 @@
"""
Hook for doing stuff before advancing time step.
"""
+ logEvent = "%sprestep" % self._loggingPrefix
+ self._logger.eventBegin(logEvent)
+
+ self._logger.eventEnd(logEvent)
return
@@ -198,6 +202,10 @@
"""
Advance to next time step.
"""
+ logEvent = "%sstep" % self._loggingPrefix
+ self._logger.eventBegin(logEvent)
+
+ self._logger.eventEnd(logEvent)
return
Modified: short/3D/PyLith/trunk/pylith/problems/Implicit.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Implicit.py 2008-02-20 04:30:42 UTC (rev 11189)
+++ short/3D/PyLith/trunk/pylith/problems/Implicit.py 2008-02-20 05:47:32 UTC (rev 11190)
@@ -88,11 +88,11 @@
"""
Initialize problem for implicit time integration.
"""
- Formulation.initialize(self, dimension, totalTime, dt)
-
logEvent = "%sinit" % self._loggingPrefix
self._logger.eventBegin(logEvent)
+ Formulation.initialize(self, dimension, totalTime, dt)
+
self._info.log("Creating other fields.")
self._debug.log(resourceUsageString())
self.fields.addReal("dispIncr")
@@ -210,7 +210,6 @@
self._step0 = False
self._logger.eventEnd(logEvent)
-
return
Modified: short/3D/PyLith/trunk/pylith/problems/Problem.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Problem.py 2008-02-20 04:30:42 UTC (rev 11189)
+++ short/3D/PyLith/trunk/pylith/problems/Problem.py 2008-02-20 05:47:32 UTC (rev 11190)
@@ -90,7 +90,9 @@
"""
Verify compatibility of configuration.
"""
-
+ logEvent = "%sverify" % self._loggingPrefix
+ self._logger.eventBegin(logEvent)
+
self._info.log("Verifying compatibility of problem configuration.")
if self.dimension != self.mesh.dimension():
raise ValueError, \
@@ -105,6 +107,7 @@
"for material '%s' is for spatial dimension '%d'." % \
(self.dimension, material.label, material.quadrature.spaceDim)
+ self._logger.eventEnd(logEvent)
return
Modified: short/3D/PyLith/trunk/pylith/solver/Solver.py
===================================================================
--- short/3D/PyLith/trunk/pylith/solver/Solver.py 2008-02-20 04:30:42 UTC (rev 11189)
+++ short/3D/PyLith/trunk/pylith/solver/Solver.py 2008-02-20 05:47:32 UTC (rev 11190)
@@ -79,6 +79,27 @@
return
+ def _setupLogging(self):
+ """
+ Setup event logging.
+ """
+ if not "_loggingPrefix" in dir(self):
+ self._loggingPrefix = ""
+
+ from pylith.utils.EventLogger import EventLogger
+ logger = EventLogger()
+ logger.setClassName("FE Solver")
+ logger.initialize()
+
+ events = ["init",
+ "solve"]
+ for event in events:
+ logger.registerEvent("%s%s" % (self._loggingPrefix, event))
+
+ self._logger = logger
+ return
+
+
# FACTORIES ////////////////////////////////////////////////////////////
def solver():
Modified: short/3D/PyLith/trunk/pylith/solver/SolverLinear.py
===================================================================
--- short/3D/PyLith/trunk/pylith/solver/SolverLinear.py 2008-02-20 04:30:42 UTC (rev 11189)
+++ short/3D/PyLith/trunk/pylith/solver/SolverLinear.py 2008-02-20 05:47:32 UTC (rev 11190)
@@ -48,6 +48,7 @@
Constructor.
"""
Solver.__init__(self, name)
+ self._loggingPrefix = "SoLi "
return
@@ -55,9 +56,15 @@
"""
Initialize solver.
"""
+ self._setupLogging()
+ logEvent = "%sinit" % self._loggingPrefix
+ self._logger.eventBegin(logEvent)
+
self._createCppHandle()
Solver.initialize(self, mesh, field)
self.cppHandle.initialize(mesh.cppHandle, field)
+
+ self._logger.eventEnd(logEvent)
return
@@ -65,9 +72,14 @@
"""
Solve linear system.
"""
+ logEvent = "%ssolve" % self._loggingPrefix
+ self._logger.eventBegin(logEvent)
+
self._info.log("Solving linear equations.")
assert(None != self.cppHandle)
self.cppHandle.solve(fieldOut, jacobian, fieldIn)
+
+ self._logger.eventEnd(logEvent)
return
Modified: short/3D/PyLith/trunk/pylith/solver/SolverNonlinear.py
===================================================================
--- short/3D/PyLith/trunk/pylith/solver/SolverNonlinear.py 2008-02-20 04:30:42 UTC (rev 11189)
+++ short/3D/PyLith/trunk/pylith/solver/SolverNonlinear.py 2008-02-20 05:47:32 UTC (rev 11190)
@@ -48,6 +48,7 @@
Constructor.
"""
Solver.__init__(self, name)
+ self._loggingPrefix = "SoNL "
return
@@ -55,8 +56,14 @@
"""
Initialize solver.
"""
+ self._setupLogging()
+ logEvent = "%sinit" % self._loggingPrefix
+ self._logger.eventBegin(logEvent)
+
self._createCppHandle()
self.cppHandle.initialize(mesh.cppHandle, field)
+
+ self._logger.eventEnd(logEvent)
return
@@ -64,9 +71,14 @@
"""
Solve nonlinear system.
"""
+ logEvent = "%ssolve" % self._loggingPrefix
+ self._logger.eventBegin(logEvent)
+
self._info.log("Solving nonlinear equations.")
assert(None != self.cppHandle)
self.cppHandle.solve(fieldOut, jacobian, fieldIn)
+
+ self._logger.eventEnd(logEvent)
return
More information about the cig-commits
mailing list