Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenVolumeMesh
OpenVolumeMesh
Commits
dc941e29
Commit
dc941e29
authored
Feb 12, 2019
by
Martin Heistermann
Browse files
deprecate implicit conversion to int for handles
parent
2354de4c
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/OpenVolumeMesh/Core/OpenVolumeMeshHandle.hh
View file @
dc941e29
...
...
@@ -48,6 +48,7 @@
#include
<vector>
#include
"../System/FunctionalInclude.hh"
#include
"../System/Deprecation.hh"
namespace
OpenVolumeMesh
{
...
...
@@ -85,7 +86,8 @@ public:
void
idx
(
const
int
&
_idx
)
{
idx_
=
_idx
;
}
inline
operator
int
()
const
{
return
idx_
;
}
OVM_DEPRECATED
(
"use explicit .idx() instead"
)
inline
operator
int
()
const
{
return
idx_
;
}
void
reset
()
{
idx_
=
-
1
;
}
...
...
src/OpenVolumeMesh/Core/PropertyDefinesT.cc
View file @
dc941e29
...
...
@@ -66,7 +66,7 @@ template<class T>
BaseProperty
*
VertexPropertyT
<
T
>::
clone
(
ResourceManager
&
_resMan
,
OpenVolumeMeshHandle
_handle
)
const
{
auto
prop_clone
=
ptr
::
shared_ptr
<
OpenVolumeMeshPropertyT
<
T
>>::
get
()
->
clone
();
return
new
VertexPropertyT
<
T
>
(
prop_clone
,
_resMan
,
VertexPropHandle
(
_handle
));
return
new
VertexPropertyT
<
T
>
(
prop_clone
,
_resMan
,
VertexPropHandle
(
_handle
.
idx
()
));
}
template
<
class
T
>
...
...
@@ -94,7 +94,7 @@ template<class T>
BaseProperty
*
EdgePropertyT
<
T
>::
clone
(
ResourceManager
&
_resMan
,
const
OpenVolumeMeshHandle
_handle
)
const
{
auto
prop_clone
=
ptr
::
shared_ptr
<
OpenVolumeMeshPropertyT
<
T
>>::
get
()
->
clone
();
return
new
EdgePropertyT
<
T
>
(
prop_clone
,
_resMan
,
EdgePropHandle
(
_handle
));
return
new
EdgePropertyT
<
T
>
(
prop_clone
,
_resMan
,
EdgePropHandle
(
_handle
.
idx
()
));
}
template
<
class
T
>
...
...
@@ -122,7 +122,7 @@ template<class T>
BaseProperty
*
HalfEdgePropertyT
<
T
>::
clone
(
ResourceManager
&
_resMan
,
const
OpenVolumeMeshHandle
_handle
)
const
{
auto
prop_clone
=
ptr
::
shared_ptr
<
OpenVolumeMeshPropertyT
<
T
>>::
get
()
->
clone
();
return
new
HalfEdgePropertyT
<
T
>
(
prop_clone
,
_resMan
,
HalfEdgePropHandle
(
_handle
));
return
new
HalfEdgePropertyT
<
T
>
(
prop_clone
,
_resMan
,
HalfEdgePropHandle
(
_handle
.
idx
()
));
}
template
<
class
T
>
...
...
@@ -150,7 +150,7 @@ template<class T>
BaseProperty
*
FacePropertyT
<
T
>::
clone
(
ResourceManager
&
_resMan
,
const
OpenVolumeMeshHandle
_handle
)
const
{
auto
prop_clone
=
ptr
::
shared_ptr
<
OpenVolumeMeshPropertyT
<
T
>>::
get
()
->
clone
();
return
new
FacePropertyT
<
T
>
(
prop_clone
,
_resMan
,
FacePropHandle
(
_handle
));
return
new
FacePropertyT
<
T
>
(
prop_clone
,
_resMan
,
FacePropHandle
(
_handle
.
idx
()
));
}
template
<
class
T
>
...
...
@@ -178,7 +178,7 @@ template<class T>
BaseProperty
*
HalfFacePropertyT
<
T
>::
clone
(
ResourceManager
&
_resMan
,
const
OpenVolumeMeshHandle
_handle
)
const
{
auto
prop_clone
=
ptr
::
shared_ptr
<
OpenVolumeMeshPropertyT
<
T
>>::
get
()
->
clone
();
return
new
HalfFacePropertyT
<
T
>
(
prop_clone
,
_resMan
,
HalfFacePropHandle
(
_handle
));
return
new
HalfFacePropertyT
<
T
>
(
prop_clone
,
_resMan
,
HalfFacePropHandle
(
_handle
.
idx
()
));
}
template
<
class
T
>
...
...
@@ -206,7 +206,7 @@ template<class T>
BaseProperty
*
CellPropertyT
<
T
>::
clone
(
ResourceManager
&
_resMan
,
const
OpenVolumeMeshHandle
_handle
)
const
{
auto
prop_clone
=
ptr
::
shared_ptr
<
OpenVolumeMeshPropertyT
<
T
>>::
get
()
->
clone
();
return
new
CellPropertyT
<
T
>
(
prop_clone
,
_resMan
,
CellPropHandle
(
_handle
));
return
new
CellPropertyT
<
T
>
(
prop_clone
,
_resMan
,
CellPropHandle
(
_handle
.
idx
()
));
}
template
<
class
T
>
...
...
@@ -234,7 +234,7 @@ template<class T>
BaseProperty
*
MeshPropertyT
<
T
>::
clone
(
ResourceManager
&
_resMan
,
const
OpenVolumeMeshHandle
_handle
)
const
{
auto
prop_clone
=
ptr
::
shared_ptr
<
OpenVolumeMeshPropertyT
<
T
>>::
get
()
->
clone
();
return
new
MeshPropertyT
<
T
>
(
prop_clone
,
_resMan
,
MeshPropHandle
(
_handle
));
return
new
MeshPropertyT
<
T
>
(
prop_clone
,
_resMan
,
MeshPropHandle
(
_handle
.
idx
()
));
}
template
<
class
T
>
...
...
src/OpenVolumeMesh/Core/ResourceManager.hh
View file @
dc941e29
...
...
@@ -120,7 +120,7 @@ protected:
{
PropIterator
p_iter
=
_begin
;
for
(;
p_iter
!=
_end
;
++
p_iter
)
(
*
p_iter
)
->
swap_elements
(
_h1
,
_h2
);
(
*
p_iter
)
->
swap_elements
(
_h1
.
idx
(),
_h2
.
idx
()
);
}
...
...
src/OpenVolumeMesh/Core/TopologyKernel.cc
View file @
dc941e29
...
...
@@ -562,13 +562,13 @@ void TopologyKernel::set_cell(const CellHandle& _ch, const std::vector<HalfFaceH
for
(
std
::
vector
<
HalfFaceHandle
>::
const_iterator
hf_it
=
hfs
.
begin
(),
hf_end
=
hfs
.
end
();
hf_it
!=
hf_end
;
++
hf_it
)
{
incident_cell_per_hf_
[
*
hf_it
]
=
InvalidCellHandle
;
incident_cell_per_hf_
[
hf_it
->
idx
()
]
=
InvalidCellHandle
;
}
for
(
std
::
vector
<
HalfFaceHandle
>::
const_iterator
hf_it
=
_hfs
.
begin
(),
hf_end
=
_hfs
.
end
();
hf_it
!=
hf_end
;
++
hf_it
)
{
incident_cell_per_hf_
[
*
hf_it
]
=
_ch
;
incident_cell_per_hf_
[
hf_it
->
idx
()
]
=
_ch
;
}
}
...
...
@@ -1503,7 +1503,7 @@ void TopologyKernel::swap_face_indices(FaceHandle _h1, FaceHandle _h2)
for
(
unsigned
int
j
=
0
;
j
<
2
;
++
j
)
// for both halffaces
{
HalfFaceHandle
hfh
=
HalfFaceHandle
(
2
*
id
+
j
);
CellHandle
ch
=
incident_cell_per_hf_
[
hfh
];
CellHandle
ch
=
incident_cell_per_hf_
[
hfh
.
idx
()
];
if
(
!
ch
.
is_valid
())
continue
;
...
...
@@ -1570,7 +1570,7 @@ void TopologyKernel::swap_face_indices(FaceHandle _h1, FaceHandle _h2)
if
(
has_edge_bottom_up_incidences
())
{
std
::
set
<
unsigned
int
>
processed_halfedges
;
// to ensure ids are only swapped once (in the case that a halfedge is incident to both swapped faces)
std
::
set
<
HalfEdgeHandle
>
processed_halfedges
;
// to ensure ids are only swapped once (in the case that a halfedge is incident to both swapped faces)
for
(
unsigned
int
i
=
0
;
i
<
2
;
++
i
)
// For both swapped faces
{
unsigned
int
id
=
ids
[
i
];
...
...
@@ -1583,7 +1583,7 @@ void TopologyKernel::swap_face_indices(FaceHandle _h1, FaceHandle _h2)
{
HalfEdgeHandle
heh
=
hf
.
halfedges
()[
k
];
if
(
processed_halfedges
.
find
(
heh
.
idx
()
)
!=
processed_halfedges
.
end
())
if
(
processed_halfedges
.
find
(
heh
)
!=
processed_halfedges
.
end
())
continue
;
std
::
vector
<
HalfFaceHandle
>&
incident_halffaces
=
incident_hfs_per_he_
[
heh
.
idx
()];
...
...
@@ -1713,7 +1713,7 @@ void TopologyKernel::swap_edge_indices(EdgeHandle _h1, EdgeHandle _h2)
if
(
has_vertex_bottom_up_incidences
())
{
std
::
set
<
int
>
processed_vertices
;
std
::
set
<
VertexHandle
>
processed_vertices
;
for
(
unsigned
int
i
=
0
;
i
<
2
;
++
i
)
// For both swapped edges
{
Edge
e
=
edge
(
EdgeHandle
(
ids
[
i
]));
...
...
@@ -1723,7 +1723,7 @@ void TopologyKernel::swap_edge_indices(EdgeHandle _h1, EdgeHandle _h2)
for
(
unsigned
int
j
=
0
;
j
<
2
;
++
j
)
// for both incident vertices
{
if
(
processed_vertices
.
find
(
vhs
[
j
]
.
idx
()
)
!=
processed_vertices
.
end
())
if
(
processed_vertices
.
find
(
vhs
[
j
])
!=
processed_vertices
.
end
())
continue
;
std
::
vector
<
HalfEdgeHandle
>&
outgoing_hes
=
outgoing_hes_per_vertex_
[
vhs
[
j
].
idx
()];
...
...
@@ -1782,14 +1782,14 @@ void TopologyKernel::swap_vertex_indices(VertexHandle _h1, VertexHandle _h2)
if
(
processed_edges
.
find
(
e_id
)
==
processed_edges
.
end
())
{
Edge
&
e
=
edges_
[
e_id
];
if
(
e
.
from_vertex
()
==
(
int
)
ids
[
0
])
if
(
e
.
from_vertex
()
.
idx
()
==
(
int
)
ids
[
0
])
e
.
set_from_vertex
(
VertexHandle
(
ids
[
1
]));
else
if
(
e
.
from_vertex
()
==
(
int
)
ids
[
1
])
else
if
(
e
.
from_vertex
()
.
idx
()
==
(
int
)
ids
[
1
])
e
.
set_from_vertex
(
VertexHandle
(
ids
[
0
]));
if
(
e
.
to_vertex
()
==
(
int
)
ids
[
0
])
if
(
e
.
to_vertex
()
.
idx
()
==
(
int
)
ids
[
0
])
e
.
set_to_vertex
(
VertexHandle
(
ids
[
1
]));
else
if
(
e
.
to_vertex
()
==
(
int
)
ids
[
1
])
else
if
(
e
.
to_vertex
()
.
idx
()
==
(
int
)
ids
[
1
])
e
.
set_to_vertex
(
VertexHandle
(
ids
[
0
]));
processed_edges
.
insert
(
e_id
);
...
...
@@ -1805,14 +1805,14 @@ void TopologyKernel::swap_vertex_indices(VertexHandle _h1, VertexHandle _h2)
for
(
unsigned
int
i
=
0
;
i
<
edges_
.
size
();
++
i
)
{
Edge
&
e
=
edges_
[
i
];
if
(
e
.
from_vertex
()
==
(
int
)
ids
[
0
])
if
(
e
.
from_vertex
()
.
idx
()
==
(
int
)
ids
[
0
])
e
.
set_from_vertex
(
VertexHandle
(
ids
[
1
]));
else
if
(
e
.
from_vertex
()
==
(
int
)
ids
[
1
])
else
if
(
e
.
from_vertex
()
.
idx
()
==
(
int
)
ids
[
1
])
e
.
set_from_vertex
(
VertexHandle
(
ids
[
0
]));
if
(
e
.
to_vertex
()
==
(
int
)
ids
[
0
])
if
(
e
.
to_vertex
()
.
idx
()
==
(
int
)
ids
[
0
])
e
.
set_to_vertex
(
VertexHandle
(
ids
[
1
]));
else
if
(
e
.
to_vertex
()
==
(
int
)
ids
[
1
])
else
if
(
e
.
to_vertex
()
.
idx
()
==
(
int
)
ids
[
1
])
e
.
set_to_vertex
(
VertexHandle
(
ids
[
0
]));
}
}
...
...
src/OpenVolumeMesh/System/Deprecation.hh
0 → 100644
View file @
dc941e29
#pragma once
#if defined(__cplusplus) && (__cplusplus >= 201402L)
# define OVM_DEPRECATED(msg) [[deprecated(msg)]]
#elif defined(__GNUC__) || defined(__clang__)
# define OVM_DEPRECATED(msg) __attribute__((deprecated))
#elif defined(_MSC_VER)
# define OVM_DEPRECATED(msg) __declspec(deprecated)
#else
# pragma message("WARNING: You need to implement DEPRECATED for this compiler")
# define OVM_DEPRECATED(msg)
#endif
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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