Création d'un compte pour un collaborateur extérieur au laboratoire depuis l'intranet ICube : https://intranet.icube.unistra.fr/fr/labs/member/profile

Commit 1f2a45ce authored by Sylvain Thery's avatar Sylvain Thery
Browse files

remove dangerous usage of push_back in a loop on iterator

parent 1e13a811
...@@ -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; iface != visitedFaces.size(); ++iface)
{ {
Dart e = *face ; Dart e = visitedFaces[iface] ;
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 != *face) ; } while(e != currentFace) ;
} }
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;
......
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