Commit 6401bee8 authored by Martin Heistermann's avatar Martin Heistermann

More asserts to catch working with deleted entities

parent 5a91d22c
......@@ -99,8 +99,8 @@ EdgeHandle TopologyKernel::add_edge(const VertexHandle& _fromVertex,
// If the conditions are not fulfilled, assert will fail (instead
// of returning an invalid handle)
assert(_fromVertex.is_valid() && (size_t)_fromVertex.idx() < n_vertices());
assert(_toVertex.is_valid() && (size_t)_toVertex.idx() < n_vertices());
assert(_fromVertex.is_valid() && (size_t)_fromVertex.idx() < n_vertices() && !is_deleted(_fromVertex));
assert(_toVertex.is_valid() && (size_t)_toVertex.idx() < n_vertices() && !is_deleted(_toVertex));
// Test if edge does not exist, yet
if(!_allowDuplicates) {
......@@ -164,7 +164,7 @@ FaceHandle TopologyKernel::add_face(const std::vector<HalfEdgeHandle>& _halfedge
// Assert that halfedges are valid
for(std::vector<HalfEdgeHandle>::const_iterator it = _halfedges.begin(),
end = _halfedges.end(); it != end; ++it)
assert(it->is_valid() && (size_t)it->idx() < edges_.size() * 2u);
assert(it->is_valid() && (size_t)it->idx() < edges_.size() * 2u && !is_deleted(*it));
#endif
// Perform topology check
......@@ -253,7 +253,7 @@ FaceHandle TopologyKernel::add_face(const std::vector<VertexHandle>& _vertices)
// Assert that all vertices have valid indices
for(std::vector<VertexHandle>::const_iterator it = _vertices.begin(),
end = _vertices.end(); it != end; ++it)
assert(it->is_valid() && (size_t)it->idx() < n_vertices());
assert(it->is_valid() && (size_t)it->idx() < n_vertices() && !is_deleted(*it));
#endif
// Add edge for each pair of vertices
......@@ -381,7 +381,7 @@ CellHandle TopologyKernel::add_cell(const std::vector<HalfFaceHandle>& _halfface
// Assert that halffaces have valid indices
for(std::vector<HalfFaceHandle>::const_iterator it = _halffaces.begin(),
end = _halffaces.end(); it != end; ++it)
assert(it->is_valid() && ((size_t)it->idx() < faces_.size() * 2u));
assert(it->is_valid() && ((size_t)it->idx() < faces_.size() * 2u) && !is_deleted(*it));
#endif
// Perform topology check
......@@ -483,6 +483,9 @@ CellHandle TopologyKernel::add_cell(const std::vector<HalfFaceHandle>& _halfface
/// Set the vertices of an edge
void TopologyKernel::set_edge(const EdgeHandle& _eh, const VertexHandle& _fromVertex, const VertexHandle& _toVertex) {
assert(_fromVertex.is_valid() && (size_t)_fromVertex.idx() < n_vertices() && !is_deleted(_fromVertex));
assert(_toVertex.is_valid() && (size_t)_toVertex.idx() < n_vertices() && !is_deleted(_toVertex));
Edge& e = edge(_eh);
// Update bottom-up entries
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment