[cig-commits] [commit] knepley/upgrade-petsc-interface: Fixed another potential use of NULL index set in parallel runs. (ed24816)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Fri Nov 22 12:32:17 PST 2013


Repository : ssh://geoshell/pylith

On branch  : knepley/upgrade-petsc-interface
Link       : https://github.com/geodynamics/pylith/compare/0de634fa7e9338451f19d5aa3cb546c2c0e3484c...ed24816f78210d867e5b479053d7eaabe9a9fb97

>---------------------------------------------------------------

commit ed24816f78210d867e5b479053d7eaabe9a9fb97
Author: Brad Aagaard <baagaard at usgs.gov>
Date:   Fri Nov 22 12:34:49 2013 -0800

    Fixed another potential use of NULL index set in parallel runs.


>---------------------------------------------------------------

ed24816f78210d867e5b479053d7eaabe9a9fb97
 libsrc/pylith/topology/Field.cc | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/libsrc/pylith/topology/Field.cc b/libsrc/pylith/topology/Field.cc
index 08d2c08..7748899 100644
--- a/libsrc/pylith/topology/Field.cc
+++ b/libsrc/pylith/topology/Field.cc
@@ -1014,14 +1014,16 @@ pylith::topology::Field::createScatterWithBC(const Mesh& mesh,
   err = DMPlexGetSubpointMap(dm,  &subpointMap);PYLITH_CHECK_ERROR(err);
   err = DMPlexGetSubpointMap(_dm, &subpointMapF);PYLITH_CHECK_ERROR(err);
   if (((dim != dimF) || ((pEnd-pStart) < (qEnd-qStart))) && subpointMap && !subpointMapF) {
-    const PetscInt *ind;
-    PetscIS subpointIS;
-    PetscInt n, q;
+    const PetscInt *ind = NULL;
+    PetscIS subpointIS = NULL;
+    PetscInt n = 0, q = 0;
 
     err = PetscSectionGetChart(section, &qStart, &qEnd);PYLITH_CHECK_ERROR(err);
     err = DMPlexCreateSubpointIS(dm, &subpointIS);PYLITH_CHECK_ERROR(err);
-    err = ISGetLocalSize(subpointIS, &n);PYLITH_CHECK_ERROR(err);
-    err = ISGetIndices(subpointIS, &ind);PYLITH_CHECK_ERROR(err);
+    if (subpointIS) {
+      err = ISGetLocalSize(subpointIS, &n);PYLITH_CHECK_ERROR(err);
+      err = ISGetIndices(subpointIS, &ind);PYLITH_CHECK_ERROR(err);
+    } // if
     err = PetscSectionCreate(mesh.comm(), &subSection);PYLITH_CHECK_ERROR(err);
     err = PetscSectionSetChart(subSection, pStart, pEnd);PYLITH_CHECK_ERROR(err);
     for(q = qStart; q < qEnd; ++q) {
@@ -1037,8 +1039,10 @@ pylith::topology::Field::createScatterWithBC(const Mesh& mesh,
         } // if
       } // if
     } // for
-    err = ISRestoreIndices(subpointIS, &ind);PYLITH_CHECK_ERROR(err);
-    err = ISDestroy(&subpointIS);PYLITH_CHECK_ERROR(err);
+    if (subpointIS) {
+      err = ISRestoreIndices(subpointIS, &ind);PYLITH_CHECK_ERROR(err);
+      err = ISDestroy(&subpointIS);PYLITH_CHECK_ERROR(err);
+    } // if
     /* No need to setup section */
     section = subSection;
     /* There are no excludes for surface meshes */



More information about the CIG-COMMITS mailing list