Commit f3916a06 authored by Sylvain Thery's avatar Sylvain Thery

optim virt/novirt traversors

parent 119ac9f2
......@@ -527,20 +527,6 @@ inline void GenericMap::updateQuickIncidentTraversal()
vd.reserve(buffer.size());
vd.assign(buffer.begin(),buffer.end());
}
// TraversorCell<MAP,ORBIT> tra_glob(map);
// for (Dart d = tra_glob.begin(); d != tra_glob.end(); d = tra_glob.next())
// {
// buffer.clear();
// Traversor3XY<MAP,ORBIT,INCI> tra_loc(map,d);
// for (Dart e = tra_loc.begin(); e != tra_loc.end(); e = tra_loc.next())
// buffer.push_back(e);
// buffer.push_back(NIL);
// std::vector<Dart>& vd = (*ptrVD)[getEmbedding<ORBIT>(d)];
// vd.reserve(buffer.size());
// vd.assign(buffer.begin(),buffer.end());
// }
m_quickLocalIncidentTraversal[ORBIT][INCI] = ptrVD;
}
......@@ -570,7 +556,7 @@ inline void GenericMap::enableQuickAdjacentTraversal()
if(!isOrbitEmbedded<ORBIT>())
addEmbedding<ORBIT>() ;
std::stringstream ss;
ss << "m_quickLocalAdjacentTraversal" << ADJ;
ss << "quickLocalAdjacentTraversal" << ADJ;
m_quickLocalAdjacentTraversal[ORBIT][ADJ] = m_attribs[ORBIT].addAttribute<NoTypeNameAttribute<std::vector<Dart> > >(ss.str()) ;
}
updateQuickAdjacentTraversal<MAP,ORBIT,ADJ>() ;
......@@ -602,20 +588,6 @@ inline void GenericMap::updateQuickAdjacentTraversal()
vd.reserve(buffer.size());
vd.assign(buffer.begin(),buffer.end());
}
// TraversorCell<MAP,ORBIT> tra_glob(map);
// for (Dart d = tra_glob.begin(); d != tra_glob.end(); d = tra_glob.next())
// {
// buffer.clear();
// Traversor3XXaY<MAP,ORBIT,ADJ> tra_loc(map,d);
// for (Dart e = tra_loc.begin(); e != tra_loc.end(); e = tra_loc.next())
// buffer.push_back(e);
// buffer.push_back(NIL);
// std::vector<Dart>& vd = (*ptrVD)[getEmbedding<ORBIT>(d)];
// vd.reserve(buffer.size());
// vd.assign(buffer.begin(),buffer.end());
// }
m_quickLocalAdjacentTraversal[ORBIT][ADJ] = ptrVD;
}
......
......@@ -26,7 +26,7 @@
#define __TRAVERSOR2_H__
#include "Topology/generic/dart.h"
#include "Topology/generic/traversorGen.h"
//#include "Topology/generic/traversorGen.h"
namespace CGoGN
{
......@@ -37,7 +37,7 @@ namespace CGoGN
// Traverse the edges incident to a given vertex
template <typename MAP>
class Traversor2VE: public Traversor<MAP>
class Traversor2VE//: public Traversor<MAP>
{
private:
MAP& m ;
......@@ -55,7 +55,7 @@ public:
// Traverse the faces incident to a given vertex
template <typename MAP>
class Traversor2VF : public Traversor<MAP>
class Traversor2VF //: public Traversor<MAP>
{
private:
MAP& m ;
......@@ -73,7 +73,7 @@ public:
// Traverse the vertices adjacent to a given vertex through sharing a common edge
template <typename MAP>
class Traversor2VVaE : public Traversor<MAP>
class Traversor2VVaE //: public Traversor<MAP>
{
private:
MAP& m ;
......@@ -91,7 +91,7 @@ public:
// Traverse the vertices adjacent to a given vertex through sharing a common face
template <typename MAP>
class Traversor2VVaF : public Traversor<MAP>
class Traversor2VVaF //: public Traversor<MAP>
{
private:
MAP& m ;
......@@ -115,7 +115,7 @@ public:
// Traverse the vertices incident to a given edge
template <typename MAP>
class Traversor2EV : public Traversor<MAP>
class Traversor2EV //: public Traversor<MAP>
{
private:
MAP& m ;
......@@ -133,7 +133,7 @@ public:
// Traverse the faces incident to a given edge
template <typename MAP>
class Traversor2EF : public Traversor<MAP>
class Traversor2EF //: public Traversor<MAP>
{
private:
MAP& m ;
......@@ -151,7 +151,7 @@ public:
// Traverse the edges adjacent to a given edge through sharing a common vertex
template <typename MAP>
class Traversor2EEaV : public Traversor<MAP>
class Traversor2EEaV //: public Traversor<MAP>
{
private:
MAP& m ;
......@@ -171,7 +171,7 @@ public:
// Traverse the edges adjacent to a given edge through sharing a common face
template <typename MAP>
class Traversor2EEaF : public Traversor<MAP>
class Traversor2EEaF //: public Traversor<MAP>
{
private:
MAP& m ;
......@@ -195,7 +195,7 @@ public:
// Traverse the vertices incident to a given face
template <typename MAP>
class Traversor2FV : public Traversor<MAP>
class Traversor2FV //: public Traversor<MAP>
{
private:
MAP& m ;
......@@ -222,7 +222,7 @@ public:
// Traverse the faces adjacent to a given face through sharing a common vertex
template <typename MAP>
class Traversor2FFaV : public Traversor<MAP>
class Traversor2FFaV //: public Traversor<MAP>
{
private:
MAP& m ;
......@@ -242,7 +242,7 @@ public:
// Traverse the faces adjacent to a given face through sharing a common edge
template <typename MAP>
class Traversor2FFaE : public Traversor<MAP>
class Traversor2FFaE //: public Traversor<MAP>
{
private:
MAP& m ;
......
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#ifndef __VTraversor2_VIRT_H__
#define __VTraversor2_VIRT_H__
#include "Topology/generic/dart.h"
#include "Topology/generic/traversorGen.h"
namespace CGoGN
{
/*******************************************************************************
VERTEX CENTERED TRAVERSALS
*******************************************************************************/
// Traverse the edges incident to a given vertex
template <typename MAP>
class VTraversor2VE: public Traversor<MAP>
{
private:
MAP& m ;
Dart start ;
Dart current ;
std::vector<Dart>* m_QLT;
std::vector<Dart>::iterator m_ItDarts;
public:
VTraversor2VE(MAP& map, Dart dart) ;
Dart begin() ;
Dart end() ;
Dart next() ;
} ;
// Traverse the faces incident to a given vertex
template <typename MAP>
class VTraversor2VF : public Traversor<MAP>
{
private:
MAP& m ;
Dart start ;
Dart current ;
std::vector<Dart>* m_QLT;
std::vector<Dart>::iterator m_ItDarts;
public:
VTraversor2VF(MAP& map, Dart dart) ;
Dart begin() ;
Dart end() ;
Dart next() ;
} ;
// Traverse the vertices adjacent to a given vertex through sharing a common edge
template <typename MAP>
class VTraversor2VVaE : public Traversor<MAP>
{
private:
MAP& m ;
Dart start ;
Dart current ;
std::vector<Dart>* m_QLT;
std::vector<Dart>::iterator m_ItDarts;
public:
VTraversor2VVaE(MAP& map, Dart dart) ;
Dart begin() ;
Dart end() ;
Dart next() ;
} ;
// Traverse the vertices adjacent to a given vertex through sharing a common face
template <typename MAP>
class VTraversor2VVaF : public Traversor<MAP>
{
private:
MAP& m ;
Dart start ;
Dart current ;
Dart stop ;
std::vector<Dart>* m_QLT;
std::vector<Dart>::iterator m_ItDarts;
public:
VTraversor2VVaF(MAP& map, Dart dart) ;
Dart begin() ;
Dart end() ;
Dart next() ;
} ;
/*******************************************************************************
EDGE CENTERED TRAVERSALS
*******************************************************************************/
// Traverse the vertices incident to a given edge
template <typename MAP>
class VTraversor2EV : public Traversor<MAP>
{
private:
MAP& m ;
Dart start ;
Dart current ;
std::vector<Dart>* m_QLT;
std::vector<Dart>::iterator m_ItDarts;
public:
VTraversor2EV(MAP& map, Dart dart) ;
Dart begin() ;
Dart end() ;
Dart next() ;
} ;
// Traverse the faces incident to a given edge
template <typename MAP>
class VTraversor2EF : public Traversor<MAP>
{
private:
MAP& m ;
Dart start ;
Dart current ;
std::vector<Dart>* m_QLT;
std::vector<Dart>::iterator m_ItDarts;
public:
VTraversor2EF(MAP& map, Dart dart) ;
Dart begin() ;
Dart end() ;
Dart next() ;
} ;
// Traverse the edges adjacent to a given edge through sharing a common vertex
template <typename MAP>
class VTraversor2EEaV : public Traversor<MAP>
{
private:
MAP& m ;
Dart start ;
Dart current ;
Dart stop1, stop2 ;
std::vector<Dart>* m_QLT;
std::vector<Dart>::iterator m_ItDarts;
public:
VTraversor2EEaV(MAP& map, Dart dart) ;
Dart begin() ;
Dart end() ;
Dart next() ;
} ;
// Traverse the edges adjacent to a given edge through sharing a common face
template <typename MAP>
class VTraversor2EEaF : public Traversor<MAP>
{
private:
MAP& m ;
Dart start ;
Dart current ;
Dart stop1, stop2 ;
std::vector<Dart>* m_QLT;
std::vector<Dart>::iterator m_ItDarts;
public:
VTraversor2EEaF(MAP& map, Dart dart) ;
Dart begin() ;
Dart end() ;
Dart next() ;
} ;
/*******************************************************************************
FACE CENTERED TRAVERSALS
*******************************************************************************/
// Traverse the vertices incident to a given face
template <typename MAP>
class VTraversor2FV : public Traversor<MAP>
{
private:
MAP& m ;
Dart start ;
Dart current ;
std::vector<Dart>* m_QLT;
std::vector<Dart>::iterator m_ItDarts;
public:
VTraversor2FV(MAP& map, Dart dart) ;
Dart begin() ;
Dart end() ;
Dart next() ;
} ;
// Traverse the edges incident to a given face (equivalent to vertices)
template <typename MAP>
class VTraversor2FE: public VTraversor2FV<MAP>
{
public:
VTraversor2FE(MAP& map, Dart dart):VTraversor2FV<MAP>(map,dart){}
} ;
// Traverse the faces adjacent to a given face through sharing a common vertex
template <typename MAP>
class VTraversor2FFaV : public Traversor<MAP>
{
private:
MAP& m ;
Dart start ;
Dart current ;
Dart stop ;
std::vector<Dart>* m_QLT;
std::vector<Dart>::iterator m_ItDarts;
public:
VTraversor2FFaV(MAP& map, Dart dart) ;
Dart begin() ;
Dart end() ;
Dart next() ;
} ;
// Traverse the faces adjacent to a given face through sharing a common edge
template <typename MAP>
class VTraversor2FFaE : public Traversor<MAP>
{
private:
MAP& m ;
Dart start ;
Dart current ;
std::vector<Dart>* m_QLT;
std::vector<Dart>::iterator m_ItDarts;
public:
VTraversor2FFaE(MAP& map, Dart dart) ;
Dart begin() ;
Dart end() ;
Dart next() ;
} ;
} // namespace CGoGN
#include "Topology/generic/traversor2Virt.hpp"
#endif
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
namespace CGoGN
{
/*******************************************************************************
VERTEX CENTERED TRAVERSALS
*******************************************************************************/
// VTraversor2VE
template <typename MAP>
VTraversor2VE<MAP>::VTraversor2VE(MAP& map, Dart dart) : m(map), start(dart),m_QLT(NULL)
{
AttributeMultiVector<NoTypeNameAttribute<std::vector<Dart> > >* quickTraversal = map.template getQuickIncidentTraversal<VERTEX,EDGE>() ;
if (quickTraversal != NULL)
{
m_QLT = &(quickTraversal->operator[](map.template getEmbedding<VERTEX>(dart)));
}
}
template <typename MAP>
Dart VTraversor2VE<MAP>::begin()
{
if(m_QLT != NULL)
{
m_ItDarts = m_QLT->begin();
return *m_ItDarts++;
}
current = start ;
return current ;
}
template <typename MAP>
Dart VTraversor2VE<MAP>::end()
{
return NIL ;
}
template <typename MAP>
Dart VTraversor2VE<MAP>::next()
{
if(m_QLT != NULL)
{
return *m_ItDarts++;
}
if(current != NIL)
{
// current = m.alpha1(current) ;
current = m.phi2(m.phi_1(current)) ;
if(current == start)
current = NIL ;
}
return current ;
}
// VTraversor2VF
template <typename MAP>
VTraversor2VF<MAP>::VTraversor2VF(MAP& map, Dart dart) : m(map), start(dart),m_QLT(NULL)
{
AttributeMultiVector<NoTypeNameAttribute<std::vector<Dart> > >* quickTraversal = map.template getQuickIncidentTraversal<VERTEX,FACE>() ;
if (quickTraversal != NULL)
{
m_QLT = &(quickTraversal->operator[](map.template getEmbedding<VERTEX>(dart)));
}
else
{
if(m.isBoundaryMarked2(start)) // jump over a boundary face
start = m.phi2(m.phi_1(start)) ;
}
}
template <typename MAP>
Dart VTraversor2VF<MAP>::begin()
{
if(m_QLT != NULL)
{
m_ItDarts = m_QLT->begin();
return *m_ItDarts++;
}
current = start ;
return current ;
}
template <typename MAP>
Dart VTraversor2VF<MAP>::end()
{
return NIL ;
}
template <typename MAP>
Dart VTraversor2VF<MAP>::next()
{
if(m_QLT != NULL)
{
return *m_ItDarts++;
}
if(current != NIL)
{
current = m.phi2(m.phi_1(current)) ;
if(m.isBoundaryMarked2(current)) // jump over a boundary face
current = m.phi2(m.phi_1(current)) ;
if(current == start)
current = NIL ;
}
return current ;
}
// VTraversor2VVaE
template <typename MAP>
VTraversor2VVaE<MAP>::VTraversor2VVaE(MAP& map, Dart dart) : m(map),m_QLT(NULL)
{
AttributeMultiVector<NoTypeNameAttribute<std::vector<Dart> > >* quickTraversal = map.template getQuickAdjacentTraversal<VERTEX,EDGE>() ;
if (quickTraversal != NULL)
{
m_QLT = &(quickTraversal->operator[](map.template getEmbedding<VERTEX>(dart)));
}
else
{
start = m.phi2(dart) ;
}
}
template <typename MAP>
Dart VTraversor2VVaE<MAP>::begin()
{
if(m_QLT != NULL)
{
m_ItDarts = m_QLT->begin();
return *m_ItDarts++;
}
current = start ;
return current ;
}
template <typename MAP>
Dart VTraversor2VVaE<MAP>::end()
{
return NIL ;
}
template <typename MAP>
Dart VTraversor2VVaE<MAP>::next()
{
if(m_QLT != NULL)
{
return *m_ItDarts++;
}
if(current != NIL)
{
current = m.phi_1(m.phi2(current)) ;
if(current == start)
current = NIL ;
}
return current ;
}
// VTraversor2VVaF
template <typename MAP>
VTraversor2VVaF<MAP>::VTraversor2VVaF(MAP& map, Dart dart) : m(map),m_QLT(NULL)
{
AttributeMultiVector<NoTypeNameAttribute<std::vector<Dart> > >* quickTraversal = map.template getQuickAdjacentTraversal<VERTEX,FACE>() ;
if (quickTraversal != NULL)
{
m_QLT = &(quickTraversal->operator[](map.template getEmbedding<VERTEX>(dart)));
}
else
{
if(m.isBoundaryMarked2(dart))
dart = m.phi2(m.phi_1(dart)) ;
start = m.phi1(m.phi1(dart)) ;
if(start == dart)
start = m.phi1(dart) ;
stop = dart ;
}
}
template <typename MAP>
Dart VTraversor2VVaF<MAP>::begin()
{
if(m_QLT != NULL)
{
m_ItDarts = m_QLT->begin();
return *m_ItDarts++;
}
current = start ;