Commit b78a9704 authored by Sylvain Thery's avatar Sylvain Thery

Merge branch 'develop' of cgogn:~kraemer/CGoGN into develop

parents 07dc1967 15a8cad2
......@@ -29,6 +29,7 @@
#include "Algo/Modelisation/polyhedron.h"
#include "Algo/Import/import.h"
#include "Algo/Geometry/volume.h"
#include "Algo/Geometry/area.h"
#include "Utils/chrono.h"
......@@ -171,16 +172,19 @@ void MyQT::cb_Open()
float maxV = 0.0f;
for (Dart d = tra.begin(); d != tra.end(); d = tra.next())
{
float v = Algo::Geometry::tetrahedronVolume<PFP>(myMap, d, position);
color[d] = PFP::VEC3(v,0,0);
if (v>maxV)
maxV=v;
}
for (unsigned int i = color.begin(); i != color.end(); color.next(i))
{
color[i][0] /= maxV;
color[i][2] = 1.0f - color[i][0];
// float v = Algo::Geometry::tetrahedronVolume<PFP>(myMap, d, position);
// color[d] = PFP::VEC3(v,0,0);
// if (v>maxV)
// maxV=v;
if(myMap.isVolumeIncidentToBoundary(d))
color[d] = PFP::VEC3(0,0,0);
}
// for (unsigned int i = color.begin(); i != color.end(); color.next(i))
// {
// color[i][0] /= maxV;
// color[i][2] = 1.0f - color[i][0];
// }
// SelectorDartNoBoundary<PFP::MAP> nb(myMap);
m_topo_render->updateData(myMap, position, 0.8f, 0.8f, 0.8f);
......@@ -417,17 +421,17 @@ int main(int argc, char **argv)
color[d] = PFP::VEC3(v,0,0);
if (v>maxV)
maxV=v;
// if(myMap.isVolumeIncidentToBoundary(d))
// color[d] = PFP::VEC3(0,0,0);
// else
color[d] = PFP::VEC3(v,0,0);
}
for (unsigned int i = color.begin(); i != color.end(); color.next(i))
{
color[i][0] /= maxV;
color[i][2] = 1.0f - color[i][0];
}
// Algo::Volume::Export::exportNAS<PFP>(myMap,position,"/tmp/test2.nas");
// Algo::Volume::Export::exportMSH<PFP>(myMap,position,"/tmp/test2.msh");
// Algo::Volume::Export::exportTet<PFP>(myMap,position,"/tmp/test2.tet");
// Algo::Volume::Export::exportNodeEle<PFP>(myMap,position,"/tmp/test2");
// Algo::Volume::Export::exportVTU<PFP>(myMap,position,"/tmp/test4.vtu");
}
else
......@@ -502,9 +506,18 @@ int main(int argc, char **argv)
Vol w(myMap.begin());
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;
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;
ch.start();
vol += Algo::Geometry::totalVolume<PFP>(myMap, position);
......@@ -516,13 +529,6 @@ int main(int argc, char **argv)
vol += Algo::Geometry::totalVolume<PFP>(myMap, position);
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.
return app.exec();
......
......@@ -196,6 +196,9 @@ bool importMRDAT(typename PFP::MAP& map, const std::string& filename, std::vecto
VertexAutoAttribute<NoTypeNameAttribute<std::vector<Dart> >, typename PFP::MAP::IMPL> vecDartsPerVertex(map, "incidents") ;
DartMarkerNoUnmark<typename PFP::MAP> m(map) ;
unsigned int vemb = EMBNULL;
auto fsetemb = [&] (Dart d) { map.template setDartEmbedding<VERTEX>(d, vemb); };
unsigned nbf = qt.roots.size() ;
// for each root face
......@@ -206,13 +209,12 @@ bool importMRDAT(typename PFP::MAP& map, const std::string& filename, std::vecto
for (unsigned int j = 0; j < 3; ++j)
{
unsigned int idx = qt.roots[i]->indices[j] ;
unsigned int emb = qt.verticesID[idx] ;
vemb = qt.verticesID[idx] ;
FunctorSetEmb<typename PFP::MAP, VERTEX> fsetemb(map, emb) ;
map.template foreach_dart_of_orbit<PFP::MAP::VERTEX_OF_PARENT>(d, fsetemb) ;
m.mark(d) ; // mark on the fly to unmark on second loop
vecDartsPerVertex[emb].push_back(d) ; // store incident darts for fast adjacency reconstruction
vecDartsPerVertex[vemb].push_back(d) ; // store incident darts for fast adjacency reconstruction
d = map.phi1(d) ;
}
}
......
......@@ -133,7 +133,7 @@ public:
p1 *= 1.0 / 3.0 ;
p2 *= 1.0 / 3.0 ;
if(m_map.isBoundaryFace(d))
if(m_map.isFaceIncidentToBoundary(d))
{
Dart df = m_map.findBoundaryEdgeOfFace(d);
m_map.incCurrentLevel() ;
......
......@@ -167,7 +167,7 @@ void Map2MR<PFP>::addNewLevelSqrt3()
for (Dart dit = t.begin(); dit != t.end(); dit = t.next())
{
//if it is an even level (triadic refinement) and a boundary face
if((m_map.getCurrentLevel()%2 == 0) && m_map.isBoundaryFace(dit))
if((m_map.getCurrentLevel()%2 == 0) && m_map.isFaceIncidentToBoundary(dit))
{
//find the boundary edge
Dart df = m_map.findBoundaryEdgeOfFace(dit);
......
......@@ -301,9 +301,9 @@ public:
assert(this->m_map.template getMarkerSet<DART>(this->m_thread).testMark(this->m_mark));
this->m_map.foreach_dart_of_orbit(c, [&] (Dart d)
{
unsigned int dindex = this->m_map.dartIndex(d);
(*this->m_markVector)[dindex].setMark(this->m_mark);
m_markedDarts.push_back(dindex);
unsigned int d_index = this->m_map.dartIndex(d);
(*this->m_markVector)[d_index].setMark(this->m_mark);
m_markedDarts.push_back(d_index);
}
, this->m_thread) ;
}
......
......@@ -364,7 +364,7 @@ public:
//! Tell if a face of the volume is on the boundary
/* @param d a dart
*/
bool isBoundaryAdjacentVolume(Dart d) const;
bool isVolumeIncidentToBoundary(Dart d) const;
//! Tell if an edge of the volume is on the boundary
/* @param d a dart
......
......@@ -1024,12 +1024,12 @@ inline bool Map3<MAP_IMPL>::isBoundaryFace(Dart d) const
}
template <typename MAP_IMPL>
bool Map3<MAP_IMPL>::isBoundaryAdjacentVolume(Dart d) const
bool Map3<MAP_IMPL>::isVolumeIncidentToBoundary(Dart d) const
{
Traversor3WF<Map3<MAP_IMPL> > tra(*this, d);
for(Dart dit = tra.begin() ; dit != tra.end() ; dit = tra.next())
{
if(isBoundaryMarked3(phi3(dit)))
if(this->template isBoundaryMarked<3>(phi3(dit)))
return true ;
}
return false;
......
......@@ -167,12 +167,12 @@ private: // private members
private: // private constants
// D65 reference white
static const REAL Xn = 0.950456 ;
static const REAL Yn = 1.0 ;
static const REAL Zn = 1.088754 ;
static constexpr REAL Xn = 0.950456 ;
static constexpr REAL Yn = 1.0 ;
static constexpr REAL Zn = 1.088754 ;
static const REAL un = 0.197832 ;
static const REAL vn = 0.468340 ;
static constexpr REAL un = 0.197832 ;
static constexpr REAL vn = 0.468340 ;
} ;
......
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