Commit daa19158 authored by untereiner's avatar untereiner
Browse files

some changes MRDAT working again

parent a119b8e3
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
#ifndef __IMPORT_MR_DAT__ #ifndef __IMPORT_MR_DAT__
#define __IMPORT_MR_DAT__ #define __IMPORT_MR_DAT__
#include "Topology/generic/autoAttributeHandler.h"
namespace CGoGN namespace CGoGN
{ {
...@@ -97,25 +99,31 @@ public: ...@@ -97,25 +99,31 @@ public:
unsigned int idx = emb == v0 ? 0 : emb == v1 ? 1 : 2 ; unsigned int idx = emb == v0 ? 0 : emb == v1 ? 1 : 2 ;
map.incCurrentLevel() ; map.incCurrentLevel() ;
Dart dd = map.phi1(next) ; Dart dd = map.phi1(next) ;
unsigned int oldEmb = map.template getEmbedding<VERTEX>(dd) ; // unsigned int oldEmb = map.template getEmbedding<VERTEX>(dd) ;
unsigned int newEmb = vID[children[0]->indices[idx]] ; unsigned int newEmb = vID[children[0]->indices[idx]] ;
if(oldEmb == EMBNULL) // if(oldEmb == EMBNULL)
{ // {
//std::cout << "oldEmb == NULL"<< std::endl; //std::cout << "oldEmb == NULL"<< std::endl;
map.template setOrbitEmbedding<VERTEX>(dd, newEmb) ; map.template setOrbitEmbedding<VERTEX>(dd, newEmb) ;
map.pushLevel() ;
//needed because the darts are duplicated at each level
//and the vertex orbits are initialized at the creation of each level with wrong embedding indices
//map.pushLevel() ;
unsigned int cur = map.getCurrentLevel(); //necessary because IHM2 does not allow a Stack
for(unsigned int i = map.getCurrentLevel() + 1; i <= map.getMaxLevel(); ++i) for(unsigned int i = map.getCurrentLevel() + 1; i <= map.getMaxLevel(); ++i)
{ {
map.setCurrentLevel(i) ; map.setCurrentLevel(i) ;
map.template setOrbitEmbedding<VERTEX>(dd, newEmb) ; map.template setOrbitEmbedding<VERTEX>(dd, newEmb) ;
} }
map.popLevel() ; //map.popLevel() ;
} map.setCurrentLevel(cur);
else // }
{ // else
//std::cout << "oldEmb != NULL"<< std::endl; // {
assert(oldEmb == newEmb) ; // //std::cout << "oldEmb != NULL"<< std::endl;
} // assert(oldEmb == newEmb) ;
// }
map.decCurrentLevel() ; map.decCurrentLevel() ;
it = next ; it = next ;
......
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
#include "Topology/generic/traversor2.h" #include "Topology/generic/traversor2.h"
#include "Algo/Multiresolution/filter.h" #include "Algo/Multiresolution/filter.h"
#include "Algo/Import/importMRDAT.h"
#include <cmath> #include <cmath>
...@@ -39,6 +41,9 @@ namespace CGoGN ...@@ -39,6 +41,9 @@ namespace CGoGN
namespace Algo namespace Algo
{ {
namespace Surface
{
namespace MR namespace MR
{ {
...@@ -77,14 +82,19 @@ public: ...@@ -77,14 +82,19 @@ public:
void synthesis() ; void synthesis() ;
void addLevelFront(); void addLevelFront();
void import(Algo::Surface::Import::QuadTree& qt);
} ; } ;
} // namespace Adaptive } // namespace Regular
} // namespace Primal } // namespace Primal
} // namespace MR } // namespace MR
} // namespace Surface
} // namespace Algo } // namespace Algo
} // namespace CGoGN } // namespace CGoGN
......
...@@ -22,12 +22,16 @@ ...@@ -22,12 +22,16 @@
* * * *
*******************************************************************************/ *******************************************************************************/
namespace CGoGN namespace CGoGN
{ {
namespace Algo namespace Algo
{ {
namespace Surface
{
namespace MR namespace MR
{ {
...@@ -154,10 +158,8 @@ void IHM2<PFP>::addNewLevel(bool triQuad) ...@@ -154,10 +158,8 @@ void IHM2<PFP>::addNewLevel(bool triQuad)
template <typename PFP> template <typename PFP>
void IHM2<PFP>::addLevelFront() void IHM2<PFP>::addLevelFront()
{ {
std::vector<Dart> irregVertices; //1. look for an irregular vertex
irregVertices.reserve(1024); Dart irregVertex = NIL;
//look for an irregular vertex
TraversorV<typename PFP::MAP> tv(m_map); TraversorV<typename PFP::MAP> tv(m_map);
bool found = false; bool found = false;
...@@ -166,13 +168,13 @@ void IHM2<PFP>::addLevelFront() ...@@ -166,13 +168,13 @@ void IHM2<PFP>::addLevelFront()
if(m_map.vertexDegree(d) != 6) if(m_map.vertexDegree(d) != 6)
{ {
found = true; found = true;
irregVertices.push_back(d); irregVertex = d;
} }
} }
//found the number of levels //2. found the number of levels
bool finished = false; bool finished = false;
Dart dit = irregVertices[0]; Dart dit = irregVertex;
unsigned int nbSteps = 0; unsigned int nbSteps = 0;
do do
{ {
...@@ -191,10 +193,11 @@ void IHM2<PFP>::addLevelFront() ...@@ -191,10 +193,11 @@ void IHM2<PFP>::addLevelFront()
nbSteps /= 2 ; nbSteps /= 2 ;
++nbLevel ; ++nbLevel ;
} }
m_map.setMaxLevel(nbLevel);
m_map.setMaxLevel(nbLevel);
std::cout << "nb levels = " << nbLevel+1 << std::endl; std::cout << "nb levels = " << nbLevel+1 << std::endl;
//3. construct the topology of the differents levels
unsigned int curLevel = nbLevel; unsigned int curLevel = nbLevel;
do do
...@@ -202,7 +205,9 @@ void IHM2<PFP>::addLevelFront() ...@@ -202,7 +205,9 @@ void IHM2<PFP>::addLevelFront()
m_map.setCurrentLevel(curLevel); m_map.setCurrentLevel(curLevel);
DartMarker md(m_map); DartMarker md(m_map);
std::vector<Dart> visitedVertices(irregVertices); std::vector<Dart> visitedVertices;
visitedVertices.reserve(1024);
visitedVertices.push_back(irregVertex);
std::cout << "getCurrentLevel = " << m_map.getCurrentLevel() << std::endl; std::cout << "getCurrentLevel = " << m_map.getCurrentLevel() << std::endl;
...@@ -240,7 +245,7 @@ void IHM2<PFP>::addLevelFront() ...@@ -240,7 +245,7 @@ void IHM2<PFP>::addLevelFront()
m_map.setDartLevel(m_map.phi2(fit3), curLevel); m_map.setDartLevel(m_map.phi2(fit3), curLevel);
m_map.setDartLevel(m_map.phi1(m_map.phi2(fit3)), curLevel); m_map.setDartLevel(m_map.phi1(m_map.phi2(fit3)), curLevel);
if(curLevel == maxLevel) if(curLevel == m_map.getMaxLevel())
{ {
unsigned int id = m_map.getTriRefinementEdgeId(m_map.phi2(fit1)); unsigned int id = m_map.getTriRefinementEdgeId(m_map.phi2(fit1));
m_map.setEdgeId(m_map.phi2(fit1), id); m_map.setEdgeId(m_map.phi2(fit1), id);
...@@ -256,31 +261,28 @@ void IHM2<PFP>::addLevelFront() ...@@ -256,31 +261,28 @@ void IHM2<PFP>::addLevelFront()
} }
else else
{ {
}
// if(curLevel == 2)
// {
// unsigned int id = m_map.getTriRefinementEdgeId(m_map.phi2(fit1)); // unsigned int id = m_map.getTriRefinementEdgeId(m_map.phi2(fit1));
// m_map.setEdgeId(m_map.phi2(fit1), id); // m_map.setEdgeId(m_map.phi2(fit1), id);
// m_map.setEdgeId(fit1, id); // m_map.setEdgeId(fit1, id);
//m_map.setEdgeId(fit1, id);
// /std::cout << "fit1 = " << fit1 << std::endl; // m_map.incCurrentLevel();
//std::cout << "m_map.phi2(fit1) = " << m_map.phi2(fit1) << std::endl; // m_map.setEdgeId(m_map.phi2(fit1), id);
// m_map.decCurrentLevel();
// id = m_map.getTriRefinementEdgeId(m_map.phi2(fit2)); // id = m_map.getTriRefinementEdgeId(m_map.phi2(fit2));
// m_map.setEdgeId(m_map.phi2(fit2), id); // m_map.setEdgeId(m_map.phi2(fit2), id);
// m_map.setEdgeId(fit2, id); // m_map.setEdgeId(fit2, id);
//m_map.setEdgeId(fit2, id); // m_map.incCurrentLevel();
//std::cout << "fit2 = " << fit2 << std::endl; // m_map.setEdgeId(m_map.phi2(fit2), id);
//std::cout << "m_map.phi2(fit2) = " << m_map.phi2(fit2) << std::endl; // m_map.decCurrentLevel();
// id = m_map.getTriRefinementEdgeId(m_map.phi2(fit3)); // id = m_map.getTriRefinementEdgeId(m_map.phi2(fit3));
// m_map.setEdgeId(m_map.phi2(fit3), id); // m_map.setEdgeId(m_map.phi2(fit3), id);
// m_map.setEdgeId(fit3, id); // m_map.setEdgeId(fit3, id);
//m_map.setEdgeId(fit3, id); // m_map.incCurrentLevel();
//std::cout << "fit3 = " << fit3 << std::endl; // m_map.setEdgeId(m_map.phi2(fit3), id);
//std::cout << "m_map.phi2(fit3) = " << m_map.phi2(fit3) << std::endl; // m_map.decCurrentLevel();
// } }
} }
} }
} }
...@@ -316,12 +318,33 @@ void IHM2<PFP>::synthesis() ...@@ -316,12 +318,33 @@ void IHM2<PFP>::synthesis()
m_map.incCurrentLevel() ; m_map.incCurrentLevel() ;
} }
template <typename PFP>
void IHM2<PFP>::import(Algo::Surface::Import::QuadTree& qt)
{
std::cout << " Create finer resolution levels.." << std::flush ;
for(unsigned int i = 0; i < qt.depth; ++i)
addNewLevel(true) ;
std::cout << "..done" << std::endl ;
std::cout << " Embed finer resolution levels.." << std::flush ;
m_map.setCurrentLevel(0) ;
qt.embed<PFP>(m_map) ;
m_map.setCurrentLevel(m_map.getMaxLevel()) ;
std::cout << "..done" << std::endl ;
}
} // namespace Regular } // namespace Regular
} // namespace Primal } // namespace Primal
} // namespace MR } // namespace MR
} // namespace Surface
} // namespace Algo } // namespace Algo
} // namespace CGoGN } // namespace CGoGN
...@@ -310,7 +310,6 @@ void Map2MR<PFP>::addLevelFront() ...@@ -310,7 +310,6 @@ void Map2MR<PFP>::addLevelFront()
Dart fit1 = m_map.phi2(m_map.phi1(d)); Dart fit1 = m_map.phi2(m_map.phi1(d));
//m_map.mergeFaces(fit1) ; //m_map.mergeFaces(fit1) ;
// Traversor2VE<typename PFP::MAP> tve(m_map, d); // Traversor2VE<typename PFP::MAP> tve(m_map, d);
// for(Dart eit = tve.begin() ; eit != tve.end() ; eit = tve.next()) // for(Dart eit = tve.begin() ; eit != tve.end() ; eit = tve.next())
// { // {
......
...@@ -351,10 +351,13 @@ inline unsigned int ImplicitHierarchicalMap2::getTriRefinementEdgeId(Dart d) ...@@ -351,10 +351,13 @@ inline unsigned int ImplicitHierarchicalMap2::getTriRefinementEdgeId(Dart d)
else if(id == 1) else if(id == 1)
return 2; return 2;
else if(id == 2) else if(id == 2)
{
if(dId == eId) if(dId == eId)
return 0; return 0;
else else
return 1; return 1;
}
//else if(id == 3) //else if(id == 3)
return 0; return 0;
} }
...@@ -370,11 +373,6 @@ inline unsigned int ImplicitHierarchicalMap2::getQuadRefinementEdgeId(Dart d) ...@@ -370,11 +373,6 @@ inline unsigned int ImplicitHierarchicalMap2::getQuadRefinementEdgeId(Dart d)
return 0; return 0;
} }
inline void ImplicitHierarchicalMap2::setTriRefinementEdgeId(Dart d)
{
}
/*************************************************** /***************************************************
* CELLS INFORMATION * * CELLS INFORMATION *
***************************************************/ ***************************************************/
......
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