[cig-commits] r8311 - in short/3D/PyLith/trunk: . libsrc libsrc/utils modulesrc/utils pylith pylith/utils unittests/libtests unittests/libtests/feassemble unittests/libtests/utils unittests/pytests/utils

brad at geodynamics.org brad at geodynamics.org
Wed Nov 21 10:43:16 PST 2007


Author: brad
Date: 2007-11-21 10:43:15 -0800 (Wed, 21 Nov 2007)
New Revision: 8311

Added:
   short/3D/PyLith/trunk/libsrc/utils/EventLogger.cc
   short/3D/PyLith/trunk/libsrc/utils/EventLogger.hh
   short/3D/PyLith/trunk/libsrc/utils/EventLogger.icc
   short/3D/PyLith/trunk/modulesrc/utils/utils.pyxe.src
   short/3D/PyLith/trunk/pylith/utils/EventLogger.py
   short/3D/PyLith/trunk/unittests/libtests/utils/
   short/3D/PyLith/trunk/unittests/libtests/utils/Makefile.am
   short/3D/PyLith/trunk/unittests/libtests/utils/TestEventLogger.cc
   short/3D/PyLith/trunk/unittests/libtests/utils/TestEventLogger.hh
   short/3D/PyLith/trunk/unittests/libtests/utils/test_utils.cc
   short/3D/PyLith/trunk/unittests/pytests/utils/TestEventLogger.py
   short/3D/PyLith/trunk/unittests/pytests/utils/testmanager.py
   short/3D/PyLith/trunk/unittests/pytests/utils/testutils.py
Removed:
   short/3D/PyLith/trunk/libsrc/utils/PetscLogger.hh
   short/3D/PyLith/trunk/unittests/pytests/utils/testdriver.py
Modified:
   short/3D/PyLith/trunk/configure.ac
   short/3D/PyLith/trunk/libsrc/Makefile.am
   short/3D/PyLith/trunk/libsrc/utils/Makefile.am
   short/3D/PyLith/trunk/modulesrc/utils/Makefile.am
   short/3D/PyLith/trunk/pylith/Makefile.am
   short/3D/PyLith/trunk/unittests/libtests/Makefile.am
   short/3D/PyLith/trunk/unittests/libtests/feassemble/TestIntegrator.cc
   short/3D/PyLith/trunk/unittests/pytests/utils/Makefile.am
Log:
Implemented EventLogger for logging events using PETSc.

Modified: short/3D/PyLith/trunk/configure.ac
===================================================================
--- short/3D/PyLith/trunk/configure.ac	2007-11-21 06:05:28 UTC (rev 8310)
+++ short/3D/PyLith/trunk/configure.ac	2007-11-21 18:43:15 UTC (rev 8311)
@@ -214,8 +214,8 @@
 		libsrc/faults/Makefile
                 libsrc/materials/Makefile
                 libsrc/meshio/Makefile
+		libsrc/topology/Makefile
 		libsrc/utils/Makefile
-		libsrc/topology/Makefile
                 modulesrc/Makefile
                 modulesrc/bc/Makefile
                 modulesrc/faults/Makefile
@@ -240,6 +240,7 @@
 		unittests/libtests/meshio/data/Makefile
 		unittests/libtests/topology/Makefile
 		unittests/libtests/topology/data/Makefile
+		unittests/libtests/utils/Makefile
 		unittests/pytests/Makefile
 		unittests/pytests/bc/Makefile
 		unittests/pytests/bc/data/Makefile

Modified: short/3D/PyLith/trunk/libsrc/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/libsrc/Makefile.am	2007-11-21 06:05:28 UTC (rev 8310)
+++ short/3D/PyLith/trunk/libsrc/Makefile.am	2007-11-21 18:43:15 UTC (rev 8311)
@@ -81,7 +81,8 @@
 	meshio/SolutionIO.cc \
 	meshio/SolutionIOVTK.cc \
 	topology/FieldsManager.cc \
-	topology/Distributor.cc
+	topology/Distributor.cc \
+	utils/EventLogger.cc
 
 libpylith_la_LDFLAGS = $(AM_LDFLAGS) $(PYTHON_LA_LDFLAGS)
 libpylith_la_LIBADD = \

Added: short/3D/PyLith/trunk/libsrc/utils/EventLogger.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/utils/EventLogger.cc	2007-11-21 06:05:28 UTC (rev 8310)
+++ short/3D/PyLith/trunk/libsrc/utils/EventLogger.cc	2007-11-21 18:43:15 UTC (rev 8311)
@@ -0,0 +1,88 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#include "EventLogger.hh" // Implementation of class methods
+
+
+#include <stdexcept> // USES std::runtime_error
+#include <sstream> // USES std::ostringstream
+#include <assert.h> // USES assert()
+
+// ----------------------------------------------------------------------
+// Constructor
+pylith::utils::EventLogger::EventLogger(void) :
+  _className(""),
+  _classId(0)
+{ // constructor
+} // constructor
+
+// ----------------------------------------------------------------------
+// Destructor
+pylith::utils::EventLogger::~EventLogger(void)
+{ // destructor
+} // destructor
+
+// ----------------------------------------------------------------------
+// Setup logging class.
+void
+pylith::utils::EventLogger::initialize(void)
+{ // initialize
+  if (_className == "")
+    throw std::logic_error("Must set logging class name before "
+			   "initializaing EventLogger.");
+  
+  _events.clear();
+  PetscErrorCode err = PetscLogClassRegister(&_classId, _className.c_str());
+  if (err) {
+    std::ostringstream msg;
+    msg << "Could not register logging class '" << _className << "'.";
+    throw std::runtime_error(msg.str());
+  } // if
+  assert(0 != _classId);
+} // initialize
+
+// ----------------------------------------------------------------------
+// Register event.
+int
+pylith::utils::EventLogger::registerEvent(const char* name)
+{ // registerEvent
+  assert(0 != _classId);
+  int id = 0;
+  PetscErrorCode err = PetscLogEventRegister(&id, name, _classId);
+  if (err) {
+    std::ostringstream msg;
+    msg << "Could not register logging event '" << name
+	<< "' for logging class '" << _className << "'.";
+    throw std::runtime_error(msg.str());
+  } // if  
+  _events[name] = id;
+  return id;
+} // registerEvent
+
+// ----------------------------------------------------------------------
+// Get event identifier.
+int
+pylith::utils::EventLogger::eventId(const char* name)
+{ // eventId
+  map_event_type::iterator id = _events.find(name);
+  if (id == _events.end()) {
+    std::ostringstream msg;
+    msg << "Could not find logging event '" << name
+	<< "' in logging class '" << _className << "'.";
+    throw std::runtime_error(msg.str());
+  } // if
+
+  return id->second;
+} // eventId
+
+
+// End of file 

Copied: short/3D/PyLith/trunk/libsrc/utils/EventLogger.hh (from rev 8310, short/3D/PyLith/trunk/libsrc/utils/PetscLogger.hh)
===================================================================
--- short/3D/PyLith/trunk/libsrc/utils/PetscLogger.hh	2007-11-21 06:05:28 UTC (rev 8310)
+++ short/3D/PyLith/trunk/libsrc/utils/EventLogger.hh	2007-11-21 18:43:15 UTC (rev 8311)
@@ -0,0 +1,117 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+/**
+ * @file pylith/utils/EventLogger.hh
+ *
+ * @brief C++ object for managing event logging using PETSc.
+ *
+ * Each logger object manages the events for a single "logging class".
+ */
+
+#if !defined(pylith_utils_eventlogger_hh)
+#define pylith_utils_eventlogger_hh
+
+#include <string> // USES std::string
+#include <map> // USES std::map
+
+#include "petsclog.h" // USES PetscLogEventBegin/End() in inline methods
+
+namespace pylith {
+  namespace utils {
+    class EventLogger;
+    class TestEventLogger; // unit testing
+  } // utils
+} // pylith
+
+class pylith::utils::EventLogger
+{ // EventLogger
+  friend class TestEventLogger; // unit testing
+
+// PUBLIC MEMBERS ///////////////////////////////////////////////////////
+public :
+
+  /// Constructor
+  EventLogger(void);
+
+  /// Destructor
+  ~EventLogger(void);
+
+  /** Set name of logging class.
+   *
+   * @param name Name of logging class.
+   */
+  void className(const char* name);
+
+  /** Get name of logging class.
+   *
+   * @returns Name of logging class.
+   */
+  const char* className(void) const;
+
+  /// Setup logging class.
+  void initialize(void);
+
+  /** Register event.
+   *
+   * @prerequisite Must call initialize() before registerEvent().
+   * 
+   * @param name Name of event.
+   * @returns Event identifier.
+   */
+  int registerEvent(const char* name);
+
+  /** Get event identifier.
+   *
+   * @param name Name of event.
+   * @returns Event identifier.
+   */
+  int eventId(const char* name);
+
+  /** Log event begin.
+   *
+   * @param id Event identifier.
+   */
+  void eventBegin(const int id);
+
+  /** Log event end.
+   *
+   * @param id Event identifier.
+   */
+  void eventEnd(const int id);
+
+// PRIVATE METHODS //////////////////////////////////////////////////////
+private :
+
+  EventLogger(const EventLogger&); ///< Not implemented
+  const EventLogger& operator=(const EventLogger&); ///< Not implemented
+
+// PRIVATE TYPEDEFS /////////////////////////////////////////////////////
+private :
+
+  typedef std::map<std::string,int> map_event_type;
+
+// PRIVATE MEMBERS //////////////////////////////////////////////////////
+private :
+
+  std::string _className; ///< Name of logging class
+  int _classId; ///< PETSc logging identifier for class
+  map_event_type _events; ///< PETSc logging identifiers for events
+
+}; // EventLogger
+
+#include "EventLogger.icc" // inline methods
+
+#endif // pylith_utils_eventlogger_hh
+
+
+// End of file 

Added: short/3D/PyLith/trunk/libsrc/utils/EventLogger.icc
===================================================================
--- short/3D/PyLith/trunk/libsrc/utils/EventLogger.icc	2007-11-21 06:05:28 UTC (rev 8310)
+++ short/3D/PyLith/trunk/libsrc/utils/EventLogger.icc	2007-11-21 18:43:15 UTC (rev 8311)
@@ -0,0 +1,48 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+
+#if !defined(pylith_utils_eventlogger_hh)
+#error "EventLogger.icc must only be included from EventLogger.hh"
+#endif
+
+// Set name of logging class.
+inline
+void
+pylith::utils::EventLogger::className(const char* name) {
+  _className = name;
+}
+
+// Get name of logging class.
+inline
+const char*
+pylith::utils::EventLogger::className(void) const {
+  return _className.c_str();
+}
+
+// Log event begin.
+inline
+void
+pylith::utils::EventLogger::eventBegin(const int id) {
+  PetscLogEventBegin(id, 0, 0, 0, 0);
+} // eventBegin
+  
+// Log event end.
+inline
+void
+pylith::utils::EventLogger::eventEnd(const int id)
+{ // eventEnd
+  PetscLogEventEnd(id, 0, 0, 0, 0);
+} // eventEnd
+
+
+// End of file 

Modified: short/3D/PyLith/trunk/libsrc/utils/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/libsrc/utils/Makefile.am	2007-11-21 06:05:28 UTC (rev 8310)
+++ short/3D/PyLith/trunk/libsrc/utils/Makefile.am	2007-11-21 18:43:15 UTC (rev 8311)
@@ -14,6 +14,8 @@
 include $(top_srcdir)/subpackage.am
 
 subpkginclude_HEADERS = \
+	EventLogger.hh \
+	EventLogger.icc \
 	array.hh \
 	arrayfwd.hh \
 	macrodefs.h \

Deleted: short/3D/PyLith/trunk/libsrc/utils/PetscLogger.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/utils/PetscLogger.hh	2007-11-21 06:05:28 UTC (rev 8310)
+++ short/3D/PyLith/trunk/libsrc/utils/PetscLogger.hh	2007-11-21 18:43:15 UTC (rev 8311)
@@ -1,103 +0,0 @@
-// -*- C++ -*-
-//
-// ======================================================================
-//
-//                           Brad T. Aagaard
-//                        U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ======================================================================
-//
-
-/**
- * @file pylith/utils/PetscLogger.hh
- *
- * @brief C++ object for managing PETSc logger.
- *
- * Each logger object manages the events for a single "logging class".
- */
-
-#if !defined(pylith_utils_petsclogger_hh)
-#define pylith_utils_petsclogger_hh
-
-#include <string> // USES std::string
-
-namespace pylith {
-  namespace utils {
-    class PetscLogger;
-    class TestPetscLogger;
-  } // utils
-} // pylith
-
-class pylith::utils::PetscLogger
-{ // Integrator
-  friend class TestPetscLogger; // unit testing
-
-// PUBLIC MEMBERS ///////////////////////////////////////////////////////
-public :
-
-  /// Constructor
-  PetscLogger(void);
-
-  /// Destructor
-  ~PetscLogger(void);
-
-  /** Set name of logging class.
-   *
-   * @param name Name of logging class.
-   */
-  void className(const char* name);
-
-  /** Get name of logging class.
-   *
-   * @returns Name of logging class.
-   */
-  const char* className(void) const;
-
-  /** Register event.
-   *
-   * @param name Name of event.
-   */
-  void registerEvent(const char* name);
-
-  /** Get event identifier.
-   *
-   * @param name Name of event.
-   * @returns Event identifier.
-   */
-  int eventId(const char* name);
-
-  /** Log event begin.
-   *
-   * @param id Event identifier.
-   */
-  void eventBegin(const int id)
-
-  /** Log event end.
-   *
-   * @param id Event identifier.
-   */
-  void eventEnd(const int id)
-
-
-// PRIVATE METHODS //////////////////////////////////////////////////////
-private :
-
-  PetscLogger(const PetscLogger&); ///< Not implemented
-  const PetscLogger& operator=(const PetscLogger&); ///< Not implemented
-
-// PRIVATE MEMBERS //////////////////////////////////////////////////////
-private :
-
-  std::string _className; ///< Name of logging class
-  std::map<string, int> _events;
-
-}; // PetscLogger
-
-#include "PetscLogger.icc" // inline methods
-
-#endif // pylith_utils_petsclogger_hh
-
-
-// End of file 

Modified: short/3D/PyLith/trunk/modulesrc/utils/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/modulesrc/utils/Makefile.am	2007-11-21 06:05:28 UTC (rev 8310)
+++ short/3D/PyLith/trunk/modulesrc/utils/Makefile.am	2007-11-21 18:43:15 UTC (rev 8311)
@@ -13,20 +13,16 @@
 subpackage = utils
 include $(top_srcdir)/subpackage.am
 
-subpkgpyexec_LTLIBRARIES = petscmodule.la
+subpkgpyexec_LTLIBRARIES = petscmodule.la utilsmodule.la
 
 petscmodule_la_LDFLAGS = -module -avoid-version \
 	$(AM_LDFLAGS) $(PYTHON_LA_LDFLAGS)
-
 petscmodule_la_SOURCES = petsc.pyxe
-
 nodist_petscmodule_la_SOURCES = \
 	petsc.c petsc_embed.cpp petsc_embed.h
-
 petscmodule_la_LIBADD = \
 	$(top_builddir)/libsrc/libpylith.la \
 	$(PETSC_LIB)
-
 if ENABLE_CUBIT
   petscmodule_la_LIBADD += -lnetcdf_c++ -lnetcdf
 endif
@@ -34,6 +30,24 @@
   petscmodule_la_LIBADD += $(PYTHON_BLDLIBRARY) $(PYTHON_LIBS) $(PYTHON_SYSLIBS)
 endif
 
+
+utilsmodule_la_LDFLAGS = -module -avoid-version \
+	$(AM_LDFLAGS) $(PYTHON_LA_LDFLAGS)
+utilsmodule_la_SOURCES = utils.pyxe
+nodist_utilsmodule_la_SOURCES = \
+	utils.c utils_embed.cpp utils_embed.h
+utilsmodule_la_LIBADD = \
+	$(top_builddir)/libsrc/libpylith.la \
+	$(PETSC_LIB)
+if ENABLE_CUBIT
+  utilsmodule_la_LIBADD += -lnetcdf_c++ -lnetcdf
+endif
+if NO_UNDEFINED
+  utilsmodule_la_LIBADD += $(PYTHON_BLDLIBRARY) $(PYTHON_LIBS) $(PYTHON_SYSLIBS)
+endif
+
+
+
 INCLUDES += -I$(PYTHON_INCDIR) $(PETSC_INCLUDE)
 
 petsc.pyx petsc_embed.cpp  petsc_embed.h: petsc.pyxe
@@ -43,9 +57,18 @@
 petsc_embed.cpp: petsc_embed.h
 petsc_embed.h: petsc.pyx
 
+utils.pyx utils_embed.cpp  utils_embed.h: utils.pyxe
+	pyrexembed utils.pyxe
+utils.pyxe: $(srcdir)/utils.pyxe.src
+	cp $(srcdir)/utils.pyxe.src $@
+utils_embed.cpp: utils_embed.h
+utils_embed.h: utils.pyx
+
 .pyx.c:
 	pyrexc $< $(PYREX_INCLUDES)
 
-CLEANFILES = petsc.pyxe petsc.pyx petsc.c *_embed.*
+CLEANFILES = *_embed.* \
+	petsc.pyxe petsc.pyx petsc.c \
+	utils.pyxe utils.pyx utils.c
 
 # End of file 

Added: short/3D/PyLith/trunk/modulesrc/utils/utils.pyxe.src
===================================================================
--- short/3D/PyLith/trunk/modulesrc/utils/utils.pyxe.src	2007-11-21 06:05:28 UTC (rev 8310)
+++ short/3D/PyLith/trunk/modulesrc/utils/utils.pyxe.src	2007-11-21 18:43:15 UTC (rev 8311)
@@ -0,0 +1,242 @@
+# -*- Pyrex -*-
+#
+# ======================================================================
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# {LicenseText}
+#
+# ======================================================================
+#
+
+#header{
+#include "pylith/utils/EventLogger.hh"
+
+#include <assert.h>
+#include <stdexcept>
+#include <Python.h>
+#}header
+
+# ----------------------------------------------------------------------
+cdef extern from "Python.h":
+  object PyCObject_FromVoidPtr(void*, void (*destruct)(void*))
+  void* PyCObject_AsVoidPtr(object)
+
+cdef void* ptrFromHandle(obj):
+  """Extract pointer from PyCObject."""
+  return PyCObject_AsVoidPtr(obj.handle)
+
+cdef extern from "stdlib.h":
+  ctypedef unsigned long size_t
+  void* malloc(size_t size)
+  void free(void* mem)
+
+cdef void EventLogger_destructor(void* obj):
+  """
+  Destroy EventLogger object.
+  """
+  # create shim for destructor
+  #embed{ void EventLogger_destructor_cpp(void* objVptr)
+  pylith::utils::EventLogger* logger = (pylith::utils::EventLogger*) objVptr;
+  delete logger;
+  #}embed
+  EventLogger_destructor_cpp(obj)
+  return
+
+
+# ----------------------------------------------------------------------
+cdef class EventLogger:
+
+  cdef void* thisptr # Pointer to C++ object
+  cdef readonly object handle # PyCObject holding pointer to C++ object
+  cdef readonly object name # Identifier for object base type
+
+  def __init__(self):
+    """
+    Constructor.
+    """
+    # create shim for constructor
+    #embed{ void* EventLogger_constructor()
+    void* result = 0;
+    try {
+      result = (void*)(new pylith::utils::EventLogger);
+      assert(0 != result);
+    } catch (const std::exception& err) {
+      PyErr_SetString(PyExc_RuntimeError,
+                      const_cast<char*>(err.what()));
+    } catch (...) {
+      PyErr_SetString(PyExc_RuntimeError,
+                      "Caught unknown C++ exception.");
+    } // try/catch
+    return result;
+    #}embed
+
+    self.thisptr = EventLogger_constructor()
+    self.handle = self._createHandle()
+    self.name = "pylith_utils_EventLogger"
+    return
+
+
+  def initialize(self):
+    """
+    Initialize event logger.
+    """
+    # create shim for method 'initialize'
+    #embed{ void EventLogger_initialize(void* objVptr)
+    try {
+      assert(0 != objVptr);
+      ((pylith::utils::EventLogger*) objVptr)->initialize();
+    } catch (const std::exception& err) {
+      PyErr_SetString(PyExc_RuntimeError,
+                      const_cast<char*>(err.what()));
+    } catch (...) {
+      PyErr_SetString(PyExc_RuntimeError,
+                      "Caught unknown C++ exception.");
+    } // try/catch      
+    #}embed
+
+    EventLogger_initialize(self.thisptr)
+    return
+
+
+  def registerEvent(self, name):
+    """
+    Register event.
+    """
+    # create shim for method 'registerEvent'
+    #embed{ int EventLogger_registerEvent(void* objVptr, char* name)
+    int result = 0;
+    try {
+      assert(0 != objVptr);
+      result = ((pylith::utils::EventLogger*) objVptr)->registerEvent(name);
+    } catch (const std::exception& err) {
+      PyErr_SetString(PyExc_RuntimeError,
+                      const_cast<char*>(err.what()));
+    } catch (...) {
+      PyErr_SetString(PyExc_RuntimeError,
+                      "Caught unknown C++ exception.");
+    } // try/catch
+    return result;
+    #}embed
+
+    return EventLogger_registerEvent(self.thisptr, name)
+
+
+  def eventId(self, name):
+    """
+    Get event identifier.
+    """
+    # create shim for method 'eventId'
+    #embed{ int EventLogger_eventId(void* objVptr, char* name)
+    int result = 0;
+    try {
+      assert(0 != objVptr);
+      result = ((pylith::utils::EventLogger*) objVptr)->eventId(name);
+    } catch (const std::exception& err) {
+      PyErr_SetString(PyExc_RuntimeError,
+                      const_cast<char*>(err.what()));
+    } catch (...) {
+      PyErr_SetString(PyExc_RuntimeError,
+                      "Caught unknown C++ exception.");
+    } // try/catch
+    return result;
+    #}embed
+
+    return EventLogger_eventId(self.thisptr, name)
+
+
+  def eventBegin(self, id):
+    """
+    Log event begin.
+    """
+    # create shim for method 'eventBegin'
+    #embed{ void EventLogger_eventBegin(void* objVptr, int id)
+    try {
+      assert(0 != objVptr);
+      ((pylith::utils::EventLogger*) objVptr)->eventBegin(id);
+    } catch (const std::exception& err) {
+      PyErr_SetString(PyExc_RuntimeError,
+                      const_cast<char*>(err.what()));
+    } catch (...) {
+      PyErr_SetString(PyExc_RuntimeError,
+                      "Caught unknown C++ exception.");
+    } // try/catch
+    #}embed
+
+    EventLogger_eventBegin(self.thisptr, id)
+    return
+
+
+  def eventEnd(self, id):
+    """
+    Log event end.
+    """
+    # create shim for method 'eventEnd'
+    #embed{ void EventLogger_eventEnd(void* objVptr, int id)
+    try {
+      assert(0 != objVptr);
+      ((pylith::utils::EventLogger*) objVptr)->eventEnd(id);
+    } catch (const std::exception& err) {
+      PyErr_SetString(PyExc_RuntimeError,
+                      const_cast<char*>(err.what()));
+    } catch (...) {
+      PyErr_SetString(PyExc_RuntimeError,
+                      "Caught unknown C++ exception.");
+    } // try/catch
+    #}embed
+
+    EventLogger_eventEnd(self.thisptr, id)
+    return
+  
+
+  def _createHandle(self):
+    """
+    Wrap pointer to C++ object in PyCObject.
+    """
+    return PyCObject_FromVoidPtr(self.thisptr, EventLogger_destructor)
+
+
+  property className:
+    def __set__(self, name):
+      """
+      Set name of logging class.
+      """
+      # create shim for method 'className'
+      #embed{ void EventLogger_className_set(void* objVptr, char* name)
+      try {
+        assert(0 != objVptr);
+        ((pylith::utils::EventLogger*) objVptr)->className(name);
+      } catch (const std::exception& err) {
+        PyErr_SetString(PyExc_RuntimeError,
+                        const_cast<char*>(err.what()));
+      } catch (...) {
+        PyErr_SetString(PyExc_RuntimeError,
+                        "Caught unknown C++ exception.");
+      } // try/catch
+      #}embed
+      EventLogger_className_set(self.thisptr, name)
+
+    def __get__(self):
+      """
+      Get name of logging class.
+      """
+      # create shim for method 'className'
+      #embed{ char* EventLogger_className_get(void* objVptr)
+      char* result = 0;
+      try {
+        assert(0 != objVptr);
+        result = (char*)((pylith::utils::EventLogger*) objVptr)->className();
+      } catch (const std::exception& err) {
+        PyErr_SetString(PyExc_RuntimeError,
+                        const_cast<char*>(err.what()));
+      } catch (...) {
+        PyErr_SetString(PyExc_RuntimeError,
+                        "Caught unknown C++ exception.");
+      } // try/catch
+      return result;
+      #}embed
+      return EventLogger_className_get(self.thisptr)
+
+
+# End of file 

Modified: short/3D/PyLith/trunk/pylith/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/pylith/Makefile.am	2007-11-21 06:05:28 UTC (rev 8310)
+++ short/3D/PyLith/trunk/pylith/Makefile.am	2007-11-21 18:43:15 UTC (rev 8311)
@@ -100,6 +100,7 @@
 	utils/__init__.py \
 	utils/CheckpointTimer.py \
 	utils/CppData.py \
+	utils/EventLogger.py \
 	utils/ObjectBin.py \
 	utils/PetscManager.py \
 	utils/importing.py \

Added: short/3D/PyLith/trunk/pylith/utils/EventLogger.py
===================================================================
--- short/3D/PyLith/trunk/pylith/utils/EventLogger.py	2007-11-21 06:05:28 UTC (rev 8310)
+++ short/3D/PyLith/trunk/pylith/utils/EventLogger.py	2007-11-21 18:43:15 UTC (rev 8311)
@@ -0,0 +1,109 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file pylith/utils/EventLogger.py
+##
+## @brief Python object for managing event logging using PETSc.
+##
+## Each logger object manages the events for a single "logging class".
+
+# EventLogger class
+class EventLogger(object):
+  """
+  Python object for managing event logging using PETSc.
+
+  Each logger object manages the events for a single 'logging class'.
+  """
+
+  # PUBLIC METHODS /////////////////////////////////////////////////////
+
+  def __init__(self):
+    """
+    Constructor.
+    """
+    self.cppHandle = None
+    self._createCppHandle()
+    return
+
+
+  def setClassName(self, name):
+    """
+    Set name of logging class.
+    """
+    self._createCppHandle()
+    self.cppHandle.className = name
+    return
+
+
+  def getClassName(self):
+    """
+    Set name of logging class.
+    """
+    assert(None != self.cppHandle)
+    return self.cppHandle.className
+
+
+  def initialize(self):
+    """
+    Setup logging class.
+    """    
+    assert(None != self.cppHandle)
+    self.cppHandle.initialize()
+    return
+
+
+  def registerEvent(self, name):
+    """
+    Register event.
+    """    
+    assert(None != self.cppHandle)
+    return self.cppHandle.registerEvent(name)
+
+
+  def eventId(self, name):
+    """
+    Get event identifier.
+    """    
+    assert(None != self.cppHandle)
+    return self.cppHandle.eventId(name)
+
+
+  def eventBegin(self, name):
+    """
+    Log event begin.
+    """    
+    assert(None != self.cppHandle)
+    self.cppHandle.eventBegin(self.cppHandle.eventId(name))
+    return
+
+
+  def eventEnd(self, name):
+    """
+    Log event end.
+    """    
+    assert(None != self.cppHandle)
+    self.cppHandle.eventEnd(self.cppHandle.eventId(name))
+    return
+
+
+  # PRIVATE METHODS ////////////////////////////////////////////////////
+
+  def _createCppHandle(self):
+    """
+    Create handle to corresponding C++ object.
+    """
+    if None == self.cppHandle:
+      import pylith.utils.utils as bindings
+      self.cppHandle = bindings.EventLogger()
+  
+  
+# End of file 

Modified: short/3D/PyLith/trunk/unittests/libtests/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/Makefile.am	2007-11-21 06:05:28 UTC (rev 8310)
+++ short/3D/PyLith/trunk/unittests/libtests/Makefile.am	2007-11-21 18:43:15 UTC (rev 8311)
@@ -16,7 +16,8 @@
 	feassemble \
 	materials \
 	meshio \
-	topology
+	topology \
+	utils
 
 
 # End of file 

Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestIntegrator.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestIntegrator.cc	2007-11-21 06:05:28 UTC (rev 8310)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestIntegrator.cc	2007-11-21 18:43:15 UTC (rev 8311)
@@ -19,7 +19,6 @@
 
 #include <petscmat.h>
 
-#include <stdexcept> // TEMPORARY
 // ----------------------------------------------------------------------
 CPPUNIT_TEST_SUITE_REGISTRATION( pylith::feassemble::TestIntegrator );
 

Added: short/3D/PyLith/trunk/unittests/libtests/utils/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/utils/Makefile.am	2007-11-21 06:05:28 UTC (rev 8310)
+++ short/3D/PyLith/trunk/unittests/libtests/utils/Makefile.am	2007-11-21 18:43:15 UTC (rev 8311)
@@ -0,0 +1,41 @@
+# -*- Makefile -*-
+#
+# ----------------------------------------------------------------------
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+subpackage = utils
+include $(top_srcdir)/subpackage.am
+
+TESTS = testutils
+
+check_PROGRAMS = testutils
+
+# Primary source files
+testutils_SOURCES = \
+	TestEventLogger.cc \
+	test_utils.cc
+
+noinst_HEADERS = \
+	TestEventLogger.hh
+
+AM_CPPFLAGS = $(PETSC_SIEVE_FLAGS) $(PETSC_INCLUDE)
+
+testutils_LDADD = \
+	-lcppunit -ldl \
+	$(top_builddir)/libsrc/libpylith.la \
+	-lspatialdata \
+	$(PETSC_LIB) $(PYTHON_BLDLIBRARY) $(PYTHON_LIBS) $(PYTHON_SYSLIBS)
+
+if ENABLE_CUBIT
+  testutils_LDADD += -lnetcdf_c++ -lnetcdf
+endif
+
+
+# End of file 

Added: short/3D/PyLith/trunk/unittests/libtests/utils/TestEventLogger.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/utils/TestEventLogger.cc	2007-11-21 06:05:28 UTC (rev 8310)
+++ short/3D/PyLith/trunk/unittests/libtests/utils/TestEventLogger.cc	2007-11-21 18:43:15 UTC (rev 8311)
@@ -0,0 +1,141 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestEventLogger.hh" // Implementation of class methods
+
+#include "pylith/utils/EventLogger.hh" // USES EventLogger
+
+
+// ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( pylith::utils::TestEventLogger );
+
+// ----------------------------------------------------------------------
+// Test constructor.
+void
+pylith::utils::TestEventLogger::testConstructor(void)
+{ // testConstructor
+  EventLogger logger;
+} // testConstructor
+
+// ----------------------------------------------------------------------
+// Test className().
+void
+pylith::utils::TestEventLogger::testClassName(void)
+{ // testClassName
+  EventLogger logger;
+  CPPUNIT_ASSERT_EQUAL(std::string(""), std::string(logger.className()));
+
+  const std::string& name = "my name";
+  logger.className(name.c_str());
+  CPPUNIT_ASSERT_EQUAL(name, std::string(logger.className()));
+} // testClassName
+
+// ----------------------------------------------------------------------
+// Test initialize().
+void
+pylith::utils::TestEventLogger::testInitialize(void)
+{ // testInitialize
+  EventLogger logger;
+  logger.className("my class");
+  CPPUNIT_ASSERT_EQUAL(0, logger._classId);
+  logger.initialize();
+  CPPUNIT_ASSERT(0 != logger._classId);
+} // testInitialize
+
+// ----------------------------------------------------------------------
+// Test registerEvent().
+void
+pylith::utils::TestEventLogger::testRegisterEvent(void)
+{ // testRegisterEvent
+  EventLogger logger;
+  logger.className("my class");
+  logger.initialize();
+
+  const char* events[] = { "event A", "event B", "event C" };
+  const int numEvents = 3;
+  int ids[numEvents];
+
+  for (int i=0; i < numEvents; ++i)
+    ids[i] = logger.registerEvent(events[i]);
+
+  int i = 0;
+  for (EventLogger::map_event_type::iterator e_iter=logger._events.begin();
+       e_iter != logger._events.end();
+       ++e_iter, ++i) {
+    CPPUNIT_ASSERT_EQUAL(std::string(events[i]), e_iter->first);
+    CPPUNIT_ASSERT_EQUAL(ids[i], e_iter->second);
+  } // for
+} // testRegisterEvent
+
+// ----------------------------------------------------------------------
+// Test eventId().
+void
+pylith::utils::TestEventLogger::testEventId(void)
+{ // testEventId
+  EventLogger logger;
+  logger.className("my class");
+  logger.initialize();
+
+  const char* events[] = { "event A", "event B", "event C" };
+  const int numEvents = 3;
+
+  for (int i=0; i < numEvents; ++i)
+    logger.registerEvent(events[i]);
+
+  const int order[] = { 1, 0, 2 };
+  int ids[numEvents];
+  for (int i=0; i < numEvents; ++i)
+    ids[order[i]] = logger.eventId(events[order[i]]);
+
+  int i = 0;
+  for (EventLogger::map_event_type::iterator e_iter=logger._events.begin();
+       e_iter != logger._events.end();
+       ++e_iter, ++i)
+    CPPUNIT_ASSERT_EQUAL(e_iter->second, ids[i]);
+} // testEventId
+
+// ----------------------------------------------------------------------
+// Test eventBegin() and eventEnd().
+void
+pylith::utils::TestEventLogger::testEventLogging(void)
+{ // testEventLogging
+  EventLogger logger;
+  logger.className("my class");
+  logger.initialize();
+
+  const char* events[] = { "event A", "event B", "event C" };
+  const int numEvents = 3;
+  int ids[numEvents];
+
+  for (int i=0; i < numEvents; ++i)
+    ids[i] = logger.registerEvent(events[i]);
+
+  int event = ids[1];
+  logger.eventBegin(event);
+  logger.eventEnd(event);
+
+  event = ids[0];
+  logger.eventBegin(event);
+  logger.eventEnd(event);
+
+  event = ids[2];
+  logger.eventBegin(event);
+  int event2 = ids[0];
+  logger.eventBegin(event2);
+  logger.eventEnd(event2);
+  logger.eventEnd(event);
+} // testEventLogging
+
+
+// End of file 

Added: short/3D/PyLith/trunk/unittests/libtests/utils/TestEventLogger.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/utils/TestEventLogger.hh	2007-11-21 06:05:28 UTC (rev 8310)
+++ short/3D/PyLith/trunk/unittests/libtests/utils/TestEventLogger.hh	2007-11-21 18:43:15 UTC (rev 8311)
@@ -0,0 +1,75 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/**
+ * @file unittests/libtests/utils/TestEventLogger.hh
+ *
+ * @brief C++ TestEventLogger object
+ *
+ * C++ unit testing for EventLogger.
+ */
+
+#if !defined(pylith_utils_testeventlogger_hh)
+#define pylith_utils_testeventlogger_hh
+
+#include <cppunit/extensions/HelperMacros.h>
+
+/// Namespace for pylith package
+namespace pylith {
+  namespace utils {
+    class TestEventLogger;
+  } // utils
+} // pylith
+
+/// C++ unit testing for TestEventLogger
+class pylith::utils::TestEventLogger : public CppUnit::TestFixture
+{ // class TestEventLogger
+
+  // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+  CPPUNIT_TEST_SUITE( TestEventLogger );
+
+  CPPUNIT_TEST( testConstructor );
+  CPPUNIT_TEST( testClassName );
+  CPPUNIT_TEST( testInitialize );
+  CPPUNIT_TEST( testRegisterEvent );
+  CPPUNIT_TEST( testEventId );
+  CPPUNIT_TEST( testEventLogging );
+
+  CPPUNIT_TEST_SUITE_END();
+
+// PUBLIC METHODS ///////////////////////////////////////////////////////
+public :
+
+  /// Test constructor.
+  void testConstructor(void);
+
+  /// Test className().
+  void testClassName(void);
+
+  /// Test initialize().
+  void testInitialize(void);
+
+  /// Test registerEvent().
+  void testRegisterEvent(void);
+
+  /// Test eventId().
+  void testEventId(void);
+
+  /// Test eventBegin() and eventEnd().
+  void testEventLogging(void);
+
+}; // class TestEventLogging
+
+#endif // pylith_utils_testeventlogger_hh
+
+
+// End of file 

Added: short/3D/PyLith/trunk/unittests/libtests/utils/test_utils.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/utils/test_utils.cc	2007-11-21 06:05:28 UTC (rev 8310)
+++ short/3D/PyLith/trunk/unittests/libtests/utils/test_utils.cc	2007-11-21 18:43:15 UTC (rev 8311)
@@ -0,0 +1,67 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include "petsc.h"
+
+#include <cppunit/extensions/TestFactoryRegistry.h>
+
+#include <cppunit/BriefTestProgressListener.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/TestResult.h>
+#include <cppunit/TestResultCollector.h>
+#include <cppunit/TestRunner.h>
+#include <cppunit/TextOutputter.h>
+
+#include <stdlib.h> // USES abort()
+
+int
+main(int argc,
+     char* argv[])
+{ // main
+  CppUnit::TestResultCollector result;
+
+  try {
+    // Initialize PETSc
+    PetscErrorCode err = PetscInitialize(&argc, &argv, PETSC_NULL, PETSC_NULL);
+    CHKERRQ(err);
+
+    // Create event manager and test controller
+    CppUnit::TestResult controller;
+
+    // Add listener to collect test results
+    controller.addListener(&result);
+
+    // Add listener to show progress as tests run
+    CppUnit::BriefTestProgressListener progress;
+    controller.addListener(&progress);
+
+    // Add top suite to test runner
+    CppUnit::TestRunner runner;
+    runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
+    runner.run(controller);
+
+    // Print tests
+    CppUnit::TextOutputter outputter(&result, std::cerr);
+    outputter.write();
+
+    // Finalize PETSc
+    err = PetscFinalize();
+    CHKERRQ(err);
+  } catch (...) {
+    abort();
+  } // catch
+
+  return (result.wasSuccessful() ? 0 : 1);
+} // main
+
+
+// End of file

Modified: short/3D/PyLith/trunk/unittests/pytests/utils/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/utils/Makefile.am	2007-11-21 06:05:28 UTC (rev 8310)
+++ short/3D/PyLith/trunk/unittests/pytests/utils/Makefile.am	2007-11-21 18:43:15 UTC (rev 8311)
@@ -13,11 +13,12 @@
 subpackage = utils
 include $(top_srcdir)/subpackage.am
 
-TESTS = testdriver.py
+TESTS = testmanager.py testutils.py
 
-check_SCRIPTS = testdriver.py
+check_SCRIPTS = testmanager.py testutils.py
 
 noinst_PYTHON = \
+	TestEventLogger.py \
 	TestPetscManager.py
 
 TESTS_ENVIRONMENT = $(PYTHON)

Added: short/3D/PyLith/trunk/unittests/pytests/utils/TestEventLogger.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/utils/TestEventLogger.py	2007-11-21 06:05:28 UTC (rev 8310)
+++ short/3D/PyLith/trunk/unittests/pytests/utils/TestEventLogger.py	2007-11-21 18:43:15 UTC (rev 8311)
@@ -0,0 +1,102 @@
+#!/usr/bin/env python
+#
+# ======================================================================
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# {LicenseText}
+#
+# ======================================================================
+#
+
+## @file unittests/pytests/utils/TestPescManager.py
+
+## @brief Unit testing of EventLogger object.
+
+import unittest
+
+
+# ----------------------------------------------------------------------
+class TestEventLogger(unittest.TestCase):
+  """
+  Unit testing of EventLogger object.
+  """
+  
+
+  def test_constructor(self):
+    """
+    Test constructor.
+    """
+    from pylith.utils.EventLogger import EventLogger
+    logger = EventLogger()
+    return
+
+
+  def test_className(self):
+    """
+    Test setClassName() and getClassName.
+    """
+    from pylith.utils.EventLogger import EventLogger
+    logger = EventLogger()
+    name = "my class"
+    logger.setClassName(name)
+    self.assertEqual(name, logger.getClassName())
+    return
+
+
+  def test_initialize(self):
+    """
+    Test initialize().
+    """
+    from pylith.utils.EventLogger import EventLogger
+    logger = EventLogger()
+    logger.setClassName("logging A")
+    logger.initialize()
+    return
+
+
+  def test_registerEvent(self):
+    """
+    Test registerEvent().
+    """
+    from pylith.utils.EventLogger import EventLogger
+    logger = EventLogger()
+    logger.setClassName("logging A")
+    logger.initialize()
+
+    events = ["event 1" , "event 2" , "event 3"]
+    id = {}
+    for event in events:
+      id[event] = logger.registerEvent(event)
+    for event in events:
+      self.assertEqual(id[event], logger.eventId(event))
+    return
+
+
+  def test_eventLogging(self):
+    """
+    Test eventBegin() and eventEnd().
+    """
+    from pylith.utils.EventLogger import EventLogger
+    logger = EventLogger()
+    logger.setClassName("logging A")
+    logger.initialize()
+    events = ["event 1" , "event 2" , "event 3"]
+    for event in events:
+      logger.registerEvent(event)
+
+    logger.eventBegin("event 2")
+    logger.eventEnd("event 2")
+
+    logger.eventBegin("event 1")
+    logger.eventEnd("event 1")
+
+    logger.eventBegin("event 3")
+    logger.eventBegin("event 1")
+    logger.eventEnd("event 1")
+    logger.eventEnd("event 3")
+    return
+
+
+# End of file 

Deleted: short/3D/PyLith/trunk/unittests/pytests/utils/testdriver.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/utils/testdriver.py	2007-11-21 06:05:28 UTC (rev 8310)
+++ short/3D/PyLith/trunk/unittests/pytests/utils/testdriver.py	2007-11-21 18:43:15 UTC (rev 8311)
@@ -1,65 +0,0 @@
-#!/usr/bin/env python
-#
-# ======================================================================
-#
-#                           Brad T. Aagaard
-#                        U.S. Geological Survey
-#
-# {LicenseText}
-#
-# ======================================================================
-#
-
-## @file unittests/utils/testdriver.py
-
-## @brief Python application for testing meshio code.
-
-from pyre.applications.Script import Script
-
-import unittest
-
-class TestApp(Script):
-  """
-  Test application.
-  """
-
-  # PUBLIC METHODS /////////////////////////////////////////////////////
-
-  def __init__(self, name="testapp"):
-    """
-    Constructor.
-    """
-    Script.__init__(self, name)
-    return
-
-
-  def main(self):
-    """
-    Run the application.
-    """
-    unittest.TextTestRunner(verbosity=2).run(self._suite())
-    return
-
-
-  # PRIVATE METHODS ////////////////////////////////////////////////////
-
-  def _suite(self):
-    """
-    Setup the test suite.
-    """
-
-    suite = unittest.TestSuite()
-
-    from TestPetscManager import TestPetscManager
-    suite.addTest(unittest.makeSuite(TestPetscManager))
-
-    return suite
-
-
-# ----------------------------------------------------------------------
-if __name__ == '__main__':
-  app = TestApp()
-  app.run()
-
-
-# End of file 

Copied: short/3D/PyLith/trunk/unittests/pytests/utils/testmanager.py (from rev 8310, short/3D/PyLith/trunk/unittests/pytests/utils/testdriver.py)
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/utils/testdriver.py	2007-11-21 06:05:28 UTC (rev 8310)
+++ short/3D/PyLith/trunk/unittests/pytests/utils/testmanager.py	2007-11-21 18:43:15 UTC (rev 8311)
@@ -0,0 +1,65 @@
+#!/usr/bin/env python
+#
+# ======================================================================
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# {LicenseText}
+#
+# ======================================================================
+#
+
+## @file unittests/utils/testmanager.py
+
+## @brief Python application for testing PetscManager.
+
+from pyre.applications.Script import Script
+
+import unittest
+
+class TestApp(Script):
+  """
+  Test application.
+  """
+
+  # PUBLIC METHODS /////////////////////////////////////////////////////
+
+  def __init__(self, name="testapp"):
+    """
+    Constructor.
+    """
+    Script.__init__(self, name)
+    return
+
+
+  def main(self):
+    """
+    Run the application.
+    """
+    unittest.TextTestRunner(verbosity=2).run(self._suite())
+    return
+
+
+  # PRIVATE METHODS ////////////////////////////////////////////////////
+
+  def _suite(self):
+    """
+    Setup the test suite.
+    """
+
+    suite = unittest.TestSuite()
+
+    from TestPetscManager import TestPetscManager
+    suite.addTest(unittest.makeSuite(TestPetscManager))
+
+    return suite
+
+
+# ----------------------------------------------------------------------
+if __name__ == '__main__':
+  app = TestApp()
+  app.run()
+
+
+# End of file 

Added: short/3D/PyLith/trunk/unittests/pytests/utils/testutils.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/utils/testutils.py	2007-11-21 06:05:28 UTC (rev 8310)
+++ short/3D/PyLith/trunk/unittests/pytests/utils/testutils.py	2007-11-21 18:43:15 UTC (rev 8311)
@@ -0,0 +1,71 @@
+#!/usr/bin/env python
+#
+# ======================================================================
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# {LicenseText}
+#
+# ======================================================================
+#
+
+## @file unittests/utils/testutils.py
+
+## @brief Python application for testing utils code.
+
+from pyre.applications.Script import Script
+
+import unittest
+
+class TestApp(Script):
+  """
+  Test application.
+  """
+
+  # PUBLIC METHODS /////////////////////////////////////////////////////
+
+  def __init__(self, name="testapp"):
+    """
+    Constructor.
+    """
+    Script.__init__(self, name)
+    return
+
+
+  def main(self):
+    """
+    Run the application.
+    """
+    from pylith.utils.PetscManager import PetscManager
+    petsc = PetscManager()
+    petsc.initialize()
+
+    unittest.TextTestRunner(verbosity=2).run(self._suite())
+
+    petsc.finalize()
+    return
+
+
+  # PRIVATE METHODS ////////////////////////////////////////////////////
+
+  def _suite(self):
+    """
+    Setup the test suite.
+    """
+
+    suite = unittest.TestSuite()
+
+    from TestEventLogger import TestEventLogger
+    suite.addTest(unittest.makeSuite(TestEventLogger))
+
+    return suite
+
+
+# ----------------------------------------------------------------------
+if __name__ == '__main__':
+  app = TestApp()
+  app.run()
+
+
+# End of file 


Property changes on: short/3D/PyLith/trunk/unittests/pytests/utils/testutils.py
___________________________________________________________________
Name: svn:executable
   + *



More information about the cig-commits mailing list