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
Etienne Schmitt
CGoGN
Commits
1f2a45ce
Commit
1f2a45ce
authored
Aug 24, 2012
by
Sylvain Thery
Browse files
remove dangerous usage of push_back in a loop on iterator
parent
1e13a811
Changes
1
Show whitespace changes
Inline
Side-by-side
include/Algo/Geometry/volume.hpp
View file @
1f2a45ce
...
@@ -77,9 +77,9 @@ typename PFP::REAL convexPolyhedronVolume(typename PFP::MAP& map, Dart d, const
...
@@ -77,9 +77,9 @@ typename PFP::REAL convexPolyhedronVolume(typename PFP::MAP& map, Dart d, const
visitedFaces
.
push_back
(
d
)
;
visitedFaces
.
push_back
(
d
)
;
mark
.
markOrbit
<
FACE
>
(
d
)
;
mark
.
markOrbit
<
FACE
>
(
d
)
;
for
(
typename
std
::
vector
<
Dart
>::
iterator
face
=
visitedFaces
.
begin
()
;
face
!=
visitedFaces
.
end
();
++
face
)
for
(
unsigned
int
iface
=
0
;
i
face
!=
visitedFaces
.
size
();
++
i
face
)
{
{
Dart
e
=
*
face
;
Dart
e
=
visitedFaces
[
i
face
]
;
if
(
map
.
isCycleTriangle
(
e
))
if
(
map
.
isCycleTriangle
(
e
))
{
{
VEC3
p1
=
position
[
e
]
;
VEC3
p1
=
position
[
e
]
;
...
@@ -99,6 +99,7 @@ typename PFP::REAL convexPolyhedronVolume(typename PFP::MAP& map, Dart d, const
...
@@ -99,6 +99,7 @@ typename PFP::REAL convexPolyhedronVolume(typename PFP::MAP& map, Dart d, const
f
=
map
.
phi1
(
f
)
;
f
=
map
.
phi1
(
f
)
;
}
while
(
f
!=
e
)
;
}
while
(
f
!=
e
)
;
}
}
Dart
currentFace
=
e
;
do
// add all face neighbours to the table
do
// add all face neighbours to the table
{
{
Dart
ee
=
map
.
phi2
(
e
)
;
Dart
ee
=
map
.
phi2
(
e
)
;
...
@@ -108,18 +109,18 @@ typename PFP::REAL convexPolyhedronVolume(typename PFP::MAP& map, Dart d, const
...
@@ -108,18 +109,18 @@ typename PFP::REAL convexPolyhedronVolume(typename PFP::MAP& map, Dart d, const
mark
.
markOrbit
<
FACE
>
(
ee
)
;
mark
.
markOrbit
<
FACE
>
(
ee
)
;
}
}
e
=
map
.
phi1
(
e
)
;
e
=
map
.
phi1
(
e
)
;
}
while
(
e
!=
*
f
ace
)
;
}
while
(
e
!=
currentF
ace
)
;
}
}
return
vol
;
return
vol
;
}
}
}
}
template
<
typename
PFP
>
template
<
typename
PFP
>
typename
PFP
::
REAL
totalVolume
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
const
FunctorSelect
&
select
,
unsigned
int
thread
)
typename
PFP
::
REAL
totalVolume
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
const
FunctorSelect
&
select
,
unsigned
int
thread
)
{
{
// typename PFP::REAL vol = 0 ;
double
vol
=
0.0
;
double
vol
=
0
;
TraversorW
<
typename
PFP
::
MAP
>
t
(
map
,
select
,
thread
)
;
TraversorW
<
typename
PFP
::
MAP
>
t
(
map
,
select
,
thread
)
;
for
(
Dart
d
=
t
.
begin
();
d
!=
t
.
end
();
d
=
t
.
next
())
for
(
Dart
d
=
t
.
begin
();
d
!=
t
.
end
();
d
=
t
.
next
())
...
@@ -135,7 +136,6 @@ template <typename PFP>
...
@@ -135,7 +136,6 @@ template <typename PFP>
class
FunctorTotalVolume
:
public
FunctorMapThreaded
<
typename
PFP
::
MAP
>
class
FunctorTotalVolume
:
public
FunctorMapThreaded
<
typename
PFP
::
MAP
>
{
{
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
m_position
;
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
m_position
;
// typename PFP::REAL m_vol;
double
m_vol
;
double
m_vol
;
public:
public:
FunctorTotalVolume
<
PFP
>
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
)
:
FunctorTotalVolume
<
PFP
>
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
)
:
...
@@ -147,7 +147,6 @@ public:
...
@@ -147,7 +147,6 @@ public:
m_vol
+=
convexPolyhedronVolume
<
PFP
>
(
this
->
m_map
,
d
,
m_position
,
threadID
)
;
m_vol
+=
convexPolyhedronVolume
<
PFP
>
(
this
->
m_map
,
d
,
m_position
,
threadID
)
;
}
}
// typename PFP::REAL getVol() const
double
getVol
()
const
double
getVol
()
const
{
{
return
m_vol
;
return
m_vol
;
...
...
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