Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
OpenVolumeMesh
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
7
Issues
7
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenVolumeMesh
OpenVolumeMesh
Commits
93ed0e80
Commit
93ed0e80
authored
Jul 27, 2018
by
Martin Heistermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add asserts to detect double-deletion of entities.
parent
06d4281e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
5 deletions
+15
-5
src/OpenVolumeMesh/Core/TopologyKernel.cc
src/OpenVolumeMesh/Core/TopologyKernel.cc
+15
-5
No files found.
src/OpenVolumeMesh/Core/TopologyKernel.cc
View file @
93ed0e80
...
...
@@ -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
...
...
@@ -591,6 +594,8 @@ void TopologyKernel::set_cell(const CellHandle& _ch, const std::vector<HalfFaceH
*/
VertexIter
TopologyKernel
::
delete_vertex
(
const
VertexHandle
&
_h
)
{
assert
(
!
is_deleted
(
_h
));
std
::
vector
<
VertexHandle
>
vs
;
vs
.
push_back
(
_h
);
...
...
@@ -641,6 +646,8 @@ VertexIter TopologyKernel::delete_vertex(const VertexHandle& _h) {
*/
EdgeIter
TopologyKernel
::
delete_edge
(
const
EdgeHandle
&
_h
)
{
assert
(
!
is_deleted
(
_h
));
std
::
vector
<
EdgeHandle
>
es
;
es
.
push_back
(
_h
);
...
...
@@ -682,6 +689,8 @@ EdgeIter TopologyKernel::delete_edge(const EdgeHandle& _h) {
*/
FaceIter
TopologyKernel
::
delete_face
(
const
FaceHandle
&
_h
)
{
assert
(
!
is_deleted
(
_h
));
std
::
vector
<
FaceHandle
>
fs
;
fs
.
push_back
(
_h
);
...
...
@@ -711,6 +720,7 @@ FaceIter TopologyKernel::delete_face(const FaceHandle& _h) {
*/
CellIter
TopologyKernel
::
delete_cell
(
const
CellHandle
&
_h
)
{
assert
(
!
is_deleted
(
_h
));
return
delete_cell_core
(
_h
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment