[cig-commits] r11642 - short/3D/PyLith/trunk/libsrc/feassemble

brad at geodynamics.org brad at geodynamics.org
Sun Mar 30 14:50:35 PDT 2008


Author: brad
Date: 2008-03-30 14:50:35 -0700 (Sun, 30 Mar 2008)
New Revision: 11642

Modified:
   short/3D/PyLith/trunk/libsrc/feassemble/IntegratorElasticity.cc
Log:
Fixed bug. Need to reallocate buffer if size changes.

Modified: short/3D/PyLith/trunk/libsrc/feassemble/IntegratorElasticity.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/IntegratorElasticity.cc	2008-03-30 19:50:42 UTC (rev 11641)
+++ short/3D/PyLith/trunk/libsrc/feassemble/IntegratorElasticity.cc	2008-03-30 21:50:35 UTC (rev 11642)
@@ -278,7 +278,7 @@
   assert(0 != _quadrature);
   assert(0 != _material);
 
-  bool calcStress = (0 == strcasecmp(name, "stress")) ? true : false;
+  const bool calcStress = (0 == strcasecmp(name, "stress")) ? true : false;
     
   const int cellDim = _quadrature->cellDim();
   int tensorSize = 0;
@@ -318,15 +318,16 @@
   const int cellVecSize = numBasis*spaceDim;
   double_array dispCell(cellVecSize);
   
-  // Allocate vector for total strain
-  double_array totalStrain(numQuadPts*tensorSize);
+  // Allocate array for total strain
+  const int totalFiberDim = numQuadPts * tensorSize;
+  double_array totalStrain(totalFiberDim);
   totalStrain = 0.0;
   
-  // Allocate buffer for tensor field.
-  if (field->isNull()) {
-    const int fiberDim = numQuadPts * tensorSize;
+  // Allocate buffer for property field.
+  if (field->isNull() || 
+      totalFiberDim != (*field)->getFiberDimension(*cells->begin())) {
     *field = new real_section_type(mesh->comm(), mesh->debug());
-    (*field)->setFiberDimension(cells, fiberDim);
+    (*field)->setFiberDimension(cells, totalFiberDim);
     mesh->allocate(*field);
   } // if
   



More information about the cig-commits mailing list