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

brad at geodynamics.org brad at geodynamics.org
Fri Oct 27 21:39:59 PDT 2006


Author: brad
Date: 2006-10-27 21:39:58 -0700 (Fri, 27 Oct 2006)
New Revision: 5112

Modified:
   short/3D/PyLith/trunk/libsrc/feassemble/Integrator.hh
   short/3D/PyLith/trunk/libsrc/feassemble/IntegratorElasticity3D.cc
   short/3D/PyLith/trunk/libsrc/feassemble/IntegratorElasticity3D.hh
   short/3D/PyLith/trunk/libsrc/feassemble/IntegratorInertia.cc
   short/3D/PyLith/trunk/libsrc/feassemble/IntegratorInertia.hh
   short/3D/PyLith/trunk/unittests/libtests/feassemble/TestIntegrator.cc
Log:
Fixed compiler errors associated with Integrator::integrate(). Need to debug with unit tests.

Modified: short/3D/PyLith/trunk/libsrc/feassemble/Integrator.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/Integrator.hh	2006-10-28 01:21:54 UTC (rev 5111)
+++ short/3D/PyLith/trunk/libsrc/feassemble/Integrator.hh	2006-10-28 04:39:58 UTC (rev 5112)
@@ -75,7 +75,8 @@
    */
   virtual 
   void integrate(PetscMat* mat,
-         const ALE::Obj<real_section_type>& fieldIn,
+		 ALE::Obj<ALE::Mesh>& mesh,
+		 const ALE::Obj<real_section_type>& fieldIn,
 		 const ALE::Obj<real_section_type>& coordinates) = 0;
 
   /** Set quadrature for integrating finite-element quantities.

Modified: short/3D/PyLith/trunk/libsrc/feassemble/IntegratorElasticity3D.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/IntegratorElasticity3D.cc	2006-10-28 01:21:54 UTC (rev 5111)
+++ short/3D/PyLith/trunk/libsrc/feassemble/IntegratorElasticity3D.cc	2006-10-28 04:39:58 UTC (rev 5112)
@@ -50,6 +50,7 @@
 // Compute matrix associated with operator.
 void
 pylith::feassemble::IntegratorElasticity3D::integrate(PetscMat* mat,
+		    ALE::Obj<ALE::Mesh>& mesh,
    		    const ALE::Obj<ALE::Mesh::real_section_type>& fieldIn,
 		    const ALE::Obj<ALE::Mesh::real_section_type>& coordinates)
 { // integrate

Modified: short/3D/PyLith/trunk/libsrc/feassemble/IntegratorElasticity3D.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/IntegratorElasticity3D.hh	2006-10-28 01:21:54 UTC (rev 5111)
+++ short/3D/PyLith/trunk/libsrc/feassemble/IntegratorElasticity3D.hh	2006-10-28 04:39:58 UTC (rev 5112)
@@ -60,7 +60,8 @@
    * @param coordinates Field of cell vertex coordinates
    */
   void integrate(PetscMat* mat,
-         const ALE::Obj<ALE::Mesh::real_section_type>& fieldIn,
+		 ALE::Obj<ALE::Mesh>& mesh,
+		 const ALE::Obj<ALE::Mesh::real_section_type>& fieldIn,
 		 const ALE::Obj<ALE::Mesh::real_section_type>& coordinates);
 
 // PROTECTED METHODS ////////////////////////////////////////////////////

Modified: short/3D/PyLith/trunk/libsrc/feassemble/IntegratorInertia.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/IntegratorInertia.cc	2006-10-28 01:21:54 UTC (rev 5111)
+++ short/3D/PyLith/trunk/libsrc/feassemble/IntegratorInertia.cc	2006-10-28 04:39:58 UTC (rev 5112)
@@ -115,12 +115,13 @@
 void
 pylith::feassemble::IntegratorInertia::integrate(
 			     PetscMat* mat,
-                 const ALE::Obj<real_section_type>& fieldIn,
+			     ALE::Obj<ALE::Mesh>& mesh,
+			     const ALE::Obj<real_section_type>& fieldIn,
 			     const ALE::Obj<real_section_type>& coordinates)
 { // integrate
   assert(0 != mat);
   assert(0 != _quadrature);
-  PetscErrorCode ierr;
+  PetscErrorCode err;
 
   // Get information about section
   const topology_type::patch_type patch = 0;
@@ -128,15 +129,20 @@
   const ALE::Obj<topology_type::label_sequence>& cells = 
     topology->heightStratum(patch, 0);
   const topology_type::label_sequence::iterator cellsEnd = cells->end();
-  const ALE::Obj<ALE::Mesh::order_type>& globalOrder = ALE::New::NumberingFactory<topology_type>::singleton(topology->debug())->getGlobalOrder(topology, patch, "default", fieldIn->getAtlas());
+  const ALE::Obj<ALE::Mesh::order_type>& globalOrder = 
+    ALE::New::NumberingFactory<topology_type>::singleton(
+       topology->debug())->getGlobalOrder(topology, patch, 
+					  "default", fieldIn->getAtlas());
 
   // Setup symmetric, sparse matrix
+  // :TODO: This needs to be moved outside Integrator object, because
+  // integrator object will be specific to cell type and material type
   int localSize  = globalOrder->getLocalSize();
   int globalSize = globalOrder->getGlobalSize();
-  ierr = MatCreate(topology->comm(), mat);
-  ierr = MatSetSizes(*mat, localSize, localSize, globalSize, globalSize);
-  ierr = MatSetFromOptions(*mat);
-  ierr = preallocateMatrix(topology, fieldIn->getAtlas(), globalOrder, *mat);
+  err = MatCreate(topology->comm(), mat);
+  err = MatSetSizes(*mat, localSize, localSize, globalSize, globalSize);
+  err = MatSetFromOptions(*mat);
+  err = preallocateMatrix(mesh, fieldIn->getAtlas(), globalOrder, *mat);
 
   // Allocate matrix for cell values (if necessary)
   _initCellMatrix();
@@ -177,13 +183,13 @@
 	} // for
       } // for
     } // for
-    PetscErrorCode err = 
-      PetscLogFlops(numQuadPts*(2+numBasis*(1+numBasis*(1+spaceDim))));
+    err = PetscLogFlops(numQuadPts*(2+numBasis*(1+numBasis*(1+spaceDim))));
     if (err)
       throw std::runtime_error("Logging PETSc flops failed.");
     
     // Assemble cell contribution into sparse matrix
-    ierr = updateOperator(*mat, fieldIn, globalOrder, *cellIter, _cellMatrix, ADD_VALUES);
+    err = updateOperator(*mat, fieldIn, globalOrder, *cellIter, _cellMatrix, 
+			 ADD_VALUES);
   } // for
 } // integrate
 

Modified: short/3D/PyLith/trunk/libsrc/feassemble/IntegratorInertia.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/IntegratorInertia.hh	2006-10-28 01:21:54 UTC (rev 5111)
+++ short/3D/PyLith/trunk/libsrc/feassemble/IntegratorInertia.hh	2006-10-28 04:39:58 UTC (rev 5112)
@@ -75,6 +75,7 @@
    * @param coordinates Field of cell vertex coordinates
    */
   void integrate(PetscMat* mat,
+		 ALE::Obj<ALE::Mesh>& mesh,
                  const ALE::Obj<real_section_type>& fieldIn,
                  const ALE::Obj<real_section_type>& coordinates);
 

Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestIntegrator.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestIntegrator.cc	2006-10-28 01:21:54 UTC (rev 5111)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestIntegrator.cc	2006-10-28 04:39:58 UTC (rev 5112)
@@ -148,12 +148,23 @@
   typedef ALE::Mesh::real_section_type real_section_type;
 
   ALE::Obj<ALE::Mesh> mesh = _TestIntegrator::_setupMesh(data);
+  const ALE::Mesh::int_section_type::patch_type patch = 0;
 
+  // Fiber dimension (number of values in field per vertex) for fields
+  const int fiberDim = data.fiberDim;
+
+  // Setup input field for action
+  const ALE::Obj<real_section_type>& fieldIn =
+    mesh->getRealSection("fieldIn");
+  fieldIn->setName("fieldIn");
+  fieldIn->setFiberDimensionByDepth(patch, 0, fiberDim);
+  fieldIn->allocate();
+
   // Integrate
   PetscMat mat;
   const ALE::Obj<real_section_type>& coordinates = 
     mesh->getRealSection("coordinates");
-  integrator->integrate(&mat, coordinates);
+  integrator->integrate(&mat, mesh, fieldIn, coordinates);
 
   // Crate dense matrix
   // :TODO: ADD STUFF HERE



More information about the cig-commits mailing list