[cig-commits] [commit] knepley/fix-parallel-mult-faults, master, next: HDF5: Short circuit new Plex code - We will eventually switch over to it (a68f689)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Wed Apr 9 03:04:33 PDT 2014


Repository : ssh://geoshell/pylith

On branches: knepley/fix-parallel-mult-faults,master,next
Link       : https://github.com/geodynamics/pylith/compare/a213c3005450d915f40c7137ff7d8dbbb439d334...1b3d6d3bc246edc4235d0051142d675d91e9be41

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

commit a68f689441f9cea02053b4daf857d29c93e00fdb
Author: Matthew G. Knepley <knepley at gmail.com>
Date:   Mon Mar 31 10:40:35 2014 -0500

    HDF5: Short circuit new Plex code
    - We will eventually switch over to it


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

a68f689441f9cea02053b4daf857d29c93e00fdb
 libsrc/pylith/meshio/DataWriterHDF5.cc | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/libsrc/pylith/meshio/DataWriterHDF5.cc b/libsrc/pylith/meshio/DataWriterHDF5.cc
index 99d362d..45477be 100644
--- a/libsrc/pylith/meshio/DataWriterHDF5.cc
+++ b/libsrc/pylith/meshio/DataWriterHDF5.cc
@@ -32,6 +32,11 @@
 #include <sstream> // USES std::ostringstream
 #include <stdexcept> // USES std::runtime_error
 
+extern "C" {
+extern PetscErrorCode VecView_Seq(Vec, PetscViewer);
+extern PetscErrorCode VecView_MPI(Vec, PetscViewer);
+}
+
 // ----------------------------------------------------------------------
 // Constructor
 pylith::meshio::DataWriterHDF5::DataWriterHDF5(void) :
@@ -127,7 +132,14 @@ pylith::meshio::DataWriterHDF5::open(const topology::Mesh& mesh,
     PetscVec coordVector = coordinatesField.vector(metadata.label.c_str());assert(coordVector);
     err = VecScale(coordVector, lengthScale);PYLITH_CHECK_ERROR(err);
     err = PetscViewerHDF5PushGroup(_viewer, "/geometry");PYLITH_CHECK_ERROR(err);
+#if 0
     err = VecView(coordVector, _viewer);PYLITH_CHECK_ERROR(err);
+#else
+    PetscBool isseq;
+    err = PetscObjectTypeCompare((PetscObject) coordVector, VECSEQ, &isseq);PYLITH_CHECK_ERROR(err);
+    if (isseq) {err = VecView_Seq(coordVector, _viewer);PYLITH_CHECK_ERROR(err);}
+    else       {err = VecView_MPI(coordVector, _viewer);PYLITH_CHECK_ERROR(err);}
+#endif
     err = PetscViewerHDF5PopGroup(_viewer); PYLITH_CHECK_ERROR(err);
 
     PetscInt vStart, vEnd, cellHeight, cStart, cEnd, cMax, dof, conesSize, numCorners, numCornersLocal = 0;
@@ -292,7 +304,14 @@ pylith::meshio::DataWriterHDF5::writeVertexField(const PylithScalar t,
 
     err = PetscViewerHDF5PushGroup(_viewer, "/vertex_fields");PYLITH_CHECK_ERROR(err);
     err = PetscViewerHDF5SetTimestep(_viewer, istep);PYLITH_CHECK_ERROR(err);
+#if 0
     err = VecView(vector, _viewer);PYLITH_CHECK_ERROR(err);
+#else
+    PetscBool isseq;
+    err = PetscObjectTypeCompare((PetscObject) vector, VECSEQ, &isseq);PYLITH_CHECK_ERROR(err);
+    if (isseq) {err = VecView_Seq(vector, _viewer);PYLITH_CHECK_ERROR(err);}
+    else       {err = VecView_MPI(vector, _viewer);PYLITH_CHECK_ERROR(err);}
+#endif
     err = PetscViewerHDF5PopGroup(_viewer);PYLITH_CHECK_ERROR(err);
 
     if (0 == istep) {
@@ -353,7 +372,14 @@ pylith::meshio::DataWriterHDF5::writeCellField(const PylithScalar t,
 
     err = PetscViewerHDF5PushGroup(_viewer, "/cell_fields");PYLITH_CHECK_ERROR(err);
     err = PetscViewerHDF5SetTimestep(_viewer, istep);PYLITH_CHECK_ERROR(err);
+#if 0
     err = VecView(vector, _viewer);PYLITH_CHECK_ERROR(err);
+#else
+    PetscBool isseq;
+    err = PetscObjectTypeCompare((PetscObject) vector, VECSEQ, &isseq);PYLITH_CHECK_ERROR(err);
+    if (isseq) {err = VecView_Seq(vector, _viewer);PYLITH_CHECK_ERROR(err);}
+    else       {err = VecView_MPI(vector, _viewer);PYLITH_CHECK_ERROR(err);}
+#endif
     err = PetscViewerHDF5PopGroup(_viewer);PYLITH_CHECK_ERROR(err);
 
     if (0 == istep) {



More information about the CIG-COMMITS mailing list