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

knepley at geodynamics.org knepley at geodynamics.org
Fri Mar 30 19:01:27 PDT 2007


Author: knepley
Date: 2007-03-30 19:01:26 -0700 (Fri, 30 Mar 2007)
New Revision: 6481

Modified:
   short/3D/PyLith/trunk/libsrc/materials/ElasticMaterial.cc
   short/3D/PyLith/trunk/libsrc/materials/ElasticMaterial.hh
   short/3D/PyLith/trunk/unittests/libtests/materials/TestElasticMaterial.cc
Log:
Small fixes for Sieve


Modified: short/3D/PyLith/trunk/libsrc/materials/ElasticMaterial.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/ElasticMaterial.cc	2007-03-31 01:41:15 UTC (rev 6480)
+++ short/3D/PyLith/trunk/libsrc/materials/ElasticMaterial.cc	2007-03-31 02:01:26 UTC (rev 6481)
@@ -60,7 +60,7 @@
   memset(_density, 0, size*sizeof(double));
 
   double* paramsCell = 0;
-  _getParameters(&paramsCell, cell, patch, numQuadPts);
+  _getParameters(&paramsCell, cell, numQuadPts);
   const int numParams = _numParameters();
   _calcDensity(paramsCell, numParams, numQuadPts);
   delete[] paramsCell; paramsCell = 0;
@@ -72,8 +72,7 @@
 // Compute stress tensor for cell at quadrature points.
 const double*
 pylith::materials::ElasticMaterial::calcStress(
-				     const topology_type::point_type& cell,
-				     const topology_type::patch_type& patch,
+				     const Mesh::point_type& cell,
 				     const double* totalStrain,
 				     const int numQuadPts,
 				     const int spaceDim)
@@ -85,7 +84,7 @@
   memset(_stress, 0, size*sizeof(double));
 
   double* paramsCell = 0;
-  _getParameters(&paramsCell, cell, patch, numQuadPts);
+  _getParameters(&paramsCell, cell, numQuadPts);
   const int numParams = _numParameters();
   _calcStress(paramsCell, numParams, totalStrain, numQuadPts, spaceDim);
   delete[] paramsCell; paramsCell = 0;
@@ -97,8 +96,7 @@
 // Compute derivative of elasticity matrix for cell at quadrature points.
 const double*
 pylith::materials::ElasticMaterial::calcDerivElastic(
-				     const topology_type::point_type& cell,
-				     const topology_type::patch_type& patch,
+				     const Mesh::point_type& cell,
 				     const double* totalStrain,
 				     const int numQuadPts,
 				     const int spaceDim)
@@ -110,7 +108,7 @@
   memset(_elasticConsts, 0, size*sizeof(double));
 
   double* paramsCell = 0;
-  _getParameters(&paramsCell, cell, patch, numQuadPts);
+  _getParameters(&paramsCell, cell, numQuadPts);
   const int numParams = _numParameters();
   _calcElasticConsts(paramsCell, numParams, totalStrain, numQuadPts, spaceDim);
   delete[] paramsCell; paramsCell = 0;
@@ -138,8 +136,7 @@
 // Get parameters for cell.
 void
 pylith::materials::ElasticMaterial::_getParameters(double** paramsCell,
-				       const topology_type::point_type& cell,
-				       const topology_type::patch_type& patch,
+				       const Mesh::point_type& cell,
 				       const int numQuadPts)
 { // _getParameters
   const int numParams = _numParameters();
@@ -151,9 +148,9 @@
     const ALE::Obj<real_section_type> parameter = 
       _parameters->getReal(paramNames[iParam]);
     
-    assert(numQuadPts == parameter->getFiberDimension(patch, cell));
+    assert(numQuadPts == parameter->getFiberDimension(cell));
     const real_section_type::value_type* parameterCell =
-      parameter->restrict(patch, cell);
+      parameter->restrictPoint(cell);
     for (int iQuadPt=0; iQuadPt < numQuadPts; ++iQuadPt)
       (*paramsCell)[iQuadPt*numParams+iParam] = parameterCell[iQuadPt];
   } // for

Modified: short/3D/PyLith/trunk/libsrc/materials/ElasticMaterial.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/ElasticMaterial.hh	2007-03-31 01:41:15 UTC (rev 6480)
+++ short/3D/PyLith/trunk/libsrc/materials/ElasticMaterial.hh	2007-03-31 02:01:26 UTC (rev 6481)
@@ -69,8 +69,7 @@
    *
    * @returns Array of density values at cell's quadrature points.
    */
-  const double* calcDensity(const topology_type::point_type& cell,
-			    const topology_type::patch_type& patch,
+  const double* calcDensity(const Mesh::point_type& cell,
 			    const int numQuadPts);
   
   /** Get stress tensor at quadrature points.
@@ -95,8 +94,7 @@
    *
    * @returns Array of stresses at cell's quadrature points.
    */
-  const double* calcStress(const topology_type::point_type& cell,
-			   const topology_type::patch_type& patch,
+  const double* calcStress(const Mesh::point_type& cell,
 			   const double* totalStrain,
 			   const int numQuadPts,
 			   const int spaceDim);
@@ -139,8 +137,7 @@
    * @param numQuadPts Number of quadrature points (consistency check)
    * @param spaceDim Spatial dimension (consistency check)
    */
-  const double* calcDerivElastic(const topology_type::point_type& cell,
-				 const topology_type::patch_type& patch,
+  const double* calcDerivElastic(const Mesh::point_type& cell,
 				 const double* totalStrain,
 				 const int numQuadPts,
 				 const int spaceDim);

Modified: short/3D/PyLith/trunk/unittests/libtests/materials/TestElasticMaterial.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/materials/TestElasticMaterial.cc	2007-03-31 01:41:15 UTC (rev 6480)
+++ short/3D/PyLith/trunk/unittests/libtests/materials/TestElasticMaterial.cc	2007-03-31 02:01:26 UTC (rev 6481)
@@ -47,11 +47,11 @@
 void
 pylith::materials::TestElasticMaterial::testCalcDensity(void)
 { // testCalcDensity
-  typedef ALE::Mesh::topology_type topology_type;
-  typedef topology_type::sieve_type sieve_type;
-  typedef ALE::Mesh::real_section_type real_section_type;
+  typedef ALE::Field::Mesh Mesh;
+  typedef Mesh::sieve_type sieve_type;
+  typedef Mesh::real_section_type real_section_type;
 
-  ALE::Obj<ALE::Mesh> mesh;
+  ALE::Obj<Mesh> mesh;
   { // create mesh
     const int cellDim = 1;
     const int numCorners = 2;
@@ -63,28 +63,21 @@
     CPPUNIT_ASSERT(0 != vertCoords);
     CPPUNIT_ASSERT(0 != cells);
 
-    mesh = new ALE::Mesh(PETSC_COMM_WORLD, cellDim);
+    mesh = new Mesh(PETSC_COMM_WORLD, cellDim);
     ALE::Obj<sieve_type> sieve = new sieve_type(mesh->comm());
-    ALE::Obj<topology_type> topology = new topology_type(mesh->comm());
 
     const bool interpolate = false;
-    ALE::New::SieveBuilder<sieve_type>::buildTopology(sieve, cellDim, numCells,
+    ALE::New::SieveBuilder<Mesh>::buildTopology(sieve, cellDim, numCells,
 	       const_cast<int*>(cells), numVertices, interpolate, numCorners);
-    sieve->stratify();
-    topology->setPatch(0, sieve);
-    topology->stratify();
-    mesh->setTopology(topology);
-    ALE::New::SieveBuilder<sieve_type>::buildCoordinates(
-		   mesh->getRealSection("coordinates"), spaceDim, vertCoords);
+    mesh->setSieve(sieve);
+    mesh->stratify();
+    ALE::New::SieveBuilder<Mesh>::buildCoordinatesNew(mesh, spaceDim, vertCoords);
   } // create mesh
 
   // Get cells associated with material
-  const ALE::Mesh::int_section_type::patch_type patch = 0;
   const ALE::Obj<real_section_type>& coordinates = 
     mesh->getRealSection("coordinates");
-  const ALE::Obj<topology_type>& topology = coordinates->getTopology();
-  const ALE::Obj<topology_type::label_sequence>& cells = 
-    topology->heightStratum(patch, 0);
+  const ALE::Obj<Mesh::label_sequence>& cells = mesh->heightStratum(0);
 
   ElasticIsotropic3D material;
   ElasticIsotropic3DData data;
@@ -93,38 +86,38 @@
   const int numQuadPts = 2;
   const int fiberDim = numQuadPts; // number of values in field per cell
 
-  topology_type::label_sequence::iterator cellIter=cells->begin();
+  Mesh::label_sequence::iterator cellIter=cells->begin();
 
   material._parameters->addReal("density");
   const ALE::Obj<real_section_type>& parameterDensity = 
     material._parameters->getReal("density");
-  parameterDensity->setFiberDimension(patch, cells, fiberDim);
-  parameterDensity->allocate();
+  parameterDensity->setFiberDimension(cells, fiberDim);
+  mesh->allocate(parameterDensity);
   double cellData[numQuadPts];
   cellData[0] = data.parameterData[0];
   cellData[1] = data.parameterData[3];
-  parameterDensity->updateAdd(patch, *cellIter, cellData);
+  parameterDensity->updateAddPoint(*cellIter, cellData);
 
   material._parameters->addReal("mu");
   const ALE::Obj<real_section_type>& parameterMu = 
     material._parameters->getReal("mu");
-  parameterMu->setFiberDimension(patch, cells, fiberDim);
-  parameterMu->allocate();
+  parameterMu->setFiberDimension(cells, fiberDim);
+  mesh->allocate(parameterMu);
   cellData[0] = data.parameterData[1];
   cellData[1] = data.parameterData[4];
-  parameterMu->updateAdd(patch, *cellIter, cellData);
+  parameterMu->updateAddPoint(*cellIter, cellData);
 
   material._parameters->addReal("lambda");
   const ALE::Obj<real_section_type>& parameterLambda = 
     material._parameters->getReal("lambda");
-  parameterLambda->setFiberDimension(patch, cells, fiberDim);
-  parameterLambda->allocate();
+  parameterLambda->setFiberDimension(cells, fiberDim);
+  mesh->allocate(parameterLambda);
   cellData[0] = data.parameterData[2];
   cellData[1] = data.parameterData[5];
-  parameterLambda->updateAdd(patch, *cellIter, cellData);
+  parameterLambda->updateAddPoint(*cellIter, cellData);
 
   material._initCellData(numQuadPts);
-  const double* density = material.calcDensity(*cellIter, patch, numQuadPts);
+  const double* density = material.calcDensity(*cellIter, numQuadPts);
 
   const double tolerance = 1.0e-06;
   const double* densityE = data.density;
@@ -140,11 +133,11 @@
 void
 pylith::materials::TestElasticMaterial::testCalcStress(void)
 { // testCalcProperties
-  typedef ALE::Mesh::topology_type topology_type;
-  typedef topology_type::sieve_type sieve_type;
-  typedef ALE::Mesh::real_section_type real_section_type;
+  typedef ALE::Field::Mesh Mesh;
+  typedef Mesh::sieve_type sieve_type;
+  typedef Mesh::real_section_type real_section_type;
 
-  ALE::Obj<ALE::Mesh> mesh;
+  ALE::Obj<Mesh> mesh;
   { // create mesh
     const int cellDim = 1;
     const int numCorners = 2;
@@ -156,28 +149,21 @@
     CPPUNIT_ASSERT(0 != vertCoords);
     CPPUNIT_ASSERT(0 != cells);
 
-    mesh = new ALE::Mesh(PETSC_COMM_WORLD, cellDim);
+    mesh = new Mesh(PETSC_COMM_WORLD, cellDim);
     ALE::Obj<sieve_type> sieve = new sieve_type(mesh->comm());
-    ALE::Obj<topology_type> topology = new topology_type(mesh->comm());
 
     const bool interpolate = false;
-    ALE::New::SieveBuilder<sieve_type>::buildTopology(sieve, cellDim, numCells,
+    ALE::New::SieveBuilder<Mesh>::buildTopology(sieve, cellDim, numCells,
 	       const_cast<int*>(cells), numVertices, interpolate, numCorners);
-    sieve->stratify();
-    topology->setPatch(0, sieve);
-    topology->stratify();
-    mesh->setTopology(topology);
-    ALE::New::SieveBuilder<sieve_type>::buildCoordinates(
-		   mesh->getRealSection("coordinates"), spaceDim, vertCoords);
+    mesh->setSieve(sieve);
+    mesh->stratify();
+    ALE::New::SieveBuilder<Mesh>::buildCoordinatesNew(mesh, spaceDim, vertCoords);
   } // create mesh
 
   // Get cells associated with material
-  const ALE::Mesh::int_section_type::patch_type patch = 0;
   const ALE::Obj<real_section_type>& coordinates = 
     mesh->getRealSection("coordinates");
-  const ALE::Obj<topology_type>& topology = coordinates->getTopology();
-  const ALE::Obj<topology_type::label_sequence>& cells = 
-    topology->heightStratum(patch, 0);
+  const ALE::Obj<Mesh::label_sequence>& cells = mesh->heightStratum(0);
 
   ElasticIsotropic3D material;
   ElasticIsotropic3DData data;
@@ -186,38 +172,38 @@
   const int numQuadPts = 2;
   const int fiberDim = numQuadPts; // number of values in field per cell
 
-  topology_type::label_sequence::iterator cellIter=cells->begin();
+  Mesh::label_sequence::iterator cellIter=cells->begin();
 
   material._parameters->addReal("density");
   const ALE::Obj<real_section_type>& parameterDensity = 
     material._parameters->getReal("density");
-  parameterDensity->setFiberDimension(patch, cells, fiberDim);
-  parameterDensity->allocate();
+  parameterDensity->setFiberDimension(cells, fiberDim);
+  mesh->allocate(parameterDensity);
   double cellData[numQuadPts];
   cellData[0] = data.parameterData[0];
   cellData[1] = data.parameterData[3];
-  parameterDensity->updateAdd(patch, *cellIter, cellData);
+  parameterDensity->updateAddPoint(*cellIter, cellData);
 
   material._parameters->addReal("mu");
   const ALE::Obj<real_section_type>& parameterMu = 
     material._parameters->getReal("mu");
-  parameterMu->setFiberDimension(patch, cells, fiberDim);
-  parameterMu->allocate();
+  parameterMu->setFiberDimension(cells, fiberDim);
+  mesh->allocate(parameterMu);
   cellData[0] = data.parameterData[1];
   cellData[1] = data.parameterData[4];
-  parameterMu->updateAdd(patch, *cellIter, cellData);
+  parameterMu->updateAddPoint(*cellIter, cellData);
 
   material._parameters->addReal("lambda");
   const ALE::Obj<real_section_type>& parameterLambda = 
     material._parameters->getReal("lambda");
-  parameterLambda->setFiberDimension(patch, cells, fiberDim);
-  parameterLambda->allocate();
+  parameterLambda->setFiberDimension(cells, fiberDim);
+  mesh->allocate(parameterLambda);
   cellData[0] = data.parameterData[2];
   cellData[1] = data.parameterData[5];
-  parameterLambda->updateAdd(patch, *cellIter, cellData);
+  parameterLambda->updateAddPoint(*cellIter, cellData);
 
   material._initCellData(numQuadPts);
-  const double* stress = material.calcStress(*cellIter, patch, data.strain, 
+  const double* stress = material.calcStress(*cellIter, data.strain, 
 					     numQuadPts, data.dimension);
 
   const double tolerance = 1.0e-06;
@@ -309,7 +295,7 @@
 
   material._initCellData(numQuadPts);
   const double* elasticConsts = 
-    material.calcDerivElastic(*cellIter, patch, data.strain, 
+    material.calcDerivElastic(*cellIter, data.strain, 
 			      numQuadPts, data.dimension);
 
   const double tolerance = 1.0e-06;



More information about the cig-commits mailing list