Commit 29130379 authored by Sylvain Thery's avatar Sylvain Thery

traversor & foreach macros tutos

parent 40687654
......@@ -34,3 +34,5 @@ IF (WITH_QT)
ENDIF (WITH_QT)
add_subdirectory(Examples/Tests)
add_subdirectory(Tuto/Traversals)
......@@ -71,11 +71,11 @@ add_executable( tuto_orbits tuto_orbits.cpp ${tuto_orbits_ui} ${tuto_orbits_moc}
target_link_libraries( tuto_orbits
${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS} )
QT4_WRAP_UI( show_traversors_ui show_traversors.ui )
QT4_WRAP_CPP(show_traversors_moc show_traversors.h)
add_executable( show_traversors show_traversors.cpp ${show_traversors_ui} ${show_traversors_moc})
target_link_libraries( show_traversors
${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS} )
#QT4_WRAP_UI( show_traversors_ui show_traversors.ui )
#QT4_WRAP_CPP(show_traversors_moc show_traversors.h)
#add_executable( show_traversors show_traversors.cpp ${show_traversors_ui} ${show_traversors_moc})
#target_link_libraries( show_traversors
# ${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS} )
add_executable( tuto_subdivision tuto_subdivision.cpp)
target_link_libraries( tuto_subdivision
......
......@@ -52,6 +52,8 @@ public:
inline Cell(const Cell<ORBIT>& c): dart(c.dart) {}
/// Dart cast operator
inline operator Dart() const {return dart;}
friend std::ostream& operator<<( std::ostream &out, const Cell<ORBIT>& fa ) { return out << fa.dart; }
inline bool valid() const { return !dart.isNil();}
};
typedef Cell<VERTEX> Vertex;
......
......@@ -101,6 +101,17 @@ for (Cell<ORBIT> Cell_ITER ( Cell_ITER##_TraversalMacroLocalLoop##LNN.begin()),
#define foreachCellMT(ORBIT, Cell_ITER, MAP_TYPE, MAP_PARAM, THREAD) XforeachCellMT(ORBIT, Cell_ITER, MAP_TYPE, MAP_PARAM, THREAD,__LINE__)
#define YfindCell(ORBIT, Cell_ITER, MAP_TYPE, MAP_PARAM, COND, LNN)\
TraversorCell<MAP_TYPE,ORBIT> Cell_ITER##_TraversalMacroLocalLoop##LNN(MAP_PARAM);\
Dart Cell_ITER##_endTMLoop = Cell_ITER##_TraversalMacroLocalLoop##LNN.end();\
Cell_ITER = Cell_ITER##_TraversalMacroLocalLoop##LNN.begin(); \
while( (Cell_ITER.dart != Cell_ITER##_endTMLoop) && (!(COND)) )\
Cell_ITER.dart = Cell_ITER##_TraversalMacroLocalLoop##LNN.next();
#define XfindCell(ORBIT, Cell_ITER, MAP_TYPE, MAP_PARAM, COND, LNN) YfindCell(ORBIT, Cell_ITER, MAP_TYPE, MAP_PARAM,COND,LNN)
#define findCell(ORBIT, Cell_ITER, MAP_TYPE, MAP_PARAM, COND) XfindCell(ORBIT, Cell_ITER, MAP_TYPE, MAP_PARAM,COND,__LINE__)
}
#endif /* __CELLS_MACRO_H_ */
......@@ -67,7 +67,7 @@ struct Dart
Dart(unsigned int v): index(v) {}
bool isNil() { return index == 0xffffffff ; }
bool isNil() const { return index == 0xffffffff ; }
/**
* affectation operator
......
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