Commit c9c55962 authored by Sylvain Thery's avatar Sylvain Thery

cellular using

parent 4fa17a33
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#ifndef __ALGO_GEOMETRY_AREA_H__ #ifndef __ALGO_GEOMETRY_AREA_H__
#define __ALGO_GEOMETRY_AREA_H__ #define __ALGO_GEOMETRY_AREA_H__
#include "Topology/generic/cells.h" #include "Topology/generic/cells_macros.h"
namespace CGoGN namespace CGoGN
{ {
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
//#include "Topology/generic/traversorCell.h" //#include "Topology/generic/traversorCell.h"
//#include "Topology/generic/traversor2.h" //#include "Topology/generic/traversor2.h"
#include "Topology/generic/cells.h" #include "Topology/generic/cells_macros.h"
#include "Topology/generic/autoAttributeHandler.h" #include "Topology/generic/autoAttributeHandler.h"
namespace CGoGN namespace CGoGN
...@@ -45,7 +45,7 @@ namespace Geometry ...@@ -45,7 +45,7 @@ namespace Geometry
template <typename PFP> template <typename PFP>
typename PFP::REAL triangleArea(typename PFP::MAP& map, Face d, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position) typename PFP::REAL triangleArea(typename PFP::MAP& map, Face d, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position)
{ {
typename PFP::VEC3 p1 = position[d] ; typename PFP::VEC3 p1 = position[d.dart] ;
typename PFP::VEC3 p2 = position[map.phi1(d)] ; typename PFP::VEC3 p2 = position[map.phi1(d)] ;
typename PFP::VEC3 p3 = position[map.phi_1(d)] ; typename PFP::VEC3 p3 = position[map.phi_1(d)] ;
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#define __ALGO_GEOMETRY_CENTROID_H__ #define __ALGO_GEOMETRY_CENTROID_H__
#include "Geometry/basic.h" #include "Geometry/basic.h"
#include "Topology/generic/cells.h" #include "Topology/generic/cells_macros.h"
namespace CGoGN namespace CGoGN
{ {
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include "Topology/generic/traversorCell.h" #include "Topology/generic/traversorCell.h"
#include "Topology/generic/traversor3.h" #include "Topology/generic/traversor3.h"
#include "Algo/Parallel/parallel_foreach.h" #include "Algo/Parallel/parallel_foreach.h"
#include "Topology/generic/cells.h" #include "Topology/generic/cells_macros.h"
namespace CGoGN namespace CGoGN
{ {
...@@ -76,7 +76,7 @@ typename V_ATT::DATA_TYPE volumeCentroidELW(typename PFP::MAP& map, Vol d, const ...@@ -76,7 +76,7 @@ typename V_ATT::DATA_TYPE volumeCentroidELW(typename PFP::MAP& map, Vol d, const
foreachIncident3MT(VOLUME,d,EDGE,it,typename PFP::MAP,map,thread) foreachIncident3MT(VOLUME,d,EDGE,it,typename PFP::MAP,map,thread)
{ {
EMB e1 = attributs[it]; EMB e1 = attributs[it.dart];
EMB e2 = attributs[map.phi1(it)]; EMB e2 = attributs[map.phi1(it)];
double l = (e2-e1).norm(); double l = (e2-e1).norm();
center += (e1+e2)*l; center += (e1+e2)*l;
...@@ -115,7 +115,7 @@ typename V_ATT::DATA_TYPE faceCentroidELW(typename PFP::MAP& map, Face d, const ...@@ -115,7 +115,7 @@ typename V_ATT::DATA_TYPE faceCentroidELW(typename PFP::MAP& map, Face d, const
// for(Dart it = t.begin(); it != t.end(); it = t.next()) // for(Dart it = t.begin(); it != t.end(); it = t.next())
foreachIncident2(FACE,d,EDGE,it,typename PFP::MAP,map) foreachIncident2(FACE,d,EDGE,it,typename PFP::MAP,map)
{ {
EMB e1 = attributs[it]; EMB e1 = attributs[it.dart];
EMB e2 = attributs[map.phi1(it)]; EMB e2 = attributs[map.phi1(it)];
double l = (e2-e1).norm(); double l = (e2-e1).norm();
center += (e1+e2)*l; center += (e1+e2)*l;
......
...@@ -25,125 +25,12 @@ ...@@ -25,125 +25,12 @@
#ifndef CELLS_H_ #ifndef CELLS_H_
#define CELLS_H_ #define CELLS_H_
#include <iostream>
#include "dart.h" #include "dart.h"
#include "traversor2.h"
#include "traversor3.h"
#include "traversorCell.h"
namespace CGoGN namespace CGoGN
{ {
class ForeachHide
{
};
/// MACRO FOR SIMPLE TRAVERSALS WITH CELLS
#define YforeachIncident2(FROM, Cell_PARAM, TO, Cell_ITER, MAP_TYPE, MAP_PARAM,LNN)\
IncidentTrav2<MAP_TYPE,FROM,TO> Cell_ITER##_TraversalMacroLocalLoop##LNN(MAP_PARAM,Cell_PARAM); \
for ( Cell<TO> Cell_ITER ( Cell_ITER##_TraversalMacroLocalLoop##LNN.t.begin()), Cell_ITER##_endTMLoop( Cell_ITER##_TraversalMacroLocalLoop##LNN.t.end());\
Cell_ITER != Cell_ITER ## _endTMLoop; Cell_ITER.dart() = Cell_ITER ## _TraversalMacroLocalLoop##LNN.t.next())
#define XforeachIncident2(FROM, Cell_PARAM, TO, Cell_ITER, MAP_TYPE, MAP_PARAM,LNN) YforeachIncident2(FROM, Cell_PARAM, TO, Cell_ITER, MAP_TYPE, MAP_PARAM,LNN)
#define foreachIncident2(FROM, Cell_PARAM, TO, Cell_ITER, MAP_TYPE, MAP_PARAM) XforeachIncident2(FROM, Cell_PARAM, TO, Cell_ITER, MAP_TYPE, MAP_PARAM,__LINE__)
#define YforeachAdjacent2(ORBIT,THRU, Cell_PARAM, Cell_ITER, MAP_TYPE, MAP_PARAM,LNN)\
AdjacentTrav2<MAP_TYPE,ORBIT,THRU> Cell_ITER##_TraversalMacroLocalLoop##LNN(MAP_PARAM,Cell_PARAM); \
for (Cell<ORBIT> Cell_ITER ( Cell_ITER##_TraversalMacroLocalLoop##LNN.t.begin()), Cell_ITER##_endTMLoop( Cell_ITER##_TraversalMacroLocalLoop##LNN.t.end()); \
Cell_ITER != Cell_ITER##_endTMLoop; Cell_ITER.dart() = Cell_ITER##_TraversalMacroLocalLoop##LNN.t.next())
#define XforeachAdjacent2(ORBIT,THRU, Cell_PARAM, Cell_ITER, MAP_TYPE, MAP_PARAM,LNN) YforeachAdjacent2(ORBIT,THRU, Cell_PARAM, Cell_ITER, MAP_TYPE, MAP_PARAM,LNN)
#define foreachAdjacent2(ORBIT,THRU, Cell_PARAM, Cell_ITER, MAP_TYPE, MAP_PARAM) XforeachAdjacent2(ORBIT,THRU, Cell_PARAM, Cell_ITER, MAP_TYPE, MAP_PARAM,__LINE__)
#define YforeachIncident3(FROM, Cell_PARAM, TO, Cell_ITER, MAP_TYPE, MAP_PARAM,LNN)\
Traversor3XY<MAP_TYPE,FROM,TO> Cell_ITER##_TraversalMacroLocalLoop##LNN(MAP_PARAM,Cell_PARAM); \
for ( Cell<TO> Cell_ITER ( Cell_ITER##_TraversalMacroLocalLoop##LNN.begin()), Cell_ITER##_endTMLoop( Cell_ITER##_TraversalMacroLocalLoop##LNN.end());\
Cell_ITER != Cell_ITER ## _endTMLoop; Cell_ITER.dart() = Cell_ITER ## _TraversalMacroLocalLoop##LNN.next())
#define XforeachIncident3(FROM, Cell_PARAM, TO, Cell_ITER, MAP_TYPE, MAP_PARAM,LNN) YforeachIncident3(FROM, Cell_PARAM, TO, Cell_ITER, MAP_TYPE, MAP_PARAM,LNN)
#define foreachIncident3(FROM, Cell_PARAM, TO, Cell_ITER, MAP_TYPE, MAP_PARAM) XforeachIncident3(FROM, Cell_PARAM, TO, Cell_ITER, MAP_TYPE, MAP_PARAM,__LINE__)
#define YforeachAdjacent3(ORBIT,THRU, Cell_PARAM, Cell_ITER, MAP_TYPE, MAP_PARAM,LNN)\
Traversor3XXaY<MAP_TYPE,ORBIT,THRU> Cell_ITER##_TraversalMacroLocalLoop##LNN(MAP_PARAM,Cell_PARAM); \
for (Cell<ORBIT> Cell_ITER ( Cell_ITER##_TraversalMacroLocalLoop##LNN.begin()), Cell_ITER##_endTMLoop( Cell_ITER##_TraversalMacroLocalLoop##LNN.end()); \
Cell_ITER != Cell_ITER##_endTMLoop; Cell_ITER.dart() = Cell_ITER##_TraversalMacroLocalLoop##LNN.next())
#define XforeachAdjacent3(ORBIT,THRU, Cell_PARAM, Cell_ITER, MAP_TYPE, MAP_PARAM,LNN) YforeachAdjacent3(ORBIT,THRU, Cell_PARAM, Cell_ITER, MAP_TYPE, MAP_PARAM,LNN)
#define foreachAdjacent3(ORBIT,THRU, Cell_PARAM, Cell_ITER, MAP_TYPE, MAP_PARAM) XforeachAdjacent3(ORBIT,THRU, Cell_PARAM, Cell_ITER, MAP_TYPE, MAP_PARAM,__LINE__)
#define YforeachCell(ORBIT, Cell_ITER, MAP_TYPE, MAP_PARAM,LNN)\
TraversorCell<MAP_TYPE,ORBIT> Cell_ITER##_TraversalMacroLocalLoop##LNN(MAP_PARAM);\
for (Cell<ORBIT> Cell_ITER ( Cell_ITER##_TraversalMacroLocalLoop##LNN.begin()), Cell_ITER##_endTMLoop( Cell_ITER##_TraversalMacroLocalLoop##LNN.end()); \
Cell_ITER != Cell_ITER##_endTMLoop; Cell_ITER.dart() = Cell_ITER##_TraversalMacroLocalLoop##LNN.next())
#define XforeachCell(ORBIT, Cell_ITER, MAP_TYPE, MAP_PARAM,LNN) YforeachCell(ORBIT, Cell_ITER, MAP_TYPE, MAP_PARAM,LNN)
#define foreachCell(ORBIT, Cell_ITER, MAP_TYPE, MAP_PARAM) XforeachCell(ORBIT, Cell_ITER, MAP_TYPE, MAP_PARAM,__LINE__)
///// VERSION WITHOUT TYPE OF MAP, use PFP::MAP
/*
#define foreachIncident2PFP(FROM, Cell_PARAM, TO, Cell_ITER, MAP_PARAM)\
IncidentTrav2<typename PFP::MAP,FROM,TO> Cell_ITER##_TraversalMacroLocalLoop__LINE__(MAP_PARAM,Cell_PARAM); \
for ( Cell<TO> Cell_ITER ( Cell_ITER##_TraversalMacroLocalLoop__LINE__.t.begin()), Cell_ITER##_endTMLoop( Cell_ITER##_TraversalMacroLocalLoop__LINE__.t.end());\
Cell_ITER != Cell_ITER ## _endTMLoop; Cell_ITER.dart() = Cell_ITER ## _TraversalMacroLocalLoop__LINE__.t.next())
#define foreachAdjacent2PFP(ORBIT,THRU, Cell_PARAM, Cell_ITER, MAP_PARAM)\
AdjacentTrav2<typename PFP::MAP,ORBIT,THRU> Cell_ITER##_TraversalMacroLocalLoop__LINE__(MAP_PARAM,Cell_PARAM); \
for (Cell<ORBIT> Cell_ITER ( Cell_ITER##_TraversalMacroLocalLoop__LINE__.t.begin()), Cell_ITER##_endTMLoop( Cell_ITER##_TraversalMacroLocalLoop__LINE__.t.end()); \
Cell_ITER != Cell_ITER##_endTMLoop; Cell_ITER.dart() = Cell_ITER##_TraversalMacroLocalLoop__LINE__.t.next())
#define foreachIncident3PFP(FROM, Cell_PARAM, TO, Cell_ITER, MAP_PARAM)\
Traversor3XY<typename PFP::MAP,FROM,TO> Cell_ITER##_TraversalMacroLocalLoop__LINE__(MAP_PARAM,Cell_PARAM); \
for ( Cell<TO> Cell_ITER ( Cell_ITER##_TraversalMacroLocalLoop__LINE__.begin()), Cell_ITER##_endTMLoop( Cell_ITER##_TraversalMacroLocalLoop__LINE__.end());\
Cell_ITER != Cell_ITER ## _endTMLoop; Cell_ITER.dart() = Cell_ITER ## _TraversalMacroLocalLoop__LINE__.next())
#define foreachAdjacent3PFP(ORBIT,THRU, Cell_PARAM, Cell_ITER, MAP_PARAM)\
Traversor3XXaY<typename PFP::MAP,ORBIT,THRU> Cell_ITER##_TraversalMacroLocalLoop__LINE__(MAP_PARAM,Cell_PARAM); \
for (Cell<ORBIT> Cell_ITER ( Cell_ITER##_TraversalMacroLocalLoop__LINE__.begin()), Cell_ITER##_endTMLoop( Cell_ITER##_TraversalMacroLocalLoop__LINE__.end()); \
Cell_ITER != Cell_ITER##_endTMLoop; Cell_ITER.dart() = Cell_ITER##_TraversalMacroLocalLoop__LINE__.next())
#define foreachCellPFP(ORBIT, Cell_ITER, MAP_PARAM)\
TraversorCell<typename PFP::MAP,ORBIT> Cell_ITER##_TraversalMacroLocalLoop__LINE__(MAP_PARAM);\
for (Cell<ORBIT> Cell_ITER ( Cell_ITER##_TraversalMacroLocalLoop__LINE__.begin()), Cell_ITER##_endTMLoop( Cell_ITER##_TraversalMacroLocalLoop__LINE__.end()); \
Cell_ITER != Cell_ITER##_endTMLoop; Cell_ITER.dart() = Cell_ITER##_TraversalMacroLocalLoop__LINE__.next())
*/
/// MultiThread versions of foreach___3
/// for dimension no need (to not use marker)
#define YforeachIncident3MT(FROM, Cell_PARAM, TO, Cell_ITER, MAP_TYPE, MAP_PARAM, THREAD,LNN)\
Traversor3XY<MAP_TYPE,FROM,TO> Cell_ITER##_TraversalMacroLocalLoop##LNN(MAP_PARAM,Cell_PARAM,false,THREAD); \
for ( Cell<TO> Cell_ITER ( Cell_ITER##_TraversalMacroLocalLoop##LNN.begin()), Cell_ITER##_endTMLoop( Cell_ITER##_TraversalMacroLocalLoop##LNN.end());\
Cell_ITER != Cell_ITER ## _endTMLoop; Cell_ITER.dart() = Cell_ITER ## _TraversalMacroLocalLoop##LNN.next())
#define XforeachIncident3MT(FROM, Cell_PARAM, TO, Cell_ITER, MAP_TYPE, MAP_PARAM, THREAD,LNN) YforeachIncident3MT(FROM, Cell_PARAM, TO, Cell_ITER, MAP_TYPE, MAP_PARAM, THREAD,LNN)
#define foreachIncident3MT(FROM, Cell_PARAM, TO, Cell_ITER, MAP_TYPE, MAP_PARAM, THREAD) XforeachIncident3MT(FROM, Cell_PARAM, TO, Cell_ITER, MAP_TYPE, MAP_PARAM, THREAD,__LINE__)
#define YforeachAdjacent3MT(ORBIT,THRU, Cell_PARAM, Cell_ITER, MAP_TYPE, MAP_PARAM, THREAD,LNN)\
Traversor3XXaY<MAP_TYPE,ORBIT,THRU> Cell_ITER##_TraversalMacroLocalLoop##LNN(MAP_PARAM,Cell_PARAM,false,THREAD); \
for (Cell<ORBIT> Cell_ITER ( Cell_ITER##_TraversalMacroLocalLoop##LNN.begin()), Cell_ITER##_endTMLoop( Cell_ITER##_TraversalMacroLocalLoop##LNN.end()); \
Cell_ITER != Cell_ITER##_endTMLoop; Cell_ITER.dart() = Cell_ITER##_TraversalMacroLocalLoop##LNN.next())
#define XforeachAdjacent3MT(ORBIT,THRU, Cell_PARAM, Cell_ITER, MAP_TYPE, MAP_PARAM, THREAD,LNN) YforeachAdjacent3MT(ORBIT,THRU, Cell_PARAM, Cell_ITER, MAP_TYPE, MAP_PARAM, THREAD,LNN)
#define foreachAdjacent3MT(ORBIT,THRU, Cell_PARAM, Cell_ITER, MAP_TYPE, MAP_PARAM, THREAD) XforeachAdjacent3MT(ORBIT,THRU, Cell_PARAM, Cell_ITER, MAP_TYPE, MAP_PARAM, THREAD,__LINE__)
#define YforeachCellMT(ORBIT, Cell_ITER, MAP_TYPE, MAP_PARAM, THREAD,LNN)\
TraversorCell<MAP_TYPE,ORBIT> Cell_ITER##_TraversalMacroLocalLoop##LNN(MAP_PARAM,false,THREAD);\
for (Cell<ORBIT> Cell_ITER ( Cell_ITER##_TraversalMacroLocalLoop##LNN.begin()), Cell_ITER##_endTMLoop( Cell_ITER##_TraversalMacroLocalLoop##LNN.end()); \
Cell_ITER != Cell_ITER##_endTMLoop; Cell_ITER.dart() = Cell_ITER##_TraversalMacroLocalLoop##LNN.next())
#define XforeachCellMT(ORBIT, Cell_ITER, MAP_TYPE, MAP_PARAM, THREAD,LNN) YforeachCellMT(ORBIT, Cell_ITER, MAP_TYPE, MAP_PARAM, THREAD,LNN)
#define foreachCellMT(ORBIT, Cell_ITER, MAP_TYPE, MAP_PARAM, THREAD) XforeachCellMT(ORBIT, Cell_ITER, MAP_TYPE, MAP_PARAM, THREAD,__LINE__)
/** /**
* class for cellular typing * class for cellular typing
...@@ -155,31 +42,22 @@ for (Cell<ORBIT> Cell_ITER ( Cell_ITER##_TraversalMacroLocalLoop##LNN.begin()), ...@@ -155,31 +42,22 @@ for (Cell<ORBIT> Cell_ITER ( Cell_ITER##_TraversalMacroLocalLoop##LNN.begin()),
template <unsigned int ORBIT> template <unsigned int ORBIT>
class Cell class Cell
{ {
Dart m_d;
public: public:
Dart dart;
/// emoty construtor /// emoty construtor
Cell(): m_d() {} Cell(): dart() {}
/// construtor from Dart /// construtor from Dart
inline Cell(Dart d): m_d(d) {} inline Cell(Dart d): dart(d) {}
/// copy constructor /// copy constructor
inline Cell(const Cell<ORBIT>& c): m_d(c.m_d) {} inline Cell(const Cell<ORBIT>& c): dart(c.dart) {}
/// return the dart
inline Dart dart() const { return m_d; }
/// return a ref to dart
inline Dart& dart() { return m_d; }
/// equal operation
inline bool operator==(Cell<ORBIT> d) const { return d.m_d.index == m_d.index; }
inline bool operator!=(Cell<ORBIT> d) const { return d.m_d.index != m_d.index; }
/// Dart cast operator /// Dart cast operator
inline operator Dart() {return m_d;} inline operator Dart() const {return dart;}
}; };
typedef Cell<VERTEX> Vertex; typedef Cell<VERTEX> Vertex;
typedef Cell<EDGE> Edge; typedef Cell<EDGE> Edge;
typedef Cell<FACE> Face; typedef Cell<FACE> Face;
typedef Cell<VOLUME> Vol; typedef Cell<VOLUME> Vol; // not Volume because of the namespace Volume
} }
......
/*******************************************************************************
* 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 __CELLS_MACRO_H_
#define __CELLS_MACRO_H_
#include "cells.h"
#include "traversor2.h"
#include "traversor3.h"
#include "traversorCell.h"
namespace CGoGN
{
/// MACRO FOR SIMPLE TRAVERSALS WITH CELLS
#define YforeachIncident2(FROM, Cell_PARAM, TO, Cell_ITER, MAP_TYPE, MAP_PARAM,LNN)\
IncidentTrav2<MAP_TYPE,FROM,TO> Cell_ITER##_TraversalMacroLocalLoop##LNN(MAP_PARAM,Cell_PARAM); \
for ( Cell<TO> Cell_ITER ( Cell_ITER##_TraversalMacroLocalLoop##LNN.t.begin()), Cell_ITER##_endTMLoop( Cell_ITER##_TraversalMacroLocalLoop##LNN.t.end());\
Cell_ITER.dart != Cell_ITER##_endTMLoop.dart; Cell_ITER.dart = Cell_ITER##_TraversalMacroLocalLoop##LNN.t.next())
#define XforeachIncident2(FROM, Cell_PARAM, TO, Cell_ITER, MAP_TYPE, MAP_PARAM,LNN) YforeachIncident2(FROM, Cell_PARAM, TO, Cell_ITER, MAP_TYPE, MAP_PARAM,LNN)
#define foreachIncident2(FROM, Cell_PARAM, TO, Cell_ITER, MAP_TYPE, MAP_PARAM) XforeachIncident2(FROM, Cell_PARAM, TO, Cell_ITER, MAP_TYPE, MAP_PARAM,__LINE__)
#define YforeachAdjacent2(ORBIT,THRU, Cell_PARAM, Cell_ITER, MAP_TYPE, MAP_PARAM,LNN)\
AdjacentTrav2<MAP_TYPE,ORBIT,THRU> Cell_ITER##_TraversalMacroLocalLoop##LNN(MAP_PARAM,Cell_PARAM); \
for (Cell<ORBIT> Cell_ITER ( Cell_ITER##_TraversalMacroLocalLoop##LNN.t.begin()), Cell_ITER##_endTMLoop( Cell_ITER##_TraversalMacroLocalLoop##LNN.t.end()); \
Cell_ITER.dart != Cell_ITER##_endTMLoop.dart; Cell_ITER.dart = Cell_ITER##_TraversalMacroLocalLoop##LNN.t.next())
#define XforeachAdjacent2(ORBIT,THRU, Cell_PARAM, Cell_ITER, MAP_TYPE, MAP_PARAM,LNN) YforeachAdjacent2(ORBIT,THRU, Cell_PARAM, Cell_ITER, MAP_TYPE, MAP_PARAM,LNN)
#define foreachAdjacent2(ORBIT,THRU, Cell_PARAM, Cell_ITER, MAP_TYPE, MAP_PARAM) XforeachAdjacent2(ORBIT,THRU, Cell_PARAM, Cell_ITER, MAP_TYPE, MAP_PARAM,__LINE__)
#define YforeachIncident3(FROM, Cell_PARAM, TO, Cell_ITER, MAP_TYPE, MAP_PARAM,LNN)\
Traversor3XY<MAP_TYPE,FROM,TO> Cell_ITER##_TraversalMacroLocalLoop##LNN(MAP_PARAM,Cell_PARAM); \
for ( Cell<TO> Cell_ITER ( Cell_ITER##_TraversalMacroLocalLoop##LNN.begin()), Cell_ITER##_endTMLoop( Cell_ITER##_TraversalMacroLocalLoop##LNN.end());\
Cell_ITER.dart != Cell_ITER ## _endTMLoop.dart; Cell_ITER.dart = Cell_ITER ## _TraversalMacroLocalLoop##LNN.next())
#define XforeachIncident3(FROM, Cell_PARAM, TO, Cell_ITER, MAP_TYPE, MAP_PARAM,LNN) YforeachIncident3(FROM, Cell_PARAM, TO, Cell_ITER, MAP_TYPE, MAP_PARAM,LNN)
#define foreachIncident3(FROM, Cell_PARAM, TO, Cell_ITER, MAP_TYPE, MAP_PARAM) XforeachIncident3(FROM, Cell_PARAM, TO, Cell_ITER, MAP_TYPE, MAP_PARAM,__LINE__)
#define YforeachAdjacent3(ORBIT,THRU, Cell_PARAM, Cell_ITER, MAP_TYPE, MAP_PARAM,LNN)\
Traversor3XXaY<MAP_TYPE,ORBIT,THRU> Cell_ITER##_TraversalMacroLocalLoop##LNN(MAP_PARAM,Cell_PARAM); \
for (Cell<ORBIT> Cell_ITER ( Cell_ITER##_TraversalMacroLocalLoop##LNN.begin()), Cell_ITER##_endTMLoop( Cell_ITER##_TraversalMacroLocalLoop##LNN.end()); \
Cell_ITER.dart != Cell_ITER##_endTMLoop.dart; Cell_ITER.dart = Cell_ITER##_TraversalMacroLocalLoop##LNN.next())
#define XforeachAdjacent3(ORBIT,THRU, Cell_PARAM, Cell_ITER, MAP_TYPE, MAP_PARAM,LNN) YforeachAdjacent3(ORBIT,THRU, Cell_PARAM, Cell_ITER, MAP_TYPE, MAP_PARAM,LNN)
#define foreachAdjacent3(ORBIT,THRU, Cell_PARAM, Cell_ITER, MAP_TYPE, MAP_PARAM) XforeachAdjacent3(ORBIT,THRU, Cell_PARAM, Cell_ITER, MAP_TYPE, MAP_PARAM,__LINE__)
#define YforeachCell(ORBIT, Cell_ITER, MAP_TYPE, MAP_PARAM,LNN)\
TraversorCell<MAP_TYPE,ORBIT> Cell_ITER##_TraversalMacroLocalLoop##LNN(MAP_PARAM);\
for (Cell<ORBIT> Cell_ITER ( Cell_ITER##_TraversalMacroLocalLoop##LNN.begin()), Cell_ITER##_endTMLoop( Cell_ITER##_TraversalMacroLocalLoop##LNN.end()); \
Cell_ITER.dart != Cell_ITER##_endTMLoop.dart; Cell_ITER.dart = Cell_ITER##_TraversalMacroLocalLoop##LNN.next())
#define XforeachCell(ORBIT, Cell_ITER, MAP_TYPE, MAP_PARAM,LNN) YforeachCell(ORBIT, Cell_ITER, MAP_TYPE, MAP_PARAM,LNN)
#define foreachCell(ORBIT, Cell_ITER, MAP_TYPE, MAP_PARAM) XforeachCell(ORBIT, Cell_ITER, MAP_TYPE, MAP_PARAM,__LINE__)
/// MultiThread versions of foreach___3
/// for dimension 2 no need (it do not use marker)
#define YforeachIncident3MT(FROM, Cell_PARAM, TO, Cell_ITER, MAP_TYPE, MAP_PARAM, THREAD,LNN)\
Traversor3XY<MAP_TYPE,FROM,TO> Cell_ITER##_TraversalMacroLocalLoop##LNN(MAP_PARAM,Cell_PARAM,false,THREAD); \
for ( Cell<TO> Cell_ITER ( Cell_ITER##_TraversalMacroLocalLoop##LNN.begin()), Cell_ITER##_endTMLoop( Cell_ITER##_TraversalMacroLocalLoop##LNN.end());\
Cell_ITER.dart != Cell_ITER ## _endTMLoop.dart; Cell_ITER.dart = Cell_ITER ## _TraversalMacroLocalLoop##LNN.next())
#define XforeachIncident3MT(FROM, Cell_PARAM, TO, Cell_ITER, MAP_TYPE, MAP_PARAM, THREAD,LNN) YforeachIncident3MT(FROM, Cell_PARAM, TO, Cell_ITER, MAP_TYPE, MAP_PARAM, THREAD,LNN)
#define foreachIncident3MT(FROM, Cell_PARAM, TO, Cell_ITER, MAP_TYPE, MAP_PARAM, THREAD) XforeachIncident3MT(FROM, Cell_PARAM, TO, Cell_ITER, MAP_TYPE, MAP_PARAM, THREAD,__LINE__)
#define YforeachAdjacent3MT(ORBIT,THRU, Cell_PARAM, Cell_ITER, MAP_TYPE, MAP_PARAM, THREAD,LNN)\
Traversor3XXaY<MAP_TYPE,ORBIT,THRU> Cell_ITER##_TraversalMacroLocalLoop##LNN(MAP_PARAM,Cell_PARAM,false,THREAD); \
for (Cell<ORBIT> Cell_ITER ( Cell_ITER##_TraversalMacroLocalLoop##LNN.begin()), Cell_ITER##_endTMLoop( Cell_ITER##_TraversalMacroLocalLoop##LNN.end()); \
Cell_ITER.dart != Cell_ITER##_endTMLoop.dart; Cell_ITER.dart = Cell_ITER##_TraversalMacroLocalLoop##LNN.next())
#define XforeachAdjacent3MT(ORBIT,THRU, Cell_PARAM, Cell_ITER, MAP_TYPE, MAP_PARAM, THREAD,LNN) YforeachAdjacent3MT(ORBIT,THRU, Cell_PARAM, Cell_ITER, MAP_TYPE, MAP_PARAM, THREAD,LNN)
#define foreachAdjacent3MT(ORBIT,THRU, Cell_PARAM, Cell_ITER, MAP_TYPE, MAP_PARAM, THREAD) XforeachAdjacent3MT(ORBIT,THRU, Cell_PARAM, Cell_ITER, MAP_TYPE, MAP_PARAM, THREAD,__LINE__)
#define YforeachCellMT(ORBIT, Cell_ITER, MAP_TYPE, MAP_PARAM, THREAD,LNN)\
TraversorCell<MAP_TYPE,ORBIT> Cell_ITER##_TraversalMacroLocalLoop##LNN(MAP_PARAM,false,THREAD);\
for (Cell<ORBIT> Cell_ITER ( Cell_ITER##_TraversalMacroLocalLoop##LNN.begin()), Cell_ITER##_endTMLoop( Cell_ITER##_TraversalMacroLocalLoop##LNN.end()); \
Cell_ITER.dart != Cell_ITER##_endTMLoop.dart; Cell_ITER.dart = Cell_ITER##_TraversalMacroLocalLoop##LNN.next())
#define XforeachCellMT(ORBIT, Cell_ITER, MAP_TYPE, MAP_PARAM, THREAD,LNN) YforeachCellMT(ORBIT, Cell_ITER, MAP_TYPE, MAP_PARAM, THREAD,LNN)
#define foreachCellMT(ORBIT, Cell_ITER, MAP_TYPE, MAP_PARAM, THREAD) XforeachCellMT(ORBIT, Cell_ITER, MAP_TYPE, MAP_PARAM, THREAD,__LINE__)
}
#endif /* __CELLS_MACRO_H_ */
...@@ -374,7 +374,8 @@ public: ...@@ -374,7 +374,8 @@ public:
FunctorStoreNotBoundary(const MAP& map, std::vector<Dart>& vec) : FunctorConstMap<MAP>(map), m_vec(vec) {} FunctorStoreNotBoundary(const MAP& map, std::vector<Dart>& vec) : FunctorConstMap<MAP>(map), m_vec(vec) {}
bool operator()(Dart d) bool operator()(Dart d)
{ {
if (!this->m_map.template isBoundaryMarked<MAP::DIMENSION>(d)) // if (!this->m_map.template isBoundaryMarked<MAP::DIMENSION>(d))
if (!this->m_map.template isBoundaryMarkedCurrent(d))
m_vec.push_back(d); m_vec.push_back(d);
return false; return false;
} }
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#define __MAP_COMMON__ #define __MAP_COMMON__
#include "Topology/generic/attributeHandler.h" #include "Topology/generic/attributeHandler.h"
#include "Topology/generic/cells.h"
namespace CGoGN namespace CGoGN
{ {
...@@ -62,6 +63,10 @@ public: ...@@ -62,6 +63,10 @@ public:
template <unsigned int ORBIT, unsigned int INCIDENT> template <unsigned int ORBIT, unsigned int INCIDENT>
unsigned int degree(Dart d) const; unsigned int degree(Dart d) const;
template <unsigned int ORBIT>
bool sameOrbit(Cell<ORBIT> c1, Cell<ORBIT> c2, unsigned int thread=0) const;
/**************************************** /****************************************
* EMBEDDING MANAGEMENT * * EMBEDDING MANAGEMENT *
****************************************/ ****************************************/
......
...@@ -89,6 +89,21 @@ unsigned int MapCommon<MAP_IMPL>::degree(Dart d) const ...@@ -89,6 +89,21 @@ unsigned int MapCommon<MAP_IMPL>::degree(Dart d) const
return fcount.getNb() ; 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())
{
if (x==c2.dart)
return true;
}
return false;
}
/**************************************** /****************************************
* EMBEDDING MANAGEMENT * * EMBEDDING MANAGEMENT *
****************************************/ ****************************************/
......
/*******************************************************************************
* 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 __SIMPLICES_H_
#define __SIMPLICES_H_
#include <iostream>
#include "cells.h"
#include "Algo/Topo/Generic/simplex.h"
namespace CGoGN
{
template <unsigned int ORBIT>
class Simplex
{
public:
Dart dart;
/// emoty construtor
Simplex(): dart() {}
/// construtor from Dart
inline Simplex(Dart d): dart(d) {}
inline Simplex(Cell<ORBIT> c): dart(c.dart) {}
/// copy constructor
inline Simplex(const Simplex<ORBIT>& c): dart(c.dart) {}
/// Cell cast operator
inline operator Cell<ORBIT>() {return Cell<ORBIT>(dart);}
/// Dart cast operator
inline operator Dart() {return dart;}
/// check if this simplex is really a simplex
template <typename MAP>
bool check(const MAP& map) const { return Algo::Topo::isSimplex<MAP,ORBIT>(map,dart);}
};
typedef Simplex<FACE> Triangle;
typedef Simplex<VOLUME> Tetra;
}
#endif /* __SIMPLICES_H_ */
...@@ -33,7 +33,8 @@ TraversorDartsOfOrbit<MAP, ORBIT>::TraversorDartsOfOrbit(const MAP& map, Dart d, ...@@ -33,7 +33,8 @@ TraversorDartsOfOrbit<MAP, ORBIT>::TraversorDartsOfOrbit(const MAP& map, Dart d,
{ {
m_vd.reserve(16); m_vd.reserve(16);
FunctorStoreNotBoundary<MAP> fs(map, m_vd); FunctorStoreNotBoundary<MAP> fs(map, m_vd);
const_cast<MAP&>(map).template foreach_dart_of_orbit<ORBIT>(d, fs, thread); // const_cast<MAP&>(map).template foreach_dart_of_orbit<ORBIT>(d, fs, thread);
map.template foreach_dart_of_orbit<ORBIT>(d, fs, thread);
m_vd.push_back(NIL); m_vd.push_back(NIL);
} }
......
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