Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenMesh
OpenMesh
Commits
e8fa744a
Commit
e8fa744a
authored
Nov 25, 2015
by
Jan Möbius
Browse files
Merge branch 'heap-tweaks' into 'master'
Tweaks to HeapT.hh, Additional member for ArrayKernel See merge request
!27
parents
daa256e3
ec8936bf
Pipeline
#106
passed with stage
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/OpenMesh/Core/Mesh/ArrayKernel.cc
View file @
e8fa744a
...
...
@@ -177,6 +177,16 @@ void ArrayKernel::garbage_collection(bool _v, bool _e, bool _f)
garbage_collection
(
empty_vh
,
empty_hh
,
empty_fh
,
_v
,
_e
,
_f
);
}
void
ArrayKernel
::
clean_keep_reservation
()
{
vertices_
.
clear
();
edges_
.
clear
();
faces_
.
clear
();
}
void
ArrayKernel
::
clean
()
{
...
...
src/OpenMesh/Core/Mesh/ArrayKernel.hh
View file @
e8fa744a
...
...
@@ -306,6 +306,14 @@ public:
*/
void
clean
();
/** \brief Reset the whole mesh
*
* This will remove all elements from the mesh but keeps the properties.
* In contrast to clean() the memory used for the elements will remain
* allocated.
*/
void
clean_keep_reservation
();
// --- number of items ---
size_t
n_vertices
()
const
{
return
vertices_
.
size
();
}
size_t
n_halfedges
()
const
{
return
2
*
edges_
.
size
();
}
...
...
src/OpenMesh/Tools/Utils/HeapT.hh
View file @
e8fa744a
...
...
@@ -79,6 +79,9 @@
#include
"Config.hh"
#include
<vector>
#include
<OpenMesh/Core/System/omstream.hh>
#if __cplusplus > 199711L || defined(__GXX_EXPERIMENTAL_CXX0X__)
#include
<utility>
#endif
//== NAMESPACE ================================================================
...
...
@@ -147,14 +150,28 @@ public:
/// Constructor
HeapT
()
:
HeapVector
()
{}
#if __cplusplus > 199711L || defined(__GXX_EXPERIMENTAL_CXX0X__)
/// Construct with a given \c HeapIterface.
HeapT
(
const
HeapInterface
&
_interface
)
HeapT
(
HeapInterface
_interface
)
:
HeapVector
(),
interface_
(
std
::
move
(
_interface
))
{}
#else
/// Construct with a given \c HeapIterface.
HeapT
(
const
HeapInterface
&
_interface
)
:
HeapVector
(),
interface_
(
_interface
)
{}
#endif
/// Destructor.
~
HeapT
(){};
HeapInterface
&
getInterface
()
{
return
interface_
;
}
const
HeapInterface
&
getInterface
()
const
{
return
interface_
;
}
/// clear the heap
void
clear
()
{
HeapVector
::
clear
();
}
...
...
@@ -187,14 +204,14 @@ public:
HeapEntry
front
()
const
{
assert
(
!
empty
());
return
entry
(
0
);
return
HeapVector
::
front
(
);
}
/// delete the first entry
void
pop_front
()
{
assert
(
!
empty
());
reset_heap_position
(
entry
(
0
));
reset_heap_position
(
HeapVector
::
front
(
));
if
(
size
()
>
1
)
{
entry
(
0
,
entry
(
size
()
-
1
));
...
...
@@ -338,9 +355,9 @@ void
HeapT
<
HeapEntry
,
HeapInterface
>::
downheap
(
size_t
_idx
)
{
HeapEntry
h
=
entry
(
_idx
);
const
HeapEntry
h
=
entry
(
_idx
);
size_t
childIdx
;
size_t
s
=
size
();
const
size_t
s
=
size
();
while
(
_idx
<
s
)
{
...
...
Write
Preview
Supports
Markdown
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