[cig-commits] r22686 - in short/3D/PyLith/trunk: libsrc/pylith/topology unittests/libtests/topology unittests/libtests/topology/data unittests/pytests/topology

brad at geodynamics.org brad at geodynamics.org
Fri Jul 26 17:30:58 PDT 2013


Author: brad
Date: 2013-07-26 17:30:57 -0700 (Fri, 26 Jul 2013)
New Revision: 22686

Modified:
   short/3D/PyLith/trunk/libsrc/pylith/topology/RefineUniform.cc
   short/3D/PyLith/trunk/unittests/libtests/topology/TestRefineUniform.cc
   short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveHex8Level1.cc
   short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveHex8Level1Fault1.cc
   short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveQuad4Level1.cc
   short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveQuad4Level1Fault1.cc
   short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTet4Level1.cc
   short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTet4Level1Fault1.cc
   short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTri3Level1.cc
   short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTri3Level1Fault1.cc
   short/3D/PyLith/trunk/unittests/pytests/topology/TestRefineUniform.py
Log:
More work on updating refinement tests.

Modified: short/3D/PyLith/trunk/libsrc/pylith/topology/RefineUniform.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/topology/RefineUniform.cc	2013-07-26 22:13:24 UTC (rev 22685)
+++ short/3D/PyLith/trunk/libsrc/pylith/topology/RefineUniform.cc	2013-07-27 00:30:57 UTC (rev 22686)
@@ -53,6 +53,8 @@
 					const Mesh& mesh,
 					const int levels)
 { // refine
+  PYLITH_METHOD_BEGIN;
+  
   assert(newMesh);
 
   PetscErrorCode err;
@@ -77,7 +79,11 @@
     err = DMRefine(dmOrig, mesh.comm(), &dmNew);PYLITH_CHECK_ERROR(err);
   } // for
 
-  // newMesh->view("REFINED MESH");
+  newMesh->dmMesh(dmNew);
+
+  newMesh->view("REFINED MESH");
+
+  PYLITH_METHOD_END;
 } // refine
     
 

Modified: short/3D/PyLith/trunk/unittests/libtests/topology/TestRefineUniform.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/TestRefineUniform.cc	2013-07-26 22:13:24 UTC (rev 22685)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/TestRefineUniform.cc	2013-07-27 00:30:57 UTC (rev 22686)
@@ -50,7 +50,11 @@
 void
 pylith::topology::TestRefineUniform::testConstructor(void)
 { // testConstructor
+  PYLITH_METHOD_BEGIN;
+
   RefineUniform refiner;
+
+  PYLITH_METHOD_END;
 } // testConstructor
 
 // ----------------------------------------------------------------------
@@ -58,8 +62,12 @@
 void
 pylith::topology::TestRefineUniform::testRefineTri3Level1(void)
 { // testRefineTri3Level1
+  PYLITH_METHOD_BEGIN;
+
   MeshDataCohesiveTri3Level1 data;
   _testRefine(data);
+
+  PYLITH_METHOD_END;
 } // testRefineTri3Level1
 
 // ----------------------------------------------------------------------
@@ -67,8 +75,12 @@
 void
 pylith::topology::TestRefineUniform::testRefineTri3Level1Fault1(void)
 { // testRefineTri3Level1Fault1
+  PYLITH_METHOD_BEGIN;
+
   MeshDataCohesiveTri3Level1Fault1 data;
   _testRefine(data);
+
+  PYLITH_METHOD_END;
 } // testRefineTri3Level1Fault1
 
 // ----------------------------------------------------------------------
@@ -76,8 +88,12 @@
 void
 pylith::topology::TestRefineUniform::testRefineQuad4Level1(void)
 { // testRefineQuad4Level1
+  PYLITH_METHOD_BEGIN;
+
   MeshDataCohesiveQuad4Level1 data;
   _testRefine(data);
+
+  PYLITH_METHOD_END;
 } // testRefineQuad4Level1
 
 // ----------------------------------------------------------------------
@@ -85,8 +101,12 @@
 void
 pylith::topology::TestRefineUniform::testRefineQuad4Level1Fault1(void)
 { // testRefineQuad4Level1Fault1
+  PYLITH_METHOD_BEGIN;
+
   MeshDataCohesiveQuad4Level1Fault1 data;
   _testRefine(data);
+
+  PYLITH_METHOD_END;
 } // testRefineQuad4Level1Fault1
 
 // ----------------------------------------------------------------------
@@ -94,8 +114,12 @@
 void
 pylith::topology::TestRefineUniform::testRefineTet4Level1(void)
 { // testRefineTet4Level1
+  PYLITH_METHOD_BEGIN;
+
   MeshDataCohesiveTet4Level1 data;
   _testRefine(data);
+
+  PYLITH_METHOD_END;
 } // testRefineTet4Level1
 
 // ----------------------------------------------------------------------
@@ -103,8 +127,12 @@
 void
 pylith::topology::TestRefineUniform::testRefineTet4Level1Fault1(void)
 { // testRefineTet4Level1Fault1
+  PYLITH_METHOD_BEGIN;
+
   MeshDataCohesiveTet4Level1Fault1 data;
   _testRefine(data);
+
+  PYLITH_METHOD_END;
 } // testRefineTet4Level1Fault1
 
 // ----------------------------------------------------------------------
@@ -112,8 +140,12 @@
 void
 pylith::topology::TestRefineUniform::testRefineHex8Level1(void)
 { // testRefineHex8Level1
+  PYLITH_METHOD_BEGIN;
+
   MeshDataCohesiveHex8Level1 data;
   _testRefine(data);
+
+  PYLITH_METHOD_END;
 } // testRefineHex8Level1
 
 // ----------------------------------------------------------------------
@@ -121,8 +153,12 @@
 void
 pylith::topology::TestRefineUniform::testRefineHex8Level1Fault1(void)
 { // testRefineHex8Level1Fault1
+  PYLITH_METHOD_BEGIN;
+
   MeshDataCohesiveHex8Level1Fault1 data;
   _testRefine(data);
+
+  PYLITH_METHOD_END;
 } // testRefineHex8Level1Fault1
 
 // ----------------------------------------------------------------------
@@ -130,10 +166,13 @@
 pylith::topology::TestRefineUniform::_setupMesh(Mesh* const mesh,
 						const MeshDataCohesive& data)
 { // _setupMesh
-  assert(0 != mesh);
+  PYLITH_METHOD_BEGIN;
 
+  assert(mesh);
+
   meshio::MeshIOAscii iohandler;
   iohandler.filename(data.filename);
+  iohandler.interpolate(true);
 
   iohandler.read(mesh);
 
@@ -168,6 +207,8 @@
       faultB.adjustTopology(mesh, &firstFaultVertex, &firstLagrangeVertex, &firstFaultCell);
     } // if
   } // if
+
+  PYLITH_METHOD_END;
 } // _setupMesh
 
 // ----------------------------------------------------------------------
@@ -175,6 +216,7 @@
 void
 pylith::topology::TestRefineUniform::_testRefine(const MeshDataCohesive& data)
 { // _testRefine
+  PYLITH_METHOD_BEGIN;
 
   Mesh mesh(data.cellDim);
   _setupMesh(&mesh, data);
@@ -204,7 +246,7 @@
     CPPUNIT_ASSERT_EQUAL(spaceDim, coordsVisitor.sectionDof(v));
 
     for (int iDim=0; iDim < spaceDim; ++iDim, ++index) {
-      if (data.vertices[index] < 1.0) {
+      if (fabs(data.vertices[index]) < 1.0) {
         CPPUNIT_ASSERT_DOUBLES_EQUAL(data.vertices[index], coordsArray[off+iDim], tolerance);
       } else {
         CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, coordsArray[off+iDim]/data.vertices[index], tolerance);
@@ -238,8 +280,9 @@
     } // for
     err = DMPlexInvertCell(data.cellDim, numCorners, closure);PYLITH_CHECK_ERROR(err);
     CPPUNIT_ASSERT_EQUAL(data.numCorners, numCorners);
+
     for(PetscInt p = 0; p < numCorners; ++p, ++index) {
-      CPPUNIT_ASSERT_EQUAL(data.cells[index], closure[p]-offset);
+      CPPUNIT_ASSERT_EQUAL(data.cells[index], closure[p]);
     } // for
     err = DMPlexRestoreTransitiveClosure(dmMesh, c, PETSC_TRUE, &closureSize, &closure);PYLITH_CHECK_ERROR(err);
   } // for
@@ -310,6 +353,7 @@
     err = ISDestroy(&pointIS);PYLITH_CHECK_ERROR(err);
   } // for
 
+  PYLITH_METHOD_END;
 } // _testRefine
 
 

Modified: short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveHex8Level1.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveHex8Level1.cc	2013-07-26 22:13:24 UTC (rev 22685)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveHex8Level1.cc	2013-07-27 00:30:57 UTC (rev 22686)
@@ -21,7 +21,7 @@
 const char* pylith::topology::MeshDataCohesiveHex8Level1::_filename = 
   "data/twohex8.mesh";
 
-const int pylith::topology::MeshDataCohesiveHex8Level1::_refineLevel = 2;
+const int pylith::topology::MeshDataCohesiveHex8Level1::_refineLevel = 1;
 const char* pylith::topology::MeshDataCohesiveHex8Level1::_faultA = 0;
 const char* pylith::topology::MeshDataCohesiveHex8Level1::_faultB = 0;
 

Modified: short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveHex8Level1Fault1.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveHex8Level1Fault1.cc	2013-07-26 22:13:24 UTC (rev 22685)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveHex8Level1Fault1.cc	2013-07-27 00:30:57 UTC (rev 22686)
@@ -21,7 +21,7 @@
 const char* pylith::topology::MeshDataCohesiveHex8Level1Fault1::_filename = 
   "data/twohex8.mesh";
 
-const int pylith::topology::MeshDataCohesiveHex8Level1Fault1::_refineLevel = 2;
+const int pylith::topology::MeshDataCohesiveHex8Level1Fault1::_refineLevel = 1;
 const char* pylith::topology::MeshDataCohesiveHex8Level1Fault1::_faultA = 
   "fault";
 const char* pylith::topology::MeshDataCohesiveHex8Level1Fault1::_faultB = 0;

Modified: short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveQuad4Level1.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveQuad4Level1.cc	2013-07-26 22:13:24 UTC (rev 22685)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveQuad4Level1.cc	2013-07-27 00:30:57 UTC (rev 22686)
@@ -21,7 +21,7 @@
 const char* pylith::topology::MeshDataCohesiveQuad4Level1::_filename = 
   "data/fourquad4.mesh";
 
-const int pylith::topology::MeshDataCohesiveQuad4Level1::_refineLevel = 2;
+const int pylith::topology::MeshDataCohesiveQuad4Level1::_refineLevel = 1;
 const char* pylith::topology::MeshDataCohesiveQuad4Level1::_faultA = 0;
 const char* pylith::topology::MeshDataCohesiveQuad4Level1::_faultB = 0;
 
@@ -39,7 +39,7 @@
 
 const int pylith::topology::MeshDataCohesiveQuad4Level1::_numCornersCohesive = 6;
 
-const PylithScalar pylith::topology::MeshDataCohesiveQuad4Level1::_vertices[] = {
+const PylithScalar pylith::topology::MeshDataCohesiveQuad4Level1::_vertices[25*2] = {
   -1.0, -1.0,
   -1.0,  0.0,
   -1.0,  1.0,
@@ -49,68 +49,68 @@
    1.0, -1.0,
    1.0,  0.0,
    1.0,  1.0,
-  -0.5, -1.0,
+  -0.5, -1.0, // 9
    0.0, -0.5,
   -0.5,  0.0,
   -1.0, -0.5,
-  -0.5, -0.5,
-   1.0, -0.5,
+   1.0, -0.5, // 13
    0.5,  0.0,
    0.5, -1.0,
-   0.5, -0.5,
-  -1.0,  0.5,
+  -1.0,  0.5, // 16
    0.0,  0.5,
   -0.5,  1.0,
+   0.5,  1.0, // 19
+   1.0,  0.5,
+  -0.5, -0.5, // 21
+   0.5, -0.5,
   -0.5,  0.5,
-   0.5,  1.0,
-   1.0,  0.5,
    0.5,  0.5,
 };
 
-const int pylith::topology::MeshDataCohesiveQuad4Level1::_cells[] = {
-  16,  25,  29,  28,
-  19,  26,  29,  25,
-  17,  28,  29,  27,
-  20,  27,  29,  26,
-  22,  30,  33,  32,
-  23,  31,  33,  30,
-  19,  32,  33,  26,
-  20,  26,  33,  31,
-  18,  34,  37,  36,
-  17,  27,  37,  34,
-  21,  36,  37,  35,
-  20,  35,  37,  27,
-  24,  38,  40,  39,
-  21,  35,  40,  38,
-  23,  39,  40,  31,
-  20,  31,  40,  35,
+const int pylith::topology::MeshDataCohesiveQuad4Level1::_cells[16*4] = {
+  16,  25,  37,  28,
+  25,  19,  26,  37,
+  37,  26,  20,  27,
+  28,  37,  27,  17,
+  22,  29,  38,  31,
+  29,  23,  30,  38,
+  38,  30,  20,  26,
+  31,  38,  26,  19,
+  18,  32,  39,  34,
+  32,  17,  27,  39,
+  39,  27,  20,  33,
+  34,  39,  33,  21,
+  24,  35,  40,  36,
+  35,  21,  33,  40,
+  40,  33,  20,  30,
+  36,  40,  30,  23,
 };
 const int pylith::topology::MeshDataCohesiveQuad4Level1::_cellsCohesive[] = {
 };
-const int pylith::topology::MeshDataCohesiveQuad4Level1::_materialIds[] = {
+const int pylith::topology::MeshDataCohesiveQuad4Level1::_materialIds[16] = {
   1, 1, 1, 1, 2, 2, 2, 2,
   1, 1, 1, 1, 2, 2, 2, 2,
 };
 
 const int pylith::topology::MeshDataCohesiveQuad4Level1::_numGroups = 3;
 
-const int pylith::topology::MeshDataCohesiveQuad4Level1::_groupSizes[] = {
+const int pylith::topology::MeshDataCohesiveQuad4Level1::_groupSizes[3] = {
   5, 5, 5,
 };
 
-const int pylith::topology::MeshDataCohesiveQuad4Level1::_groups[] = {
+const int pylith::topology::MeshDataCohesiveQuad4Level1::_groups[5+5+5] = {
   16, 19, 22, 25, 32,
   16, 17, 18, 28, 34,
   19, 20, 21, 26, 35,
 };
 
-const char* pylith::topology::MeshDataCohesiveQuad4Level1::_groupNames[] = {
+const char* pylith::topology::MeshDataCohesiveQuad4Level1::_groupNames[3] = {
   "edge 1",
   "end points",
   "fault",
 };
 
-const char* pylith::topology::MeshDataCohesiveQuad4Level1::_groupTypes[] = {
+const char* pylith::topology::MeshDataCohesiveQuad4Level1::_groupTypes[3] = {
   "vertex",
   "vertex",
   "vertex",

Modified: short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveQuad4Level1Fault1.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveQuad4Level1Fault1.cc	2013-07-26 22:13:24 UTC (rev 22685)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveQuad4Level1Fault1.cc	2013-07-27 00:30:57 UTC (rev 22686)
@@ -21,7 +21,7 @@
 const char* pylith::topology::MeshDataCohesiveQuad4Level1Fault1::_filename = 
   "data/fourquad4.mesh";
 
-const int pylith::topology::MeshDataCohesiveQuad4Level1Fault1::_refineLevel = 2;
+const int pylith::topology::MeshDataCohesiveQuad4Level1Fault1::_refineLevel = 1;
 const char* pylith::topology::MeshDataCohesiveQuad4Level1Fault1::_faultA = "fault";
 const char* pylith::topology::MeshDataCohesiveQuad4Level1Fault1::_faultB = 0;
 

Modified: short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTet4Level1.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTet4Level1.cc	2013-07-26 22:13:24 UTC (rev 22685)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTet4Level1.cc	2013-07-27 00:30:57 UTC (rev 22686)
@@ -21,7 +21,7 @@
 const char* pylith::topology::MeshDataCohesiveTet4Level1::_filename = 
   "data/twotet4.mesh";
 
-const int pylith::topology::MeshDataCohesiveTet4Level1::_refineLevel = 2;
+const int pylith::topology::MeshDataCohesiveTet4Level1::_refineLevel = 1;
 const char* pylith::topology::MeshDataCohesiveTet4Level1::_faultA = 0;
 const char* pylith::topology::MeshDataCohesiveTet4Level1::_faultB = 0;
 

Modified: short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTet4Level1Fault1.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTet4Level1Fault1.cc	2013-07-26 22:13:24 UTC (rev 22685)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTet4Level1Fault1.cc	2013-07-27 00:30:57 UTC (rev 22686)
@@ -21,7 +21,7 @@
 const char* pylith::topology::MeshDataCohesiveTet4Level1Fault1::_filename = 
   "data/twotet4.mesh";
 
-const int pylith::topology::MeshDataCohesiveTet4Level1Fault1::_refineLevel = 2;
+const int pylith::topology::MeshDataCohesiveTet4Level1Fault1::_refineLevel = 1;
 const char* pylith::topology::MeshDataCohesiveTet4Level1Fault1::_faultA = 
   "fault";
 const char* pylith::topology::MeshDataCohesiveTet4Level1Fault1::_faultB = 0;

Modified: short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTri3Level1.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTri3Level1.cc	2013-07-26 22:13:24 UTC (rev 22685)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTri3Level1.cc	2013-07-27 00:30:57 UTC (rev 22686)
@@ -21,7 +21,7 @@
 const char* pylith::topology::MeshDataCohesiveTri3Level1::_filename = 
   "data/fourtri3.mesh";
 
-const int pylith::topology::MeshDataCohesiveTri3Level1::_refineLevel = 2;
+const int pylith::topology::MeshDataCohesiveTri3Level1::_refineLevel = 1;
 const char* pylith::topology::MeshDataCohesiveTri3Level1::_faultA = 0;
 const char* pylith::topology::MeshDataCohesiveTri3Level1::_faultB = 0;
 
@@ -57,21 +57,21 @@
 
 const int pylith::topology::MeshDataCohesiveTri3Level1::_cells[] = {
   16,  21,  23,
+  21,  17,  22,
+  23,  22,  18,
   21,  22,  23,
-  17,  22,  21,
-  18,  23,  22,
   18,  24,  23,
+  24,  19,  25,
+  23,  25, 16,
   24,  25,  23,
-  19,  25,  24,
-  16,  23,  25,
   18,  22,  27,
+  22,  17,  26,
+  27,  26,  20,
   22,  26,  27,
-  17,  26,  22,
-  20,  27,  26,
   18,  27,  24,
+  27,  20,  28,
+  24,  28,  19,
   27,  28,  24,
-  20,  28,  27,
-  19,  24,  28,
 };
 const int pylith::topology::MeshDataCohesiveTri3Level1::_cellsCohesive[] = {
 };

Modified: short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTri3Level1Fault1.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTri3Level1Fault1.cc	2013-07-26 22:13:24 UTC (rev 22685)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTri3Level1Fault1.cc	2013-07-27 00:30:57 UTC (rev 22686)
@@ -21,7 +21,7 @@
 const char* pylith::topology::MeshDataCohesiveTri3Level1Fault1::_filename = 
   "data/fourtri3.mesh";
 
-const int pylith::topology::MeshDataCohesiveTri3Level1Fault1::_refineLevel = 2;
+const int pylith::topology::MeshDataCohesiveTri3Level1Fault1::_refineLevel = 1;
 const char* pylith::topology::MeshDataCohesiveTri3Level1Fault1::_faultA = 
   "fault";
 const char* pylith::topology::MeshDataCohesiveTri3Level1Fault1::_faultB = 0;

Modified: short/3D/PyLith/trunk/unittests/pytests/topology/TestRefineUniform.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/topology/TestRefineUniform.py	2013-07-26 22:13:24 UTC (rev 22685)
+++ short/3D/PyLith/trunk/unittests/pytests/topology/TestRefineUniform.py	2013-07-27 00:30:57 UTC (rev 22686)
@@ -83,7 +83,7 @@
     io.inventory.coordsys = cs
     io._configure()
     
-    mesh = io.read(debug=False, interpolate=False)
+    mesh = io.read(debug=False, interpolate=True)
 
     if not faultGroup is None:
       from pylith.faults.FaultCohesiveKin import FaultCohesiveKin



More information about the CIG-COMMITS mailing list