[cig-commits] [commit] knepley/upgrade-petsc-interface: Finish implementation of unit tests for reordering. (1a9e203)
cig_noreply at geodynamics.org
cig_noreply at geodynamics.org
Wed Oct 23 09:08:55 PDT 2013
Repository : ssh://geoshell/pylith
On branch : knepley/upgrade-petsc-interface
Link : https://github.com/geodynamics/pylith/compare/885a302db65b09c5eee1ea0904b2bcee47e5d677...1a9e20381062fe982e7a47294f8da55ca65c32bd
>---------------------------------------------------------------
commit 1a9e20381062fe982e7a47294f8da55ca65c32bd
Author: Brad Aagaard <baagaard at usgs.gov>
Date: Wed Oct 23 09:10:53 2013 -0700
Finish implementation of unit tests for reordering.
Add test for reduction in matrix bandwidth. Also adjust tet4 mesh to
increase bandwidth of unordered mesh.
>---------------------------------------------------------------
1a9e20381062fe982e7a47294f8da55ca65c32bd
.../libtests/topology/TestReverseCuthillMcKee.cc | 18 +++++++++++++--
unittests/libtests/topology/data/reorder_tet4.mesh | 26 +++++++++++-----------
2 files changed, 29 insertions(+), 15 deletions(-)
diff --git a/unittests/libtests/topology/TestReverseCuthillMcKee.cc b/unittests/libtests/topology/TestReverseCuthillMcKee.cc
index c00f47e..9493e0e 100644
--- a/unittests/libtests/topology/TestReverseCuthillMcKee.cc
+++ b/unittests/libtests/topology/TestReverseCuthillMcKee.cc
@@ -175,8 +175,12 @@ pylith::topology::TestReverseCuthillMcKee::_testReorder(const char* filename,
Mesh mesh;
_setupMesh(&mesh, filename, faultGroup);
+
+ // Get original DM and create Mesh for it
const PetscDM dmOrig = mesh.dmMesh();
PetscObjectReference((PetscObject) dmOrig);
+ Mesh meshOrig;
+ meshOrig.dmMesh(dmOrig);
ReverseCuthillMcKee::reorder(&mesh);
@@ -226,13 +230,23 @@ pylith::topology::TestReverseCuthillMcKee::_testReorder(const char* filename,
} // for
// Verify reduction in Jacobian bandwidth
+ Field fieldOrig(meshOrig);
+ fieldOrig.newSection(FieldBase::VERTICES_FIELD, meshOrig.dimension());
+ fieldOrig.allocate();
+ fieldOrig.zero();
+ Jacobian jacobianOrig(fieldOrig);
+ PetscInt bandwidthOrig = 0;
+ err = MatComputeBandwidth(jacobianOrig.matrix(), 0.0, &bandwidthOrig);PYLITH_CHECK_ERROR(err);
+
Field field(mesh);
field.newSection(FieldBase::VERTICES_FIELD, mesh.dimension());
field.allocate();
field.zero();
Jacobian jacobian(field);
- std::cout << "****TEST IS DISABLED. FORCING FAILURE.****" << std::endl;
- CPPUNIT_ASSERT(false);
+ PetscInt bandwidth = 0;
+ err = MatComputeBandwidth(jacobian.matrix(), 0.0, &bandwidth);PYLITH_CHECK_ERROR(err);
+
+ CPPUNIT_ASSERT(bandwidth < bandwidthOrig);
PYLITH_METHOD_END;
} // _testReorder
diff --git a/unittests/libtests/topology/data/reorder_tet4.mesh b/unittests/libtests/topology/data/reorder_tet4.mesh
index d67506c..b017257 100644
--- a/unittests/libtests/topology/data/reorder_tet4.mesh
+++ b/unittests/libtests/topology/data/reorder_tet4.mesh
@@ -3,24 +3,25 @@ mesh = {
use-index-zero = true
vertices = {
dimension = 3
- count = 6
+ count = 7
coordinates = {
0 -1.0 0.0 0.0
- 1 +1.0 0.0 0.0
- 2 0.0 +1.0 0.0
- 3 0.0 0.0 +1.0
- 4 0.0 0.0 -1.0
- 5 0.0 -1.0 0.0
+ 1 +1.0 0.0 +1.0
+ 2 0.0 0.0 0.0
+ 3 +1.0 +1.0 0.0
+ 4 -1.0 +1.0 0.0
+ 5 +1.0 0.0 0.0
+ 6 0.0 0.0 +1.0
}
}
cells = {
count = 4
num-corners = 4
simplices = {
- 0 0 5 2 3
- 1 4 5 2 0
- 2 1 2 5 3
- 3 4 1 2 5
+ 0 0 2 4 6
+ 1 2 3 4 6
+ 2 2 5 3 6
+ 3 3 5 1 6
}
material-ids = {
0 1
@@ -32,12 +33,11 @@ mesh = {
group = {
name = fault
type = vertices
- count = 4
+ count = 3
indices = {
2
3
- 4
- 5
+ 6
}
}
}
More information about the CIG-COMMITS
mailing list