Commit e75796dd authored by Pierre Kraemer's avatar Pierre Kraemer

create traversor1 Virtual version

parent 4d2d5cd6
......@@ -26,6 +26,8 @@
#define CELLS_H_
#include "Topology/generic/dart.h"
//#include "Topology/generic/traversor/traversor2.h"
//#include "Topology/generic/traversor/traversor3.h"
namespace CGoGN
{
......@@ -58,6 +60,58 @@ public:
friend std::ostream& operator<<( std::ostream &out, const Cell<ORBIT>& fa ) { return out << fa.dart; }
inline bool valid() const { return !dart.isNil(); }
// template <unsigned int ORBIT_TO, typename MAP, typename FUNC>
// inline void foreach_incident(MAP& map, FUNC f)
// {
// switch (MAP::DIMENSION)
// {
// case 2 : foreach_incident2(map, f); break;
// case 3 : foreach_incident3(map, f); break;
// }
// }
// template <unsigned int ORBIT_TO, typename MAP, typename FUNC>
// inline void foreach_adjacent(MAP& map, FUNC f)
// {
// switch (MAP::DIMENSION)
// {
// case 2 : foreach_adjacent2(map, f); break;
// case 3 : foreach_adjacent3(map, f); break;
// }
// }
// template <unsigned int ORBIT_TO, typename MAP, typename FUNC>
// inline void foreach_incident2(MAP& map, FUNC f)
// {
// IncidentTrav2<MAP,ORBIT,ORBIT_TO> trav(const_cast<const MAP&>(map), *this);
// for (Cell<ORBIT_TO> c = trav.t.begin(), e = trav.t.end(); c.dart != e.dart; c = trav.t.next())
// f(c);
// }
// template <unsigned int THRU, typename MAP, typename FUNC>
// inline void foreach_adjacent2(MAP& map, FUNC f)
// {
// AdjacentTrav2<MAP,ORBIT,THRU> trav(const_cast<const MAP&>(map), *this);
// for (Cell<ORBIT> c = trav.t.begin(), e = trav.t.end(); c.dart != e.dart; c = trav.t.next())
// f(c);
// }
// template <unsigned int ORBIT_TO, typename MAP, typename FUNC>
// inline void foreach_incident3(MAP& map, FUNC f, bool forceDartMarker = false, unsigned int thread = 0)
// {
// Traversor3XY<MAP,ORBIT,ORBIT_TO> trav(const_cast<const MAP&>(map),*this,forceDartMarker,thread);
// for (Cell<ORBIT_TO> c = trav.begin(), e = trav.end(); c.dart != e.dart; c = trav.next())
// f(c);
// }
// template <unsigned int THRU, typename MAP, typename FUNC>
// inline void foreach_adjacent3(MAP& map, FUNC f, bool forceDartMarker = false, unsigned int thread = 0)
// {
// Traversor3XXaY<MAP,ORBIT,THRU> trav(const_cast<const MAP&>(map),*this,forceDartMarker,thread);
// for (Cell<ORBIT> c = trav.begin(), e = trav.end(); c.dart != e.dart; c = trav.next())
// f(c);
// }
};
typedef Cell<VERTEX> Vertex;
......
......@@ -26,7 +26,6 @@
#define __TRAVERSOR1_H__
#include "Topology/generic/dart.h"
#include "Topology/generic/traversor/traversorGen.h"
namespace CGoGN
{
......@@ -37,7 +36,7 @@ namespace CGoGN
// Traverse the edges incident to a given vertex
template <typename MAP>
class Traversor1VE: public Traversor
class Traversor1VE
{
private:
const MAP& m ;
......@@ -56,7 +55,7 @@ public:
// Traverse the vertices adjacent to a given vertex through sharing a common edge
template <typename MAP>
class Traversor1VVaE: public Traversor
class Traversor1VVaE
{
private:
const MAP& m ;
......@@ -79,7 +78,7 @@ public:
// Traverse the vertices incident to a given edge
template <typename MAP>
class Traversor1EV: public Traversor
class Traversor1EV
{
private:
const MAP& m ;
......@@ -98,7 +97,7 @@ public:
// Traverse the edges adjacent to a given edge through sharing a common vertex
template <typename MAP>
class Traversor1EEaV: public Traversor
class Traversor1EEaV
{
private:
const 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 __VTraversor1_VIRT_H__
#define __VTraversor1_VIRT_H__
#include "Topology/generic/dart.h"
#include "Topology/generic/traversor/traversorGen.h"
namespace CGoGN
{
/*******************************************************************************
VERTEX CENTERED TRAVERSALS
*******************************************************************************/
// Traverse the edges incident to a given vertex
template <typename MAP>
class VTraversor1VE : public Traversor
{
private:
const MAP& m ;
Dart start ;
Dart current ;
Dart d2 ;
public:
VTraversor1VE(const 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 VTraversor1VVaE : public Traversor
{
private:
const MAP& m ;
Dart start ;
Dart current ;
Dart d2 ;
public:
VTraversor1VVaE(const 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 VTraversor1EV : public Traversor
{
private:
const MAP& m ;
Dart start ;
Dart current ;
Dart d2 ;
public:
VTraversor1EV(const 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 VTraversor1EEaV : public Traversor
{
private:
const MAP& m ;
Dart start ;
Dart current ;
Dart d2 ;
public:
VTraversor1EEaV(const MAP& map, Dart dart) ;
Dart begin() ;
Dart end() ;
Dart next() ;
} ;
} // namespace CGoGN
#include "Topology/generic/traversor/traversor1Virt.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
*******************************************************************************/
// VTraversor1VE
template <typename MAP>
VTraversor1VE<MAP>::VTraversor1VE(const MAP& map, Dart dart) : m(map), start(dart)
{
d2 = m.phi_1(start) ;
if(d2 == start) // 1 edge loop case
d2 = NIL ;
}
template <typename MAP>
Dart VTraversor1VE<MAP>::begin()
{
current = start ;
return current ;
}
template <typename MAP>
Dart VTraversor1VE<MAP>::end()
{
return NIL ;
}
template <typename MAP>
Dart VTraversor1VE<MAP>::next()
{
if(current != NIL)
{
if(current == start)
current = d2 ;
else
current = NIL ;
}
return current ;
}
// VTraversor1VVaE
template <typename MAP>
VTraversor1VVaE<MAP>::VTraversor1VVaE(const MAP& map, Dart dart) : m(map)
{
start = m.phi_1(dart) ;
if(start == dart) // 1 edge loop case
start = NIL ;
else
{
d2 = m.phi1(dart) ;
if(d2 == start) // 2 edges loop case
d2 = NIL ;
}
}
template <typename MAP>
Dart VTraversor1VVaE<MAP>::begin()
{
current = start ;
return current ;
}
template <typename MAP>
Dart VTraversor1VVaE<MAP>::end()
{
return NIL ;
}
template <typename MAP>
Dart VTraversor1VVaE<MAP>::next()
{
if(current != NIL)
{
if(current == start)
current = d2 ;
else
current = NIL ;
}
return current ;
}
/*******************************************************************************
EDGE CENTERED TRAVERSALS
*******************************************************************************/
// VTraversor1EV
template <typename MAP>
VTraversor1EV<MAP>::VTraversor1EV(const MAP& map, Dart dart) : m(map), start(dart)
{
d2 = m.phi1(start) ;
if(d2 == start) // 1 edge loop case
d2 = NIL ;
}
template <typename MAP>
Dart VTraversor1EV<MAP>::begin()
{
current = start ;
return current ;
}
template <typename MAP>
Dart VTraversor1EV<MAP>::end()
{
return NIL ;
}
template <typename MAP>
Dart VTraversor1EV<MAP>::next()
{
if(current != NIL)
{
if(current == start)
current = d2 ;
else
current = NIL ;
}
return current ;
}
// VTraversor1EEaV
template <typename MAP>
VTraversor1EEaV<MAP>::VTraversor1EEaV(const MAP& map, Dart dart) : m(map)
{
start = m.phi_1(dart) ;
if(start == dart) // 1 edge loop case
start = NIL ;
else
{
d2 = m.phi1(dart) ;
if(d2 == start) // 2 edges loop case
d2 = NIL ;
}
}
template <typename MAP>
Dart VTraversor1EEaV<MAP>::begin()
{
current = start ;
return current ;
}
template <typename MAP>
Dart VTraversor1EEaV<MAP>::end()
{
return NIL ;
}
template <typename MAP>
Dart VTraversor1EEaV<MAP>::next()
{
if(current != NIL)
{
if(current == start)
current = d2 ;
else
current = NIL ;
}
return current ;
}
} // namespace CGoGN
......@@ -26,9 +26,7 @@
#define __TRAVERSOR2_H__
#include "Topology/generic/dart.h"
//#include "Topology/generic/traversorGen.h"
#include "Topology/generic/cells.h"
#include <functional>
namespace CGoGN
{
......@@ -39,7 +37,7 @@ namespace CGoGN
// Traverse the edges incident to a given vertex
template <typename MAP>
class Traversor2VE//: public Traversor<MAP>
class Traversor2VE
{
private:
const MAP& m ;
......@@ -57,7 +55,7 @@ public:
// Traverse the faces incident to a given vertex
template <typename MAP>
class Traversor2VF //: public Traversor<MAP>
class Traversor2VF
{
private:
const MAP& m ;
......@@ -75,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
{
private:
const MAP& m ;
......@@ -93,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
{
private:
const MAP& m ;
......@@ -117,7 +115,7 @@ public:
// Traverse the vertices incident to a given edge
template <typename MAP>
class Traversor2EV //: public Traversor<MAP>
class Traversor2EV
{
private:
const MAP& m ;
......@@ -135,7 +133,7 @@ public:
// Traverse the faces incident to a given edge
template <typename MAP>
class Traversor2EF //: public Traversor<MAP>
class Traversor2EF
{
private:
const MAP& m ;
......@@ -153,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
{
private:
const MAP& m ;
......@@ -173,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
{
private:
const MAP& m ;
......@@ -197,7 +195,7 @@ public:
// Traverse the vertices incident to a given face
template <typename MAP>
class Traversor2FV //: public Traversor<MAP>
class Traversor2FV
{
private:
const MAP& m ;
......@@ -224,7 +222,7 @@ public:
// Traverse the vertices incident to a given face
template <typename MAP>
class Traversor2FE //: public Traversor<MAP>
class Traversor2FE
{
private:
const MAP& m ;
......@@ -243,7 +241,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
{
private:
const MAP& m ;
......@@ -264,7 +262,7 @@ public:
// Traverse the faces adjacent to a given face through sharing a common edge
// Warning mult-incidence is not managed (some faces can be send several times)
template <typename MAP>
class Traversor2FFaE //: public Traversor<MAP>
class Traversor2FFaE
{
private:
const MAP& m ;
......@@ -413,8 +411,6 @@ inline void foreach_adjacent2(MAP& map, Cell<ORBIT> c, FUNC f)
f(c);
}
} // namespace CGoGN
#include "Topology/generic/traversor/traversor2.hpp"
......
......@@ -708,67 +708,4 @@ Face Traversor2FFaE<MAP>::next()
return current ;
}
//template<typename MAP>
//Traversor2<MAP>* Traversor2<MAP>::createIncident(MAP& map, Dart dart, unsigned int orbX, unsigned int orbY)
//{
// int code = 0x100*(orbX-VERTEX) + orbY-VERTEX;
//
// switch(code)
// {
// case 0x0001:
// return new Traversor2VE<MAP>(map,dart);
// break;
// case 0x0002:
// return new Traversor2VF<MAP>(map,dart);
// break;
// case 0x0100:
// return new Traversor2EV<MAP>(map,dart);
// break;
// case 0x0102:
// return new Traversor2EF<MAP>(map,dart);
// break;
// case 0x0200:
// return new Traversor2FV<MAP>(map,dart);
// break;
// case 0x0201:
// return new Traversor2FE<MAP>(map,dart);
// break;
// default:
// return NULL;
// break;
// }
// return NULL;
//}
//
//template<typename MAP>
//Traversor2<MAP>* Traversor2<MAP>::createAdjacent(MAP& map, Dart dart, unsigned int orbX, unsigned int orbY)
//{
// int code = 0x100*(orbX-VERTEX) + orbY-VERTEX;
// switch(code)
// {
// case 0x0001:
// return new Traversor2VVaE<MAP>(map,dart);
// break;
// case 0x0002:
// return new Traversor2VVaF<MAP>(map,dart);
// break;
// case 0x0100:
// return new Traversor2EEaV<MAP>(map,dart);
// break;
// case 0x0102:
// return new Traversor2EEaF<MAP>(map,dart);
// break;
// case 0x0200:
// return new Traversor2FFaV<MAP>(map,dart);
// break;
// case 0x0201:
// return new Traversor2FFaE<MAP>(map,dart);
// break;
// default:
// return NULL;
// break;
// }
// return NULL;
//}
} // namespace CGoGN
......@@ -26,9 +26,9 @@
#define __TRAVERSOR3_H__
#include "Topology/generic/dart.h"
#include "Topology/generic/cells.h"
#include "Topology/generic/cellmarker.h"
#include "Topology/generic/traversor/traversorCell.h"
//#include "Topology/generic/traversor/traversorGen.h"
#include "Topology/generic/traversor/traversorDoO.h"
namespace CGoGN
......@@ -62,7 +62,7 @@ public:
* Traverse all Y incident to X
*/
template <typename MAP, unsigned int ORBX, unsigned int ORBY>
class Traversor3XY//: public Traversor<MAP>
class Traversor3XY
{
private:
const MAP& m_map ;
......@@ -92,7 +92,7 @@ public:
* Traverse all X adjacent to X by an Y
*/
template <typename MAP, unsigned int ORBX, unsigned int ORBY>
class Traversor3XXaY//: public Traversor<MAP>
class Traversor3XXaY
{
private:
const MAP& m_map ;
......
......@@ -22,7 +22,7 @@
* *
*******************************************************************************/
#include "Topology/generic/traversor/traversor1.h"
#include "Topology/generic/traversor/traversor1Virt.h"
#include "Topology/generic/traversor/traversor2Virt.h"
#include "Topology/generic/traversor/traversor3Virt.h"
#include "Topology/generic/traversor/traversorCellVirt.h"
......@@ -97,12 +97,11 @@ Traversor* TraversorFactory<MAP>::createIncident(MAP& map, Dart dart, unsigned i
return new VTraversor2FE<MAP>(map,dart);
break;
case 0x101:
return new Traversor1VE<MAP>(map,dart);
return new VTraversor1VE<MAP>(map,dart);
break;
case 0x110:
return new Traversor1EV<MAP>(map,dart);
return new VTraversor1EV<MAP>(map,dart);
break;
default:
return NULL;
......@@ -178,10 +177,10 @@ Traversor* TraversorFactory<MAP>::createAdjacent(MAP& map, Dart dart, unsigned i
break;
case 0x101:
return new Traversor1VVaE<MAP>(map,dart);
return new VTraversor1VVaE<MAP>(map,dart);
break;
case 0x110:
return new Traversor1EEaV<MAP>(map,dart);
return new VTraversor1EEaV<MAP>(map,dart);
break;
default:
return NULL;
......
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