Commit cc63ab5a authored by Pierre Kraemer's avatar Pierre Kraemer

modify foreach_dart_of_<orbit> functions profile

parent e4ff0d46
......@@ -379,24 +379,23 @@ public:
virtual void next(Dart& d) const ;
virtual bool foreach_dart_of_vertex(Dart d, FunctorType& f, unsigned int thread = 0) const ;
void foreach_dart_of_vertex(Dart d, std::function<void (Dart)> f, unsigned int thread = 0) const ;
virtual bool foreach_dart_of_edge(Dart d, FunctorType& f, unsigned int thread = 0) const ;
void foreach_dart_of_edge(Dart d, std::function<void (Dart)> f, unsigned int thread = 0) const ;
bool foreach_dart_of_oriented_face(Dart d, FunctorType& f, unsigned int thread = 0) const;
virtual bool foreach_dart_of_face(Dart d, FunctorType& f, unsigned int thread = 0) const ;
void foreach_dart_of_oriented_face(Dart d, std::function<void (Dart)> f, unsigned int thread = 0) const;
void foreach_dart_of_face(Dart d, std::function<void (Dart)> f, unsigned int thread = 0) const ;
bool foreach_dart_of_oriented_volume(Dart d, FunctorType& f, unsigned int thread = 0) const;
virtual bool foreach_dart_of_volume(Dart d, FunctorType& f, unsigned int thread = 0) const ;
void foreach_dart_of_oriented_volume(Dart d, std::function<void (Dart)> f, unsigned int thread = 0) const;
void foreach_dart_of_volume(Dart d, std::function<void (Dart)> f, unsigned int thread = 0) const ;
virtual bool foreach_dart_of_cc(Dart d, FunctorType& f, unsigned int thread = 0) const ;
void foreach_dart_of_cc(Dart d, std::function<void (Dart)> f, unsigned int thread = 0) const ;
void foreach_dart_of_vertex2(Dart d, std::function<void (Dart)> f, unsigned int thread = 0) const;
virtual bool foreach_dart_of_vertex2(Dart d, FunctorType& f, unsigned int thread = 0) const;
void foreach_dart_of_edge2(Dart d, std::function<void (Dart)> f, unsigned int thread = 0) const;
virtual bool foreach_dart_of_edge2(Dart d, FunctorType& f, unsigned int thread = 0) const;
virtual bool foreach_dart_of_face2(Dart d, FunctorType& f, unsigned int thread = 0) const;
void foreach_dart_of_face2(Dart d, std::function<void (Dart)> f, unsigned int thread = 0) const;
//@}
template <unsigned int ORBIT>
......
......@@ -224,17 +224,16 @@ inline void ImplicitHierarchicalMap3::next(Dart& d) const
} while(d != Map3::end() && m_dartLevel[d] > m_curLevel) ;
}
inline bool ImplicitHierarchicalMap3::foreach_dart_of_vertex(Dart d, FunctorType& f, unsigned int thread) const
inline void ImplicitHierarchicalMap3::foreach_dart_of_vertex(Dart d, std::function<void (Dart)> f, unsigned int thread) const
{
DartMarkerStore<Map3> mv(*this, thread); // Lock a marker
bool found = false; // Last functor return value
std::vector<Dart> darts; // Darts that are traversed
darts.reserve(256);
darts.push_back(d); // Start with the dart d
mv.mark(d);
for(unsigned int i = 0; !found && i < darts.size(); ++i)
for(unsigned int i = 0; i < darts.size(); ++i)
{
// add phi21 and phi23 successor if they are not marked yet
Dart d2 = phi2(darts[i]);
......@@ -252,126 +251,110 @@ inline bool ImplicitHierarchicalMap3::foreach_dart_of_vertex(Dart d, FunctorType
mv.mark(d23);
}
found = f(darts[i]);
f(darts[i]);
}
return found;
}
inline bool ImplicitHierarchicalMap3::foreach_dart_of_edge(Dart d, FunctorType& f, unsigned int thread) const
inline void ImplicitHierarchicalMap3::foreach_dart_of_edge(Dart d, std::function<void (Dart)> f, unsigned int thread) const
{
Dart dNext = d;
do {
if (foreach_dart_of_edge2(dNext, f, thread))
return true;
foreach_dart_of_edge2(dNext, f, thread);
dNext = alpha2(dNext);
} while (dNext != d);
return false;
}
inline bool ImplicitHierarchicalMap3::foreach_dart_of_oriented_face(Dart d, FunctorType& f, unsigned int /*thread*/) const
inline void ImplicitHierarchicalMap3::foreach_dart_of_oriented_face(Dart d, std::function<void (Dart)> f, unsigned int /*thread*/) const
{
Dart dNext = d ;
do
{
if (f(dNext))
return true ;
f(dNext);
dNext = phi1(dNext) ;
} while (dNext != d) ;
return false ;
}
inline bool ImplicitHierarchicalMap3::foreach_dart_of_face(Dart d, FunctorType& f, unsigned int thread) const
inline void ImplicitHierarchicalMap3::foreach_dart_of_face(Dart d, std::function<void (Dart)> f, unsigned int thread) const
{
return foreach_dart_of_oriented_face(d, f, thread) || foreach_dart_of_oriented_face(phi3(d), f, thread);
foreach_dart_of_oriented_face(d, f, thread);
foreach_dart_of_oriented_face(phi3(d), f, thread);
}
inline bool ImplicitHierarchicalMap3::foreach_dart_of_oriented_volume(Dart d, FunctorType& f, unsigned int thread) const
inline void ImplicitHierarchicalMap3::foreach_dart_of_oriented_volume(Dart d, std::function<void (Dart)> f, unsigned int thread) const
{
DartMarkerStore<Map3> mark(*this, thread); // Lock a marker
bool found = false; // Last functor return value
std::vector<Dart> visitedFaces; // Faces that are traversed
visitedFaces.reserve(1024) ;
visitedFaces.push_back(d); // Start with the face of d
// For every face added to the list
for(unsigned int i = 0; !found && i < visitedFaces.size(); ++i)
for(unsigned int i = 0; i < visitedFaces.size(); ++i)
{
if (!mark.isMarked(visitedFaces[i])) // Face has not been visited yet
{
// Apply functor to the darts of the face
found = foreach_dart_of_oriented_face(visitedFaces[i], f);
foreach_dart_of_oriented_face(visitedFaces[i], f);
// If functor returns false then mark visited darts (current face)
// mark visited darts (current face)
// and add non visited adjacent faces to the list of face
if (!found)
Dart e = visitedFaces[i] ;
do
{
Dart e = visitedFaces[i] ;
do
{
mark.mark(e); // Mark
Dart adj = phi2(e); // Get adjacent face
if (!mark.isMarked(adj))
visitedFaces.push_back(adj); // Add it
e = phi1(e);
} while(e != visitedFaces[i]);
}
mark.mark(e); // Mark
Dart adj = phi2(e); // Get adjacent face
if (!mark.isMarked(adj))
visitedFaces.push_back(adj); // Add it
e = phi1(e);
} while(e != visitedFaces[i]);
}
}
return found;
}
inline bool ImplicitHierarchicalMap3::foreach_dart_of_volume(Dart d, FunctorType& f, unsigned int thread) const
inline void ImplicitHierarchicalMap3::foreach_dart_of_volume(Dart d, std::function<void (Dart)> f, unsigned int thread) const
{
return foreach_dart_of_oriented_volume(d, f, thread) ;
foreach_dart_of_oriented_volume(d, f, thread) ;
}
inline bool ImplicitHierarchicalMap3::foreach_dart_of_cc(Dart d, FunctorType& f, unsigned int thread) const
inline void ImplicitHierarchicalMap3::foreach_dart_of_cc(Dart d, std::function<void (Dart)> f, unsigned int thread) const
{
DartMarkerStore<Map3> mark(*this, thread); // Lock a marker
bool found = false; // Last functor return value
std::vector<Dart> visitedFaces; // Faces that are traversed
visitedFaces.reserve(1024) ;
visitedFaces.push_back(d); // Start with the face of d
// For every face added to the list
for(unsigned int i = 0; !found && i < visitedFaces.size(); ++i)
for(unsigned int i = 0; i < visitedFaces.size(); ++i)
{
if (!mark.isMarked(visitedFaces[i])) // Face has not been visited yet
{
// Apply functor to the darts of the face
found = foreach_dart_of_face(visitedFaces[i], f);
foreach_dart_of_face(visitedFaces[i], f);
// If functor returns false then mark visited darts (current face)
// mark visited darts (current face)
// and add non visited adjacent faces to the list of face
if (!found)
Dart e = visitedFaces[i] ;
do
{
Dart e = visitedFaces[i] ;
do
{
mark.mark(e); // Mark
Dart adj = phi2(e); // Get adjacent face
if (!mark.isMarked(adj))
visitedFaces.push_back(adj); // Add it
e = phi1(e);
} while(e != visitedFaces[i]);
}
mark.mark(e); // Mark
Dart adj = phi2(e); // Get adjacent face
if (!mark.isMarked(adj))
visitedFaces.push_back(adj); // Add it
e = phi1(e);
} while(e != visitedFaces[i]);
}
}
return found;
// //return foreach_dart_of_oriented_volume(d, f) ;
// // foreach_dart_of_oriented_volume(d, f) ;
// DartMarkerStore mv(*this,thread); // Lock a marker
// bool found = false; // Last functor return value
//
// std::vector<Dart> darts; // Darts that are traversed
// darts.reserve(1024);
// darts.push_back(d); // Start with the dart d
// mv.mark(d);
//
// for(unsigned int i = 0; !found && i < darts.size(); ++i)
// for(unsigned int i = 0; i < darts.size(); ++i)
// {
// // add all successors if they are not marked yet
// Dart d2 = phi1(darts[i]); // turn in face
......@@ -394,34 +377,29 @@ inline bool ImplicitHierarchicalMap3::foreach_dart_of_cc(Dart d, FunctorType& f,
// mv.mark(d4);
// }
//
// found = f(darts[i]);
// f(darts[i]);
// }
// return found;
}
inline bool ImplicitHierarchicalMap3::foreach_dart_of_vertex2(Dart d, FunctorType& f, unsigned int /*thread*/) const
inline void ImplicitHierarchicalMap3::foreach_dart_of_vertex2(Dart d, std::function<void (Dart)> f, unsigned int /*thread*/) const
{
Dart dNext = d;
do
{
if (f(dNext))
return true;
f(dNext);
dNext = phi2(phi_1(dNext));
} while (dNext != d);
return false;
} while (dNext != d);
}
inline bool ImplicitHierarchicalMap3::foreach_dart_of_edge2(Dart d, FunctorType& f, unsigned int /*thread*/) const
inline void ImplicitHierarchicalMap3::foreach_dart_of_edge2(Dart d, std::function<void (Dart)> f, unsigned int /*thread*/) const
{
if (f(d))
return true;
return f(phi2(d));
f(d);
f(phi2(d));
}
inline bool ImplicitHierarchicalMap3::foreach_dart_of_face2(Dart d, FunctorType& f, unsigned int thread) const
inline void ImplicitHierarchicalMap3::foreach_dart_of_face2(Dart d, std::function<void (Dart)> f, unsigned int thread) const
{
return foreach_dart_of_oriented_face(d,f,thread);
foreach_dart_of_oriented_face(d, f, thread);
}
/***************************************************
......
......@@ -174,20 +174,20 @@ public:
* @param f a functor obj
*/
template <unsigned int ORBIT>
bool foreach_dart_of_orbit(Dart d, FunctorType& f, unsigned int thread = 0) const ;
void foreach_dart_of_orbit(Dart d, std::function<void (Dart)> f, unsigned int thread = 0) const ;
virtual bool foreach_dart_of_vertex(Dart d, FunctorType& f, unsigned int thread = 0) const = 0 ;
virtual bool foreach_dart_of_edge(Dart d, FunctorType& f, unsigned int thread = 0) const = 0 ;
virtual bool foreach_dart_of_face(Dart /*d*/, FunctorType& /*f*/, unsigned int /*thread = 0*/) const { std::cerr << "Not implemented" << std::endl; return false; }
virtual bool foreach_dart_of_volume(Dart /*d*/, FunctorType& /*f*/, unsigned int /*thread = 0*/) const { std::cerr << "Not implemented" << std::endl; return false; }
virtual bool foreach_dart_of_cc(Dart /*d*/, FunctorType& /*f*/, unsigned int /*thread = 0*/) const { std::cerr << "Not implemented" << std::endl; return false; }
virtual void foreach_dart_of_vertex(Dart /*d*/, std::function<void (Dart)> /*f*/, unsigned int /*thread = 0*/) const { std::cerr << "Not implemented" << std::endl; }
virtual void foreach_dart_of_edge(Dart /*d*/, std::function<void (Dart)> /*f*/, unsigned int /*thread = 0*/) const { std::cerr << "Not implemented" << std::endl; }
virtual void foreach_dart_of_face(Dart /*d*/, std::function<void (Dart)> /*f*/, unsigned int /*thread = 0*/) const { std::cerr << "Not implemented" << std::endl; }
virtual void foreach_dart_of_volume(Dart /*d*/, std::function<void (Dart)> /*f*/, unsigned int /*thread = 0*/) const { std::cerr << "Not implemented" << std::endl; }
virtual void foreach_dart_of_cc(Dart /*d*/, std::function<void (Dart)> /*f*/, unsigned int /*thread = 0*/) const { std::cerr << "Not implemented" << std::endl; }
virtual bool foreach_dart_of_vertex1(Dart /*d*/, FunctorType& /*f*/, unsigned int /*thread = 0*/) const { std::cerr << "Not implemented" << std::endl; return false; }
virtual bool foreach_dart_of_edge1(Dart /*d*/, FunctorType& /*f*/, unsigned int /*thread = 0*/) const { std::cerr << "Not implemented" << std::endl; return false; }
virtual void foreach_dart_of_vertex1(Dart /*d*/, std::function<void (Dart)> /*f*/, unsigned int /*thread = 0*/) const { std::cerr << "Not implemented" << std::endl; }
virtual void foreach_dart_of_edge1(Dart /*d*/, std::function<void (Dart)> /*f*/, unsigned int /*thread = 0*/) const { std::cerr << "Not implemented" << std::endl; }
virtual bool foreach_dart_of_vertex2(Dart /*d*/, FunctorType& /*f*/, unsigned int /*thread = 0*/) const { std::cerr << "Not implemented" << std::endl; return false; }
virtual bool foreach_dart_of_edge2(Dart /*d*/, FunctorType& /*f*/, unsigned int /*thread = 0*/) const { std::cerr << "Not implemented" << std::endl; return false; }
virtual bool foreach_dart_of_face2(Dart /*d*/, FunctorType& /*f*/, unsigned int /*thread = 0*/) const { std::cerr << "Not implemented" << std::endl; return false; }
virtual void foreach_dart_of_vertex2(Dart /*d*/, std::function<void (Dart)> /*f*/, unsigned int /*thread = 0*/) const { std::cerr << "Not implemented" << std::endl; }
virtual void foreach_dart_of_edge2(Dart /*d*/, std::function<void (Dart)> /*f*/, unsigned int /*thread = 0*/) const { std::cerr << "Not implemented" << std::endl; }
virtual void foreach_dart_of_face2(Dart /*d*/, std::function<void (Dart)> /*f*/, unsigned int /*thread = 0*/) const { std::cerr << "Not implemented" << std::endl; }
/****************************************
* EMBEDDING MANAGEMENT *
......
......@@ -218,23 +218,22 @@ void GenericMap::addEmbedding()
****************************************/
template <unsigned int ORBIT>
bool GenericMap::foreach_dart_of_orbit(Dart d, FunctorType& f, unsigned int thread) const
void GenericMap::foreach_dart_of_orbit(Dart d, std::function<void (Dart)> f, unsigned int thread) const
{
switch(ORBIT)
{
case DART: return f(d);
case VERTEX: return foreach_dart_of_vertex(d, f, thread);
case EDGE: return foreach_dart_of_edge(d, f, thread);
case FACE: return foreach_dart_of_face(d, f, thread);
case VOLUME: return foreach_dart_of_volume(d, f, thread);
case VERTEX1: return foreach_dart_of_vertex1(d, f, thread);
case EDGE1: return foreach_dart_of_edge1(d, f, thread);
case VERTEX2: return foreach_dart_of_vertex2(d, f, thread);
case EDGE2: return foreach_dart_of_edge2(d, f, thread);
case FACE2: return foreach_dart_of_face2(d, f, thread);
case DART: f(d); break;
case VERTEX: foreach_dart_of_vertex(d, f, thread); break;
case EDGE: foreach_dart_of_edge(d, f, thread); break;
case FACE: foreach_dart_of_face(d, f, thread); break;
case VOLUME: foreach_dart_of_volume(d, f, thread); break;
case VERTEX1: foreach_dart_of_vertex1(d, f, thread); break;
case EDGE1: foreach_dart_of_edge1(d, f, thread); break;
case VERTEX2: foreach_dart_of_vertex2(d, f, thread); break;
case EDGE2: foreach_dart_of_edge2(d, f, thread); break;
case FACE2: foreach_dart_of_face2(d, f, thread); break;
default: assert(!"Cells of this dimension are not handled"); break;
}
return false;
}
/****************************************
......
......@@ -141,16 +141,16 @@ protected:
void boundaryUnmark(Dart d) ;
/**
* mark an orbit of dart as belonging to boundary
* mark an orbit as belonging to boundary
*/
template <unsigned int ORBIT, unsigned int DIM>
void boundaryMarkOrbit(Dart d) ;
template <unsigned int DIM, unsigned int ORBIT>
void boundaryMarkOrbit(Cell<ORBIT> c) ;
/**
* unmark an orbit of dart from the boundary
* unmark an orbit from the boundary
*/
template <unsigned int ORBIT, unsigned int DIM>
void boundaryUnmarkOrbit(Dart d) ;
template <unsigned int DIM, unsigned int ORBIT>
void boundaryUnmarkOrbit(Cell<ORBIT> c) ;
/**
* clear all boundary markers
......
......@@ -41,21 +41,19 @@ unsigned int MapCommon<MAP_IMPL>::degree(Dart d) const
return fcount.getNb() ;
}
template <typename MAP_IMPL>
template <unsigned int ORBIT>
bool MapCommon<MAP_IMPL>::sameOrbit(Cell<ORBIT> c1, Cell<ORBIT> c2, unsigned int thread) const
{
TraversorDartsOfOrbit< MapCommon<MAP_IMPL>, ORBIT> tradoo(*this,c1.dart,thread);
for (Dart x= tradoo.begin(); x!=tradoo.end();x=tradoo.next())
TraversorDartsOfOrbit<MapCommon<MAP_IMPL>, ORBIT> tradoo(*this, c1.dart, thread);
for (Dart x = tradoo.begin(); x != tradoo.end(); x = tradoo.next())
{
if (x==c2.dart)
if (x == c2.dart)
return true;
}
return false;
}
/****************************************
* EMBEDDING MANAGEMENT *
****************************************/
......@@ -125,8 +123,10 @@ inline void MapCommon<MAP_IMPL>::setOrbitEmbedding(Cell<ORBIT> c, unsigned int e
{
assert(this->template isOrbitEmbedded<ORBIT>() || !"Invalid parameter: orbit not embedded");
FunctorSetEmb<MapCommon<MAP_IMPL>, ORBIT> fsetemb(*this, em);
this->template foreach_dart_of_orbit<ORBIT>(c.dart, fsetemb);
this->template foreach_dart_of_orbit<ORBIT>(c.dart, [&] (Dart d)
{
this->setDartEmbedding<ORBIT>(d, em);
});
}
template <typename MAP_IMPL>
......@@ -135,8 +135,10 @@ inline void MapCommon<MAP_IMPL>::initOrbitEmbedding(Cell<ORBIT> c, unsigned int
{
assert(this->template isOrbitEmbedded<ORBIT>() || !"Invalid parameter: orbit not embedded");
FunctorInitEmb<MapCommon<MAP_IMPL>, ORBIT> finitemb(*this, em);
this->template foreach_dart_of_orbit<ORBIT>(c.dart, finitemb);
this->template foreach_dart_of_orbit<ORBIT>(c.dart, [&] (Dart d)
{
this->initDartEmbedding<ORBIT>(d, em);
});
}
template <typename MAP_IMPL>
......@@ -195,19 +197,23 @@ inline void MapCommon<MAP_IMPL>::boundaryUnmark(Dart d)
}
template <typename MAP_IMPL>
template <unsigned int ORBIT, unsigned int DIM>
void MapCommon<MAP_IMPL>::boundaryMarkOrbit(Dart d)
template <unsigned int DIM, unsigned int ORBIT>
void MapCommon<MAP_IMPL>::boundaryMarkOrbit(Cell<ORBIT> c)
{
FunctorMark<MAP_IMPL> fm(*this, this->m_boundaryMarkers[DIM-2], this->m_markTables[DART][0]) ;
this->template foreach_dart_of_orbit<ORBIT>(d, fm, 0) ;
this->template foreach_dart_of_orbit<ORBIT>(c.dart, [&] (Dart d)
{
this->boundaryMark<DIM>(d);
});
}
template <typename MAP_IMPL>
template <unsigned int ORBIT, unsigned int DIM>
void MapCommon<MAP_IMPL>::boundaryUnmarkOrbit(Dart d)
template <unsigned int DIM, unsigned int ORBIT>
void MapCommon<MAP_IMPL>::boundaryUnmarkOrbit(Cell<ORBIT> c)
{
FunctorUnmark<MAP_IMPL> fm(*this, this->m_boundaryMarkers[DIM-2], this->m_markTables[DART][0]) ;
this->template foreach_dart_of_orbit<ORBIT>(d, fm, 0) ;
this->template foreach_dart_of_orbit<ORBIT>(c.dart, [&] (Dart d)
{
this->boundaryUnmark<DIM>(d);
});
}
template <typename MAP_IMPL>
......
......@@ -69,6 +69,9 @@ public:
/*
* Executes function f on each ORBIT
*/
template <unsigned int ORBIT, typename MAP, typename FUNC>
inline void foreach_cell(const MAP& map, FUNC f, bool forceDartMarker = false, unsigned int thread = 0)
{
......@@ -77,7 +80,9 @@ inline void foreach_cell(const MAP& map, FUNC f, bool forceDartMarker = false, u
f(c);
}
/*
* Executes function f on each ORBIT until f returns false
*/
template <unsigned int ORBIT, typename MAP, typename FUNC>
inline void foreach_cell_until(const MAP& map, FUNC f, bool forceDartMarker = false, unsigned int thread = 0)
{
......
......@@ -95,15 +95,13 @@ public:
/*! @param d a dart of the vertex
* @param f the functor to apply
*/
bool foreach_dart_of_vertex(Dart d, FunctorType& f, unsigned int thread = 0) const;
void foreach_dart_of_vertex(Dart d, std::function<void (Dart)> f, unsigned int thread = 0) const;
//! Apply a functor on every dart of an edge
/*! @param d a dart of the edge
* @param f the functor to apply
*/
bool foreach_dart_of_edge(Dart d, FunctorType& f, unsigned int thread = 0) const;
// bool foreach_dart_of_cc(Dart d, FunctorType& f, unsigned int thread = 0);
void foreach_dart_of_edge(Dart d, std::function<void (Dart)> f, unsigned int thread = 0) const;
//@}
};
......
......@@ -118,18 +118,18 @@ void GMap0<MAP_IMPL>::deleteEdge(Dart d)
*************************************************************************/
template <typename MAP_IMPL>
inline bool GMap0<MAP_IMPL>::foreach_dart_of_vertex(Dart d, FunctorType& f, unsigned int /*thread*/) const
inline void GMap0<MAP_IMPL>::foreach_dart_of_vertex(Dart d, std::function<void (Dart)> f, unsigned int /*thread*/) const
{
return f(d) ;
f(d) ;
}
template <typename MAP_IMPL>
inline bool GMap0<MAP_IMPL>::foreach_dart_of_edge(Dart d, FunctorType& f, unsigned int /*thread*/) const
inline void GMap0<MAP_IMPL>::foreach_dart_of_edge(Dart d, std::function<void (Dart)> f, unsigned int /*thread*/) const
{
if (f(d)) return true;
f(d);
Dart d1 = beta0(d);
if (d1 != d) return f(d1);
return false;
if (d1 != d)
f(d1);
}
} // namespace CGoGN
......@@ -193,27 +193,27 @@ public:
* @param d a dart of the vertex
* @param fonct functor obj ref
*/
bool foreach_dart_of_vertex(Dart d, FunctorType& fonct, unsigned int thread=0) const;
void foreach_dart_of_vertex(Dart d, std::function<void (Dart)> f, unsigned int thread=0) const;
/**
* Apply a functor on each dart of an edge
* @param d a dart of the edge
* @param fonct functor obj ref
*/
bool foreach_dart_of_edge(Dart d, FunctorType& fonct, unsigned int thread=0) const;
void foreach_dart_of_edge(Dart d, std::function<void (Dart)> f, unsigned int thread=0) const;
/**
* Apply a functor on each dart of an oriented cc (face)
* @param d a dart of the oriented cc
* @param fonct functor obj ref
*/
bool foreach_dart_of_oriented_cc(Dart d, FunctorType& f, unsigned int thread=0) const;
void foreach_dart_of_oriented_cc(Dart d, std::function<void (Dart)> f, unsigned int thread=0) const;
//! Apply a functor on every dart of a cc (face)
/*! @param d a dart of the cc
* @param f the functor to apply
*/
bool foreach_dart_of_cc(Dart d, FunctorType& fonct, unsigned int thread=0) const;
void foreach_dart_of_cc(Dart d, std::function<void (Dart)> f, unsigned int thread=0) const;
//@}
};
......
......@@ -362,40 +362,39 @@ inline bool GMap1<MAP_IMPL>::isCycleTriangle(Dart d) const
*************************************************************************/
template <typename MAP_IMPL>
inline bool GMap1<MAP_IMPL>::foreach_dart_of_vertex(Dart d, FunctorType& f, unsigned int /*thread*/) const
inline void GMap1<MAP_IMPL>::foreach_dart_of_vertex(Dart d, std::function<void (Dart)> f, unsigned int /*thread*/) const
{
if (f(d)) return true;
f(d);
Dart d1 = beta1(d);
if (d1 != d) return f(d1);
return false;
if (d1 != d)
f(d1);
}
template <typename MAP_IMPL>
inline bool GMap1<MAP_IMPL>::foreach_dart_of_edge(Dart d, FunctorType& f, unsigned int /*thread*/) const
inline void GMap1<MAP_IMPL>::foreach_dart_of_edge(Dart d, std::function<void (Dart)> f, unsigned int /*thread*/) const
{
if (f(d)) return true;
f(d);
Dart d1 = this->beta0(d);
if (d1 != d) return f(d1);
return false;
if (d1 != d)
f(d1);
}
template <typename MAP_IMPL>
inline bool GMap1<MAP_IMPL>::foreach_dart_of_oriented_cc(Dart d, FunctorType& f, unsigned int /*thread*/) const
inline void GMap1<MAP_IMPL>::foreach_dart_of_oriented_cc(Dart d, std::function<void (Dart)> f, unsigned int /*thread*/) const
{
Dart it = d ;
do
{
if (f(it))
return true ;
f(it);
it = phi1(it) ;
} while (it != d) ;
return false ;
}
template <typename MAP_IMPL>
inline bool GMap1<MAP_IMPL>::foreach_dart_of_cc(Dart d, FunctorType& f, unsigned int thread) const
inline void GMap1<MAP_IMPL>::foreach_dart_of_cc(Dart d, std::function<void (Dart)> f, unsigned int thread) const
{
return GMap1<MAP_IMPL>::foreach_dart_of_oriented_cc(d, f, thread) || GMap1::foreach_dart_of_oriented_cc(this->beta0(d), f, thread) ;
GMap1<MAP_IMPL>::foreach_dart_of_oriented_cc(d, f, thread);
GMap1<MAP_IMPL>::foreach_dart_of_oriented_cc(this->beta0(d), f, thread);
}
} // namespace CGoGN
......@@ -396,66 +396,66 @@ public:
* @param d a dart of the oriented vertex
* @param fonct functor obj ref
*/
bool foreach_dart_of_oriented_vertex(Dart d, FunctorType& fonct, unsigned int thread = 0) const;
void foreach_dart_of_oriented_vertex(Dart d, std::function<void (Dart)> f, unsigned int thread = 0) const;
/**
* Apply a functor on each dart of a vertex
* @param d a dart of the vertex
* @param fonct functor obj ref
*/
bool foreach_dart_of_vertex(Dart d, FunctorType& fonct, unsigned int thread = 0) const;
void foreach_dart_of_vertex(Dart d, std::function<void (Dart)> f, unsigned int thread = 0) const;
/**
* Apply a functor on each dart of an oriented edge
* @param d a dart of the oriented edge
* @param fonct functor obj ref
*/
bool foreach_dart_of_oriented_edge(Dart d, FunctorType& fonct, unsigned int thread = 0) const;
void foreach_dart_of_oriented_edge(Dart d, std::function<void (Dart)> f, unsigned int thread = 0) const;
/**
* Apply a functor on each dart of an edge
* @param d a dart of the oriented edge
* @param fonct functor obj ref
*/
bool foreach_dart_of_edge(Dart d, FunctorType& fonct, unsigned int thread = 0) const;
void foreach_dart_of_edge(Dart d, std::function<void (Dart)> f, unsigned int thread = 0) const;
//! Apply a functor on every dart of an oriented face
/*! @param d a dart of the oriented face
* @param f the functor to apply
*/
bool foreach_dart_of_oriented_face(Dart d, FunctorType& fonct, unsigned int thread = 0) const;