[commit] knepley/upgrade-petsc-interface: Topology+Faults: When using ‘depth’ to check for an interpolated mesh in parallel, need to account for −1 on empty meshes (06c0bcc)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Thu Nov 21 08:37:08 PST 2013


Repository : ssh://geoshell/pylith

On branch  : knepley/upgrade-petsc-interface
Link       : https://github.com/geodynamics/pylith/compare/98809641a2f06d95f29257aaa275c3523f4eb303...14e3c7218d29e16d44beae10754c16e527273126

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

commit 06c0bcc64b09fc91f6c745b9e277b66a267f338d
Author: Matthew G. Knepley <knepley at gmail.com>
Date:   Thu Nov 21 10:39:05 2013 -0600

    Topology+Faults: When using ‘depth’ to check for an interpolated mesh in parallel, need to account for −1 on empty meshes


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

06c0bcc64b09fc91f6c745b9e277b66a267f338d
 libsrc/pylith/faults/CohesiveTopology.cc | 5 +++--
 libsrc/pylith/faults/FaultCohesive.cc    | 7 ++++---
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/libsrc/pylith/faults/CohesiveTopology.cc b/libsrc/pylith/faults/CohesiveTopology.cc
index cbd1068..1e68910 100644
--- a/libsrc/pylith/faults/CohesiveTopology.cc
+++ b/libsrc/pylith/faults/CohesiveTopology.cc
@@ -42,12 +42,13 @@ pylith::faults::CohesiveTopology::createFault(topology::Mesh* faultMesh,
   faultMesh->coordsys(mesh.coordsys());
   PetscDM dmMesh = mesh.dmMesh();assert(dmMesh);
 
-  PetscInt dim, depth;
+  PetscInt dim, depth, gdepth;
   err = DMPlexGetDimension(dmMesh, &dim);PYLITH_CHECK_ERROR(err);
   err = DMPlexGetDepth(dmMesh, &depth);PYLITH_CHECK_ERROR(err);
 
   // Convert fault to a DM
-  if (depth == dim) {
+  err = MPI_Allreduce(&depth, &gdepth, 1, MPIU_INT, MPI_MAX, mesh.comm());PYLITH_CHECK_ERROR(err);
+  if (gdepth == dim) {
     PetscDM subdm = NULL;
     PetscDMLabel label = NULL;
     const char *groupName = "", *labelName = "boundary";
diff --git a/libsrc/pylith/faults/FaultCohesive.cc b/libsrc/pylith/faults/FaultCohesive.cc
index ddf568c..cd76c44 100644
--- a/libsrc/pylith/faults/FaultCohesive.cc
+++ b/libsrc/pylith/faults/FaultCohesive.cc
@@ -129,7 +129,7 @@ pylith::faults::FaultCohesive::adjustTopology(topology::Mesh* const mesh,
 
       PetscDMLabel   groupField;
       PetscBool      hasLabel;
-      PetscInt       depth, dim;
+      PetscInt       depth, gdepth, dim;
       PetscMPIInt    rank;
       PetscErrorCode err;
       // We do not have labels on all ranks until after distribution
@@ -143,11 +143,12 @@ pylith::faults::FaultCohesive::adjustTopology(topology::Mesh* const mesh,
       } // if
       err = DMPlexGetDimension(dmMesh, &dim);PYLITH_CHECK_ERROR(err);
       err = DMPlexGetDepth(dmMesh, &depth);PYLITH_CHECK_ERROR(err);
+      err = MPI_Allreduce(&depth, &gdepth, 1, MPIU_INT, MPI_MAX, mesh->comm());PYLITH_CHECK_ERROR(err);
       err = DMPlexGetLabel(dmMesh, charlabel, &groupField);PYLITH_CHECK_ERROR(err);
       CohesiveTopology::createFault(&faultMesh, faultBoundary, *mesh, groupField);
 
-      if (dim > 1 && dim == depth) {
-        CohesiveTopology::createInterpolated(mesh, faultMesh, faultBoundary, groupField, id(), *firstFaultVertex, *firstLagrangeVertex, *firstFaultCell, useLagrangeConstraints());
+      if (dim > 1 && dim == gdepth) {
+        CohesiveTopology::createInterpolated(mesh, faultMesh, faultBoundary, id(), *firstFaultVertex, *firstLagrangeVertex, *firstFaultCell, useLagrangeConstraints());
       } else {
         CohesiveTopology::create(mesh, faultMesh, faultBoundary, groupField, id(), *firstFaultVertex, *firstLagrangeVertex, *firstFaultCell, useLagrangeConstraints());
       }



More information about the CIG-COMMITS mailing list