[cig-commits] [commit] knepley/fix-faults-parallel: Faults: Fixed checking for cross edge - I needed to throw out non-fault edges when checking the support size (97d95cf)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Fri May 16 05:39:21 PDT 2014


Repository : https://github.com/geodynamics/pylith

On branch  : knepley/fix-faults-parallel
Link       : https://github.com/geodynamics/pylith/compare/9983318f75355ae67fcd47081ef99c89a39cf5a8...97d95cf2f4c0545055a02f11302a82bf9b4da6f6

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

commit 97d95cf2f4c0545055a02f11302a82bf9b4da6f6
Author: Matthew G. Knepley <knepley at gmail.com>
Date:   Fri May 16 07:39:08 2014 -0500

    Faults: Fixed checking for cross edge
    - I needed to throw out non-fault edges when checking the support size


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

97d95cf2f4c0545055a02f11302a82bf9b4da6f6
 libsrc/pylith/faults/CohesiveTopology.cc | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/libsrc/pylith/faults/CohesiveTopology.cc b/libsrc/pylith/faults/CohesiveTopology.cc
index daf6763..bbba016 100644
--- a/libsrc/pylith/faults/CohesiveTopology.cc
+++ b/libsrc/pylith/faults/CohesiveTopology.cc
@@ -88,8 +88,9 @@ pylith::faults::CohesiveTopology::create(topology::Mesh* mesh,
 
       // Remove faces
       if ((p >= fStart) && (p < fEnd)) {
-        const PetscInt *edges,   *verts;
-        PetscInt        numEdges, numVerts, supportSizeA, supportSizeB, e;
+        const PetscInt *edges,   *verts, *supportA, *supportB;
+        PetscInt        numEdges, numVerts, supportSizeA, sA, supportSizeB, sB, bval, e, s;
+        PetscBool       found = PETSC_FALSE;
 
         err = DMLabelClearValue(faultBdLabel, p, 1);PYLITH_CHECK_ERROR(err);
         // Remove the cross edge
@@ -109,12 +110,28 @@ pylith::faults::CohesiveTopology::create(topology::Mesh* mesh,
             throw std::runtime_error(msg.str());
           }
           err = DMPlexGetSupportSize(dm, verts[0], &supportSizeA);PYLITH_CHECK_ERROR(err);
+          err = DMPlexGetSupport(dm, verts[0], &supportA);PYLITH_CHECK_ERROR(err);
+          for (s = 0, sA = 0; s < supportSizeA; ++s) {
+            err = DMLabelGetValue(faultBdLabel, supportA[s], &bval);PYLITH_CHECK_ERROR(err);
+            if (bval >= 0) ++sA;
+          }
           err = DMPlexGetSupportSize(dm, verts[1], &supportSizeB);PYLITH_CHECK_ERROR(err);
-          if ((supportSizeA > 2) && (supportSizeB > 2)) {
+          err = DMPlexGetSupport(dm, verts[1], &supportB);PYLITH_CHECK_ERROR(err);
+          for (s = 0, sB = 0; s < supportSizeB; ++s) {
+            err = DMLabelGetValue(faultBdLabel, supportB[s], &bval);PYLITH_CHECK_ERROR(err);
+            if (bval >= 0) ++sB;
+          }
+          if ((sA > 2) && (sB > 2)) {
             err = DMLabelClearValue(faultBdLabel, edges[e], 1);PYLITH_CHECK_ERROR(err);
+            found = PETSC_TRUE;
             break;
           }
         }
+        if (!found) {
+          std::ostringstream msg;
+          msg << "Face "<<p<<" has no cross edge.";
+          throw std::runtime_error(msg.str());
+        }
       }
     }
     err = ISRestoreIndices(bdIS, &bd);PYLITH_CHECK_ERROR(err);



More information about the CIG-COMMITS mailing list