[cig-commits] r12806 - short/3D/PyLith/trunk/libsrc/meshio
brad at geodynamics.org
brad at geodynamics.org
Thu Sep 4 13:20:24 PDT 2008
Author: brad
Date: 2008-09-04 13:20:24 -0700 (Thu, 04 Sep 2008)
New Revision: 12806
Modified:
short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc
Log:
Added check to make sure every vertex is in a cell.
Modified: short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc 2008-09-04 20:19:55 UTC (rev 12805)
+++ short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc 2008-09-04 20:20:24 UTC (rev 12806)
@@ -90,6 +90,24 @@
int dim = meshDim;
int rank;
+ { // Check to make sure every vertex is in at least one cell.
+ // This is required by Sieve
+ std::vector<bool> vertexInCell(numVertices, false);
+ const int size = cells.size();
+ for (int i=0; i < size; ++i)
+ vertexInCell[cells[i]] = true;
+ int count = 0;
+ for (int i=0; i < numVertices; ++i)
+ if (!vertexInCell[i])
+ ++count;
+ if (count > 0) {
+ std::ostringstream msg;
+ msg << "Mesh contains " << count
+ << " vertices that are not in any cells.";
+ throw std::runtime_error(msg.str());
+ } // if
+ } // check
+
MPI_Bcast(&dim, 1, MPI_INT, 0, comm);
// :BUG: This causes a memory leak.
*_mesh = new Mesh(PETSC_COMM_WORLD, dim);
More information about the cig-commits
mailing list