[cig-commits] r20729 - short/3D/PyLith/trunk/libsrc/pylith/topology

knepley at geodynamics.org knepley at geodynamics.org
Tue Sep 18 20:07:33 PDT 2012


Author: knepley
Date: 2012-09-18 20:07:33 -0700 (Tue, 18 Sep 2012)
New Revision: 20729

Modified:
   short/3D/PyLith/trunk/libsrc/pylith/topology/Field.cc
Log:
Scatters seem to work correctly now

Modified: short/3D/PyLith/trunk/libsrc/pylith/topology/Field.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/topology/Field.cc	2012-09-19 00:17:12 UTC (rev 20728)
+++ short/3D/PyLith/trunk/libsrc/pylith/topology/Field.cc	2012-09-19 03:07:33 UTC (rev 20729)
@@ -504,7 +504,7 @@
       err = VecSetFromOptions(sinfo.vector); CHECK_PETSC_ERROR(err);  
     } else {
       sinfo.vector = _globalVec;
-      err = PetscObjectReference((PetscObject) sinfo.dm);
+      err = PetscObjectReference((PetscObject) sinfo.vector);
       CHECK_PETSC_ERROR(err);
     }
     err = PetscObjectSetName((PetscObject)sinfo.vector, _metadata["default"].label.c_str());CHECK_PETSC_ERROR(err);
@@ -1097,7 +1097,7 @@
   err = VecGetSize(_localVec,  &localSize);CHECK_PETSC_ERROR(err);
   err = VecGetSize(_globalVec, &globalSize);CHECK_PETSC_ERROR(err);
   assert(order->getLocalSize()  == localSize);
-  assert(order->getGlobalSize() == globalSize);
+  //assert(order->getGlobalSize() == globalSize);
   sinfo.vector = _globalVec;
   sinfo.dm     = _dm;
   
@@ -1272,12 +1272,13 @@
   err = VecSetFromOptions(sinfo.vector);CHECK_PETSC_ERROR(err);
 #endif
 
-  PetscSection section, gsection;
+  PetscSection section, newSection, gsection;
   PetscSF      sf;
 
   err = DMComplexClone(_dm, &sinfo.dm);CHECK_PETSC_ERROR(err);
   err = DMGetDefaultSection(_dm, &section);CHECK_PETSC_ERROR(err);
-  err = DMSetDefaultSection(sinfo.dm, section);CHECK_PETSC_ERROR(err);
+  err = PetscSectionClone(section, &newSection);CHECK_PETSC_ERROR(err);
+  err = DMSetDefaultSection(sinfo.dm, newSection);CHECK_PETSC_ERROR(err);
   err = DMGetPointSF(sinfo.dm, &sf);CHECK_PETSC_ERROR(err);
   err = PetscSectionCreateGlobalSection(section, sf, PETSC_TRUE, &gsection);CHECK_PETSC_ERROR(err);
   err = DMSetDefaultGlobalSection(sinfo.dm, gsection);CHECK_PETSC_ERROR(err);
@@ -1368,12 +1369,13 @@
   err = VecSetFromOptions(sinfo.vector); CHECK_PETSC_ERROR(err);  
 #endif
 
-  PetscSection section, gsection;
+  PetscSection section, newSection, gsection;
   PetscSF      sf;
 
   err = DMComplexClone(_dm, &sinfo.dm);CHECK_PETSC_ERROR(err);
   err = DMGetDefaultSection(_dm, &section);CHECK_PETSC_ERROR(err);
-  err = DMSetDefaultSection(sinfo.dm, section);CHECK_PETSC_ERROR(err);
+  err = PetscSectionClone(section, &newSection);CHECK_PETSC_ERROR(err);
+  err = DMSetDefaultSection(sinfo.dm, newSection);CHECK_PETSC_ERROR(err);
   err = DMGetPointSF(sinfo.dm, &sf);CHECK_PETSC_ERROR(err);
   err = PetscSectionCreateGlobalSection(section, sf, PETSC_TRUE, &gsection);CHECK_PETSC_ERROR(err);
   err = DMSetDefaultGlobalSection(sinfo.dm, gsection);CHECK_PETSC_ERROR(err);
@@ -1455,10 +1457,12 @@
 
   PetscErrorCode err = 0;
   const ScatterInfo& sinfo = _getScatter(context);
+#if 0
   err = VecScatterBegin(sinfo.scatter, sinfo.scatterVec, vector,
 			INSERT_VALUES, SCATTER_FORWARD); CHECK_PETSC_ERROR(err);
   err = VecScatterEnd(sinfo.scatter, sinfo.scatterVec, vector,
 		      INSERT_VALUES, SCATTER_FORWARD); CHECK_PETSC_ERROR(err);
+#endif
 
   if (sinfo.dm) {
     err = DMLocalToGlobalBegin(sinfo.dm, _localVec, INSERT_VALUES, vector);CHECK_PETSC_ERROR(err);
@@ -1493,10 +1497,12 @@
 
   PetscErrorCode err = 0;
   const ScatterInfo& sinfo = _getScatter(context);
+#if 0
   err = VecScatterBegin(sinfo.scatter, vector, sinfo.scatterVec,
 			INSERT_VALUES, SCATTER_REVERSE); CHECK_PETSC_ERROR(err);
   err = VecScatterEnd(sinfo.scatter, vector, sinfo.scatterVec,
 		      INSERT_VALUES, SCATTER_REVERSE); CHECK_PETSC_ERROR(err);
+#endif
 
   if (sinfo.dm) {
     err = DMGlobalToLocalBegin(sinfo.dm, vector, INSERT_VALUES, _localVec);CHECK_PETSC_ERROR(err);



More information about the CIG-COMMITS mailing list