Création d'un compte pour un collaborateur extérieur au laboratoire depuis l'intranet ICube : https://intranet.icube.unistra.fr/fr/labs/member/profile

Commit 95bec210 authored by Thery Sylvain's avatar Thery Sylvain
Browse files

bug in tuto_mt (4 instead of nbthreads)

parent 5a8e28ba
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include "Algo/Parallel/parallel_foreach.h" #include "Algo/Parallel/parallel_foreach.h"
#include "Algo/Parallel/cgogn_thread.h" #include "Algo/Parallel/cgogn_thread.h"
#include "Utils/cgognStream.h"
#include "Utils/chrono.h" #include "Utils/chrono.h"
using namespace CGoGN ; using namespace CGoGN ;
...@@ -108,7 +109,7 @@ void MyQT::cb_initGL() ...@@ -108,7 +109,7 @@ void MyQT::cb_initGL()
m_lines->setScale(2.0f); m_lines->setScale(2.0f);
m_lines->setColor(Geom::Vec4f(0.0f, 1.0f, 0.2f, 0.0f)); m_lines->setColor(Geom::Vec4f(0.0f, 1.0f, 0.2f, 0.0f));
std::cout << "Je calcule les normales en meme temps que les primitives" << std::endl; CGoGNout << "Je calcule les normales en meme temps que les primitives" << CGoGNendl;
boost::thread thread1( ThreadNormals<PFP>(myMap,position,normal,1)); boost::thread thread1( ThreadNormals<PFP>(myMap,position,normal,1));
...@@ -150,7 +151,7 @@ void MyQT::cb_keyPress(int code) ...@@ -150,7 +151,7 @@ void MyQT::cb_keyPress(int code)
default: default:
break; break;
} }
std::cout << "time = "<< ch.elapsed() << std::endl; CGoGNout << "time = "<< ch.elapsed() << CGoGNendl;
updateGL(); updateGL();
} }
...@@ -281,8 +282,8 @@ void MyQT::threadStorage() ...@@ -281,8 +282,8 @@ void MyQT::threadStorage()
functs.push_back(lef); functs.push_back(lef);
} }
CGoGNout << "using "<< nbthreads << " threads"<< CGoGNendl;
Algo::Parallel::foreach_cell<PFP::MAP,EDGE>(myMap, functs, 4); Algo::Parallel::foreach_cell<PFP::MAP,EDGE>(myMap, functs, nbthreads);
//compute average length from each thread result and delete functors //compute average length from each thread result and delete functors
double average = 0; double average = 0;
...@@ -296,7 +297,7 @@ void MyQT::threadStorage() ...@@ -296,7 +297,7 @@ void MyQT::threadStorage()
} }
average /= all; average /= all;
std::cout << "AVERAGE LENGTH "<< average << std::endl; CGoGNout << "AVERAGE LENGTH "<< average << CGoGNendl;
} }
...@@ -320,10 +321,12 @@ int main(int argc, char **argv) ...@@ -320,10 +321,12 @@ int main(int argc, char **argv)
if (!normal.isValid()) if (!normal.isValid())
normal = myMap.addAttribute<PFP::VEC3, VERTEX>("normal"); normal = myMap.addAttribute<PFP::VEC3, VERTEX>("normal");
unsigned int nbt = 64;
if (argc==2)
nbt = atoi(argv[1]);
// create a sphere // create a sphere
Algo::Modelisation::Polyhedron<PFP> prim(myMap, position); Algo::Modelisation::Polyhedron<PFP> prim(myMap, position);
// prim.cylinder_topo(2640,2640, true, true); // test for speed timing prim.cylinder_topo(nbt,nbt, true, true);
prim.cylinder_topo(64,64, true, true); // topo of sphere is a closed cylinder
prim.embedSphere(20.0f); prim.embedSphere(20.0f);
...@@ -331,8 +334,8 @@ int main(int argc, char **argv) ...@@ -331,8 +334,8 @@ int main(int argc, char **argv)
Geom::BoundingBox<PFP::VEC3> bb = Algo::Geometry::computeBoundingBox<PFP>(myMap, position); Geom::BoundingBox<PFP::VEC3> bb = Algo::Geometry::computeBoundingBox<PFP>(myMap, position);
float lWidthObj = std::max<PFP::REAL>(std::max<PFP::REAL>(bb.size(0), bb.size(1)), bb.size(2)); float lWidthObj = std::max<PFP::REAL>(std::max<PFP::REAL>(bb.size(0), bb.size(1)), bb.size(2));
Geom::Vec3f lPosObj = (bb.min() + bb.max()) / PFP::REAL(2); Geom::Vec3f lPosObj = (bb.min() + bb.max()) / PFP::REAL(2);
std::cout << "lPosObj=" << lPosObj << std::endl; CGoGNout << "lPosObj=" << lPosObj << CGoGNendl;
std::cout << "lWidthObj=" << lWidthObj << std::endl; CGoGNout << "lWidthObj=" << lWidthObj << CGoGNendl;
sqt.setParamObject(lWidthObj,lPosObj.data()); sqt.setParamObject(lWidthObj,lPosObj.data());
// myMap.enableQuickTraversal<EDGE>() ; // myMap.enableQuickTraversal<EDGE>() ;
......
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