[cig-commits] r18197 - short/3D/PyLith/branches/v1.5-stable/libsrc/topology

brad at geodynamics.org brad at geodynamics.org
Thu Apr 7 13:43:51 PDT 2011


Author: brad
Date: 2011-04-07 13:43:50 -0700 (Thu, 07 Apr 2011)
New Revision: 18197

Modified:
   short/3D/PyLith/branches/v1.5-stable/libsrc/topology/Field.cc
Log:
Fixed bug that prevented creation of scatter if processors did not have DOF in field (can happen if fault is not on all processors).

Modified: short/3D/PyLith/branches/v1.5-stable/libsrc/topology/Field.cc
===================================================================
--- short/3D/PyLith/branches/v1.5-stable/libsrc/topology/Field.cc	2011-04-07 18:42:24 UTC (rev 18196)
+++ short/3D/PyLith/branches/v1.5-stable/libsrc/topology/Field.cc	2011-04-07 20:43:50 UTC (rev 18197)
@@ -287,12 +287,17 @@
       err = PetscObjectReference((PetscObject) _scatter);
       CHECK_PETSC_ERROR(err);
 
-      assert(_section->sizeWithBC() > 0);
-      err = VecCreateSeqWithArray(PETSC_COMM_SELF,
-				  _section->sizeWithBC(),
-				  _section->restrictSpace(),
-				  &_scatterVec); CHECK_PETSC_ERROR(err);
-      CHECK_PETSC_ERROR(err);
+      if (_section->sizeWithBC() > 0) {
+	err = VecCreateSeqWithArray(PETSC_COMM_SELF,
+				    _section->getStorageSize(),
+				    _section->restrictSpace(),
+				    &_scatterVec);
+	CHECK_PETSC_ERROR(err);
+      } else {
+	err = VecCreateSeqWithArray(PETSC_COMM_SELF, 0, 0,
+				    &_scatterVec);
+	CHECK_PETSC_ERROR(err);
+      } // else
     } // if
   } // if
   logger.stagePop();
@@ -683,10 +688,19 @@
     err = VecDestroy(_scatterVec); _scatterVec = 0;
     CHECK_PETSC_ERROR(err);
   } // if
-  assert(_section->sizeWithBC() > 0);
-  err = VecCreateSeqWithArray(PETSC_COMM_SELF,
-			      _section->sizeWithBC(), _section->restrictSpace(),
-			      &_scatterVec); CHECK_PETSC_ERROR(err);
+
+  // Create scatter Vec
+  if (_section->sizeWithBC() > 0) {
+    err = VecCreateSeqWithArray(PETSC_COMM_SELF,
+				_section->getStorageSize(),
+				_section->restrictSpace(),
+				&_scatterVec);
+    CHECK_PETSC_ERROR(err);
+  } else {
+    err = VecCreateSeqWithArray(PETSC_COMM_SELF, 0, 0,
+				&_scatterVec);
+    CHECK_PETSC_ERROR(err);
+  } // else
 } // createScatter
 
 // ----------------------------------------------------------------------



More information about the CIG-COMMITS mailing list