[cig-commits] r22770 - short/3D/PyLith/trunk/libsrc/pylith/faults

brad at geodynamics.org brad at geodynamics.org
Wed Sep 4 09:11:10 PDT 2013


Author: brad
Date: 2013-09-04 09:11:09 -0700 (Wed, 04 Sep 2013)
New Revision: 22770

Modified:
   short/3D/PyLith/trunk/libsrc/pylith/faults/CohesiveTopology.cc
Log:
Fixed some errors related to use of unitialized values.

Modified: short/3D/PyLith/trunk/libsrc/pylith/faults/CohesiveTopology.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/faults/CohesiveTopology.cc	2013-09-04 13:17:07 UTC (rev 22769)
+++ short/3D/PyLith/trunk/libsrc/pylith/faults/CohesiveTopology.cc	2013-09-04 16:11:09 UTC (rev 22770)
@@ -216,10 +216,10 @@
   DM faultDMMesh = faultMesh.dmMesh();
   assert(complexMesh);assert(faultDMMesh);
 
-  PetscInt depth, cStart, cEnd;
+  PetscInt depth, cStart = 0, cEnd = 0;
   err = DMPlexGetDepth(complexMesh, &depth);PYLITH_CHECK_ERROR(err);
   err = DMPlexGetHeightStratum(complexMesh, 0, &cStart, &cEnd);PYLITH_CHECK_ERROR(err);
-  PetscInt faceSizeDM;
+  PetscInt faceSizeDM = 0;
   int numFaultCorners = 0; // The number of vertices in a fault cell
   PetscInt *indicesDM = NULL; // The indices of a face vertex set in a cell
   const int debug = mesh->debug();
@@ -227,8 +227,8 @@
   TopologyOps::PointArray origVertices;
   TopologyOps::PointArray faceVertices;
   TopologyOps::PointArray neighborVertices;
-  PetscInt *origVerticesDM;
-  PetscInt *faceVerticesDM;
+  PetscInt *origVerticesDM = NULL;
+  PetscInt *faceVerticesDM = NULL;
   PetscInt cellDim, numCornersDM = 0;
 
   err = DMPlexGetDimension(complexMesh, &cellDim);PYLITH_CHECK_ERROR(err);
@@ -293,7 +293,7 @@
 
   /* DMPlex */
   DM        newMesh;
-  PetscInt *newCone;
+  PetscInt *newCone = NULL;
   PetscInt  dim, maxConeSize = 0;
 
   err = DMCreate(mesh->comm(), &newMesh);PYLITH_CHECK_ERROR(err);
@@ -313,7 +313,7 @@
   err = DMSetUp(newMesh);PYLITH_CHECK_ERROR(err);
   err = PetscMalloc(maxConeSize * sizeof(PetscInt), &newCone);PYLITH_CHECK_ERROR(err);
   for(PetscInt c = cStart; c < cEnd; ++c) {
-    const PetscInt *cone;
+    const PetscInt *cone = NULL;
     PetscInt        coneSize, cp;
 
     err = DMPlexGetCone(complexMesh, c, &cone);PYLITH_CHECK_ERROR(err);
@@ -344,10 +344,10 @@
 
   err = DMPlexGetNumLabels(complexMesh, &numLabels);PYLITH_CHECK_ERROR(err);
   for (PetscInt l = 0; l < numLabels; ++l) {
-    const char     *lname;
-    IS              idIS;
+    const char     *lname = NULL;
+    IS              idIS = NULL;
     PetscInt        n;
-    const PetscInt *ids;
+    const PetscInt *ids = NULL;
 
     err = DMPlexGetLabelName(complexMesh, l, &lname);PYLITH_CHECK_ERROR(err);
     if (std::string(lname) == skip) continue;
@@ -356,8 +356,8 @@
     err = ISGetIndices(idIS, &ids);PYLITH_CHECK_ERROR(err);
     for(PetscInt i = 0; i < n; ++i) {
       const PetscInt  id = ids[i];
-      const PetscInt *points;
-      IS              sIS;
+      const PetscInt *points = NULL;
+      IS              sIS = NULL;
       PetscInt        size;
 
       err = DMPlexGetStratumSize(complexMesh, lname, id, &size);PYLITH_CHECK_ERROR(err);
@@ -398,7 +398,7 @@
     // vertices (if they exist) because we don't want BC, etc to act
     // on constraint vertices
     for (PetscInt l = 0; l < numLabels; ++l) {
-      const char *name;
+      const char *name = NULL;
       PetscInt    value;
 
       err = DMPlexGetLabelName(complexMesh, l, &name);PYLITH_CHECK_ERROR(err);
@@ -417,8 +417,8 @@
   TopologyOps::PointSet replaceCells;
   TopologyOps::PointSet noReplaceCells;
   TopologyOps::PointSet replaceVerticesDM;
-  PetscInt       *cohesiveCone;
-  IS              subpointIS;
+  PetscInt       *cohesiveCone = NULL;
+  IS              subpointIS = NULL;
   const PetscInt *subpointMap = NULL;
 
   err = DMPlexCreateSubpointIS(faultDMMesh, &subpointIS);PYLITH_CHECK_ERROR(err);



More information about the CIG-COMMITS mailing list