Commit 15a8cad2 authored by Pierre Kraemer's avatar Pierre Kraemer
Browse files

compute volume colors in volumeExplorer main

parent 7dd93bed
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "Algo/Modelisation/polyhedron.h" #include "Algo/Modelisation/polyhedron.h"
#include "Algo/Import/import.h" #include "Algo/Import/import.h"
#include "Algo/Geometry/volume.h" #include "Algo/Geometry/volume.h"
#include "Algo/Geometry/area.h"
#include "Utils/chrono.h" #include "Utils/chrono.h"
...@@ -176,7 +177,7 @@ void MyQT::cb_Open() ...@@ -176,7 +177,7 @@ void MyQT::cb_Open()
// if (v>maxV) // if (v>maxV)
// maxV=v; // maxV=v;
if(myMap.isBoundaryAdjacentVolume(d)) if(myMap.isVolumeIncidentToBoundary(d))
color[d] = PFP::VEC3(0,0,0); color[d] = PFP::VEC3(0,0,0);
} }
// for (unsigned int i = color.begin(); i != color.end(); color.next(i)) // for (unsigned int i = color.begin(); i != color.end(); color.next(i))
...@@ -417,20 +418,20 @@ int main(int argc, char **argv) ...@@ -417,20 +418,20 @@ int main(int argc, char **argv)
for (Dart d = tra.begin(); d != tra.end(); d = tra.next()) for (Dart d = tra.begin(); d != tra.end(); d = tra.next())
{ {
float v = Algo::Geometry::tetrahedronVolume<PFP>(myMap, d, position); float v = Algo::Geometry::tetrahedronVolume<PFP>(myMap, d, position);
// color[d] = PFP::VEC3(v,0,0); color[d] = PFP::VEC3(v,0,0);
// if (v>maxV) if (v>maxV)
// maxV=v; maxV=v;
if(myMap.isBoundaryAdjacentVolume(d)) // if(myMap.isVolumeIncidentToBoundary(d))
color[d] = PFP::VEC3(0,0,0); // color[d] = PFP::VEC3(0,0,0);
else // else
color[d] = PFP::VEC3(v,0,0); color[d] = PFP::VEC3(v,0,0);
} }
// for (unsigned int i = color.begin(); i != color.end(); color.next(i)) for (unsigned int i = color.begin(); i != color.end(); color.next(i))
// { {
// color[i][0] /= maxV; color[i][0] /= maxV;
// color[i][2] = 1.0f - color[i][0]; color[i][2] = 1.0f - color[i][0];
// } }
} }
else else
...@@ -505,9 +506,18 @@ int main(int argc, char **argv) ...@@ -505,9 +506,18 @@ int main(int argc, char **argv)
Vol w(myMap.begin()); Vol w(myMap.begin());
VEC3 q = Algo::Surface::Geometry::volumeCentroid<PFP>(myMap,w,position); VEC3 q = Algo::Surface::Geometry::volumeCentroid<PFP>(myMap,w,position);
ch.start();
float vol = Algo::Geometry::Parallel::totalVolume<PFP>(myMap, position);
vol += Algo::Geometry::Parallel::totalVolume<PFP>(myMap, position);
vol += Algo::Geometry::Parallel::totalVolume<PFP>(myMap, position);
vol += Algo::Geometry::Parallel::totalVolume<PFP>(myMap, position);
std::cout << ch.elapsed()<< " ms // val="<<vol<< std::endl;
std::cout << "Compute Volume ->"<< std::endl; std::cout << "Compute Volume ->"<< std::endl;
ch.start(); ch.start();
float 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;
ch.start(); ch.start();
vol += Algo::Geometry::totalVolume<PFP>(myMap, position); vol += Algo::Geometry::totalVolume<PFP>(myMap, position);
...@@ -519,13 +529,6 @@ int main(int argc, char **argv) ...@@ -519,13 +529,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;
ch.start();
vol = Algo::Geometry::Parallel::totalVolume<PFP>(myMap, position);
vol += Algo::Geometry::Parallel::totalVolume<PFP>(myMap, position);
vol += Algo::Geometry::Parallel::totalVolume<PFP>(myMap, position);
vol += Algo::Geometry::Parallel::totalVolume<PFP>(myMap, position);
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();
......
...@@ -301,9 +301,9 @@ public: ...@@ -301,9 +301,9 @@ public:
assert(this->m_map.template getMarkerSet<DART>(this->m_thread).testMark(this->m_mark)); assert(this->m_map.template getMarkerSet<DART>(this->m_thread).testMark(this->m_mark));
this->m_map.foreach_dart_of_orbit(c, [&] (Dart d) this->m_map.foreach_dart_of_orbit(c, [&] (Dart d)
{ {
unsigned int dindex = this->m_map.dartIndex(d); unsigned int d_index = this->m_map.dartIndex(d);
(*this->m_markVector)[dindex].setMark(this->m_mark); (*this->m_markVector)[d_index].setMark(this->m_mark);
m_markedDarts.push_back(dindex); m_markedDarts.push_back(d_index);
} }
, this->m_thread) ; , this->m_thread) ;
} }
......
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