Commit edb26f50 authored by Sylvain Thery's avatar Sylvain Thery
Browse files

Merge branch 'optimizedTraversors' into develop

parents 70470eec 0c249b1a
...@@ -272,31 +272,31 @@ void Viewer::cb_keyPress(int keycode) ...@@ -272,31 +272,31 @@ void Viewer::cb_keyPress(int keycode)
if(!pos2.isValid()) if(!pos2.isValid())
pos2 = myMap.addAttribute<VEC3, VERTEX>("pos2") ; pos2 = myMap.addAttribute<VEC3, VERTEX>("pos2") ;
foreach_cell_EvenOddd<VERTEX>(myMap, [&] (Vertex d) // foreach_cell_EvenOddd<VERTEX>(myMap, [&] (Vertex d)
{ // {
pos2[d] = VEC3(0,0,0); // pos2[d] = VEC3(0,0,0);
int nb=0; // int nb=0;
foreach_adjacent2<FACE>(myMap,d,[&](Vertex e) // foreach_adjacent2<FACE>(myMap,d,[&](Vertex e)
{ // {
pos2[d] += position[e]; // pos2[d] += position[e];
nb++; // nb++;
}); // });
pos2[d]/=nb; // pos2[d]/=nb;
}, // },
[&] (Vertex d) // [&] (Vertex d)
{ // {
position[d] = VEC3(0,0,0); // position[d] = VEC3(0,0,0);
int nb=0; // int nb=0;
foreach_adjacent2<FACE>(myMap,d,[&](Vertex e) // foreach_adjacent2<FACE>(myMap,d,[&](Vertex e)
{ // {
position[d] += pos2[e]; // position[d] += pos2[e];
nb++; // nb++;
}); // });
position[d]/=nb; // position[d]/=nb;
}, // },
3); // 3);
std::cout << "Even/Odd "<< ch.elapsed()<< " ms "<< std::endl; // std::cout << "Even/Odd "<< ch.elapsed()<< " ms "<< std::endl;
Algo::Surface::Geometry::computeNormalVertices<PFP>(myMap, position, normal) ; Algo::Surface::Geometry::computeNormalVertices<PFP>(myMap, position, normal) ;
m_positionVBO->updateData(position) ; m_positionVBO->updateData(position) ;
m_normalVBO->updateData(normal) ; m_normalVBO->updateData(normal) ;
...@@ -371,45 +371,158 @@ void Viewer::cb_keyPress(int keycode) ...@@ -371,45 +371,158 @@ void Viewer::cb_keyPress(int keycode)
case'A': case'A':
{ {
myMap.disableQuickTraversal<VERTEX>() ;
#define NBLOOP 5
Utils::Chrono ch; Utils::Chrono ch;
ch.start(); ch.start();
{
TraversorCell<MAP, VERTEX,FORCE_CELL_MARKING> trav(myMap,true);
for(unsigned int i=0; i<NBLOOP; ++i)
{
for (Cell<VERTEX> v = trav.begin(), e = trav.end(); v.dart != e.dart; v = trav.next())
{
normal[v][0] = 0.0f;
}
}
std::cout << "FORCE_CELL_MARKING "<< ch.elapsed()<< " ms "<< std::endl;
}
ch.start();
{
TraversorCell<MAP, VERTEX> trav(myMap);
for(unsigned int i=0; i<NBLOOP; ++i)
{
for (Cell<VERTEX> v = trav.begin(), e = trav.end(); v.dart != e.dart; v = trav.next())
{
normal[v][0] = 0.0f;
}
}
std::cout << "auto "<< ch.elapsed()<< " ms "<< std::endl;
}
ch.start();
{
TraversorCell<MAP, VERTEX> trav(myMap,true);
for(unsigned int i=0; i<NBLOOP; ++i)
{
for (Cell<VERTEX> v = trav.begin(), e = trav.end(); v.dart != e.dart; v = trav.next())
{
normal[v][0] = 0.0f;
}
}
std::cout << "auto forcedart "<< ch.elapsed()<< " ms "<< std::endl;
}
ch.start();
{
TraversorCell<MAP, VERTEX,FORCE_DART_MARKING> trav(myMap,true);
for(unsigned int i=0; i<NBLOOP; ++i)
{
for (Cell<VERTEX> v = trav.begin(), e = trav.end(); v.dart != e.dart; v = trav.next())
{
normal[v][0] = 0.0f;
}
}
std::cout << "FORCE_DART_MARKING "<< ch.elapsed()<< " ms "<< std::endl;
}
myMap.enableQuickTraversal<VERTEX>() ;
ch.start();
{
TraversorCell<MAP, VERTEX> trav(myMap);
for(unsigned int i=0; i<NBLOOP; ++i)
{
for (Cell<VERTEX> v = trav.begin(), e = trav.end(); v.dart != e.dart; v = trav.next())
{
normal[v][0] = 0.0f;
}
}
std::cout << "auto (quick) "<< ch.elapsed()<< " ms "<< std::endl;
}
TraversorCell<MAP, VERTEX> trav(myMap,true); ch.start();
for(unsigned int i=0; i<10; ++i)
{ {
for (Cell<VERTEX> v = trav.begin(), e = trav.end(); v.dart != e.dart; v = trav.next()) TraversorCell<MAP, VERTEX,FORCE_QUICK_TRAVERSAL> trav(myMap);
for(unsigned int i=0; i<NBLOOP; ++i)
{ {
// normal[v] = Algo::Surface::Geometry::vertexNormal<PFP>(myMap, v, position) ; for (Cell<VERTEX> v = trav.begin(), e = trav.end(); v.dart != e.dart; v = trav.next())
normal[v][0] = 0.0f; {
normal[v][0] = 0.0f;
}
} }
std::cout << "FORCE_QUICK_TRAVERSAL "<< ch.elapsed()<< " ms "<< std::endl;
} }
std::cout << "Timing 10 traversors "<< ch.elapsed()<< " ms "<< std::endl;
} }
break; break;
case'Z': case'Z':
{ {
Utils::Chrono ch; Utils::Chrono ch;
ch.start(); ch.start();
TraversorCell<MAP, VERTEX> trav(myMap,true); for (unsigned int i=0; i<4; ++i)
TraversorCellEven<MAP, VERTEX> tr1(trav); Algo::Surface::Geometry::computeNormalVertices<PFP>(myMap, position, normal) ;
TraversorCellOdd<MAP, VERTEX> tr2(trav); std::cout << "Algo::Surface::Geometry::Parallel::computeNormalVertices "<< ch.elapsed()<< " ms "<< std::endl;
for(unsigned int i=0; i<5; ++i) ch.start();
{
for (Cell<VERTEX> v = tr1.begin(), e = tr1.end(); v.dart != e.dart; v = tr1.next()) CGoGN::Parallel::NumberOfThreads = 1;
{ for (unsigned int i=0; i<4; ++i)
// normal[v] = Algo::Surface::Geometry::vertexNormal<PFP>(myMap, v, position) ; Algo::Surface::Geometry::Parallel::computeNormalVertices<PFP>(myMap, position, normal) ;
normal[v][0] = 0.0f; std::cout << "Algo::Surface::Geometry::Parallel::computeNormalVertices1 "<< ch.elapsed()<< " ms "<< std::endl;
}
for (Cell<VERTEX> v = tr2.begin(), e = tr2.end(); v.dart != e.dart; v = tr2.next()) ch.start();
CGoGN::Parallel::NumberOfThreads = 2;
for (unsigned int i=0; i<4; ++i)
Algo::Surface::Geometry::Parallel::computeNormalVertices<PFP>(myMap, position, normal) ;
std::cout << "Algo::Surface::Geometry::Parallel::computeNormalVertices2 "<< ch.elapsed()<< " ms "<< std::endl;
ch.start();
CGoGN::Parallel::NumberOfThreads = 3;
for (unsigned int i=0; i<4; ++i)
Algo::Surface::Geometry::Parallel::computeNormalVertices<PFP>(myMap, position, normal) ;
std::cout << "Algo::Surface::Geometry::Parallel::computeNormalVertices3 "<< ch.elapsed()<< " ms "<< std::endl;
ch.start();
CGoGN::Parallel::NumberOfThreads = 4;
for (unsigned int i=0; i<4; ++i)
Algo::Surface::Geometry::Parallel::computeNormalVertices<PFP>(myMap, position, normal) ;
std::cout << "Algo::Surface::Geometry::Parallel::computeNormalVertices4 "<< ch.elapsed()<< " ms "<< std::endl;
ch.start();
CGoGN::Parallel::NumberOfThreads = 8;
for (unsigned int i=0; i<4; ++i)
Algo::Surface::Geometry::Parallel::computeNormalVertices<PFP>(myMap, position, normal) ;
std::cout << "Algo::Surface::Geometry::Parallel::computeNormalVertices8 "<< ch.elapsed()<< " ms "<< std::endl;
ch.start();
for (unsigned int i=0; i<4; ++i)
Parallel::foreach_cell<VERTEX>(myMap,[&](Vertex v, unsigned int th)
{ {
// normal[v] = Algo::Surface::Geometry::vertexNormal<PFP>(myMap, v, position) ; normal[v] = Algo::Surface::Geometry::vertexNormal<PFP>(myMap,v,position);
normal[v][0] = 0.0f; },false,FORCE_CELL_MARKING);
}
} std::cout << "Parallel::foreach_cell "<< ch.elapsed()<< " ms "<< std::endl;
std::cout << "Timing 5 traversors even/odd "<< ch.elapsed()<< " ms "<< std::endl;
// ch.start();
// Parallel::foreach_cell_EO<VERTEX>(myMap,[&](Vertex v, unsigned int thr)
// {
// normal[v] = Algo::Surface::Geometry::vertexNormal<PFP>(myMap,v,position);
// },
// [&](Vertex v, unsigned int th)
// {
// normal[v] = Algo::Surface::Geometry::vertexNormal<PFP>(myMap,v,position);
// },2,4,false,FORCE_CELL_MARKING);
// std::cout << "Parallel::foreach_cell_EO "<< ch.elapsed()<< " ms "<< std::endl;
} }
break; break;
......
...@@ -498,8 +498,6 @@ int main(int argc, char **argv) ...@@ -498,8 +498,6 @@ int main(int argc, char **argv)
Utils::Chrono ch; Utils::Chrono ch;
Vertex v(myMap.begin()); Vertex v(myMap.begin());
VEC3 p = Algo::Volume::Geometry::vertexNeighborhoodCentroid<PFP>(myMap,v,position); VEC3 p = Algo::Volume::Geometry::vertexNeighborhoodCentroid<PFP>(myMap,v,position);
...@@ -529,7 +527,6 @@ int main(int argc, char **argv) ...@@ -529,7 +527,6 @@ int main(int argc, char **argv)
vol += Algo::Geometry::totalVolume<PFP>(myMap, position); vol += Algo::Geometry::totalVolume<PFP>(myMap, position);
std::cout << ch.elapsed()<< " ms val="<<vol<< std::endl; std::cout << ch.elapsed()<< " ms val="<<vol<< std::endl;
// et on attend la fin. // et on attend la fin.
return app.exec(); return app.exec();
} }
...@@ -114,7 +114,7 @@ int main() ...@@ -114,7 +114,7 @@ int main()
{ {
position[v] += VEC3(0.0,0.0,PFP::REAL(thread)*0.1f); position[v] += VEC3(0.0,0.0,PFP::REAL(thread)*0.1f);
// WARNING thread vary here from 1 to 4 (and not from 0 to 3) !!!! // WARNING thread vary here from 1 to 4 (and not from 0 to 3) !!!!
},4,false); // 4:4 thread, false for no need for markers in threaded code. },false); // 4:4 thread, false for no need for markers in threaded code.
std::cout << "After // processing"<< std::endl; std::cout << "After // processing"<< std::endl;
...@@ -127,17 +127,22 @@ int main() ...@@ -127,17 +127,22 @@ int main()
// Example with // accumulation // Example with // accumulation
// computing the sum of area faces // computing the sum of area faces
// force number of threads to 4 (0 for traverse, 1,2,3 for computation)
CGoGN::Parallel::NumberOfThreads = 4;
// init nbthread values with 0 // init nbthread values with 0
float surf[4]={0.0f,0.0f,0.0f,0.0f}; float surf[3]={0.0f,0.0f,0.0f};
// traverse face in // // traverse face in //
Parallel::foreach_cell<FACE>(myMap,[&](Face f, unsigned int thr) Parallel::foreach_cell<FACE>(myMap,[&](Face f, unsigned int thr)
{ {
// for each face add surface to accumulator (-1 because counter between 1-4 not 0-3) // for each face add surface to accumulator (-1 because counter between 1-3 not 0-3)
surf[thr-1] += Algo::Surface::Geometry::convexFaceArea<PFP>(myMap,f,position); surf[thr-1] += Algo::Surface::Geometry::convexFaceArea<PFP>(myMap,f,position);
},4,false); },false);
std::cout << surf[0]<< "/"<< surf[1]<< "/"<< surf[2]<< "/"<< surf[3]<< "/"<< std::endl; std::cout << surf[0]<< "/"<< surf[1]<< "/"<< surf[2]<< "/"<< std::endl;
std::cout << "Total="<<surf[0]+surf[1]+surf[2]+surf[3]<< std::endl; std::cout << "Total="<<surf[0]+surf[1]+surf[2]<< std::endl;
TraversorV<MAP> tv0(myMap); TraversorV<MAP> tv0(myMap);
......
...@@ -86,6 +86,21 @@ void computeBarycentricAreaVertices(typename PFP::MAP& map, const VertexAttribut ...@@ -86,6 +86,21 @@ void computeBarycentricAreaVertices(typename PFP::MAP& map, const VertexAttribut
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 = 0) ; 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 = 0) ;
namespace Parallel
{
template <typename PFP>
void computeAreaFaces(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, FaceAttribute<typename PFP::REAL, typename PFP::MAP::IMPL>& area);
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>& area);
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);
template <typename PFP>
void computeVoronoiAreaVertices(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position, VertexAttribute<typename PFP::REAL, typename PFP::MAP>& area);
} // namespace Parallel
} // namespace Geometry } // namespace Geometry
} // namespace Surface } // namespace Surface
......
...@@ -76,8 +76,6 @@ typename PFP::REAL totalArea(typename PFP::MAP& map, const VertexAttribute<typen ...@@ -76,8 +76,6 @@ 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) ;
foreach_cell<FACE>(map, [&] (Face f) foreach_cell<FACE>(map, [&] (Face f)
{ {
area += convexFaceArea<PFP>(map, f, position); area += convexFaceArea<PFP>(map, f, position);
...@@ -91,7 +89,6 @@ template <typename PFP> ...@@ -91,7 +89,6 @@ template <typename PFP>
typename PFP::REAL vertexOneRingArea(typename PFP::MAP& map, Vertex v, 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) ;
foreach_incident2<FACE>(map, v, [&] (Face f) foreach_incident2<FACE>(map, v, [&] (Face f)
{ {
...@@ -104,7 +101,6 @@ template <typename PFP> ...@@ -104,7 +101,6 @@ template <typename PFP>
typename PFP::REAL vertexBarycentricArea(typename PFP::MAP& map, Vertex v, 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, v) ;
foreach_incident2<FACE>(map, v, [&] (Face f) foreach_incident2<FACE>(map, v, [&] (Face f)
{ {
...@@ -117,7 +113,6 @@ template <typename PFP> ...@@ -117,7 +113,6 @@ template <typename PFP>
typename PFP::REAL vertexVoronoiArea(typename PFP::MAP& map, Vertex v, 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, v) ;
foreach_incident2<FACE>(map, v, [&] (Face it) foreach_incident2<FACE>(map, v, [&] (Face it)
{ {
const typename PFP::VEC3& p1 = position[it] ; const typename PFP::VEC3& p1 = position[it] ;
...@@ -144,21 +139,30 @@ typename PFP::REAL vertexVoronoiArea(typename PFP::MAP& map, Vertex v, const Ver ...@@ -144,21 +139,30 @@ typename PFP::REAL vertexVoronoiArea(typename PFP::MAP& map, Vertex v, const Ver
template <typename PFP> template <typename PFP>
void computeAreaFaces(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, FaceAttribute<typename PFP::REAL, typename PFP::MAP::IMPL>& face_area, unsigned int thread) void computeAreaFaces(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, FaceAttribute<typename PFP::REAL, typename PFP::MAP::IMPL>& face_area, unsigned int thread)
{ {
// TraversorF<typename PFP::MAP> t(map) ;
// for(Dart d = t.begin(); d != t.end(); d = t.next()) if ((CGoGN::Parallel::NumberOfThreads > 1) && (thread==0))
// face_area[d] = convexFaceArea<PFP>(map, d, position) ; {
Parallel::computeAreaFaces<PFP>(map,position,face_area);
return;
}
foreach_cell<FACE>(map, [&] (Face f) foreach_cell<FACE>(map, [&] (Face f)
{ {
face_area[f] = convexFaceArea<PFP>(map, f, position) ; face_area[f] = convexFaceArea<PFP>(map, f, position) ;
} }
,false,thread); ,AUTO,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)
{ {
if ((CGoGN::Parallel::NumberOfThreads > 1) && (thread==0))
{
Parallel::computeOneRingAreaVertices<PFP>(map,position,vertex_area);
return;
}
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);
...@@ -170,30 +174,40 @@ void computeOneRingAreaVertices(typename PFP::MAP& map, const VertexAttribute<ty ...@@ -170,30 +174,40 @@ void computeOneRingAreaVertices(typename PFP::MAP& map, const VertexAttribute<ty
vertex_area[v] += areas[f]; vertex_area[v] += areas[f];
}); });
} }
,false,thread); ,FORCE_CELL_MARKING,thread);
} }
template <typename PFP> 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) ; if ((CGoGN::Parallel::NumberOfThreads > 1) && (thread==0))
{
Parallel::computeBarycentricAreaVertices<PFP>(map,position,vertex_area);
return;
}
foreach_cell<VERTEX>(map, [&] (Vertex v) foreach_cell<VERTEX>(map, [&] (Vertex v)
{ {
vertex_area[v] = vertexBarycentricArea<PFP>(map, v, position) ; vertex_area[v] = vertexBarycentricArea<PFP>(map, v, position) ;
} }
,false,thread); ,FORCE_CELL_MARKING,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) ; if ((CGoGN::Parallel::NumberOfThreads > 1) && (thread==0))
{
Parallel::computeVoronoiAreaVertices<PFP>(map,position,vertex_area);
return;
}
foreach_cell<VERTEX>(map, [&] (Vertex v) foreach_cell<VERTEX>(map, [&] (Vertex v)
{ {
vertex_area[v] = vertexVoronoiArea<PFP>(map, v, position) ; vertex_area[v] = vertexVoronoiArea<PFP>(map, v, position) ;
} }
,false,thread); ,FORCE_CELL_MARKING,thread);
} }
...@@ -202,72 +216,56 @@ namespace Parallel ...@@ -202,72 +216,56 @@ namespace Parallel
{ {
template <typename PFP> template <typename PFP>
class FunctorConvexFaceArea: public FunctorMapThreaded<typename PFP::MAP > void computeAreaFaces(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, FaceAttribute<typename PFP::REAL, typename PFP::MAP::IMPL>& area)
{ {
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& m_position; // if (map.isOrbitEmbedded<FACE>())
FaceAttribute<typename PFP::REAL, typename PFP::MAP::IMPL>& m_area; // {
public: // Parallel::foreach_cell<FACE>(map,[&](Face f, unsigned int thr)
FunctorConvexFaceArea<PFP>( typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, FaceAttribute<typename PFP::REAL, typename PFP::MAP::IMPL>& area): // {
FunctorMapThreaded<typename PFP::MAP>(map), m_position(position), m_area(area) // area[f] = convexFaceArea<PFP>(map, f, position) ;
{ } // },nbth,false,FORCE_CELL_MARKING);
// }
void run(Dart d, unsigned int threadID) // else
// {
// Parallel::foreach_cell<FACE>(map,[&](Face f, unsigned int thr)
// {
// area[f] = convexFaceArea<PFP>(map, f, position) ;
// },nbth,false,AUTO);
// }
CGoGN::Parallel::foreach_cell<FACE>(map,[&](Face f, unsigned int thr)
{ {
m_area[d] = convexFaceArea<PFP>(this->m_map, d, m_position) ; area[f] = convexFaceArea<PFP>(map, f, position) ;
} },false,AUTO);
};
template <typename PFP>
void computeAreaFaces(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, FaceAttribute<typename PFP::REAL, typename PFP::MAP::IMPL>& area, unsigned int nbth)
{
FunctorConvexFaceArea<PFP> funct(map,position,area);
Algo::Parallel::foreach_cell<typename PFP::MAP,FACE>(map, funct, nbth, false);
} }
template <typename PFP>
class FunctorVertexOneRingArea: public FunctorMapThreaded<typename PFP::MAP >
{
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& m_position;
VertexAttribute<typename PFP::REAL, typename PFP::MAP::IMPL>& m_area;
public:
FunctorVertexOneRingArea<PFP>( typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, VertexAttribute<typename PFP::REAL, typename PFP::MAP::IMPL>& area):
FunctorMapThreaded<typename PFP::MAP>(map), m_position(position), m_area(area)
{ }