[cig-commits] r21792 - short/3D/PyLith/trunk/unittests/libtests/topology
brad at geodynamics.org
brad at geodynamics.org
Wed Apr 10 08:43:56 PDT 2013
Author: brad
Date: 2013-04-10 08:43:56 -0700 (Wed, 10 Apr 2013)
New Revision: 21792
Modified:
short/3D/PyLith/trunk/unittests/libtests/topology/Makefile.am
short/3D/PyLith/trunk/unittests/libtests/topology/TestFieldMesh.cc
short/3D/PyLith/trunk/unittests/libtests/topology/TestFieldSubMesh.cc
short/3D/PyLith/trunk/unittests/libtests/topology/TestMesh.cc
short/3D/PyLith/trunk/unittests/libtests/topology/TestSubMesh.cc
Log:
Fixed memory leaks.
Modified: short/3D/PyLith/trunk/unittests/libtests/topology/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/Makefile.am 2013-04-10 15:43:20 UTC (rev 21791)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/Makefile.am 2013-04-10 15:43:56 UTC (rev 21792)
@@ -37,10 +37,11 @@
TestFieldsSubMesh.cc \
TestSolutionFields.cc \
TestJacobian.cc \
- TestRefineUniform.cc \
test_topology.cc
+# TestRefineUniform.cc
+
noinst_HEADERS = \
TestMesh.hh \
TestSubMesh.hh \
@@ -51,10 +52,11 @@
TestFieldsMesh.hh \
TestFieldsSubMesh.hh \
TestSolutionFields.hh \
- TestJacobian.hh \
- TestRefineUniform.hh
+ TestJacobian.hh
+# TestRefineUniform.hh
+
# Source files associated with testing data
testtopology_SOURCES += \
data/MeshDataCohesive.cc \
Modified: short/3D/PyLith/trunk/unittests/libtests/topology/TestFieldMesh.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/TestFieldMesh.cc 2013-04-10 15:43:20 UTC (rev 21791)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/TestFieldMesh.cc 2013-04-10 15:43:56 UTC (rev 21792)
@@ -1477,6 +1477,7 @@
} // for
err = VecRestoreArray(coordVec, &coords);CHECK_PETSC_ERROR(err);
err = DMSetCoordinatesLocal(dmMesh, coordVec);CHECK_PETSC_ERROR(err);
+ err = VecDestroy(&coordVec);CHECK_PETSC_ERROR(err);
spatialdata::geocoords::CSCart cs;
cs.setSpaceDim(spaceDim);
Modified: short/3D/PyLith/trunk/unittests/libtests/topology/TestFieldSubMesh.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/TestFieldSubMesh.cc 2013-04-10 15:43:20 UTC (rev 21791)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/TestFieldSubMesh.cc 2013-04-10 15:43:56 UTC (rev 21792)
@@ -1049,6 +1049,7 @@
} // for
err = VecRestoreArray(coordVec, &coords);CHECK_PETSC_ERROR(err);
err = DMSetCoordinatesLocal(dmMesh, coordVec);CHECK_PETSC_ERROR(err);
+ err = VecDestroy(&coordVec);CHECK_PETSC_ERROR(err);
const int numPoints = _TestFieldSubMesh::groupSize;
for(PetscInt i = 0; i < numPoints; ++i) {
Modified: short/3D/PyLith/trunk/unittests/libtests/topology/TestMesh.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/TestMesh.cc 2013-04-10 15:43:20 UTC (rev 21791)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/TestMesh.cc 2013-04-10 15:43:56 UTC (rev 21792)
@@ -42,20 +42,24 @@
Mesh mesh;
CPPUNIT_ASSERT(mesh._mesh.isNull());
+ CPPUNIT_ASSERT(!mesh._newMesh);
CPPUNIT_ASSERT_EQUAL(0, mesh.dimension());
CPPUNIT_ASSERT_EQUAL(false, mesh.debug());
MPI_Comm_compare(PETSC_COMM_WORLD, mesh.comm(), &result);
CPPUNIT_ASSERT_EQUAL(int(MPI_IDENT), result);
-
- Mesh mesh2(2);
+
+ int dim = 2;
+ Mesh mesh2(dim);
CPPUNIT_ASSERT(!mesh2._mesh.isNull());
- CPPUNIT_ASSERT_EQUAL(2, mesh2.dimension());
+ CPPUNIT_ASSERT(mesh2._newMesh);
+ CPPUNIT_ASSERT_EQUAL(dim, mesh2.dimension());
MPI_Comm_compare(PETSC_COMM_WORLD, mesh2.comm(), &result);
CPPUNIT_ASSERT_EQUAL(int(MPI_IDENT), result);
- Mesh mesh3(1, PETSC_COMM_SELF);
+ dim = 1;
+ Mesh mesh3(dim, PETSC_COMM_SELF);
CPPUNIT_ASSERT(!mesh3._mesh.isNull());
- CPPUNIT_ASSERT_EQUAL(1, mesh3.dimension());
+ CPPUNIT_ASSERT_EQUAL(dim, mesh3.dimension());
MPI_Comm_compare(PETSC_COMM_WORLD, mesh3.comm(), &result);
CPPUNIT_ASSERT_EQUAL(int(MPI_CONGRUENT), result);
Modified: short/3D/PyLith/trunk/unittests/libtests/topology/TestSubMesh.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/TestSubMesh.cc 2013-04-10 15:43:20 UTC (rev 21791)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/TestSubMesh.cc 2013-04-10 15:43:56 UTC (rev 21792)
@@ -335,10 +335,10 @@
delete[] cone; cone = 0;
err = DMPlexSymmetrize(dmMesh);CHECK_PETSC_ERROR(err);
err = DMPlexStratify(dmMesh);CHECK_PETSC_ERROR(err);
- PetscSection coordSection;
- PetscVec coordVec;
+ PetscSection coordSection = NULL;
+ PetscVec coordVec = NULL;
PetscScalar *coords = NULL;
- PetscInt coordSize;
+ PetscInt coordSize = 0;
err = DMPlexGetCoordinateSection(dmMesh, &coordSection);CHECK_PETSC_ERROR(err);
err = PetscSectionSetChart(coordSection, ncells, ncells+nvertices);CHECK_PETSC_ERROR(err);
@@ -361,6 +361,7 @@
} // for
err = VecRestoreArray(coordVec, &coords);CHECK_PETSC_ERROR(err);
err = DMSetCoordinatesLocal(dmMesh, coordVec);CHECK_PETSC_ERROR(err);
+ err = VecDestroy(&coordVec);CHECK_PETSC_ERROR(err);
spatialdata::geocoords::CSCart cs;
cs.setSpaceDim(spaceDim);
More information about the CIG-COMMITS
mailing list