[cig-commits] r22757 - short/3D/PyLith/trunk/libsrc/pylith/bc

brad at geodynamics.org brad at geodynamics.org
Tue Sep 3 10:22:37 PDT 2013


Author: brad
Date: 2013-09-03 10:22:37 -0700 (Tue, 03 Sep 2013)
New Revision: 22757

Modified:
   short/3D/PyLith/trunk/libsrc/pylith/bc/Neumann.cc
Log:
Updated Neumann to use optimized getClosure (pass in work array as arg).

Modified: short/3D/PyLith/trunk/libsrc/pylith/bc/Neumann.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/bc/Neumann.cc	2013-09-03 17:17:18 UTC (rev 22756)
+++ short/3D/PyLith/trunk/libsrc/pylith/bc/Neumann.cc	2013-09-03 17:22:37 UTC (rev 22757)
@@ -123,15 +123,13 @@
   topology::VecVisitorSubMesh residualVisitor(residual, submeshIS);
   submeshIS.deallocate();
 
+  scalar_array coordsCell(numBasis*spaceDim); // :KULDGE: Update numBasis to numCorners after implementing higher order
   topology::CoordsVisitor coordsVisitor(dmSubMesh);
 
   // Loop over faces and integrate contribution from each face
   for(PetscInt c = cStart; c < cEnd; ++c) {
-    PetscScalar* coordsCell = NULL;
-    PetscInt coordsSize = 0;
-    coordsVisitor.getClosure(&coordsCell, &coordsSize, c);assert(coordsCell);assert(numBasis*spaceDim == coordsSize);
-    _quadrature->computeGeometry(coordsCell, coordsSize, c);
-    coordsVisitor.restoreClosure(&coordsCell, &coordsSize, c);
+    coordsVisitor.getClosure(&coordsCell, c);
+    _quadrature->computeGeometry(&coordsCell[0], coordsCell.size(), c);
 
     // Reset element vector to zero
     _resetCellVector();
@@ -418,6 +416,7 @@
   PetscScalar* valueArray = valueVisitor.localArray();
 
   // Get coordinates
+  scalar_array coordsCell(numBasis*spaceDim); // :KULDGE: Update numBasis to numCorners after implementing higher order
   topology::CoordsVisitor coordsVisitor(dmSubMesh);
 
   const spatialdata::geocoords::CoordSys* cs = _boundaryMesh->coordsys();
@@ -432,11 +431,8 @@
   // Loop over cells in boundary mesh and perform queries.
   for(PetscInt c = cStart; c < cEnd; ++c) {
     // Compute geometry information for current cell
-    PetscScalar* coordsCell = NULL;
-    PetscInt coordsSize = 0;
-    coordsVisitor.getClosure(&coordsCell, &coordsSize, c);assert(coordsCell);assert(numBasis*spaceDim == coordsSize);
-    _quadrature->computeGeometry(coordsCell, coordsSize, c);
-    coordsVisitor.restoreClosure(&coordsCell, &coordsSize, c);
+    coordsVisitor.getClosure(&coordsCell, c);
+    _quadrature->computeGeometry(&coordsCell[0], coordsCell.size(), c);
 
     const scalar_array& quadPtsNondim = _quadrature->quadPts();
     quadPtsGlobal = quadPtsNondim;
@@ -508,6 +504,7 @@
   scalar_array orientation(orientationSize);
 
   // Get coordinates.
+  scalar_array coordsCell(numBasis*spaceDim); // :KULDGE: Update numBasis to numCorners after implementing higher order
   topology::CoordsVisitor coordsVisitor(dmSubMesh);
 
   // Get sections
@@ -529,14 +526,12 @@
   // rotate corresponding traction vector from local to global coordinates.
   for(PetscInt c = cStart; c < cEnd; ++c) {
     // Compute geometry information for current cell
-    PetscScalar* coordsCell = NULL;
-    PetscInt coordsSize = 0;
-    coordsVisitor.getClosure(&coordsCell, &coordsSize, c);assert(coordsCell);assert(numBasis*spaceDim == coordsSize);
-    _quadrature->computeGeometry(coordsCell, coordsSize, c);
+    coordsVisitor.getClosure(&coordsCell, c);
+    _quadrature->computeGeometry(&coordsCell[0], coordsCell.size(), c);
 
     for(int iQuad=0, iRef=0, iSpace=0; iQuad < numQuadPts; ++iQuad, iRef+=cellDim, iSpace+=spaceDim) {
       // Compute Jacobian and determinant at quadrature point, then get orientation.
-      cellGeometry.jacobian(&jacobian, &jacobianDet, coordsCell, numBasis, spaceDim, &quadPtsRef[iRef], cellDim);
+      cellGeometry.jacobian(&jacobian, &jacobianDet, &coordsCell[0], numBasis, spaceDim, &quadPtsRef[iRef], cellDim);
       cellGeometry.orientation(&orientation, jacobian, jacobianDet, up);
       assert(jacobianDet > 0.0);
       orientation /= jacobianDet;
@@ -589,7 +584,6 @@
         } // for
       } // if
     } // for
-    coordsVisitor.restoreClosure(&coordsCell, &coordsSize, c);
   } // for
 
   delete initialVisitor; initialVisitor = 0;



More information about the CIG-COMMITS mailing list