[cig-commits] [commit] knepley/upgrade-petsc-interface: Switch to non-identity tests. (9a3a8bc)
cig_noreply at geodynamics.org
cig_noreply at geodynamics.org
Wed Oct 30 12:09:32 PDT 2013
Repository : ssh://geoshell/pylith
On branch : knepley/upgrade-petsc-interface
Link : https://github.com/geodynamics/pylith/compare/fa51e996b6e488bee3553868d0bcf40e778caa3b...7bbdc391b50f931fe7d30225d5e3d6a3ac8b4e6f
>---------------------------------------------------------------
commit 9a3a8bc71cf6feed5eae3a386e6e07797eba9471
Author: Brad Aagaard <baagaard at usgs.gov>
Date: Wed Oct 30 11:50:46 2013 -0700
Switch to non-identity tests.
Switch to non-identity tests and remove flipFault flag (not needed in non-
identity tests).
>---------------------------------------------------------------
9a3a8bc71cf6feed5eae3a386e6e07797eba9471
unittests/libtests/bc/TestBoundaryMesh.cc | 48 +++++++---------------
unittests/libtests/bc/TestBoundaryMesh.hh | 1 -
unittests/libtests/bc/TestBoundaryMeshCases.cc | 4 --
unittests/libtests/bc/data/BoundaryMeshData.cc | 5 +--
unittests/libtests/bc/data/BoundaryMeshData.hh | 5 +--
unittests/libtests/bc/data/BoundaryMeshDataHex8.cc | 21 +---------
unittests/libtests/bc/data/BoundaryMeshDataHex8.hh | 5 +--
.../libtests/bc/data/BoundaryMeshDataQuad4.cc | 20 +--------
.../libtests/bc/data/BoundaryMeshDataQuad4.hh | 5 +--
unittests/libtests/bc/data/BoundaryMeshDataTet4.cc | 20 +--------
unittests/libtests/bc/data/BoundaryMeshDataTet4.hh | 5 +--
unittests/libtests/bc/data/BoundaryMeshDataTri3.cc | 18 +-------
unittests/libtests/bc/data/BoundaryMeshDataTri3.hh | 5 +--
13 files changed, 28 insertions(+), 134 deletions(-)
diff --git a/unittests/libtests/bc/TestBoundaryMesh.cc b/unittests/libtests/bc/TestBoundaryMesh.cc
index 44f653a..9128330 100644
--- a/unittests/libtests/bc/TestBoundaryMesh.cc
+++ b/unittests/libtests/bc/TestBoundaryMesh.cc
@@ -65,6 +65,7 @@ pylith::bc::TestBoundaryMesh::testSubmesh(void)
PYLITH_METHOD_BEGIN;
CPPUNIT_ASSERT(_data);
+ PetscErrorCode err;
topology::Mesh mesh;
meshio::MeshIOAscii iohandler;
@@ -83,23 +84,23 @@ pylith::bc::TestBoundaryMesh::testSubmesh(void)
topology::Mesh submesh(mesh, _data->bcLabel);
PetscDM dmMesh = submesh.dmMesh();CPPUNIT_ASSERT(dmMesh);
+ // Check consistency
+ err = DMPlexCheckSymmetry(dmMesh);CPPUNIT_ASSERT(!err);
+ if (submesh.dimension() > 1) {
+ //err = DMPlexCheckSkeleton(dmMesh, _data->isSimplexMesh ? PETSC_TRUE : PETSC_FALSE);CPPUNIT_ASSERT(!err);
+ } // if
+
// Check vertices
topology::Stratum verticesStratum(dmMesh, topology::Stratum::DEPTH, 0);
const PetscInt vStart = verticesStratum.begin();
const PetscInt vEnd = verticesStratum.end();
CPPUNIT_ASSERT_EQUAL(_data->numVerticesNoFault, verticesStratum.size());
- topology::SubMeshIS subpointIS(submesh);
- const PetscInt* subpointMap = subpointIS.points();CPPUNIT_ASSERT(subpointMap);
- for (PetscInt v = vStart; v < vEnd; ++v)
- CPPUNIT_ASSERT_EQUAL(_data->verticesNoFault[v-vStart], subpointMap[v]);
-
// Check cells
topology::Stratum cellsStratum(dmMesh, topology::Stratum::HEIGHT, 1);
const PetscInt cStart = cellsStratum.begin();
const PetscInt cEnd = cellsStratum.end();
CPPUNIT_ASSERT_EQUAL(_data->numCells, cellsStratum.size());
- PetscErrorCode err = 0;
for (PetscInt c = cStart, index = 0; c < cEnd; ++c) {
PetscInt vertices[32];
PetscInt *closure = NULL;
@@ -111,17 +112,6 @@ pylith::bc::TestBoundaryMesh::testSubmesh(void)
} // for
err = DMPlexRestoreTransitiveClosure(dmMesh, c, PETSC_TRUE, &closureSize, &closure);PYLITH_CHECK_ERROR(err);
CPPUNIT_ASSERT_EQUAL(_data->numCorners, numVertices);
- // 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;
@@ -159,7 +149,7 @@ pylith::bc::TestBoundaryMesh::testSubmeshFault(void)
firstFaultCell = firstLagrangeVertex;
fault.label(_data->faultLabel);
fault.id(_data->faultId);
- fault.adjustTopology(&mesh, &firstFaultVertex, &firstLagrangeVertex, &firstFaultCell, _flipFault);
+ fault.adjustTopology(&mesh, &firstFaultVertex, &firstLagrangeVertex, &firstFaultCell);
// Create submesh
topology::Mesh submesh(mesh, _data->bcLabel);
@@ -168,17 +158,18 @@ pylith::bc::TestBoundaryMesh::testSubmeshFault(void)
DMView(mesh.dmMesh(), PETSC_VIEWER_STDOUT_WORLD);
PetscViewerPopFormat(PETSC_VIEWER_STDOUT_WORLD);
+ // Check consistency
+ err = DMPlexCheckSymmetry(dmMesh);CPPUNIT_ASSERT(!err);
+ if (submesh.dimension() > 1) {
+ //err = DMPlexCheckSkeleton(dmMesh, _data->isSimplexMesh ? PETSC_TRUE : PETSC_FALSE);CPPUNIT_ASSERT(!err);
+ } // if
+
// Check vertices
topology::Stratum verticesStratum(dmMesh, topology::Stratum::DEPTH, 0);
const PetscInt vStart = verticesStratum.begin();
const PetscInt vEnd = verticesStratum.end();
CPPUNIT_ASSERT_EQUAL(_data->numVerticesFault, verticesStratum.size());
- topology::SubMeshIS subpointIS(submesh);
- const PetscInt *subpointMap = subpointIS.points();CPPUNIT_ASSERT(subpointMap);
- for (PetscInt v = vStart; v < vEnd; ++v)
- CPPUNIT_ASSERT_EQUAL(_data->verticesFault[v-vStart], subpointMap[v]);
-
// Check cells
topology::Stratum cellsStratum(dmMesh, topology::Stratum::HEIGHT, 1);
const PetscInt cStart = cellsStratum.begin();
@@ -196,17 +187,6 @@ pylith::bc::TestBoundaryMesh::testSubmeshFault(void)
} // for
err = DMPlexRestoreTransitiveClosure(dmMesh, c, PETSC_TRUE, &closureSize, &closure);PYLITH_CHECK_ERROR(err);
CPPUNIT_ASSERT_EQUAL(_data->numCorners, numVertices);
- // 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;
diff --git a/unittests/libtests/bc/TestBoundaryMesh.hh b/unittests/libtests/bc/TestBoundaryMesh.hh
index 47dd0bb..7fbe46a 100644
--- a/unittests/libtests/bc/TestBoundaryMesh.hh
+++ b/unittests/libtests/bc/TestBoundaryMesh.hh
@@ -61,7 +61,6 @@ public :
protected :
BoundaryMeshData* _data; ///< Data for testing
- bool _flipFault; ///< If true, flip fault orientation.
}; // class TestBoundaryMesh
diff --git a/unittests/libtests/bc/TestBoundaryMeshCases.cc b/unittests/libtests/bc/TestBoundaryMeshCases.cc
index 1cd56ca..c82496b 100644
--- a/unittests/libtests/bc/TestBoundaryMeshCases.cc
+++ b/unittests/libtests/bc/TestBoundaryMeshCases.cc
@@ -32,7 +32,6 @@ void
pylith::bc::TestBoundaryMeshTri3::setUp(void)
{ // setUp
_data = new BoundaryMeshDataTri3();
- _flipFault = true;
} // setUp
@@ -46,7 +45,6 @@ void
pylith::bc::TestBoundaryMeshQuad4::setUp(void)
{ // setUp
_data = new BoundaryMeshDataQuad4();
- _flipFault = true;
} // setUp
@@ -60,7 +58,6 @@ void
pylith::bc::TestBoundaryMeshTet4::setUp(void)
{ // setUp
_data = new BoundaryMeshDataTet4();
- _flipFault = false;
} // setUp
@@ -74,7 +71,6 @@ void
pylith::bc::TestBoundaryMeshHex8::setUp(void)
{ // setUp
_data = new BoundaryMeshDataHex8();
- _flipFault = true;
} // setUp
diff --git a/unittests/libtests/bc/data/BoundaryMeshData.cc b/unittests/libtests/bc/data/BoundaryMeshData.cc
index d98517a..c78ce35 100644
--- a/unittests/libtests/bc/data/BoundaryMeshData.cc
+++ b/unittests/libtests/bc/data/BoundaryMeshData.cc
@@ -25,10 +25,7 @@ pylith::bc::BoundaryMeshData::BoundaryMeshData(void) :
bcLabel(0),
faultLabel(0),
faultId(0),
- verticesNoFault(0),
- cellsNoFault(0),
- verticesFault(0),
- cellsFault(0)
+ isSimplexMesh(true)
{ // constructor
} // constructor
diff --git a/unittests/libtests/bc/data/BoundaryMeshData.hh b/unittests/libtests/bc/data/BoundaryMeshData.hh
index d7c1a88..015f7c8 100644
--- a/unittests/libtests/bc/data/BoundaryMeshData.hh
+++ b/unittests/libtests/bc/data/BoundaryMeshData.hh
@@ -47,19 +47,16 @@ public:
int numCorners; ///< Number of vertices in cells of boundary mesh.
int numCells; ///< Number of cells in boundary mesh.
+ bool isSimplexMesh; ///< True if simplex mesh, false otherwise.
/// @name Boundary mesh without fault.
//@{
int numVerticesNoFault; ///< Number of vertices.
- int* verticesNoFault; ///< Array of vertex labels.
- int* cellsNoFault; ///< Array of vertex labels for cells.
//@}
/// @name Boundary mesh without fault.
//@{
int numVerticesFault; ///< Number of vertices.
- int* verticesFault; ///< Array of vertex labels.
- int* cellsFault; ///< Array of vertex labels for cells.
//@}
};
diff --git a/unittests/libtests/bc/data/BoundaryMeshDataHex8.cc b/unittests/libtests/bc/data/BoundaryMeshDataHex8.cc
index 255934f..a34a5c3 100644
--- a/unittests/libtests/bc/data/BoundaryMeshDataHex8.cc
+++ b/unittests/libtests/bc/data/BoundaryMeshDataHex8.cc
@@ -27,24 +27,10 @@ const int pylith::bc::BoundaryMeshDataHex8::_faultId = 100;
const int pylith::bc::BoundaryMeshDataHex8::_numCorners = 4;
const int pylith::bc::BoundaryMeshDataHex8::_numCells = 2;
+const bool pylith::bc::BoundaryMeshDataHex8::_isSimplexMesh = false;
const int pylith::bc::BoundaryMeshDataHex8::_numVerticesNoFault = 6;
-const int pylith::bc::BoundaryMeshDataHex8::_verticesNoFault[] = {
- 2, 4, 6, 8, 10, 12
-};
-const int pylith::bc::BoundaryMeshDataHex8::_cellsNoFault[] = {
- 2, 4, 10, 8,
- 4, 6, 12, 10,
-};
-
const int pylith::bc::BoundaryMeshDataHex8::_numVerticesFault = 8;
-const int pylith::bc::BoundaryMeshDataHex8::_verticesFault[] = {
- 3, 5, 7, 9, 11, 13, 15, 17
-};
-const int pylith::bc::BoundaryMeshDataHex8::_cellsFault[] = {
- 3, 15, 17, 9,
- 5, 7, 13, 11,
-};
pylith::bc::BoundaryMeshDataHex8::BoundaryMeshDataHex8(void)
{ // constructor
@@ -57,14 +43,11 @@ pylith::bc::BoundaryMeshDataHex8::BoundaryMeshDataHex8(void)
numCorners = _numCorners;
numCells = _numCells;
+ isSimplexMesh = _isSimplexMesh;
numVerticesNoFault = _numVerticesNoFault;
- verticesNoFault = const_cast<int*>(_verticesNoFault);
- cellsNoFault = const_cast<int*>(_cellsNoFault);
numVerticesFault = _numVerticesFault;
- verticesFault = const_cast<int*>(_verticesFault);
- cellsFault = const_cast<int*>(_cellsFault);
} // constructor
pylith::bc::BoundaryMeshDataHex8::~BoundaryMeshDataHex8(void)
diff --git a/unittests/libtests/bc/data/BoundaryMeshDataHex8.hh b/unittests/libtests/bc/data/BoundaryMeshDataHex8.hh
index 233af7d..9c6b5f5 100644
--- a/unittests/libtests/bc/data/BoundaryMeshDataHex8.hh
+++ b/unittests/libtests/bc/data/BoundaryMeshDataHex8.hh
@@ -49,14 +49,11 @@ private:
static const int _numCorners;
static const int _numCells;
+ static const bool _isSimplexMesh;
static const int _numVerticesNoFault;
- static const int _verticesNoFault[];
- static const int _cellsNoFault[];
static const int _numVerticesFault;
- static const int _verticesFault[];
- static const int _cellsFault[];
};
diff --git a/unittests/libtests/bc/data/BoundaryMeshDataQuad4.cc b/unittests/libtests/bc/data/BoundaryMeshDataQuad4.cc
index fdaadbe..0acb567 100644
--- a/unittests/libtests/bc/data/BoundaryMeshDataQuad4.cc
+++ b/unittests/libtests/bc/data/BoundaryMeshDataQuad4.cc
@@ -27,24 +27,11 @@ const int pylith::bc::BoundaryMeshDataQuad4::_faultId = 100;
const int pylith::bc::BoundaryMeshDataQuad4::_numCorners = 2;
const int pylith::bc::BoundaryMeshDataQuad4::_numCells = 2;
+const bool pylith::bc::BoundaryMeshDataQuad4::_isSimplexMesh = false;
const int pylith::bc::BoundaryMeshDataQuad4::_numVerticesNoFault = 3;
-const int pylith::bc::BoundaryMeshDataQuad4::_verticesNoFault[] = {
- 2, 4, 6
-};
-const int pylith::bc::BoundaryMeshDataQuad4::_cellsNoFault[] = {
- 2, 4,
- 4, 6,
-};
const int pylith::bc::BoundaryMeshDataQuad4::_numVerticesFault = 4;
-const int pylith::bc::BoundaryMeshDataQuad4::_verticesFault[] = {
- 3, 5, 7, 9,
-};
-const int pylith::bc::BoundaryMeshDataQuad4::_cellsFault[] = {
- 3, 9,
- 5, 7,
-};
pylith::bc::BoundaryMeshDataQuad4::BoundaryMeshDataQuad4(void)
{ // constructor
@@ -57,14 +44,11 @@ pylith::bc::BoundaryMeshDataQuad4::BoundaryMeshDataQuad4(void)
numCorners = _numCorners;
numCells = _numCells;
+ isSimplexMesh = _isSimplexMesh;
numVerticesNoFault = _numVerticesNoFault;
- verticesNoFault = const_cast<int*>(_verticesNoFault);
- cellsNoFault = const_cast<int*>(_cellsNoFault);
numVerticesFault = _numVerticesFault;
- verticesFault = const_cast<int*>(_verticesFault);
- cellsFault = const_cast<int*>(_cellsFault);
} // constructor
pylith::bc::BoundaryMeshDataQuad4::~BoundaryMeshDataQuad4(void)
diff --git a/unittests/libtests/bc/data/BoundaryMeshDataQuad4.hh b/unittests/libtests/bc/data/BoundaryMeshDataQuad4.hh
index fc2504f..93cbf5f 100644
--- a/unittests/libtests/bc/data/BoundaryMeshDataQuad4.hh
+++ b/unittests/libtests/bc/data/BoundaryMeshDataQuad4.hh
@@ -49,14 +49,11 @@ private:
static const int _numCorners;
static const int _numCells;
+ static const bool _isSimplexMesh;
static const int _numVerticesNoFault;
- static const int _verticesNoFault[];
- static const int _cellsNoFault[];
static const int _numVerticesFault;
- static const int _verticesFault[];
- static const int _cellsFault[];
};
diff --git a/unittests/libtests/bc/data/BoundaryMeshDataTet4.cc b/unittests/libtests/bc/data/BoundaryMeshDataTet4.cc
index b110f2d..235a8df 100644
--- a/unittests/libtests/bc/data/BoundaryMeshDataTet4.cc
+++ b/unittests/libtests/bc/data/BoundaryMeshDataTet4.cc
@@ -27,24 +27,11 @@ const int pylith::bc::BoundaryMeshDataTet4::_faultId = 100;
const int pylith::bc::BoundaryMeshDataTet4::_numCorners = 3;
const int pylith::bc::BoundaryMeshDataTet4::_numCells = 2;
+const bool pylith::bc::BoundaryMeshDataTet4::_isSimplexMesh = false;
const int pylith::bc::BoundaryMeshDataTet4::_numVerticesNoFault = 4;
-const int pylith::bc::BoundaryMeshDataTet4::_verticesNoFault[] = {
- 2, 4, 5, 6
-};
-const int pylith::bc::BoundaryMeshDataTet4::_cellsNoFault[] = {
- 5, 4, 2,
- 5, 2, 6,
-};
const int pylith::bc::BoundaryMeshDataTet4::_numVerticesFault = 6;
-const int pylith::bc::BoundaryMeshDataTet4::_verticesFault[] = {
- 3, 5, 6, 7, 8, 10
-};
-const int pylith::bc::BoundaryMeshDataTet4::_cellsFault[] = {
- 6, 5, 3,
- 10, 8, 7,
-};
pylith::bc::BoundaryMeshDataTet4::BoundaryMeshDataTet4(void)
{ // constructor
@@ -57,14 +44,11 @@ pylith::bc::BoundaryMeshDataTet4::BoundaryMeshDataTet4(void)
numCorners = _numCorners;
numCells = _numCells;
+ isSimplexMesh = _isSimplexMesh;
numVerticesNoFault = _numVerticesNoFault;
- verticesNoFault = const_cast<int*>(_verticesNoFault);
- cellsNoFault = const_cast<int*>(_cellsNoFault);
numVerticesFault = _numVerticesFault;
- verticesFault = const_cast<int*>(_verticesFault);
- cellsFault = const_cast<int*>(_cellsFault);
} // constructor
pylith::bc::BoundaryMeshDataTet4::~BoundaryMeshDataTet4(void)
diff --git a/unittests/libtests/bc/data/BoundaryMeshDataTet4.hh b/unittests/libtests/bc/data/BoundaryMeshDataTet4.hh
index 75fec02..2d72490 100644
--- a/unittests/libtests/bc/data/BoundaryMeshDataTet4.hh
+++ b/unittests/libtests/bc/data/BoundaryMeshDataTet4.hh
@@ -49,14 +49,11 @@ private:
static const int _numCorners;
static const int _numCells;
+ static const bool _isSimplexMesh;
static const int _numVerticesNoFault;
- static const int _verticesNoFault[];
- static const int _cellsNoFault[];
static const int _numVerticesFault;
- static const int _verticesFault[];
- static const int _cellsFault[];
};
diff --git a/unittests/libtests/bc/data/BoundaryMeshDataTri3.cc b/unittests/libtests/bc/data/BoundaryMeshDataTri3.cc
index 5eec255..5a6ca06 100644
--- a/unittests/libtests/bc/data/BoundaryMeshDataTri3.cc
+++ b/unittests/libtests/bc/data/BoundaryMeshDataTri3.cc
@@ -27,22 +27,11 @@ const int pylith::bc::BoundaryMeshDataTri3::_faultId = 100;
const int pylith::bc::BoundaryMeshDataTri3::_numCorners = 2;
const int pylith::bc::BoundaryMeshDataTri3::_numCells = 1;
+const bool pylith::bc::BoundaryMeshDataTri3::_isSimplexMesh = false;
const int pylith::bc::BoundaryMeshDataTri3::_numVerticesNoFault = 2;
-const int pylith::bc::BoundaryMeshDataTri3::_verticesNoFault[] = {
- 3, 5
-};
-const int pylith::bc::BoundaryMeshDataTri3::_cellsNoFault[] = {
- 3, 5
-};
const int pylith::bc::BoundaryMeshDataTri3::_numVerticesFault = 2;
-const int pylith::bc::BoundaryMeshDataTri3::_verticesFault[] = {
- 4, 6
-};
-const int pylith::bc::BoundaryMeshDataTri3::_cellsFault[] = {
- 4, 6
-};
pylith::bc::BoundaryMeshDataTri3::BoundaryMeshDataTri3(void)
{ // constructor
@@ -55,14 +44,11 @@ pylith::bc::BoundaryMeshDataTri3::BoundaryMeshDataTri3(void)
numCorners = _numCorners;
numCells = _numCells;
+ isSimplexMesh = _isSimplexMesh;
numVerticesNoFault = _numVerticesNoFault;
- verticesNoFault = const_cast<int*>(_verticesNoFault);
- cellsNoFault = const_cast<int*>(_cellsNoFault);
numVerticesFault = _numVerticesFault;
- verticesFault = const_cast<int*>(_verticesFault);
- cellsFault = const_cast<int*>(_cellsFault);
} // constructor
pylith::bc::BoundaryMeshDataTri3::~BoundaryMeshDataTri3(void)
diff --git a/unittests/libtests/bc/data/BoundaryMeshDataTri3.hh b/unittests/libtests/bc/data/BoundaryMeshDataTri3.hh
index 8f03205..c6e8bf6 100644
--- a/unittests/libtests/bc/data/BoundaryMeshDataTri3.hh
+++ b/unittests/libtests/bc/data/BoundaryMeshDataTri3.hh
@@ -49,14 +49,11 @@ private:
static const int _numCorners;
static const int _numCells;
+ static const bool _isSimplexMesh;
static const int _numVerticesNoFault;
- static const int _verticesNoFault[];
- static const int _cellsNoFault[];
static const int _numVerticesFault;
- static const int _verticesFault[];
- static const int _cellsFault[];
};
More information about the CIG-COMMITS
mailing list