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

brad at geodynamics.org brad at geodynamics.org
Tue Apr 10 08:16:14 PDT 2007


Author: brad
Date: 2007-04-10 08:16:13 -0700 (Tue, 10 Apr 2007)
New Revision: 6536

Added:
   short/3D/PyLith/trunk/libsrc/utils/array.hh
   short/3D/PyLith/trunk/libsrc/utils/arrayfwd.hh
Removed:
   short/3D/PyLith/trunk/libsrc/utils/stlfwd.hh
Modified:
   short/3D/PyLith/trunk/libsrc/feassemble/ExplicitElasticity.cc
   short/3D/PyLith/trunk/libsrc/materials/ElasticIsotropic3D.cc
   short/3D/PyLith/trunk/libsrc/materials/ElasticMaterial.cc
   short/3D/PyLith/trunk/libsrc/materials/ElasticMaterial.hh
   short/3D/PyLith/trunk/libsrc/materials/ElasticPlaneStrain.cc
   short/3D/PyLith/trunk/libsrc/materials/ElasticPlaneStress.cc
   short/3D/PyLith/trunk/libsrc/materials/ElasticStrain1D.cc
   short/3D/PyLith/trunk/libsrc/materials/ElasticStress1D.cc
   short/3D/PyLith/trunk/libsrc/materials/Material.cc
   short/3D/PyLith/trunk/libsrc/materials/Material.hh
   short/3D/PyLith/trunk/libsrc/utils/Makefile.am
   short/3D/PyLith/trunk/unittests/libtests/materials/TestElasticIsotropic3D.cc
   short/3D/PyLith/trunk/unittests/libtests/materials/TestElasticMaterial.cc
   short/3D/PyLith/trunk/unittests/libtests/materials/TestElasticMaterial.hh
   short/3D/PyLith/trunk/unittests/libtests/materials/TestMaterial.cc
Log:
A little more cleanup of materials. Get cell parameters in ElasticMateria::initCellData() for current cell instead of retrieving each time in calcDensity(), etc.

Modified: short/3D/PyLith/trunk/libsrc/feassemble/ExplicitElasticity.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/ExplicitElasticity.cc	2007-04-10 09:58:18 UTC (rev 6535)
+++ short/3D/PyLith/trunk/libsrc/feassemble/ExplicitElasticity.cc	2007-04-10 15:16:13 UTC (rev 6536)
@@ -16,11 +16,11 @@
 
 #include "Quadrature.hh" // USES Quadrature
 #include "pylith/materials/ElasticMaterial.hh" // USES ElasticMaterial
+#include "pylith/utils/array.hh" // USES double_array
 
 #include "petscmat.h" // USES PetscMat
 #include "spatialdata/spatialdb/SpatialDB.hh"
 
-#include <valarray> // USES std::valarray (double_array)
 #include <assert.h> // USES assert()
 #include <stdexcept> // USES std::runtime_error
 
@@ -95,7 +95,6 @@
 
   // Allocate vector for cell values (if necessary)
   _initCellVector();
-  _material->initCellData(numQuadPts);
 
   for (Mesh::label_sequence::iterator cellIter=cells->begin();
        cellIter != cellsEnd;
@@ -103,6 +102,9 @@
     // Compute geometry information for current cell
     _quadrature->computeGeometry(mesh, coordinates, *cellIter);
 
+    // Set cell data in material
+    _material->initCellData(*cellIter, numQuadPts);
+
     // Reset element vector to zero
     _resetCellVector();
 
@@ -121,7 +123,7 @@
 
     // Compute action for inertial terms
     const std::vector<double_array>& density = 
-      _material->calcDensity(*cellIter);
+      _material->calcDensity();
     for (int iQuad=0; iQuad < numQuadPts; ++iQuad) {
       const double wt = 
 	quadWts[iQuad] * jacobianDet[iQuad] * density[iQuad][0] / dt2;
@@ -165,7 +167,7 @@
 	  totalStrain[iQuad][0] += basisDeriv[iQ+iBasis] * dispTCell[iBasis];
       } // for
       const std::vector<double_array>& stress = 
-	_material->calcStress(*cellIter, totalStrain);
+	_material->calcStress(totalStrain);
 
       // Compute elastic action
       for (int iQuad=0; iQuad < numQuadPts; ++iQuad) {
@@ -199,7 +201,7 @@
 	} // for
       } // for
       const std::vector<double_array>& stress = 
-	_material->calcStress(*cellIter, totalStrain);
+	_material->calcStress(totalStrain);
 
       // Compute elastic action
       for (int iQuad=0; iQuad < numQuadPts; ++iQuad) {
@@ -245,7 +247,7 @@
 	} // for
       } // for
       const std::vector<double_array>& stress = 
-	_material->calcStress(*cellIter, totalStrain);
+	_material->calcStress(totalStrain);
 
       // Compute elastic action
       for (int iQuad=0; iQuad < numQuadPts; ++iQuad) {
@@ -311,7 +313,6 @@
 
   // Allocate vector for cell values (if necessary)
   _initCellMatrix();
-  _material->initCellData(numQuadPts);
 
   for (Mesh::label_sequence::iterator cellIter=cells->begin();
        cellIter != cellsEnd;
@@ -319,6 +320,9 @@
     // Compute geometry information for current cell
     _quadrature->computeGeometry(mesh, coordinates, *cellIter);
 
+    // Set cell data in material
+    _material->initCellData(*cellIter, numQuadPts);
+
     // Reset element vector to zero
     _resetCellMatrix();
 
@@ -327,8 +331,7 @@
     const double* jacobianDet = _quadrature->jacobianDet();
 
     // Get material physical properties at quadrature points for this cell
-    const std::vector<double_array>& density = 
-      _material->calcDensity(*cellIter);
+    const std::vector<double_array>& density = _material->calcDensity();
 
     // Compute Jacobian for cell
 

Modified: short/3D/PyLith/trunk/libsrc/materials/ElasticIsotropic3D.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/ElasticIsotropic3D.cc	2007-04-10 09:58:18 UTC (rev 6535)
+++ short/3D/PyLith/trunk/libsrc/materials/ElasticIsotropic3D.cc	2007-04-10 15:16:13 UTC (rev 6536)
@@ -14,7 +14,8 @@
 
 #include "ElasticIsotropic3D.hh" // implementation of object methods
 
-#include <valarray> // USES std::valarray (double_array)
+#include "pylith/utils/array.hh" // USES double_array
+
 #include <assert.h> // USES assert()
 
 // ----------------------------------------------------------------------

Modified: short/3D/PyLith/trunk/libsrc/materials/ElasticMaterial.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/ElasticMaterial.cc	2007-04-10 09:58:18 UTC (rev 6535)
+++ short/3D/PyLith/trunk/libsrc/materials/ElasticMaterial.cc	2007-04-10 15:16:13 UTC (rev 6536)
@@ -15,10 +15,10 @@
 #include "ElasticMaterial.hh" // implementation of object methods
 
 #include "pylith/feassemble/ParameterManager.hh" // USES ParameterManager
+#include "pylith/utils/array.hh" // USES double_array
 
 #include <petscmesh.h> // USES Mesh
 
-#include <valarray> // USES std::valarray (double_array)
 #include <assert.h> // USES assert()
 
 // ----------------------------------------------------------------------
@@ -45,10 +45,8 @@
 // ----------------------------------------------------------------------
 // Compute density for cell at quadrature points.
 const std::vector<pylith::double_array>&
-pylith::materials::ElasticMaterial::calcDensity(const Mesh::point_type& cell)
+pylith::materials::ElasticMaterial::calcDensity(void)
 { // calcDensity
-  _getParameters(cell);
-
   const int numQuadPts = _numQuadPts;
   assert(_paramsCell.size() == numQuadPts);
   assert(_density.size() == numQuadPts);
@@ -62,11 +60,9 @@
 // ----------------------------------------------------------------------
 // Compute stress tensor for cell at quadrature points.
 const std::vector<pylith::double_array>&
-pylith::materials::ElasticMaterial::calcStress(const Mesh::point_type& cell,
+pylith::materials::ElasticMaterial::calcStress(
 			         const std::vector<double_array>& totalStrain)
 { // calcStress
-  _getParameters(cell);
-  
   const int numQuadPts = _numQuadPts;
   assert(_paramsCell.size() == numQuadPts);
   assert(totalStrain.size() == numQuadPts);
@@ -82,11 +78,8 @@
 // Compute derivative of elasticity matrix for cell at quadrature points.
 const std::vector<pylith::double_array>&
 pylith::materials::ElasticMaterial::calcDerivElastic(
-					     const Mesh::point_type& cell,
 				const std::vector<double_array>& totalStrain)
 { // calcDerivElastic
-  _getParameters(cell);
-
   const int numQuadPts = _numQuadPts;
   assert(_paramsCell.size() == numQuadPts);
   assert(totalStrain.size() == numQuadPts);
@@ -102,7 +95,8 @@
 // ----------------------------------------------------------------------
 // Initialize arrays holding cell data.
 void
-pylith::materials::ElasticMaterial::initCellData(const int numQuadPts)
+pylith::materials::ElasticMaterial::initCellData(const Mesh::point_type& cell,
+						 const int numQuadPts)
 { // initCellData
   if (_numQuadPts != numQuadPts) {
     _numQuadPts = numQuadPts;
@@ -118,6 +112,8 @@
       _elasticConsts[iQuad].resize(_numElasticConsts());
     } // for
   } // if
+
+  _getParameters(cell);
 } // initCellData
 
 

Modified: short/3D/PyLith/trunk/libsrc/materials/ElasticMaterial.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/ElasticMaterial.hh	2007-04-10 09:58:18 UTC (rev 6535)
+++ short/3D/PyLith/trunk/libsrc/materials/ElasticMaterial.hh	2007-04-10 15:16:13 UTC (rev 6536)
@@ -23,7 +23,7 @@
 #include "Material.hh" // ISA Material
 
 #include <petscmesh.h> // USES Mesh
-#include "pylith/utils/stlfwd.hh" // USES double_array
+#include "pylith/utils/arrayfwd.hh" // USES double_array
 #include <vector> // USES std::vector
 
 /// Namespace for pylith package
@@ -63,14 +63,19 @@
   virtual
   ElasticMaterial* clone(void) const = 0;
 
+  /** Initialize arrays holding cell data.
+   *
+   * @param cell Finite element cell
+   * @param numQuadPts Number of quadrature points
+   */
+  void initCellData(const Mesh::point_type& cell,
+		    const int numQuadPts);
+
   /** Compute density for cell at quadrature points.
    *
-   * @param cell Finite-element cell
-   *
    * @returns Array of density values at cell's quadrature points.
    */
-  const std::vector<double_array>&
-  calcDensity(const Mesh::point_type& cell);
+  const std::vector<double_array>& calcDensity(void);
   
   /** Get stress tensor at quadrature points.
    *
@@ -85,15 +90,13 @@
    * Order of elasticity constants for 1-D:
    *  0: S11
    *
-   * @param cell Finite-element cell
    * @param totalStrain Total strain tensor at quadrature points
    *    [numQuadPts][tensorSize]
    *
    * @returns Array of stresses at cell's quadrature points.
    */
   const std::vector<double_array>&
-  calcStress(const Mesh::point_type& cell,
-	     const std::vector<double_array>& totalStrain);
+  calcStress(const std::vector<double_array>& totalStrain);
 
   /** Compute derivative of elasticity matrix for cell at quadrature points.
    *
@@ -115,20 +118,12 @@
    * Order of elasticity constants for 1-D:
    *  0: C1111
    *
-   * @param cell Finite-element cell
    * @param totalStrain Total strain tensor at quadrature points
    *    [numQuadPts][tensorSize]
    */
   const std::vector<double_array>&
-  calcDerivElastic(const Mesh::point_type& cell,
-		   const std::vector<double_array>& totalStrain);
+  calcDerivElastic(const std::vector<double_array>& totalStrain);
 
-  /** Initialize arrays holding cell data.
-   *
-   * @param numQuadPts Number of quadrature points
-   */
-  void initCellData(const int numQuadPts);
-
   // PROTECTED METHODS //////////////////////////////////////////////////
 protected :
 

Modified: short/3D/PyLith/trunk/libsrc/materials/ElasticPlaneStrain.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/ElasticPlaneStrain.cc	2007-04-10 09:58:18 UTC (rev 6535)
+++ short/3D/PyLith/trunk/libsrc/materials/ElasticPlaneStrain.cc	2007-04-10 15:16:13 UTC (rev 6536)
@@ -14,7 +14,8 @@
 
 #include "ElasticPlaneStrain.hh" // implementation of object methods
 
-#include <valarray> // USES std::valarray (double_array)
+#include "pylith/utils/array.hh" // USES double_array
+
 #include <assert.h> // USES assert()
 
 // ----------------------------------------------------------------------

Modified: short/3D/PyLith/trunk/libsrc/materials/ElasticPlaneStress.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/ElasticPlaneStress.cc	2007-04-10 09:58:18 UTC (rev 6535)
+++ short/3D/PyLith/trunk/libsrc/materials/ElasticPlaneStress.cc	2007-04-10 15:16:13 UTC (rev 6536)
@@ -14,7 +14,8 @@
 
 #include "ElasticPlaneStress.hh" // implementation of object methods
 
-#include <valarray> // USES std::valarray (double_array)
+#include "pylith/utils/array.hh" // USES double_array
+
 #include <assert.h> // USES assert()
 
 // ----------------------------------------------------------------------

Modified: short/3D/PyLith/trunk/libsrc/materials/ElasticStrain1D.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/ElasticStrain1D.cc	2007-04-10 09:58:18 UTC (rev 6535)
+++ short/3D/PyLith/trunk/libsrc/materials/ElasticStrain1D.cc	2007-04-10 15:16:13 UTC (rev 6536)
@@ -14,7 +14,8 @@
 
 #include "ElasticStrain1D.hh" // implementation of object methods
 
-#include <valarray> // USES std::valarray (double_array)
+#include "pylith/utils/array.hh" // USES double_array
+
 #include <assert.h> // USES assert()
 
 // ----------------------------------------------------------------------

Modified: short/3D/PyLith/trunk/libsrc/materials/ElasticStress1D.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/ElasticStress1D.cc	2007-04-10 09:58:18 UTC (rev 6535)
+++ short/3D/PyLith/trunk/libsrc/materials/ElasticStress1D.cc	2007-04-10 15:16:13 UTC (rev 6536)
@@ -14,7 +14,8 @@
 
 #include "ElasticStress1D.hh" // implementation of object methods
 
-#include <valarray> // USES std::valarray (double_array)
+#include "pylith/utils/array.hh" // USES double_array
+
 #include <assert.h> // USES assert()
 
 // ----------------------------------------------------------------------

Modified: short/3D/PyLith/trunk/libsrc/materials/Material.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/Material.cc	2007-04-10 09:58:18 UTC (rev 6535)
+++ short/3D/PyLith/trunk/libsrc/materials/Material.cc	2007-04-10 15:16:13 UTC (rev 6536)
@@ -16,14 +16,12 @@
 
 #include "pylith/feassemble/ParameterManager.hh" // USES ParameterManager
 #include "pylith/feassemble/Quadrature.hh" // USES ParameterManager
+#include "pylith/utils/array.hh" // USES double_array, std::vector
 
 #include "spatialdata/spatialdb/SpatialDB.hh" // USES SpatialDB
 
 #include <petscmesh.h> // USES Mesh
 
-#include <vector> // USES std::vector
-#include <valarray> // USES std::valarray (double_array)
-
 #include <assert.h> // USES assert()
 #include <stdexcept> // USES std::runtime_error
 #include <sstream> // USES std::ostringstream

Modified: short/3D/PyLith/trunk/libsrc/materials/Material.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/Material.hh	2007-04-10 09:58:18 UTC (rev 6535)
+++ short/3D/PyLith/trunk/libsrc/materials/Material.hh	2007-04-10 15:16:13 UTC (rev 6536)
@@ -20,7 +20,7 @@
 #if !defined(pylith_materials_material_hh)
 #define pylith_materials_material_hh
 
-#include "pylith/utils/stlfwd.hh"
+#include "pylith/utils/arrayfwd.hh"
 #include <string> // HASA std::string
 
 /// Namespace for pylith package

Modified: short/3D/PyLith/trunk/libsrc/utils/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/libsrc/utils/Makefile.am	2007-04-10 09:58:18 UTC (rev 6535)
+++ short/3D/PyLith/trunk/libsrc/utils/Makefile.am	2007-04-10 15:16:13 UTC (rev 6536)
@@ -14,8 +14,9 @@
 include $(top_srcdir)/subpackage.am
 
 subpkginclude_HEADERS = \
-	petscfwd.h \
-	stlfwd.hh
+	array.hh \
+	arrayfwd.hh \
+	petscfwd.h
 
 noinst_HEADERS = 
 

Added: short/3D/PyLith/trunk/libsrc/utils/array.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/utils/array.hh	2007-04-10 09:58:18 UTC (rev 6535)
+++ short/3D/PyLith/trunk/libsrc/utils/array.hh	2007-04-10 15:16:13 UTC (rev 6536)
@@ -0,0 +1,30 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+/**
+ * @file pylith/utils/array.hh
+ *
+ * @brief Header file for PyLith array objects.
+ *
+ * Since the arrays are really C++ STL objects, we simply include the
+ * STL header files.
+ */
+
+#if !defined(pylith_utils_array_hh)
+#define pylith_utils_array_hh
+
+#include <vector>
+#include <valarray>
+
+#endif // pylith_utils_array_hh
+
+// End of file

Copied: short/3D/PyLith/trunk/libsrc/utils/arrayfwd.hh (from rev 6533, short/3D/PyLith/trunk/libsrc/utils/stlfwd.hh)
===================================================================
--- short/3D/PyLith/trunk/libsrc/utils/stlfwd.hh	2007-04-10 01:28:52 UTC (rev 6533)
+++ short/3D/PyLith/trunk/libsrc/utils/arrayfwd.hh	2007-04-10 15:16:13 UTC (rev 6536)
@@ -0,0 +1,57 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+/**
+ * @file pylith/utils/arrayfwd.hh
+ *
+ * @brief Forward declarations for PyLith array objects.
+ *
+ * These are generally just forward declarations for C++ STL objects.
+ *
+ * For simple types (i.e., int and double) std::valarray provides some
+ * features that std::vector does not have, such as operating on the
+ * whole array at once.
+ */
+
+#if !defined(pylith_utils_arrayfwd_hh)
+#define pylith_utils_arrayfwd_hh
+
+/// Forward declaration of STL vector
+namespace std {
+  // std::vector
+  template<typename T> class allocator;
+  template<typename T, typename U> class vector;
+
+  // std::valarray
+  template<typename T> class valarray;
+} // std
+
+/// Aliases 
+namespace pylith {
+  /// Alias for std::vector<int>
+  typedef std::vector<int, std::allocator<int> > int_vector;
+
+  /// Alias for std::vector<double>
+  typedef std::vector<double, std::allocator<double> > double_vector;
+
+  /// Alias for std::valarray<int>
+  typedef std::valarray<int> int_array;
+
+  /// Alias for std::valarray<double>
+  typedef std::valarray<double> double_array;
+
+} // pylith
+
+
+#endif // pylith_utils_arrayfwd_hh
+
+// End of file

Deleted: short/3D/PyLith/trunk/libsrc/utils/stlfwd.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/utils/stlfwd.hh	2007-04-10 09:58:18 UTC (rev 6535)
+++ short/3D/PyLith/trunk/libsrc/utils/stlfwd.hh	2007-04-10 15:16:13 UTC (rev 6536)
@@ -1,55 +0,0 @@
-// -*- C++ -*-
-//
-// ======================================================================
-//
-//                           Brad T. Aagaard
-//                        U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ======================================================================
-//
-
-/**
- * @file pylith/utils/stlfwd.hh
- *
- * @brief Forward declarations for C++ STL objects.
- *
- * For simple types (i.e., int and double) std::valarray provides some
- * features that std::vector does not have, such as operating on the
- * whole array at once.
- */
-
-#if !defined(pylith_utils_stlfwd_hh)
-#define pylith_utils_stlfwd_hh
-
-/// Forward declaration of STL vector
-namespace std {
-  // std::vector
-  template<typename T> class allocator;
-  template<typename T, typename U> class vector;
-
-  // std::valarray
-  template<typename T> class valarray;
-} // std
-
-/// Aliases 
-namespace pylith {
-  /// Alias for std::vector<int>
-  typedef std::vector<int, std::allocator<int> > int_vector;
-
-  /// Alias for std::vector<double>
-  typedef std::vector<double, std::allocator<double> > double_vector;
-
-  /// Alias for std::valarray<int>
-  typedef std::valarray<int> int_array;
-
-  /// Alias for std::valarray<double>
-  typedef std::valarray<double> double_array;
-
-} // pylith
-
-
-#endif // pylith_utils_stlfwd_hh
-
-// End of file

Modified: short/3D/PyLith/trunk/unittests/libtests/materials/TestElasticIsotropic3D.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/materials/TestElasticIsotropic3D.cc	2007-04-10 09:58:18 UTC (rev 6535)
+++ short/3D/PyLith/trunk/unittests/libtests/materials/TestElasticIsotropic3D.cc	2007-04-10 15:16:13 UTC (rev 6536)
@@ -14,9 +14,10 @@
 
 #include "TestElasticIsotropic3D.hh" // Implementation of class methods
 
-#include "pylith/materials/ElasticIsotropic3D.hh" // USES ElasticIsotropic3D
 #include "data/ElasticIsotropic3DData.hh" // USES ElasticIsotropic3DData
 
+#include "pylith/materials/ElasticIsotropic3D.hh" // USES ElasticIsotropic3D
+
 // ----------------------------------------------------------------------
 CPPUNIT_TEST_SUITE_REGISTRATION( pylith::materials::TestElasticIsotropic3D );
 

Modified: short/3D/PyLith/trunk/unittests/libtests/materials/TestElasticMaterial.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/materials/TestElasticMaterial.cc	2007-04-10 09:58:18 UTC (rev 6535)
+++ short/3D/PyLith/trunk/unittests/libtests/materials/TestElasticMaterial.cc	2007-04-10 15:16:13 UTC (rev 6536)
@@ -14,14 +14,13 @@
 
 #include "TestElasticMaterial.hh" // Implementation of class methods
 
-#include "pylith/materials/ElasticIsotropic3D.hh" // USES ElasticIsotropic3D
 #include "data/ElasticMaterialData.hh" // USES ElasticMaterialData
 #include "data/ElasticIsotropic3DData.hh" // USES ElasticIsotropic3DData
 
+#include "pylith/materials/ElasticIsotropic3D.hh" // USES ElasticIsotropic3D
+#include "pylith/utils/array.hh" // USES double_array
 #include "pylith/feassemble/ParameterManager.hh" // USES ParameterManager
 
-#include <valarray> // USES std::valarray (double_array)
-
 // ----------------------------------------------------------------------
 CPPUNIT_TEST_SUITE_REGISTRATION( pylith::materials::TestElasticMaterial );
 
@@ -118,8 +117,8 @@
   cellData[1] = data.parameterData[5];
   parameterLambda->updateAddPoint(*cellIter, cellData);
 
-  material.initCellData(numQuadPts);
-  const std::vector<double_array>& density = material.calcDensity(*cellIter);
+  material.initCellData(*cellIter, numQuadPts);
+  const std::vector<double_array>& density = material.calcDensity();
 
   const double tolerance = 1.0e-06;
   const double* densityE = data.density;
@@ -223,9 +222,8 @@
       strain[iQuad][iStrain] = data.strain[i];
   } // for
 
-  material.initCellData(numQuadPts);
-  const std::vector<double_array>& stress = 
-    material.calcStress(*cellIter, strain);
+  material.initCellData(*cellIter, numQuadPts);
+  const std::vector<double_array>& stress = material.calcStress(strain);
 
   const double tolerance = 1.0e-06;
   const double* stressE = data.stress;
@@ -338,9 +336,9 @@
       strain[iQuad][iStrain] = data.strain[i];
   } // for
 
-  material.initCellData(numQuadPts);
+  material.initCellData(*cellIter, numQuadPts);
   const std::vector<double_array>& elasticConsts = 
-    material.calcDerivElastic(*cellIter, strain);
+    material.calcDerivElastic(strain);
 
   const double tolerance = 1.0e-06;
   const double* elasticConstsE = data.elasticConsts;
@@ -362,22 +360,6 @@
 } // testCalcDerivElastic
     
 // ----------------------------------------------------------------------
-// Test initCellData()
-void
-pylith::materials::TestElasticMaterial::testInitCellData(void)
-{ // testInitCellData
-  ElasticIsotropic3D material;
-
-  CPPUNIT_ASSERT(0 == material._density.size());
-  CPPUNIT_ASSERT(0 == material._elasticConsts.size());
-  const int numQuadPts = 4;
-  material.initCellData(numQuadPts);
-  CPPUNIT_ASSERT(numQuadPts == material._density.size());
-  CPPUNIT_ASSERT(numQuadPts == material._stress.size());
-  CPPUNIT_ASSERT(numQuadPts == material._elasticConsts.size());
-} // testInitCellData
-
-// ----------------------------------------------------------------------
 // Test _calcDensity()
 void
 pylith::materials::TestElasticMaterial::_testCalcDensity(

Modified: short/3D/PyLith/trunk/unittests/libtests/materials/TestElasticMaterial.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/materials/TestElasticMaterial.hh	2007-04-10 09:58:18 UTC (rev 6535)
+++ short/3D/PyLith/trunk/unittests/libtests/materials/TestElasticMaterial.hh	2007-04-10 15:16:13 UTC (rev 6536)
@@ -42,7 +42,6 @@
   CPPUNIT_TEST( testCalcDensity );
   CPPUNIT_TEST( testCalcStress );
   CPPUNIT_TEST( testCalcDerivElastic );
-  CPPUNIT_TEST( testInitCellData );
   CPPUNIT_TEST_SUITE_END();
 
   // PUBLIC METHODS /////////////////////////////////////////////////////
@@ -60,9 +59,6 @@
   /// Test calcDerivElastic()
   void testCalcDerivElastic(void);
 
-  /// Test _initCellData()
-  void testInitCellData(void);
-
   // PROTECTED METHODS //////////////////////////////////////////////////
 protected :
 

Modified: short/3D/PyLith/trunk/unittests/libtests/materials/TestMaterial.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/materials/TestMaterial.cc	2007-04-10 09:58:18 UTC (rev 6535)
+++ short/3D/PyLith/trunk/unittests/libtests/materials/TestMaterial.cc	2007-04-10 15:16:13 UTC (rev 6536)
@@ -14,18 +14,19 @@
 
 #include "TestMaterial.hh" // Implementation of class methods
 
-#include "pylith/materials/ElasticIsotropic3D.hh" // USES ElasticIsotropic3D
 #include "data/MaterialData.hh" // USES MaterialData
 
+#include "pylith/materials/ElasticIsotropic3D.hh" // USES ElasticIsotropic3D
+#include "pylith/utils/array.hh" // USES double_array
+#include "pylith/feassemble/Quadrature1D.hh" // USES Quadrature1D
+#include "pylith/feassemble/ParameterManager.hh" // USES ParameterManager
+
 #include "spatialdata/spatialdb/SimpleDB.hh" // USES SimpleDB
 #include "spatialdata/spatialdb/SimpleIOAscii.hh" // USES SimpleIOAscii
 #include "spatialdata/geocoords/CSCart.hh" // USES CSCart
-#include "pylith/feassemble/Quadrature1D.hh" // USES Quadrature1D
-#include "pylith/feassemble/ParameterManager.hh" // USES ParameterManager
 
 #include <petscmesh.h> // USES PETSc Mesh
 
-#include <valarray> // USES std::valarray (double_array)
 #include <math.h> // USES assert()
 
 // ----------------------------------------------------------------------



More information about the cig-commits mailing list