[cig-commits] [commit] knepley/upgrade-petsc-interface: Field: Better viewing in parallel (9eb83e5)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Fri Feb 7 20:54:39 PST 2014


Repository : ssh://geoshell/pylith

On branch  : knepley/upgrade-petsc-interface
Link       : https://github.com/geodynamics/pylith/compare/7b36c0565c201e5a6630485ab44ea1c969a04a36...9eb83e524cdee666bb3efd6ac5e7810ed154ec26

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

commit 9eb83e524cdee666bb3efd6ac5e7810ed154ec26
Author: Matthew G. Knepley <knepley at gmail.com>
Date:   Fri Feb 7 22:54:37 2014 -0600

    Field: Better viewing in parallel


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

9eb83e524cdee666bb3efd6ac5e7810ed154ec26
 libsrc/pylith/topology/Field.cc | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/libsrc/pylith/topology/Field.cc b/libsrc/pylith/topology/Field.cc
index db82229..1014787 100644
--- a/libsrc/pylith/topology/Field.cc
+++ b/libsrc/pylith/topology/Field.cc
@@ -869,13 +869,20 @@ pylith::topology::Field::view(const char* label) const
 	    << "  scale: " << const_cast<Field*>(this)->_metadata["default"].scale << "\n"
 	    << "  dimensionalize flag: " << const_cast<Field*>(this)->_metadata["default"].dimsOkay << std::endl;
   if (_dm) {
-    PetscSection section = NULL;
+    PetscSection   section = NULL;
+    PetscMPIInt    numProcs, rank;
     PetscErrorCode err;
 
     err = DMGetDefaultSection(_dm, &section);PYLITH_CHECK_ERROR(err);
     err = DMView(_dm, PETSC_VIEWER_STDOUT_WORLD);PYLITH_CHECK_ERROR(err);
     err = PetscSectionView(section, PETSC_VIEWER_STDOUT_WORLD);PYLITH_CHECK_ERROR(err);
-    err = VecView(_localVec, PETSC_VIEWER_STDOUT_WORLD);PYLITH_CHECK_ERROR(err);
+    err = MPI_Comm_size(PetscObjectComm((PetscObject) _dm), &numProcs);PYLITH_CHECK_ERROR(err);
+    err = MPI_Comm_rank(PetscObjectComm((PetscObject) _dm), &rank);PYLITH_CHECK_ERROR(err);
+    for (PetscInt p = 0; p < numProcs; ++p) {
+      err = PetscPrintf(PetscObjectComm((PetscObject) _dm), "Proc %d local vector\n", p);PYLITH_CHECK_ERROR(err);
+      if (p == rank) {err = VecView(_localVec, PETSC_VIEWER_STDOUT_SELF);PYLITH_CHECK_ERROR(err);}
+      err = PetscBarrier((PetscObject) _dm);PYLITH_CHECK_ERROR(err);
+    }
   }
 
   PYLITH_METHOD_END;



More information about the CIG-COMMITS mailing list