[cig-commits] r22744 - in short/3D/PyLith/trunk: libsrc/pylith/topology unittests/libtests/topology unittests/libtests/topology/data
brad at geodynamics.org
brad at geodynamics.org
Thu Aug 29 17:19:08 PDT 2013
Author: brad
Date: 2013-08-29 17:19:08 -0700 (Thu, 29 Aug 2013)
New Revision: 22744
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/MeshDataCohesiveQuad4Level1.cc
short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTri3Level1.cc
Log:
Updated tri3 and quad4 refinement tests. Made group refinement test more robust.
Modified: short/3D/PyLith/trunk/libsrc/pylith/topology/RefineUniform.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/topology/RefineUniform.cc 2013-08-30 00:18:50 UTC (rev 22743)
+++ short/3D/PyLith/trunk/libsrc/pylith/topology/RefineUniform.cc 2013-08-30 00:19:08 UTC (rev 22744)
@@ -81,7 +81,7 @@
newMesh->dmMesh(dmNew);
- newMesh->view("REFINED MESH");
+ 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-08-30 00:18:50 UTC (rev 22743)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/TestRefineUniform.cc 2013-08-30 00:19:08 UTC (rev 22744)
@@ -318,18 +318,27 @@
PetscInt numGroups, pStart, pEnd;
err = DMPlexGetChart(dmMesh, &pStart, &pEnd);PYLITH_CHECK_ERROR(err);
err = DMPlexGetNumLabels(dmMesh, &numGroups);PYLITH_CHECK_ERROR(err);
- numGroups -= 2; // Remove depth and material labels.
- CPPUNIT_ASSERT_EQUAL(data.numGroups, numGroups);
+ CPPUNIT_ASSERT_EQUAL(data.numGroups, numGroups-2); // Omit depth and material labels
PetscInt index = 0;
- for(PetscInt iGroup = 0, iLabel = numGroups-1; iGroup < numGroups; ++iGroup, --iLabel) {
+ for(PetscInt iGroup = 0; iGroup < data.numGroups; ++iGroup) {
+ // Don't know order of labels, so do brute force linear search
+ bool foundLabel = false;
+ int iLabel = 0;
const char *name = NULL;
PetscInt firstPoint = 0;
+ while (iLabel < numGroups) {
+ err = DMPlexGetLabelName(dmMesh, iLabel, &name);PYLITH_CHECK_ERROR(err);
+ if (0 == strcmp(data.groupNames[iGroup], name)) {
+ foundLabel = true;
+ break;
+ } else {
+ ++iLabel;
+ } // if/else
+ } // while
+ CPPUNIT_ASSERT(foundLabel);
- err = DMPlexGetLabelName(dmMesh, iLabel, &name);PYLITH_CHECK_ERROR(err);
- CPPUNIT_ASSERT_EQUAL(std::string(data.groupNames[iGroup]), std::string(name));
for(PetscInt p = pStart; p < pEnd; ++p) {
PetscInt val;
-
err = DMPlexGetLabelValue(dmMesh, name, p, &val);PYLITH_CHECK_ERROR(err);
if (val >= 0) {
firstPoint = p;
@@ -347,7 +356,7 @@
err = DMPlexGetStratumIS(dmMesh, name, 1, &pointIS);PYLITH_CHECK_ERROR(err);
err = ISGetIndices(pointIS, &points);PYLITH_CHECK_ERROR(err);
for(PetscInt p = 0; p < numPoints; ++p) {
- CPPUNIT_ASSERT_EQUAL(data.groups[index++], points[p]-offset);
+ CPPUNIT_ASSERT_EQUAL(data.groups[index++], points[p]);
} // for
err = ISRestoreIndices(pointIS, &points);PYLITH_CHECK_ERROR(err);
err = ISDestroy(&pointIS);PYLITH_CHECK_ERROR(err);
Modified: short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveQuad4Level1.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveQuad4Level1.cc 2013-08-30 00:18:50 UTC (rev 22743)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveQuad4Level1.cc 2013-08-30 00:19:08 UTC (rev 22744)
@@ -95,13 +95,13 @@
const int pylith::topology::MeshDataCohesiveQuad4Level1::_numGroups = 3;
const int pylith::topology::MeshDataCohesiveQuad4Level1::_groupSizes[3] = {
- 5, 5, 5,
+ 9, 9, 9,
};
-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 int pylith::topology::MeshDataCohesiveQuad4Level1::_groups[9+9+9] = { // vertices, edges
+ 16, 19, 22, 25, 31, 41, 42, 53, 54,
+ 16, 17, 18, 28, 32, 47, 48, 55, 56,
+ 19, 20, 21, 26, 33, 43, 44, 57, 58,
};
const char* pylith::topology::MeshDataCohesiveQuad4Level1::_groupNames[3] = {
Modified: short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTri3Level1.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTri3Level1.cc 2013-08-30 00:18:50 UTC (rev 22743)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTri3Level1.cc 2013-08-30 00:19:08 UTC (rev 22744)
@@ -83,24 +83,24 @@
const int pylith::topology::MeshDataCohesiveTri3Level1::_numGroups = 4;
const int pylith::topology::MeshDataCohesiveTri3Level1::_groupSizes[] = {
- 5, 3, 2, 5,
+ 9, 5, 2, 9,
};
-const int pylith::topology::MeshDataCohesiveTri3Level1::_groups[] = {
- 16, 17, 19, 21, 25,
- 17, 20, 26,
+const int pylith::topology::MeshDataCohesiveTri3Level1::_groups[] = { // vertices, edges
+ 16, 17, 19, 21, 25, 29, 30, 37, 38,
+ 17, 20, 26, 39, 40,
16, 20,
- 17, 18, 19, 22, 24,
+ 17, 18, 19, 22, 24, 31, 32, 35, 36,
};
-const char* pylith::topology::MeshDataCohesiveTri3Level1::_groupNames[] = {
+const char* pylith::topology::MeshDataCohesiveTri3Level1::_groupNames[4] = {
"edge 1",
"edge 2",
"end points",
"fault",
};
-const char* pylith::topology::MeshDataCohesiveTri3Level1::_groupTypes[] = {
+const char* pylith::topology::MeshDataCohesiveTri3Level1::_groupTypes[4] = {
"vertex",
"vertex",
"vertex",
More information about the CIG-COMMITS
mailing list