[cig-commits] r22759 - short/3D/PyLith/trunk/unittests/libtests/bc

knepley at geodynamics.org knepley at geodynamics.org
Tue Sep 3 11:59:01 PDT 2013


Author: knepley
Date: 2013-09-03 11:59:00 -0700 (Tue, 03 Sep 2013)
New Revision: 22759

Modified:
   short/3D/PyLith/trunk/unittests/libtests/bc/TestAbsorbingDampers.cc
   short/3D/PyLith/trunk/unittests/libtests/bc/TestBoundaryMesh.cc
   short/3D/PyLith/trunk/unittests/libtests/bc/TestNeumann.cc
Log:
Cleaner test failures

Modified: short/3D/PyLith/trunk/unittests/libtests/bc/TestAbsorbingDampers.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestAbsorbingDampers.cc	2013-09-03 17:29:42 UTC (rev 22758)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestAbsorbingDampers.cc	2013-09-03 18:59:00 UTC (rev 22759)
@@ -152,8 +152,17 @@
     }
     err = DMPlexRestoreTransitiveClosure(subMesh, c, PETSC_TRUE, &closureSize, &closure);PYLITH_CHECK_ERROR(err);
     CPPUNIT_ASSERT_EQUAL(_data->numCorners, numCorners);
-    for(PetscInt p = 0; p < numCorners; ++p, ++dp) {
-      CPPUNIT_ASSERT_EQUAL(_data->cells[dp], vertices[p]);
+    // Allow cyclic permutations to handle both interpolated and non-interpolated cases
+    if (boundaryMesh.dimension() > 1) {
+      PetscInt first;
+      for (first = 0; first < numCorners; ++first) if (_data->cells[dp] == vertices[first]) break;
+      CPPUNIT_ASSERT(first < numCorners);
+      for (PetscInt p = 0; p < numCorners; ++p, ++dp)
+        CPPUNIT_ASSERT_EQUAL(_data->cells[dp], vertices[(p+first)%numCorners]);
+    } else {
+      for(PetscInt p = 0; p < numCorners; ++p, ++dp) {
+        CPPUNIT_ASSERT_EQUAL(_data->cells[dp], vertices[p]);
+      }
     } // for
   } // for
 

Modified: short/3D/PyLith/trunk/unittests/libtests/bc/TestBoundaryMesh.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestBoundaryMesh.cc	2013-09-03 17:29:42 UTC (rev 22758)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestBoundaryMesh.cc	2013-09-03 18:59:00 UTC (rev 22759)
@@ -111,8 +111,17 @@
     } // for
     err = DMPlexRestoreTransitiveClosure(dmMesh, c, PETSC_TRUE, &closureSize, &closure);PYLITH_CHECK_ERROR(err);
     CPPUNIT_ASSERT_EQUAL(_data->numCorners, numVertices);
-    for (PetscInt v = 0; v < numVertices; ++v, ++index)
-      CPPUNIT_ASSERT_EQUAL(_data->cellsNoFault[index], subpointMap[vertices[v]]);
+    // Allow cyclic permutations to handle both interpolated and non-interpolated cases
+    if (submesh.dimension() > 1) {
+      PetscInt first;
+      for (first = 0; first < numVertices; ++first) if (_data->cellsNoFault[index] == subpointMap[vertices[first]]) break;
+      CPPUNIT_ASSERT(first < numVertices);
+      for (PetscInt v = 0; v < numVertices; ++v, ++index)
+        CPPUNIT_ASSERT_EQUAL(_data->cellsNoFault[index], subpointMap[vertices[(v+first)%numVertices]]);
+    } else {
+      for (PetscInt v = 0; v < numVertices; ++v, ++index)
+        CPPUNIT_ASSERT_EQUAL(_data->cellsNoFault[index], subpointMap[vertices[v]]);
+    }
   } // for
 
   PYLITH_METHOD_END;
@@ -187,8 +196,17 @@
     } // for
     err = DMPlexRestoreTransitiveClosure(dmMesh, c, PETSC_TRUE, &closureSize, &closure);PYLITH_CHECK_ERROR(err);
     CPPUNIT_ASSERT_EQUAL(_data->numCorners, numVertices);
-    for (PetscInt v = 0; v < numVertices; ++v, ++index)
-      CPPUNIT_ASSERT_EQUAL(_data->cellsFault[index], subpointMap[vertices[v]]);
+    // Allow cyclic permutations to handle both interpolated and non-interpolated cases
+    if (submesh.dimension() > 1) {
+      PetscInt first;
+      for (first = 0; first < numVertices; ++first) if (_data->cellsFault[index] == subpointMap[vertices[first]]) break;
+      CPPUNIT_ASSERT(first < numVertices);
+      for (PetscInt v = 0; v < numVertices; ++v, ++index)
+        CPPUNIT_ASSERT_EQUAL(_data->cellsFault[index], subpointMap[vertices[(v+first)%numVertices]]);
+    } else {
+      for (PetscInt v = 0; v < numVertices; ++v, ++index)
+        CPPUNIT_ASSERT_EQUAL(_data->cellsFault[index], subpointMap[vertices[v]]);
+    }
   } // for
 
   PYLITH_METHOD_END;

Modified: short/3D/PyLith/trunk/unittests/libtests/bc/TestNeumann.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestNeumann.cc	2013-09-03 17:29:42 UTC (rev 22758)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestNeumann.cc	2013-09-03 18:59:00 UTC (rev 22759)
@@ -204,9 +204,17 @@
     } // for
     err = DMPlexRestoreTransitiveClosure(subMesh, c, PETSC_TRUE, &closureSize, &closure);PYLITH_CHECK_ERROR(err);
     CPPUNIT_ASSERT_EQUAL(_data->numCorners, numCorners);
-    for(PetscInt p = 0; p < numCorners; ++p, ++dp) {
-      CPPUNIT_ASSERT_EQUAL(_data->cells[dp], vertices[p]);
-    } // for
+    if (boundaryMesh.dimension() > 1) {
+      PetscInt first;
+      for (first = 0; first < numCorners; ++first) if (_data->cells[dp] == vertices[first]) break;
+      CPPUNIT_ASSERT(first < numCorners);
+      for (PetscInt p = 0; p < numCorners; ++p, ++dp)
+        CPPUNIT_ASSERT_EQUAL(_data->cells[dp], vertices[(p+first)%numCorners]);
+    } else {
+      for(PetscInt p = 0; p < numCorners; ++p, ++dp) {
+        CPPUNIT_ASSERT_EQUAL(_data->cells[dp], vertices[p]);
+      } // for
+    }
   } // for
 
   // Check traction values



More information about the CIG-COMMITS mailing list