Commit d2dd217b authored by Sylvain Thery's avatar Sylvain Thery

foreach macro -> foreach function

parent 74edf8e4
...@@ -493,6 +493,14 @@ int main(int argc, char **argv) ...@@ -493,6 +493,14 @@ int main(int argc, char **argv)
Utils::Chrono ch; Utils::Chrono ch;
Vertex v(myMap.begin());
VEC3 p = Algo::Volume::Geometry::vertexNeighborhoodCentroid<PFP>(myMap,v,position);
Vol w(myMap.begin());
VEC3 q = Algo::Surface::Geometry::volumeCentroid<PFP>(myMap,w,position);
std::cout << "Compute Volume ->"<< std::endl; std::cout << "Compute Volume ->"<< std::endl;
ch.start(); ch.start();
float vol = Algo::Geometry::totalVolume<PFP>(myMap, position); float vol = Algo::Geometry::totalVolume<PFP>(myMap, position);
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include "Algo/Import/import.h" #include "Algo/Import/import.h"
#include "Algo/Export/export.h" #include "Algo/Export/export.h"
#include "Topology/generic/cells_macros.h"
using namespace CGoGN ; using namespace CGoGN ;
int main(int argc, char **argv) int main(int argc, char **argv)
...@@ -84,31 +83,18 @@ void MyQT::traversors(int x) ...@@ -84,31 +83,18 @@ void MyQT::traversors(int x)
{ {
case 0: case 0:
{ {
// TRAVERSE2_ADJACENT(VERTEX,EDGE,m_selected, b, MAP, myMap)
// m_render_topo->setDartColor(b,0.0f,1.0f,0.0f);
Vertex v(m_selected);
Edge e(m_selected);
fonct(v);
fonct2(e);
fonct(m_selected);
v = m_selected;
/*
Traversor2VVaE<MAP> trav(myMap,m_selected); Traversor2VVaE<MAP> trav(myMap,m_selected);
for(Dart b=trav.begin(); b!= trav.end(); b=trav.next()) for(Dart b=trav.begin(); b!= trav.end(); b=trav.next())
m_render_topo->setDartColor(b,0.0f,1.0f,0.0f); m_render_topo->setDartColor(b,0.0f,1.0f,0.0f);
*/
} }
break; break;
case 1: case 1:
{ {
foreachAdjacent2(VERTEX,FACE,m_selected, b, MAP, myMap)
m_render_topo->setDartColor(b,0.0f,1.0f,0.0f);
/*
Traversor2VVaF<MAP> trav(myMap,m_selected); Traversor2VVaF<MAP> trav(myMap,m_selected);
for(Dart b=trav.begin(); b!= trav.end(); b=trav.next()) for(Dart b=trav.begin(); b!= trav.end(); b=trav.next())
m_render_topo->setDartColor(b,0.0f,1.0f,0.0f); m_render_topo->setDartColor(b,0.0f,1.0f,0.0f);
*/
} }
break; break;
case 2: case 2:
...@@ -177,13 +163,9 @@ void MyQT::traversors(int x) ...@@ -177,13 +163,9 @@ void MyQT::traversors(int x)
break; break;
case 11: case 11:
{ {
/* Traversor2VF<MAP> trav(myMap,m_selected); Traversor2VF<MAP> trav(myMap,m_selected);
for(Dart b=trav.begin(); b!= trav.end(); b=trav.next()) for(Dart b=trav.begin(); b!= trav.end(); b=trav.next())
m_render_topo->setDartColor(b,0.0f,1.0f,0.0f); m_render_topo->setDartColor(b,0.0f,1.0f,0.0f);
*/
foreachIncident2(VERTEX,m_selected, FACE, b, MAP, myMap)
m_render_topo->setDartColor(b,0.0f,1.0f,0.0f);
} }
break; break;
default: default:
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include "Topology/generic/parameters.h" #include "Topology/generic/parameters.h"
#include "Topology/map/embeddedMap2.h" #include "Topology/map/embeddedMap2.h"
#include "Algo/Tiling/Surface/square.h" #include "Algo/Tiling/Surface/square.h"
#include "Topology/generic/cells_macros.h"
using namespace CGoGN ; using namespace CGoGN ;
...@@ -102,9 +101,12 @@ int main() ...@@ -102,9 +101,12 @@ int main()
std::cout << std::endl; std::cout << std::endl;
//using foreach macro //using foreach function (C++11 lambda expression)
foreachCell(VERTEX,v,MAP,myMap) // for each Vertex v of the MAP myMap foreach_cell<VERTEX>(myMap,[&](Vertex v) // for each Vertex v of the MAP myMap
{
std::cout << v << " : " << position[v]<< " / "; std::cout << v << " : " << position[v]<< " / ";
});
std::cout << std::endl; std::cout << std::endl;
// warning here v is a Vertex and not a Dart (but can cast automatically into) // warning here v is a Vertex and not a Dart (but can cast automatically into)
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include "Topology/generic/parameters.h" #include "Topology/generic/parameters.h"
#include "Topology/map/embeddedMap2.h" #include "Topology/map/embeddedMap2.h"
#include "Algo/Tiling/Surface/square.h" #include "Algo/Tiling/Surface/square.h"
#include "Topology/generic/cells_macros.h"
using namespace CGoGN ; using namespace CGoGN ;
...@@ -60,7 +59,12 @@ int main() ...@@ -60,7 +59,12 @@ int main()
// easy way to find the central vertex of the grid // easy way to find the central vertex of the grid
Vertex v; Vertex v;
findCell(VERTEX,v,MAP,myMap, position[v] == VEC3(0,0,0) ); // findCell(VERTEX,v,MAP,myMap, position[v] == VEC3(0,0,0) );
find_cell<VERTEX>(myMap,v, [&](Vertex v)
{
return position[v] == VEC3(0,0,0);
});
// must test of find ok (if not v.dart is NIL) // must test of find ok (if not v.dart is NIL)
if (! v.valid()) if (! v.valid())
std::cerr << "could not find a vertex with position (0,0,0)" << std::endl; std::cerr << "could not find a vertex with position (0,0,0)" << std::endl;
...@@ -82,15 +86,19 @@ int main() ...@@ -82,15 +86,19 @@ int main()
std::cout << "vertex of dart "<<e<< " adjacent to vertex of dart " << v.dart<< " by a face" << std::endl; std::cout << "vertex of dart "<<e<< " adjacent to vertex of dart " << v.dart<< " by a face" << std::endl;
} }
// WITH FOREACH MACRO // WITH FOREACH FUNCTION (C++11 lambda expression)
// find incident faces to vertex // find incident faces to vertex
foreachIncident2(VERTEX,v,FACE,f,MAP,myMap) foreach_incident2<FACE>(myMap,v,[&](Face f)
{
std::cout << "Face of dart "<<f<< " incident to vertex of dart " << v.dart<< std::endl; std::cout << "Face of dart "<<f<< " incident to vertex of dart " << v.dart<< std::endl;
});
// find adjacent vertices thru a face // find adjacent vertices thru a face
foreachAdjacent2(VERTEX,FACE,v,x, MAP, myMap) foreach_adjacent2<FACE>(myMap,v,[&](Vertex x)
{
std::cout << "vertex of dart "<<x<< " adjacent to vertex of dart " << v.dart<< " by a face" << std::endl; std::cout << "vertex of dart "<<x<< " adjacent to vertex of dart " << v.dart<< " by a face" << std::endl;
});
return 0; return 0;
} }
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
#ifndef __ALGO_GEOMETRY_AREA_H__ #ifndef __ALGO_GEOMETRY_AREA_H__
#define __ALGO_GEOMETRY_AREA_H__ #define __ALGO_GEOMETRY_AREA_H__
#include "Topology/generic/cells_macros.h"
namespace CGoGN namespace CGoGN
{ {
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include "Geometry/basic.h" #include "Geometry/basic.h"
#include "Algo/Geometry/centroid.h" #include "Algo/Geometry/centroid.h"
#include "Topology/generic/cells_macros.h"
#include "Topology/generic/autoAttributeHandler.h" #include "Topology/generic/autoAttributeHandler.h"
namespace CGoGN namespace CGoGN
...@@ -78,46 +77,48 @@ typename PFP::REAL totalArea(typename PFP::MAP& map, const VertexAttribute<typen ...@@ -78,46 +77,48 @@ typename PFP::REAL totalArea(typename PFP::MAP& map, const VertexAttribute<typen
typename PFP::REAL area(0) ; typename PFP::REAL area(0) ;
// TraversorF<typename PFP::MAP> t(map) ; // TraversorF<typename PFP::MAP> t(map) ;
// for(Dart d = t.begin(); d != t.end(); d = t.next())
// area += convexFaceArea<PFP>(map, d, position) ;
foreachCellMT(FACE,f,typename PFP::MAP,map,thread) foreach_cell<FACE>(map, [&] (Face f)
{
area += convexFaceArea<PFP>(map, f, position); area += convexFaceArea<PFP>(map, f, position);
}
,false,thread);
return area ; return area ;
} }
template <typename PFP> template <typename PFP>
typename PFP::REAL vertexOneRingArea(typename PFP::MAP& map, Vertex d, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position) typename PFP::REAL vertexOneRingArea(typename PFP::MAP& map, Vertex v, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position)
{ {
typename PFP::REAL area(0) ; typename PFP::REAL area(0) ;
// Traversor2VF<typename PFP::MAP> t(map, d) ; // Traversor2VF<typename PFP::MAP> t(map, d) ;
// for(Dart it = t.begin(); it != t.end(); it = t.next())
foreachIncident2(VERTEX,d,FACE,f, typename PFP::MAP, map) foreach_incident2<FACE>(map, v, [&] (Face f)
{
area += convexFaceArea<PFP>(map,f, position) ; area += convexFaceArea<PFP>(map,f, position) ;
});
return area ; return area ;
} }
template <typename PFP> template <typename PFP>
typename PFP::REAL vertexBarycentricArea(typename PFP::MAP& map, Vertex d, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position) typename PFP::REAL vertexBarycentricArea(typename PFP::MAP& map, Vertex v, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position)
{ {
typename PFP::REAL area(0) ; typename PFP::REAL area(0) ;
// Traversor2VF<typename PFP::MAP> t(map, d) ; // Traversor2VF<typename PFP::MAP> t(map, v) ;
// for(Dart it = t.begin(); it != t.end(); it = t.next())
// area += convexFaceArea<PFP>(map, it, position) / 3 ; foreach_incident2<FACE>(map, v, [&] (Face f)
foreachIncident2(VERTEX,d,FACE,f, typename PFP::MAP, map) {
area += convexFaceArea<PFP>(map, f, position) / 3 ; area += convexFaceArea<PFP>(map, f, position) / 3 ;
});
return area ; return area ;
} }
template <typename PFP> template <typename PFP>
typename PFP::REAL vertexVoronoiArea(typename PFP::MAP& map, Vertex d, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position) typename PFP::REAL vertexVoronoiArea(typename PFP::MAP& map, Vertex v, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position)
{ {
typename PFP::REAL area(0) ; typename PFP::REAL area(0) ;
// Traversor2VF<typename PFP::MAP> t(map, d) ; // Traversor2VF<typename PFP::MAP> t(map, v) ;
// for(Dart it = t.begin(); it != t.end(); it = t.next()) foreach_incident2<FACE>(map, v, [&] (Face it)
foreachIncident2(VERTEX,d,FACE,it, typename PFP::MAP, map)
{ {
const typename PFP::VEC3& p1 = position[it] ; const typename PFP::VEC3& p1 = position[it] ;
const typename PFP::VEC3& p2 = position[map.phi1(it)] ; const typename PFP::VEC3& p2 = position[map.phi1(it)] ;
...@@ -136,7 +137,7 @@ typename PFP::REAL vertexVoronoiArea(typename PFP::MAP& map, Vertex d, const Ver ...@@ -136,7 +137,7 @@ typename PFP::REAL vertexVoronoiArea(typename PFP::MAP& map, Vertex d, const Ver
else else
area += tArea / 4 ; area += tArea / 4 ;
} }
} });
return area ; return area ;
} }
...@@ -146,28 +147,30 @@ void computeAreaFaces(typename PFP::MAP& map, const VertexAttribute<typename PFP ...@@ -146,28 +147,30 @@ void computeAreaFaces(typename PFP::MAP& map, const VertexAttribute<typename PFP
// TraversorF<typename PFP::MAP> t(map) ; // TraversorF<typename PFP::MAP> t(map) ;
// for(Dart d = t.begin(); d != t.end(); d = t.next()) // for(Dart d = t.begin(); d != t.end(); d = t.next())
// face_area[d] = convexFaceArea<PFP>(map, d, position) ; // face_area[d] = convexFaceArea<PFP>(map, d, position) ;
foreachCellMT(FACE,f,typename PFP::MAP,map,thread)
foreach_cell<FACE>(map, [&] (Face f)
{
face_area[f] = convexFaceArea<PFP>(map, f, position) ; face_area[f] = convexFaceArea<PFP>(map, f, position) ;
}
,false,thread);
} }
template <typename PFP> template <typename PFP>
void computeOneRingAreaVertices(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, VertexAttribute<typename PFP::REAL, typename PFP::MAP::IMPL>& vertex_area, unsigned int thread) void computeOneRingAreaVertices(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, VertexAttribute<typename PFP::REAL, typename PFP::MAP::IMPL>& vertex_area, unsigned int thread)
{ {
// TraversorV<typename PFP::MAP> t(map) ;
// for(Dart d = t.begin(); d != t.end(); d = t.next())
// foreachCell(VERTEX,d,typename PFP::MAP,map,thread)
// vertex_area[d] = vertexOneRingArea<PFP>(map, d, position) ;
FaceAutoAttribute<typename PFP::REAL,typename PFP::MAP::IMPL> areas(map); FaceAutoAttribute<typename PFP::REAL,typename PFP::MAP::IMPL> areas(map);
computeAreaFaces<PFP>(map,position,areas); computeAreaFaces<PFP>(map,position,areas);
foreachCellMT(VERTEX,v,typename PFP::MAP,map,thread)
foreach_cell<VERTEX>(map, [&] (Vertex v)
{ {
vertex_area[v] = typename PFP::REAL(0); vertex_area[v] = typename PFP::REAL(0);
foreachIncident2(VERTEX,v,FACE,f, typename PFP::MAP, map) foreach_incident2<FACE>(map, v, [&] (Face f)
{
vertex_area[v] += areas[f]; vertex_area[v] += areas[f];
});
} }
,false,thread);
} }
...@@ -175,18 +178,22 @@ template <typename PFP> ...@@ -175,18 +178,22 @@ template <typename PFP>
void computeBarycentricAreaVertices(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, VertexAttribute<typename PFP::REAL, typename PFP::MAP::IMPL>& vertex_area, unsigned int thread) void computeBarycentricAreaVertices(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, VertexAttribute<typename PFP::REAL, typename PFP::MAP::IMPL>& vertex_area, unsigned int thread)
{ {
// TraversorV<typename PFP::MAP> t(map) ; // TraversorV<typename PFP::MAP> t(map) ;
// for(Dart d = t.begin(); d != t.end(); d = t.next()) foreach_cell<VERTEX>(map, [&] (Vertex v)
foreachCellMT(VERTEX,d,typename PFP::MAP,map,thread) {
vertex_area[d] = vertexBarycentricArea<PFP>(map, d, position) ; vertex_area[v] = vertexBarycentricArea<PFP>(map, v, position) ;
}
,false,thread);
} }
template <typename PFP> template <typename PFP>
void computeVoronoiAreaVertices(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, VertexAttribute<typename PFP::REAL, typename PFP::MAP::IMPL>& vertex_area, unsigned int thread) void computeVoronoiAreaVertices(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, VertexAttribute<typename PFP::REAL, typename PFP::MAP::IMPL>& vertex_area, unsigned int thread)
{ {
// TraversorV<typename PFP::MAP> t(map) ; // TraversorV<typename PFP::MAP> t(map) ;
// for(Dart d = t.begin(); d != t.end(); d = t.next()) foreach_cell<VERTEX>(map, [&] (Vertex v)
foreachCellMT(VERTEX,d,typename PFP::MAP,map,thread) {
vertex_area[d] = vertexVoronoiArea<PFP>(map, d, position) ; vertex_area[v] = vertexVoronoiArea<PFP>(map, v, position) ;
}
,false,thread);
} }
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#define __ALGO_GEOMETRY_CENTROID_H__ #define __ALGO_GEOMETRY_CENTROID_H__
#include "Geometry/basic.h" #include "Geometry/basic.h"
#include "Topology/generic/cells_macros.h"
namespace CGoGN namespace CGoGN
{ {
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#include "Topology/generic/traversor/traversorCell.h" #include "Topology/generic/traversor/traversorCell.h"
#include "Topology/generic/traversor/traversor3.h" #include "Topology/generic/traversor/traversor3.h"
#include "Algo/Parallel/parallel_foreach.h" #include "Algo/Parallel/parallel_foreach.h"
#include "Topology/generic/cells_macros.h"
namespace CGoGN namespace CGoGN
{ {
...@@ -48,17 +47,13 @@ typename V_ATT::DATA_TYPE volumeCentroid(typename PFP::MAP& map, Vol d, const V_ ...@@ -48,17 +47,13 @@ typename V_ATT::DATA_TYPE volumeCentroid(typename PFP::MAP& map, Vol d, const V_
typename V_ATT::DATA_TYPE center(0.0); typename V_ATT::DATA_TYPE center(0.0);
unsigned int count = 0 ; unsigned int count = 0 ;
// Traversor3WV<typename PFP::MAP> tra(map,d,false,thread); // Traversor3WV<typename PFP::MAP> tra(map,d,false,thread);
// for (Dart d = tra.begin(); d != tra.end(); d = tra.next())
// {
// center += attributs[d];
// ++count;
// }
foreachIncident3MT(VOLUME,d,VERTEX,e,typename PFP::MAP,map,thread) foreach_incident3<VERTEX>(map,d, [&] (Vertex v)
{ {
center += attributs[e]; center += attributs[v];
++count; ++count;
} }
,false,thread);
center /= double(count) ; center /= double(count) ;
return center ; return center ;
...@@ -72,9 +67,7 @@ typename V_ATT::DATA_TYPE volumeCentroidELW(typename PFP::MAP& map, Vol d, const ...@@ -72,9 +67,7 @@ typename V_ATT::DATA_TYPE volumeCentroidELW(typename PFP::MAP& map, Vol d, const
double count=0.0; double count=0.0;
// Traversor3WE<typename PFP::MAP> t(map, d,false,thread) ; // Traversor3WE<typename PFP::MAP> t(map, d,false,thread) ;
// for(Dart it = t.begin(); it != t.end();it = t.next())
// foreachIncident3MT(VOLUME,d,EDGE,it,typename PFP::MAP,map,thread)
foreach_incident3<EDGE>(map,d, [&] (Edge it) foreach_incident3<EDGE>(map,d, [&] (Edge it)
{ {
EMB e1 = attributs[it.dart]; EMB e1 = attributs[it.dart];
...@@ -94,8 +87,6 @@ typename V_ATT::DATA_TYPE faceCentroid(typename PFP::MAP& map, Face f, const V_A ...@@ -94,8 +87,6 @@ typename V_ATT::DATA_TYPE faceCentroid(typename PFP::MAP& map, Face f, const V_A
unsigned int count = 0 ; unsigned int count = 0 ;
// Traversor2FV<typename PFP::MAP> t(map, d) ; // Traversor2FV<typename PFP::MAP> t(map, d) ;
// for(Dart it = t.begin(); it != t.end(); it = t.next())
// foreachIncident2(FACE,d,VERTEX,it,typename PFP::MAP,map)
foreach_incident2<VERTEX>(map, f, [&](Vertex it) foreach_incident2<VERTEX>(map, f, [&](Vertex it)
{ {
...@@ -107,7 +98,7 @@ typename V_ATT::DATA_TYPE faceCentroid(typename PFP::MAP& map, Face f, const V_A ...@@ -107,7 +98,7 @@ typename V_ATT::DATA_TYPE faceCentroid(typename PFP::MAP& map, Face f, const V_A
} }
template <typename PFP, typename V_ATT> template <typename PFP, typename V_ATT>
typename V_ATT::DATA_TYPE faceCentroidELW(typename PFP::MAP& map, Face d, const V_ATT& attributs) typename V_ATT::DATA_TYPE faceCentroidELW(typename PFP::MAP& map, Face f, const V_ATT& attributs)
{ {
typedef typename V_ATT::DATA_TYPE EMB; typedef typename V_ATT::DATA_TYPE EMB;
...@@ -115,32 +106,31 @@ typename V_ATT::DATA_TYPE faceCentroidELW(typename PFP::MAP& map, Face d, const ...@@ -115,32 +106,31 @@ typename V_ATT::DATA_TYPE faceCentroidELW(typename PFP::MAP& map, Face d, const
double count=0.0; double count=0.0;
// Traversor2FE<typename PFP::MAP> t(map, d) ; // Traversor2FE<typename PFP::MAP> t(map, d) ;
// for(Dart it = t.begin(); it != t.end(); it = t.next())
foreachIncident2(FACE,d,EDGE,it,typename PFP::MAP,map) foreach_incident2<EDGE>(map, f, [&](Edge it)
{ {
EMB e1 = attributs[it.dart]; 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;
count += 2.0*l ; count += 2.0*l ;
} });
center /= double(count); center /= double(count);
return center ; return center ;
} }
template <typename PFP, typename V_ATT> template <typename PFP, typename V_ATT>
typename V_ATT::DATA_TYPE vertexNeighborhoodCentroid(typename PFP::MAP& map, Vertex d, const V_ATT& attributs) typename V_ATT::DATA_TYPE vertexNeighborhoodCentroid(typename PFP::MAP& map, Vertex v, const V_ATT& attributs)
{ {
typename V_ATT::DATA_TYPE center(0.0); typename V_ATT::DATA_TYPE center(0.0);
unsigned int count = 0 ; unsigned int count = 0 ;
// Traversor2VVaE<typename PFP::MAP> t(map, d) ; // Traversor2VVaE<typename PFP::MAP> t(map, d) ;
// for(Dart it = t.begin(); it != t.end(); it = t.next()) foreach_adjacent2<EDGE>(map, v, [&](Vertex it)
foreachAdjacent2(VERTEX,EDGE,d,it,typename PFP::MAP,map)
{ {
center += attributs[it]; center += attributs[it];
++count ; ++count ;
} });
center /= count ; center /= count ;
return center ; return center ;
} }
...@@ -148,28 +138,31 @@ typename V_ATT::DATA_TYPE vertexNeighborhoodCentroid(typename PFP::MAP& map, Ver ...@@ -148,28 +138,31 @@ typename V_ATT::DATA_TYPE vertexNeighborhoodCentroid(typename PFP::MAP& map, Ver
template <typename PFP, typename V_ATT, typename F_ATT> template <typename PFP, typename V_ATT, typename F_ATT>
void computeCentroidFaces(typename PFP::MAP& map, const V_ATT& position, F_ATT& face_centroid, unsigned int thread) void computeCentroidFaces(typename PFP::MAP& map, const V_ATT& position, F_ATT& face_centroid, unsigned int thread)
{ {
// TraversorF<typename PFP::MAP> t(map,thread) ; foreach_cell<FACE>(map, [&] (Face f)
// for(Dart d = t.begin(); d != t.end(); d = t.next()) {
foreachCellMT(FACE,d,typename PFP::MAP,map ,thread) face_centroid[f] = faceCentroid<PFP,V_ATT>(map, f, position) ;
face_centroid[d] = faceCentroid<PFP,V_ATT>(map, d, position) ; }
,false,thread);
} }
template <typename PFP, typename V_ATT, typename F_ATT> template <typename PFP, typename V_ATT, typename F_ATT>
void computeCentroidELWFaces(typename PFP::MAP& map, const V_ATT& position, F_ATT& face_centroid, unsigned int thread) void computeCentroidELWFaces(typename PFP::MAP& map, const V_ATT& position, F_ATT& face_centroid, unsigned int thread)
{ {
// TraversorF<typename PFP::MAP> t(map,thread) ; foreach_cell<FACE>(map, [&] (Face f)
// for(Dart d = t.begin(); d != t.end(); d = t.next()) {
foreachCellMT(FACE,d,typename PFP::MAP,map ,thread) face_centroid[f] = faceCentroidELW<PFP,V_ATT>(map, f, position) ;
face_centroid[d] = faceCentroidELW<PFP,V_ATT>(map, d, position) ; }
,false,thread);
} }
template <typename PFP, typename V_ATT> template <typename PFP, typename V_ATT>
void computeNeighborhoodCentroidVertices(typename PFP::MAP& map, const V_ATT& position, V_ATT& vertex_centroid, unsigned int thread) void computeNeighborhoodCentroidVertices(typename PFP::MAP& map, const V_ATT& position, V_ATT& vertex_centroid, unsigned int thread)
{ {
// TraversorV<typename PFP::MAP> t(map, thread) ; foreach_cell<VERTEX>(map, [&] (Vertex v)
// for(Dart d = t.begin(); d != t.end(); d = t.next()) {
foreachCellMT(VERTEX,d,typename PFP::MAP,map ,thread) vertex_centroid[v] = vertexNeighborhoodCentroid<PFP,V_ATT>(map, v, position) ;
vertex_centroid[d] = vertexNeighborhoodCentroid<PFP,V_ATT>(map, d, position) ; }
,false,thread);
} }