[cig-commits] r3824 - short/3D/PyLith/branches/pylith-0.8/pylith3d/module

knepley at geodynamics.org knepley at geodynamics.org
Tue Jun 20 10:57:51 PDT 2006


Author: knepley
Date: 2006-06-20 10:57:51 -0700 (Tue, 20 Jun 2006)
New Revision: 3824

Modified:
   short/3D/PyLith/branches/pylith-0.8/pylith3d/module/scanner.cc
Log:
Fixed stupid memory error in VTK outupt


Modified: short/3D/PyLith/branches/pylith-0.8/pylith3d/module/scanner.cc
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/module/scanner.cc	2006-06-20 16:01:41 UTC (rev 3823)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/module/scanner.cc	2006-06-20 17:57:51 UTC (rev 3824)
@@ -489,9 +489,10 @@
     ALE::Obj<ALE::Mesh::field_type::order_type::coneSequence> elements = full_displacement->getPatch(*p_iter);
 
     for(ALE::Mesh::field_type::order_type::coneSequence::iterator e_iter = elements->begin(); e_iter != elements->end(); ++e_iter) {
+      const int     dim   = displacement->getIndex(*p_iter, *e_iter).index;
       const double *array = displacement->restrict(*p_iter, *e_iter);
+      int           v     = 0;
       double        values[3];
-      int           v = 0;
 
       for(int c = 0; c < 3; c++) {
         ALE::Mesh::foliation_type::patch_type        bPatch(*p_iter, c+1);
@@ -499,10 +500,13 @@
 
         if (idx.index > 0) {
           values[c] = boundaries->restrict(bPatch, *e_iter)[0];
-        } else {
+        } else if (dim > 0) {
           values[c] = array[v++];
         }
       }
+      if (v != dim) {
+        std::cout << "ERROR: Invalid size " << v << " used for " << *e_iter << " with index " << displacement->getIndex(*p_iter, *e_iter) << std::endl;
+      }
       full_displacement->update(*p_iter, *e_iter, values);
     }
   }



More information about the Cig-commits mailing list