[cig-commits] r5974 - in short/3D/PyLith/trunk: libsrc libsrc/feassemble unittests/libtests/feassemble

brad at geodynamics.org brad at geodynamics.org
Wed Feb 7 08:55:34 PST 2007


Author: brad
Date: 2007-02-07 08:55:34 -0800 (Wed, 07 Feb 2007)
New Revision: 5974

Modified:
   short/3D/PyLith/trunk/libsrc/Makefile.am
   short/3D/PyLith/trunk/libsrc/feassemble/DynExplicitElasticity.cc
   short/3D/PyLith/trunk/libsrc/feassemble/DynExplicitElasticity.hh
   short/3D/PyLith/trunk/libsrc/feassemble/Integrator.cc
   short/3D/PyLith/trunk/libsrc/feassemble/Integrator.hh
   short/3D/PyLith/trunk/libsrc/feassemble/IntegratorDynExplicit.cc
   short/3D/PyLith/trunk/libsrc/feassemble/IntegratorDynExplicit.hh
   short/3D/PyLith/trunk/libsrc/feassemble/Makefile.am
   short/3D/PyLith/trunk/unittests/libtests/feassemble/Makefile.am
   short/3D/PyLith/trunk/unittests/libtests/feassemble/TestIntegrator.cc
   short/3D/PyLith/trunk/unittests/libtests/feassemble/TestIntegrator.hh
Log:
Added more comments to files and tidied up Integrator interfaces.

Modified: short/3D/PyLith/trunk/libsrc/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/libsrc/Makefile.am	2007-02-07 06:31:09 UTC (rev 5973)
+++ short/3D/PyLith/trunk/libsrc/Makefile.am	2007-02-07 16:55:34 UTC (rev 5974)
@@ -21,6 +21,7 @@
 
 libpylith_la_SOURCES = \
 	feassemble/DynExplicitElasticity.cc \
+	feassemble/Integrator.cc \
 	feassemble/IntegratorDynExplicit.cc \
 	feassemble/Quadrature.cc \
 	feassemble/Quadrature1D.cc \

Modified: short/3D/PyLith/trunk/libsrc/feassemble/DynExplicitElasticity.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/DynExplicitElasticity.cc	2007-02-07 06:31:09 UTC (rev 5973)
+++ short/3D/PyLith/trunk/libsrc/feassemble/DynExplicitElasticity.cc	2007-02-07 16:55:34 UTC (rev 5974)
@@ -46,16 +46,16 @@
 // finite elements.
 void
 pylith::feassemble::DynExplicitElasticity::integrateResidual(
-			      const ALE::Obj<real_section_type>& fieldOut,
-			      const ALE::Obj<real_section_type>& fieldInT,
-			      const ALE::Obj<real_section_type>& fieldInTmdt,
+			      const ALE::Obj<real_section_type>& residual,
+			      const ALE::Obj<real_section_type>& dispT,
+			      const ALE::Obj<real_section_type>& dispTmdt,
 			      const ALE::Obj<real_section_type>& coordinates)
 { // integrateResidual
   assert(0 != _quadrature);
 
   // Get information about section
   const topology_type::patch_type patch = 0;
-  const ALE::Obj<topology_type>& topology = fieldInT->getTopology();
+  const ALE::Obj<topology_type>& topology = dispT->getTopology();
   const ALE::Obj<topology_type::label_sequence>& cells = 
     topology->heightStratum(patch, 0);
   const topology_type::label_sequence::iterator cellsEnd = cells->end();
@@ -73,10 +73,10 @@
     _resetCellVector();
 
     // Restrict input fields to cell
-    const real_section_type::value_type* fieldInTCell = 
-      fieldInT->restrict(patch, *cellIter);
-    const real_section_type::value_type* fieldInTmdtCell = 
-      fieldInTmdt->restrict(patch, *cellIter);
+    const real_section_type::value_type* dispTCell = 
+      dispT->restrict(patch, *cellIter);
+    const real_section_type::value_type* dispTmdtCell = 
+      dispTmdt->restrict(patch, *cellIter);
 
     // Get cell geometry information
     const int numQuadPts = _quadrature->numQuadPts();
@@ -108,7 +108,7 @@
           const int jBlock = jBasis * spaceDim;
           const double val = valI * basis[iQ+jBasis];
           for (int iDim=0; iDim < spaceDim; ++iDim)
-            _cellVector[iBlock+iDim] += val * fieldInTCell[jBlock+iDim];
+            _cellVector[iBlock+iDim] += val * dispTCell[jBlock+iDim];
         } // for
       } // for
     } // for
@@ -118,7 +118,7 @@
       throw std::runtime_error("Logging PETSc flops failed.");
     
     // Assemble cell contribution into field
-    fieldOut->updateAdd(patch, *cellIter, _cellVector);
+    residual->updateAdd(patch, *cellIter, _cellVector);
   } // for
 } // integrateResidual
 
@@ -127,7 +127,7 @@
 void
 pylith::feassemble::DynExplicitElasticity::integrateJacobian(
 			     PetscMat* mat,
-			     const ALE::Obj<real_section_type>& fieldIn,
+			     const ALE::Obj<real_section_type>& dispT,
 			     const ALE::Obj<real_section_type>& coordinates)
 { // integrateJacobian
   assert(0 != mat);
@@ -143,8 +143,8 @@
   const ALE::Obj<ALE::Mesh::order_type>& globalOrder = 
     ALE::New::NumberingFactory<topology_type>::singleton(
        topology->debug())->getGlobalOrder(topology, patch, 
-					  fieldIn->getName(), 
-					  fieldIn->getAtlas());
+					  dispT->getName(), 
+					  dispT->getAtlas());
 
   // Setup symmetric, sparse matrix
   // :TODO: This needs to be moved outside Integrator object, because
@@ -154,7 +154,7 @@
   err = MatCreate(topology->comm(), mat);
   err = MatSetSizes(*mat, localSize, localSize, globalSize, globalSize);
   err = MatSetFromOptions(*mat);
-  err = preallocateMatrix(topology, fieldIn->getAtlas(), globalOrder, *mat);
+  err = preallocateMatrix(topology, dispT->getAtlas(), globalOrder, *mat);
 
   // Allocate matrix for cell values (if necessary)
   _initCellMatrix();
@@ -206,7 +206,7 @@
       throw std::runtime_error("Logging PETSc flops failed.");
     
     // Assemble cell contribution into sparse matrix
-    err = updateOperator(*mat, fieldIn, globalOrder, *cellIter, _cellMatrix, 
+    err = updateOperator(*mat, dispT, globalOrder, *cellIter, _cellMatrix, 
 			 ADD_VALUES);
   } // for
 } // integrateResidual
@@ -216,7 +216,7 @@
 void
 pylith::feassemble::DynExplicitElasticity::integrateJacobian(
 			     const ALE::Obj<real_section_type>& fieldOut,
-			     const ALE::Obj<real_section_type>& fieldIn,
+			     const ALE::Obj<real_section_type>& dispT,
 			     const ALE::Obj<real_section_type>& coordinates)
 { // integrateJacobian
   assert(0 != _quadrature);

Modified: short/3D/PyLith/trunk/libsrc/feassemble/DynExplicitElasticity.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/DynExplicitElasticity.hh	2007-02-07 06:31:09 UTC (rev 5973)
+++ short/3D/PyLith/trunk/libsrc/feassemble/DynExplicitElasticity.hh	2007-02-07 16:55:34 UTC (rev 5974)
@@ -23,39 +23,25 @@
  *
  * A = 1/(dt*dt) [M]
  *
- * b = 2/(dt*dt)[M]{u(t)} - 1/(dt*dt)[M]{u(t-dt)} - 1/s[K]{u(t)} + {f(t)}
+ * b = 2/(dt*dt)[M]{u(t)} - 1/(dt*dt)[M]{u(t-dt)} - [K]{u(t)} + {f(t)}
  */
 
 #if !defined(pylith_feassemble_dynexplicitelasticity_hh)
 #define pylith_feassemble_dynexplicitelasticity_hh
 
-#include <petscmesh.h> // USES Mesh
-#include "pylith/utils/petscfwd.h" // USES PetscMat
+#include "IntegratorDynExplicit.hh" // ISA IntegratorDynExplicit
 
-#include "IntegratorDynExplicit.hh"
-
 namespace pylith {
   namespace feassemble {
     class DynExplicitElasticity;
     class TestDynExplicitElasticity;
-
-    class Quadrature; // HOLDSA Quadrature
   } // feassemble
 } // pylith
 
-class pylith::feassemble::DynExplicitElasticity : 
-  public IntegratorDynExplicit
+class pylith::feassemble::DynExplicitElasticity : public IntegratorDynExplicit
 { // DynExplicitElasticity
   friend class TestDynExplicitElasticity; // unit testing
 
-// PUBLIC TYPEDEFS //////////////////////////////////////////////////////
-public :
-
-  typedef ALE::Mesh Mesh;
-  typedef Mesh::topology_type topology_type;
-  typedef topology_type::point_type point_type;
-  typedef Mesh::real_section_type real_section_type;
-
 // PUBLIC MEMBERS ///////////////////////////////////////////////////////
 public :
 
@@ -71,34 +57,34 @@
   /** Integrate residual term (b) for dynamic elasticity term 
    * for 3-D finite elements.
    *
-   * @param fieldOut Output field
-   * @param fieldInT Input field at time t
-   * @param fieldInTmdt Input field at time t-dt
+   * @param residual Residual field (output)
+   * @param dispT Displacement field at time t
+   * @param dispTmdt Displacement field at time t-dt
    * @param coordinates Field of cell vertex coordinates
    */
-  void integrateResidual(const ALE::Obj<real_section_type>& fieldOut,
-			 const ALE::Obj<real_section_type>& fieldInT,
-			 const ALE::Obj<real_section_type>& fieldInTmdt,
+  void integrateResidual(const ALE::Obj<real_section_type>& residual,
+			 const ALE::Obj<real_section_type>& dispT,
+			 const ALE::Obj<real_section_type>& dispTmdt,
 			 const ALE::Obj<real_section_type>& coordinates);
 
   /** Compute matrix (A) associated with operator.
    *
    * @param mat Sparse matrix
-   * @param fieldIn Input field at time t
+   * @param dispT Displacement at time t
    * @param coordinates Field of cell vertex coordinates
    */
   void integrateJacobian(PetscMat* mat,
-			 const ALE::Obj<real_section_type>& fieldIn,
+			 const ALE::Obj<real_section_type>& dispT,
 			 const ALE::Obj<real_section_type>& coordinates);
   
   /** Compute field (A) associated with lumped operator.
    *
    * @param fieldOut Output Jacobian field
-   * @param fieldIn Input field at time t
+   * @param dispT Displacement at time t
    * @param coordinates Field of cell vertex coordinates
    */
   void integrateJacobian(const ALE::Obj<real_section_type>& fieldOut,
-			 const ALE::Obj<real_section_type>& fieldIn,
+			 const ALE::Obj<real_section_type>& dispT,
 			 const ALE::Obj<real_section_type>& coordinates);
   
   /** Initialize, get material property parameters from database.

Modified: short/3D/PyLith/trunk/libsrc/feassemble/Integrator.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/Integrator.cc	2007-02-07 06:31:09 UTC (rev 5973)
+++ short/3D/PyLith/trunk/libsrc/feassemble/Integrator.cc	2007-02-07 16:55:34 UTC (rev 5974)
@@ -14,8 +14,7 @@
 
 #include "Integrator.hh" // implementation of class methods
 
-#include "Quadrature.hh"
-#include "spatialdata/spatialdb/SpatialDB.hh"
+#include "Quadrature.hh" // USES Quadrature
 
 #include <assert.h> // USES assert()
 
@@ -112,4 +111,5 @@
     _cellMatrix[i] = 0.0;
 } // _resetCellMatrix
 
+
 // End of file 

Modified: short/3D/PyLith/trunk/libsrc/feassemble/Integrator.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/Integrator.hh	2007-02-07 06:31:09 UTC (rev 5973)
+++ short/3D/PyLith/trunk/libsrc/feassemble/Integrator.hh	2007-02-07 16:55:34 UTC (rev 5974)
@@ -20,7 +20,6 @@
 #define pylith_feassemble_integrator_hh
 
 #include <petscmesh.h> // USES Mesh
-#include "pylith/utils/petscfwd.h" // USES PetscMat
 
 namespace pylith {
   namespace feassemble {
@@ -31,15 +30,6 @@
   } // feassemble
 } // pylith
 
-namespace spatialdata {
-  namespace spatialdb {
-    class SpatialDB; // USES SpatialDB
-  } // spatialdb
-  namespace geocoords {
-    class CoordSys; // USES CoordSys
-  } // geocoords
-} // spatialdata
-
 class pylith::feassemble::Integrator
 { // Integrator
   friend class TestIntegrator; // unit testing
@@ -59,50 +49,14 @@
   Integrator(void);
 
   /// Destructor
-  virtual
   ~Integrator(void);
 
-  /// Create a copy of this object.
-  virtual
-  Integrator* clone(void) const = 0;
-
-  /** Integrate elasticity term for 3-D finite elements.
-   *
-   * @param fieldOut Output field
-   * @param fieldIn Input field
-   * @param coordinates Field of cell vertex coordinates
-   */
-  virtual 
-  void integrateAction(const ALE::Obj<real_section_type>& fieldOut,
-		       const ALE::Obj<real_section_type>& fieldIn,
-		       const ALE::Obj<real_section_type>& coordinates) = 0;
-
-  /** Compute matrix associated with operator.
-   *
-   * @param mat Sparse matrix
-   * @param coordinates Field of cell vertex coordinates
-   */
-  virtual 
-  void integrate(PetscMat* mat,
-		 const ALE::Obj<real_section_type>& fieldIn,
-		 const ALE::Obj<real_section_type>& coordinates) = 0;
-
   /** Set quadrature for integrating finite-element quantities.
    *
    * @param q Quadrature for integrating.
    */
   void quadrature(const Quadrature* q);
 
-  /** Initialize, get material property parameters from database.
-   *
-   * @param mesh PETSc mesh
-   * @param cs Pointer to coordinate system of vertices
-   * @param db Pointer to spatial database with material property parameters
-   */
-  virtual void initialize(ALE::Obj<ALE::Mesh>& mesh,
-			  spatialdata::geocoords::CoordSys* cs,
-			  spatialdata::spatialdb::SpatialDB* db) = 0;
-
 // PROTECTED METHODS ////////////////////////////////////////////////////
 protected :
 

Modified: short/3D/PyLith/trunk/libsrc/feassemble/IntegratorDynExplicit.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/IntegratorDynExplicit.cc	2007-02-07 06:31:09 UTC (rev 5973)
+++ short/3D/PyLith/trunk/libsrc/feassemble/IntegratorDynExplicit.cc	2007-02-07 16:55:34 UTC (rev 5974)
@@ -14,17 +14,9 @@
 
 #include "IntegratorDynExplicit.hh" // implementation of class methods
 
-#include "Quadrature.hh"
-#include "spatialdata/spatialdb/SpatialDB.hh"
-
-#include <assert.h> // USES assert()
-
 // ----------------------------------------------------------------------
 // Constructor
-pylith::feassemble::IntegratorDynExplicit::IntegratorDynExplicit(void) :
-  _quadrature(0),
-  _cellVector(0),
-  _cellMatrix(0)
+pylith::feassemble::IntegratorDynExplicit::IntegratorDynExplicit(void)
 { // constructor
 } // constructor
 
@@ -32,85 +24,14 @@
 // Destructor
 pylith::feassemble::IntegratorDynExplicit::~IntegratorDynExplicit(void)
 { // destructor
-  delete _quadrature; _quadrature = 0;
-  delete[] _cellVector; _cellVector = 0;
-  delete[] _cellMatrix; _cellMatrix = 0;
 } // destructor
   
 // ----------------------------------------------------------------------
 // Copy constructor
 pylith::feassemble::IntegratorDynExplicit::IntegratorDynExplicit(const IntegratorDynExplicit& i) :
-  _cellVector(0),
-  _cellMatrix(0)
+  Integrator(i)
 { // copy constructor
-  if (0 != i._quadrature)
-    _quadrature = i._quadrature->clone();
 } // copy constructor
 
-// ----------------------------------------------------------------------
-// Set quadrature for integrating finite-element quantities.
-void
-pylith::feassemble::IntegratorDynExplicit::quadrature(const Quadrature* q)
-{ // quadrature
-  delete _quadrature; 
-  _quadrature = (0 != q) ? q->clone() : 0;
 
-  // Deallocate cell vector and matrix since size may change
-  delete[] _cellVector; _cellVector = 0;
-  delete[] _cellMatrix; _cellMatrix = 0;
-} // quadrature
-
-// ----------------------------------------------------------------------
-// Initialize vector containing result of integration action for cell.
-void
-pylith::feassemble::IntegratorDynExplicit::_initCellVector(void)
-{ // _initCellVector
-  assert(0 != _quadrature);
-  const int size = _quadrature->spaceDim() * _quadrature->numCorners();
-  if (0 == _cellVector)
-    _cellVector = (size > 0) ? new real_section_type::value_type[size] : 0;
-  for (int i=0; i < size; ++i)
-    _cellVector[i] = 0.0;
-} // _initCellVector
-
-// ----------------------------------------------------------------------
-// Zero out vector containing result of integration actions for cell.
-void
-pylith::feassemble::IntegratorDynExplicit::_resetCellVector(void)
-{ // _resetCellVector
-  assert(0 != _quadrature);
-  const int size = _quadrature->spaceDim() * _quadrature->numCorners();
-  for (int i=0; i < size; ++i)
-    _cellVector[i] = 0.0;
-} // _resetCellVector
-
-// ----------------------------------------------------------------------
-// Initialize matrix containing result of integration for cell.
-void
-pylith::feassemble::IntegratorDynExplicit::_initCellMatrix(void)
-{ // _initCellMatrix
-  assert(0 != _quadrature);
-  const int size =
-    _quadrature->spaceDim() * _quadrature->numCorners() *
-    _quadrature->spaceDim() * _quadrature->numCorners();
-  if (0 == _cellMatrix)
-    _cellMatrix = (size > 0) ? new real_section_type::value_type[size] : 0;
-  for (int i=0; i < size; ++i)
-    _cellMatrix[i] = 0.0;
-} // _initCellMatrix
-
-// ----------------------------------------------------------------------
-// Zero out matrix containing result of integration for cell.
-void
-pylith::feassemble::IntegratorDynExplicit::_resetCellMatrix(void)
-{ // _resetCellMatrix
-  assert(0 != _quadrature);
-  const int size =
-    _quadrature->spaceDim() * _quadrature->numCorners() *
-    _quadrature->spaceDim() * _quadrature->numCorners();
-  for (int i=0; i < size; ++i)
-    _cellMatrix[i] = 0.0;
-} // _resetCellMatrix
-
-
 // End of file 

Modified: short/3D/PyLith/trunk/libsrc/feassemble/IntegratorDynExplicit.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/IntegratorDynExplicit.hh	2007-02-07 06:31:09 UTC (rev 5973)
+++ short/3D/PyLith/trunk/libsrc/feassemble/IntegratorDynExplicit.hh	2007-02-07 16:55:34 UTC (rev 5974)
@@ -25,15 +25,14 @@
 #if !defined(pylith_feassemble_integratordynexplicit_hh)
 #define pylith_feassemble_integratordynexplicit_hh
 
-#include <petscmesh.h> // USES Mesh
 #include "pylith/utils/petscfwd.h" // USES PetscMat
 
+#include "Integrator.hh" // ISA Integrator
+
 namespace pylith {
   namespace feassemble {
     class IntegratorDynExplicit;
     class TestIntegratorDynExplicit;
-
-    class Quadrature; // HOLDSA Quadrature
   } // feassemble
 } // pylith
 
@@ -46,18 +45,10 @@
   } // geocoords
 } // spatialdata
 
-class pylith::feassemble::IntegratorDynExplicit
+class pylith::feassemble::IntegratorDynExplicit : public Integrator
 { // Integrator
   friend class TestIntegratorDynExplicit; // unit testing
 
-// PUBLIC TYPEDEFS //////////////////////////////////////////////////////
-public :
-
-  typedef ALE::Mesh Mesh;
-  typedef Mesh::topology_type topology_type;
-  typedef topology_type::point_type point_type;
-  typedef Mesh::real_section_type real_section_type;
-
 // PUBLIC MEMBERS ///////////////////////////////////////////////////////
 public :
 
@@ -75,13 +66,13 @@
   /** Integrate residual term (b) for dynamic elasticity term 
    * for 3-D finite elements.
    *
-   * @param fieldOut Output field
+   * @param residual Residual field (output)
    * @param fieldInT Input field at time t
    * @param fieldInTmdt Input field at time t-dt
    * @param coordinates Field of cell vertex coordinates
    */
   virtual 
-  void integrateResidual(const ALE::Obj<real_section_type>& fieldOut,
+  void integrateResidual(const ALE::Obj<real_section_type>& residual,
 			 const ALE::Obj<real_section_type>& fieldInT,
 			 const ALE::Obj<real_section_type>& fieldInTmdt,
 			 const ALE::Obj<real_section_type>& coordinates) = 0;
@@ -108,12 +99,6 @@
 			 const ALE::Obj<real_section_type>& fieldIn,
 			 const ALE::Obj<real_section_type>& coordinates) = 0;
   
-  /** Set quadrature for integrating finite-element quantities.
-   *
-   * @param q Quadrature for integrating.
-   */
-  void quadrature(const Quadrature* q);
-
   /** Initialize, get material property parameters from database.
    *
    * @param mesh PETSc mesh
@@ -134,35 +119,12 @@
    */
   IntegratorDynExplicit(const IntegratorDynExplicit& i);
 
-  /// Initialize vector containing result of integration action for cell.
-  void _initCellVector(void);
-
-  /// Zero out vector containing result of integration actions for cell.
-  void _resetCellVector(void);
-
-  /// Initialize matrix containing result of integration for cell.
-  void _initCellMatrix(void);
-
-  /// Zero out matrix containing result of integration for cell.
-  void _resetCellMatrix(void);
-
 // PRIVATE METHODS //////////////////////////////////////////////////////
 private :
 
   /// Not implemented
   const IntegratorDynExplicit& operator=(const IntegratorDynExplicit&);
 
-// PROTECTED MEMBERS ////////////////////////////////////////////////////
-protected :
-
-  Quadrature* _quadrature; ///< Quadrature for integrating finite-element
-
-  /// Vector local to cell containing result of integration action
-  real_section_type::value_type* _cellVector;
-
-  /// Matrix local to cell containing result of integration
-  real_section_type::value_type* _cellMatrix;
-
 }; // IntegratorDynExplicit
 
 #endif // pylith_feassemble_integratordynexplicit_hh

Modified: short/3D/PyLith/trunk/libsrc/feassemble/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/Makefile.am	2007-02-07 06:31:09 UTC (rev 5973)
+++ short/3D/PyLith/trunk/libsrc/feassemble/Makefile.am	2007-02-07 16:55:34 UTC (rev 5974)
@@ -15,6 +15,7 @@
 
 subpkginclude_HEADERS = \
 	DynExplicitElasticity.hh \
+	Integrator.hh \
 	IntegratorDynExplicit.hh \
 	Quadrature.hh \
 	Quadrature.icc \

Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/Makefile.am	2007-02-07 06:31:09 UTC (rev 5973)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/Makefile.am	2007-02-07 16:55:34 UTC (rev 5974)
@@ -19,6 +19,7 @@
 
 # Primary source files
 testfeassemble_SOURCES = \
+	TestIntegrator.cc \
 	TestQuadrature.cc \
 	TestQuadrature1D.cc \
 	TestQuadrature1Din2D.cc \
@@ -27,7 +28,6 @@
 	TestQuadrature3D.cc \
 	test_feassemble.cc
 
-#TestIntegrator.cc \
 #TestIntegratorInertia.cc \
 #TestIntegratorInertia1D.cc \
 #TestIntegratorInertia2D.cc \

Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestIntegrator.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestIntegrator.cc	2007-02-07 06:31:09 UTC (rev 5973)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestIntegrator.cc	2007-02-07 16:55:34 UTC (rev 5974)
@@ -14,9 +14,8 @@
 
 #include "TestIntegrator.hh" // Implementation of class methods
 
-#include "pylith/feassemble/IntegratorInertia.hh" // USES IntegratorInertia
+#include "pylith/feassemble/Integrator.hh" // USES Integrator
 #include "pylith/feassemble/Quadrature1D.hh" // USES Quadrature1D
-#include "data/IntegratorData.hh" // USES IntegratorData
 
 #include <petscmat.h>
 
@@ -24,45 +23,23 @@
 CPPUNIT_TEST_SUITE_REGISTRATION( pylith::feassemble::TestIntegrator );
 
 // ----------------------------------------------------------------------
-namespace pylith {
-  namespace feassemble {
-    class _TestIntegrator;
-  } // feassemble
-} // pylith
-
-/// Helper class for TestIntegrator
-class pylith::feassemble::_TestIntegrator {
-
-public :
-  /** Setup mesh.
-   *
-   * @param data Integrator data
-   */
-  static 
-  ALE::Obj<ALE::Mesh>
-  _setupMesh(const IntegratorData& data);
-}; // _TestIntegrator
-
-// ----------------------------------------------------------------------
 // Test clone().
 void
-pylith::feassemble::TestIntegrator::testClone(void)
-{ // testClone
-  // Test cloning by testing value of minJacobian value in quadrature
+pylith::feassemble::TestIntegrator::testCopy(void)
+{ // testCopy
+  // Test copy constructor by testing value of minJacobian value in quadrature
 
   Quadrature1D quadrature;
   const double minJacobian = 4.0;
   quadrature.minJacobian(minJacobian);
   
-  IntegratorInertia iOrig;
+  Integrator iOrig;
   iOrig.quadrature(&quadrature);
 
-  Integrator* iCopy = iOrig.clone();
-  CPPUNIT_ASSERT_EQUAL(minJacobian, iCopy->_quadrature->minJacobian());
+  Integrator iCopy = Integrator(iOrig);
+  CPPUNIT_ASSERT_EQUAL(minJacobian, iCopy._quadrature->minJacobian());
+} // testCopy
 
-  delete iCopy;
-} // testClone
-
 // ----------------------------------------------------------------------
 // Test quadrature().
 void
@@ -75,14 +52,36 @@
   const double minJacobian = 4.0;
   quadrature.minJacobian(minJacobian);
   
-  IntegratorInertia integrator;
+  Integrator integrator;
   integrator.quadrature(&quadrature);
 
   CPPUNIT_ASSERT_EQUAL(minJacobian, integrator._quadrature->minJacobian());
 } // testQuadrature
 
 
+#if 0
 // ----------------------------------------------------------------------
+namespace pylith {
+  namespace feassemble {
+    class _TestIntegrator;
+  } // feassemble
+} // pylith
+
+/// Helper class for TestIntegrator
+class pylith::feassemble::_TestIntegrator {
+
+public :
+  /** Setup mesh.
+   *
+   * @param data Integrator data
+   */
+  static 
+  ALE::Obj<ALE::Mesh>
+  _setupMesh(const IntegratorData& data);
+}; // _TestIntegrator
+
+
+// ----------------------------------------------------------------------
 // Test integrateAction()
 void
 pylith::feassemble::TestIntegrator::_testIntegrateAction(Integrator* integrator,
@@ -90,7 +89,6 @@
 { // _testIntegrateAction
   CPPUNIT_ASSERT(false);
 
-#if 0
   typedef ALE::Mesh::real_section_type real_section_type;
   typedef ALE::Mesh::topology_type topology_type;
 
@@ -143,7 +141,6 @@
     for (int iDim=0; iDim < fiberDim; ++iDim)
       CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, vals[iDim]/valsE[iDim], tolerance);
   } // for
-#endif
 } // _testIntegrateAction
 
 // ----------------------------------------------------------------------
@@ -154,7 +151,6 @@
 { // _testIntegrate
   CPPUNIT_ASSERT(false);
 
-#if 0
   typedef ALE::Mesh::real_section_type real_section_type;
   typedef ALE::Mesh::topology_type topology_type;
 
@@ -258,7 +254,6 @@
     std::cerr << err << std::endl;
     throw;
   } // try/catch
-#endif
 } // _testIntegrate
 
 // ----------------------------------------------------------------------
@@ -295,6 +290,7 @@
 
   return mesh;
 } // _setupMesh
+#endif
 
 
 // End of file 

Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestIntegrator.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestIntegrator.hh	2007-02-07 06:31:09 UTC (rev 5973)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestIntegrator.hh	2007-02-07 16:55:34 UTC (rev 5974)
@@ -38,7 +38,7 @@
 
   // CPPUNIT TEST SUITE /////////////////////////////////////////////////
   CPPUNIT_TEST_SUITE( TestIntegrator );
-  CPPUNIT_TEST( testClone );
+  CPPUNIT_TEST( testCopy );
   CPPUNIT_TEST( testQuadrature );
 
   CPPUNIT_TEST_SUITE_END();
@@ -46,31 +46,12 @@
   // PUBLIC METHODS /////////////////////////////////////////////////////
 public :
 
-  /// Test clone()
-  void testClone(void);
+  /// Test copy constructor.
+  void testCopy(void);
 
   /// Test quadrature()
   void testQuadrature(void);
 
-  // PROTECTED METHODS //////////////////////////////////////////////////
-protected :
-
-  /** Test integrateAction()
-   *
-   * @param integrator Pointer to integrator
-   * @param data Data for testing integrator
-   */
-  void _testIntegrateAction(Integrator* integrator,
-			    const IntegratorData& data) const;
-
-  /** Test integrate()
-   *
-   * @param integrator Pointer to integrator
-   * @param data Data for testing integrator
-   */
-  void _testIntegrate(Integrator* integrator,
-		      const IntegratorData& data) const;
-
 }; // class TestIntegrator
 
 #endif // pylith_feassemble_testintegrator_hh



More information about the cig-commits mailing list