[cig-commits] r6270 - in short/3D/PyLith/trunk: . libsrc/materials unittests/libtests unittests/libtests/materials unittests/libtests/materials/data

brad at geodynamics.org brad at geodynamics.org
Thu Mar 15 21:19:51 PDT 2007


Author: brad
Date: 2007-03-15 21:19:50 -0700 (Thu, 15 Mar 2007)
New Revision: 6270

Added:
   short/3D/PyLith/trunk/unittests/libtests/materials/
   short/3D/PyLith/trunk/unittests/libtests/materials/Makefile.am
   short/3D/PyLith/trunk/unittests/libtests/materials/TestMaterial.cc
   short/3D/PyLith/trunk/unittests/libtests/materials/TestMaterial.hh
   short/3D/PyLith/trunk/unittests/libtests/materials/data/
   short/3D/PyLith/trunk/unittests/libtests/materials/data/ElasticIsotropic3DData.cc
   short/3D/PyLith/trunk/unittests/libtests/materials/data/ElasticIsotropic3DData.hh
   short/3D/PyLith/trunk/unittests/libtests/materials/data/MaterialData.cc
   short/3D/PyLith/trunk/unittests/libtests/materials/data/MaterialData.hh
   short/3D/PyLith/trunk/unittests/libtests/materials/test_materials.cc
Modified:
   short/3D/PyLith/trunk/TODO
   short/3D/PyLith/trunk/configure.ac
   short/3D/PyLith/trunk/libsrc/materials/ElasticIsotropic3D.cc
   short/3D/PyLith/trunk/libsrc/materials/ElasticIsotropic3D.hh
   short/3D/PyLith/trunk/libsrc/materials/Material.cc
   short/3D/PyLith/trunk/libsrc/materials/Material.hh
   short/3D/PyLith/trunk/unittests/libtests/Makefile.am
Log:
Started work on material tests. Small cleanup of Material method names.

Modified: short/3D/PyLith/trunk/TODO
===================================================================
--- short/3D/PyLith/trunk/TODO	2007-03-16 00:15:21 UTC (rev 6269)
+++ short/3D/PyLith/trunk/TODO	2007-03-16 04:19:50 UTC (rev 6270)
@@ -10,31 +10,30 @@
   ElasticIsotropic3D
 
 0. Finish implementing materials with 3-D linear, isotropic elastic material
-  a. module
-  b. unit tests for C++ level
-  c. unit tests for Python level
+   a. unit tests for C++ level
+   b. unit tests for Python level
 
 1. Create element families for materials.
-  a. Limit cells to cells with material label
+   a. Limit cells to cells with material label
 
 2. Finish implementing ExplicitElasticity
-  a. C++
-  a. Python object
-  b. bindings
-  c. unit tests at C++ level
-  d. unit tests at Python level
+   a. C++
+   b. Python object
+   c. bindings
+   d. unit tests at C++ level
+   e. unit tests at Python level
 
-  Status: Started on a.
+   Status: Started on a.
     Only implement nonlumped and let PETSc "solver" do the lumping.
 
-3.  Finish implementing Python Formulation
-    (e.g., Explicit) with initialization of solid element families.
-  a. Python object
-  b. unit tests at Python level
+3. Finish implementing Python Formulation
+   (e.g., Explicit) with initialization of solid element families.
+   a. Python object
+   b. unit tests at Python level
 
 4. Implement unit tests for MeshIO at Python level.
-  a. read()/write()
-  b. checkFile()
+   a. read()/write()
+   b. checkFile()
 
   STATUS: 
 
@@ -47,22 +46,22 @@
 ======================================================================
 
 0. Adjust MeshIOAscii format
-  a. Add indices for coordinates, simplices, material ids (easier to see)
-  b. Add group of vertices
+   a. Add indices for coordinates, simplices, material ids (easier to see)
+   b. Add group of vertices
 
 1. Implement MeshIOHDF5 & HDF5
-  a. C++ objects
-  b. unit tests at C++ level
-  b. Python object (MeshIOHDF5)
-  c. bindings
-  d. unit tests at Python level
+   a. C++ objects
+   b. unit tests at C++ level
+   c. Python object (MeshIOHDF5)
+   d. bindings
+   e. unit tests at Python level
 
 2. Implement MeshIOCubit
-  a. C++ objects
-  b. unit tests at C++ level
-  b. Python object (MeshIOCubit)
-  c. bindings
-  d. unit tests at Python level
+   a. C++ objects
+   b. unit tests at C++ level
+   c. Python object (MeshIOCubit)
+   d. bindings
+   e. unit tests at Python level
 
 ======================================================================
 UNRESOLVED ISSUES

Modified: short/3D/PyLith/trunk/configure.ac
===================================================================
--- short/3D/PyLith/trunk/configure.ac	2007-03-16 00:15:21 UTC (rev 6269)
+++ short/3D/PyLith/trunk/configure.ac	2007-03-16 04:19:50 UTC (rev 6270)
@@ -159,9 +159,11 @@
 		unittests/Makefile
 		unittests/libtests/Makefile
 		unittests/libtests/feassemble/Makefile
+		unittests/libtests/materials/Makefile
 		unittests/libtests/meshio/Makefile
 		unittests/pytests/Makefile
 		unittests/pytests/feassemble/Makefile
+		unittests/pytests/materials/Makefile
 		unittests/pytests/meshio/Makefile
                 doc/Makefile])
 

Modified: short/3D/PyLith/trunk/libsrc/materials/ElasticIsotropic3D.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/ElasticIsotropic3D.cc	2007-03-16 00:15:21 UTC (rev 6269)
+++ short/3D/PyLith/trunk/libsrc/materials/ElasticIsotropic3D.cc	2007-03-16 04:19:50 UTC (rev 6270)
@@ -127,10 +127,10 @@
 // ----------------------------------------------------------------------
 // Compute parameters from values in spatial database.
 void
-pylith::materials::ElasticIsotropic3D::_dbToParams(double* paramVals,
-						   const int numParams,
-						   double* dbValues,
-						   const int numValues) const
+pylith::materials::ElasticIsotropic3D::_dbToParameters(double* paramVals,
+						       const int numParams,
+						       double* dbValues,
+						       const int numValues) const
 { // computeParameters
   assert(0 != paramVals);
   assert(_ElasticIsotropic3D::numParameters == numParams);

Modified: short/3D/PyLith/trunk/libsrc/materials/ElasticIsotropic3D.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/ElasticIsotropic3D.hh	2007-03-16 00:15:21 UTC (rev 6269)
+++ short/3D/PyLith/trunk/libsrc/materials/ElasticIsotropic3D.hh	2007-03-16 04:19:50 UTC (rev 6270)
@@ -110,10 +110,10 @@
    * @param dbValues Array of database values
    * @param numValues Number of database values
    */
-  void _dbToParams(double* paramVals,
-		   const int numParams,
-		   double* dbValues,
-		   const int numValues) const;
+  void _dbToParameters(double* paramVals,
+		       const int numParams,
+		       double* dbValues,
+		       const int numValues) const;
 
   /** Compute density at locations from parameters.
    *

Modified: short/3D/PyLith/trunk/libsrc/materials/Material.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/Material.cc	2007-03-16 00:15:21 UTC (rev 6269)
+++ short/3D/PyLith/trunk/libsrc/materials/Material.cc	2007-03-16 04:19:50 UTC (rev 6270)
@@ -140,7 +140,7 @@
 	delete[] paramData; paramData = 0;
 	throw std::runtime_error(msg.str());
       } // if
-      _dbToParams(paramData, numParams, queryData, numValues);
+      _dbToParameters(paramData, numParams, queryData, numValues);
 
       for (int iParam=0; iParam < numParams; ++iParam)
 	cellData[iParam][iQuadPt] = paramData[iParam];

Modified: short/3D/PyLith/trunk/libsrc/materials/Material.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/Material.hh	2007-03-16 00:15:21 UTC (rev 6269)
+++ short/3D/PyLith/trunk/libsrc/materials/Material.hh	2007-03-16 04:19:50 UTC (rev 6270)
@@ -154,10 +154,10 @@
    * @param numValues Number of database values
    */
   virtual
-  void _dbToParams(double* paramVals,
-		  const int numParams,
-		  double* dbValues,
-		  const int numValues) const = 0;
+  void _dbToParameters(double* paramVals,
+		       const int numParams,
+		       double* dbValues,
+		       const int numValues) const = 0;
 
   // NOT IMPLEMENTED ////////////////////////////////////////////////////
 private :

Modified: short/3D/PyLith/trunk/unittests/libtests/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/Makefile.am	2007-03-16 00:15:21 UTC (rev 6269)
+++ short/3D/PyLith/trunk/unittests/libtests/Makefile.am	2007-03-16 04:19:50 UTC (rev 6270)
@@ -12,6 +12,7 @@
 
 SUBDIRS = \
 	feassemble \
+	materials \
 	meshio
 
 # End of file 

Added: short/3D/PyLith/trunk/unittests/libtests/materials/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/materials/Makefile.am	2007-03-16 00:15:21 UTC (rev 6269)
+++ short/3D/PyLith/trunk/unittests/libtests/materials/Makefile.am	2007-03-16 04:19:50 UTC (rev 6270)
@@ -0,0 +1,50 @@
+# -*- Makefile -*-
+#
+# ----------------------------------------------------------------------
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+subpackage = materials
+include $(top_srcdir)/subpackage.am
+
+TESTS = testmaterials
+
+check_PROGRAMS = testmaterials
+
+# Primary source files
+testmaterials_SOURCES = \
+	TestMaterial.cc \
+	test_materials.cc
+
+noinst_HEADERS = \
+	TestMaterial.hh
+
+# Source files associated with testing data
+testmaterials_SOURCES += \
+	data/MaterialData.cc \
+	data/ElasticIsotropic3DData.cc
+
+noinst_HEADERS += \
+	data/MaterialData.hh \
+	data/ElasticIsotropic3DData.hh
+
+testmaterials_LDFLAGS = $(PETSC_LIB)
+
+AM_CPPFLAGS = $(PETSC_SIEVE_FLAGS) $(PETSC_INCLUDE)
+
+testmaterials_LDADD = \
+	-lcppunit -ldl \
+	$(top_builddir)/libsrc/libpylith.la \
+	-lspatialdata
+
+noinst_tmp =
+
+CLEANFILES = $(noinst_tmp)
+
+# End of file 

Added: short/3D/PyLith/trunk/unittests/libtests/materials/TestMaterial.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/materials/TestMaterial.cc	2007-03-16 00:15:21 UTC (rev 6269)
+++ short/3D/PyLith/trunk/unittests/libtests/materials/TestMaterial.cc	2007-03-16 04:19:50 UTC (rev 6270)
@@ -0,0 +1,113 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestMaterial.hh" // Implementation of class methods
+
+#include "pylith/materials/ElasticIsotropic3D.hh" // USES ElasticIsotropic3D
+#include "data/MaterialData.hh" // USES MaterialData
+
+#include "spatialdata/spatialdb/SimpleDB.hh" // USES SimpleDB
+
+// ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( pylith::materials::TestMaterial );
+
+// ----------------------------------------------------------------------
+// Test db()
+void
+pylith::materials::TestMaterial::testDB(void)
+{ // testDB
+  const char* label = "my_database";
+  spatialdata::spatialdb::SimpleDB db;
+  db.label(label);
+  
+  ElasticIsotropic3D material;
+  material.db(&db);
+  
+  CPPUNIT_ASSERT(0 != material._db);
+  CPPUNIT_ASSERT(0 == strcmp(label, material._db->label()));
+} // testDB
+
+// ----------------------------------------------------------------------
+// Test id()
+void
+pylith::materials::TestMaterial::testID(void)
+{ // testID
+  const int id = 346;
+  ElasticIsotropic3D material;
+  material.id(id);
+  
+  CPPUNIT_ASSERT(id == material.id());
+} // testID
+
+// ----------------------------------------------------------------------
+// Test label()
+void
+pylith::materials::TestMaterial::testLabel(void)
+{ // testLabel
+  const char* label = "the_database";
+  ElasticIsotropic3D material;
+  material.label(label);
+  
+  CPPUNIT_ASSERT(0 == strcmp(label, material.label().c_str()));
+} // testLabel
+    
+// ----------------------------------------------------------------------
+// Test initialize()
+void
+pylith::materials::TestMaterial::testInitialize(void)
+{ // testInitialize
+  CPPUNIT_ASSERT(false);
+} // testInitialize
+
+// ----------------------------------------------------------------------
+// Test DBToParameters
+void
+pylith::materials::TestMaterial::_testDBToParameters(Material* material,
+						     const MaterialData& data) const
+{ // _testDBToParameters
+  CPPUNIT_ASSERT(false);
+} // _testDBToParameters
+
+// ----------------------------------------------------------------------
+// Test _dbValues() and _numDBValues()
+void
+pylith::materials::TestMaterial::_testDBValues(Material* material,
+					       const MaterialData& data) const
+{ // _testDBValues
+  const int numDBValues = data.numDBValues;
+
+  CPPUNIT_ASSERT(numDBValues == material->_numDBValues());
+  char** const dbValuesE = data.dbValues;
+  const char** dbValues = material->_dbValues();
+  for (int i=0; i < numDBValues; ++i)
+    CPPUNIT_ASSERT(0 == strcmp(dbValuesE[i], dbValues[i]));
+} // _testDBValues
+
+// ----------------------------------------------------------------------
+// Test _numParameters() and _parameterNames()
+void
+pylith::materials::TestMaterial::_testParameters(Material* material,
+						 const MaterialData& data) const
+{ // _testParameters
+  const int numParameters = data.numParameters;
+
+  CPPUNIT_ASSERT(numParameters == material->_numParameters());
+  char** const namesE = data.parameterNames;
+  const char** names = material->_parameterNames();
+  for (int i=0; i < numParameters; ++i)
+    CPPUNIT_ASSERT(0 == strcmp(namesE[i], names[i]));
+} // _testParameters
+
+
+// End of file 

Added: short/3D/PyLith/trunk/unittests/libtests/materials/TestMaterial.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/materials/TestMaterial.hh	2007-03-16 00:15:21 UTC (rev 6269)
+++ short/3D/PyLith/trunk/unittests/libtests/materials/TestMaterial.hh	2007-03-16 04:19:50 UTC (rev 6270)
@@ -0,0 +1,93 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/**
+ * @file unittests/libtests/materials/TestMaterial.hh
+ *
+ * @brief C++ TestMaterial object
+ *
+ * C++ unit testing for Material.
+ */
+
+#if !defined(pylith_materials_testquadrature_hh)
+#define pylith_materials_testquadrature_hh
+
+#include <cppunit/extensions/HelperMacros.h>
+
+/// Namespace for pylith package
+namespace pylith {
+  namespace materials {
+    class Material;
+    class TestMaterial;
+    class MaterialData;
+  } // materials
+} // pylith
+
+/// C++ unit testing for Material
+class pylith::materials::TestMaterial : public CppUnit::TestFixture
+{ // class TestMaterial
+
+  // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+  CPPUNIT_TEST_SUITE( TestMaterial );
+  CPPUNIT_TEST( testDB );
+  CPPUNIT_TEST( testID );
+  CPPUNIT_TEST( testLabel );
+  CPPUNIT_TEST( testInitialize );
+  CPPUNIT_TEST_SUITE_END();
+
+  // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+  /// Test db()
+  void testDB(void);
+
+  /// Test id()
+  void testID(void);
+
+  /// Test label()
+  void testLabel(void);
+
+  /// Test initialize()
+  void testInitialize(void);
+
+  // PROTECTED METHODS //////////////////////////////////////////////////
+protected :
+
+  /** Test dbToParameters().
+   *
+   * @param material Pointer to material
+   * @param data Data for testing material
+   */
+  void _testDBToParameters(Material* material,
+			   const MaterialData& data) const;
+
+  /** Test _numDBValues and _dbValues()
+   *
+   * @param material Pointer to material
+   * @param data Data for testing material
+   */
+  void _testDBValues(Material* material,
+		     const MaterialData& data) const;
+
+  /** Test _numParameters() and _parameterNames()
+   *
+   * @param material Pointer to material
+   * @param data Data for testing material
+   */
+  void _testParameters(Material* material,
+		       const MaterialData& data) const;
+
+}; // class TestMaterial
+
+#endif // pylith_materials_testquadrature_hh
+
+// End of file 

Added: short/3D/PyLith/trunk/unittests/libtests/materials/data/ElasticIsotropic3DData.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/materials/data/ElasticIsotropic3DData.cc	2007-03-16 00:15:21 UTC (rev 6269)
+++ short/3D/PyLith/trunk/unittests/libtests/materials/data/ElasticIsotropic3DData.cc	2007-03-16 04:19:50 UTC (rev 6270)
@@ -0,0 +1,38 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#include "ElasticIsotropic3DData.hh"
+
+const int pylith::materials::ElasticIsotropic3DData::_numDBValues = 3;
+
+const int pylith::materials::ElasticIsotropic3DData::_numParameters = 1;
+
+const char* pylith::materials::ElasticIsotropic3DData::_dbValues[] =
+  { "density", "vp", "vs" };
+
+const char* pylith::materials::ElasticIsotropic3DData::_parameterNames[] =
+  { "density", "mu", "lambda" };
+
+
+pylith::materials::ElasticIsotropic3DData::ElasticIsotropic3DData(void)
+{ // constructor
+  numDBValues = _numDBValues;
+  numParameters = _numParameters;
+  dbValues = const_cast<char**>(_dbValues);
+  parameterNames = const_cast<char**>(_parameterNames);
+} // constructor
+
+pylith::materials::ElasticIsotropic3DData::~ElasticIsotropic3DData(void)
+{}
+
+
+// End of file

Added: short/3D/PyLith/trunk/unittests/libtests/materials/data/ElasticIsotropic3DData.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/materials/data/ElasticIsotropic3DData.hh	2007-03-16 00:15:21 UTC (rev 6269)
+++ short/3D/PyLith/trunk/unittests/libtests/materials/data/ElasticIsotropic3DData.hh	2007-03-16 04:19:50 UTC (rev 6270)
@@ -0,0 +1,48 @@
+
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#if !defined(pylith_materials_elasticisotropic3ddata_hh)
+#define pylith_materials_elasticisotropic3ddata_hh
+
+#include "MaterialData.hh"
+
+namespace pylith {
+  namespace materials {
+     class ElasticIsotropic3DData;
+  } // pylith
+} // materials
+
+class pylith::materials::ElasticIsotropic3DData : public MaterialData
+{
+
+public: 
+
+  /// Constructor
+  ElasticIsotropic3DData(void);
+
+  /// Destructor
+  ~ElasticIsotropic3DData(void);
+
+private:
+
+  static const int _numDBValues;
+  static const int _numParameters;
+  static const char* _dbValues[];
+  static const char* _parameterNames[];
+
+};
+
+#endif // pylith_materials_elasticisotropic3ddata_hh
+
+
+// End of file

Added: short/3D/PyLith/trunk/unittests/libtests/materials/data/MaterialData.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/materials/data/MaterialData.cc	2007-03-16 00:15:21 UTC (rev 6269)
+++ short/3D/PyLith/trunk/unittests/libtests/materials/data/MaterialData.cc	2007-03-16 04:19:50 UTC (rev 6270)
@@ -0,0 +1,31 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#include "MaterialData.hh"
+
+// ----------------------------------------------------------------------
+// Constructor
+pylith::materials::MaterialData::MaterialData(void) :
+  numDBValues(0),
+  numParameters(0),
+  dbValues(0),
+  parameterNames(0)
+{ // constructor
+} // constructor
+
+// ----------------------------------------------------------------------
+// Destructor
+pylith::materials::MaterialData::~MaterialData(void)
+{ // destructor
+} // destructor
+
+// End of file

Added: short/3D/PyLith/trunk/unittests/libtests/materials/data/MaterialData.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/materials/data/MaterialData.hh	2007-03-16 00:15:21 UTC (rev 6269)
+++ short/3D/PyLith/trunk/unittests/libtests/materials/data/MaterialData.hh	2007-03-16 04:19:50 UTC (rev 6270)
@@ -0,0 +1,46 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#if !defined(pylith_materials_materialdata_hh)
+#define pylith_materials_materialdata_hh
+
+namespace pylith {
+  namespace materials {
+     class MaterialData;
+  } // pylith
+} // materials
+
+class pylith::materials::MaterialData
+{
+
+// PUBLIC METHODS ///////////////////////////////////////////////////////
+public :
+  
+  /// Constructor
+  MaterialData(void);
+
+  /// Destructor
+  ~MaterialData(void);
+
+// PUBLIC MEMBERS ///////////////////////////////////////////////////////
+public:
+
+  int numDBValues; ///< Number of database values
+  int numParameters; ///< Number of parameters
+
+  char** dbValues; ///< Aray of names of database values;
+  char** parameterNames; //< Array of names of parameters
+};
+
+#endif // pylith_materials_materialdata_hh
+
+// End of file

Added: short/3D/PyLith/trunk/unittests/libtests/materials/test_materials.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/materials/test_materials.cc	2007-03-16 00:15:21 UTC (rev 6269)
+++ short/3D/PyLith/trunk/unittests/libtests/materials/test_materials.cc	2007-03-16 04:19:50 UTC (rev 6270)
@@ -0,0 +1,66 @@
+// -*- 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



More information about the cig-commits mailing list