Commit 324560fb authored by untereiner's avatar untereiner

modifs dans map3 et ihm3

parent 92875e5f
......@@ -36,11 +36,11 @@ namespace Algo
namespace IHM
{
template<typename T> class AttributeHandler_IHM ;
//template<typename T> class AttributeHandler_IHM ;
class ImplicitHierarchicalMap3 : public EmbeddedMap3
{
template<typename T> friend class AttributeHandler_IHM ;
//template<typename T> friend class AttributeHandler_IHM ;
public:
unsigned int m_curLevel ;
......@@ -65,11 +65,11 @@ public:
* ATTRIBUTES MANAGEMENT *
***************************************************/
template <typename T>
AttributeHandler_IHM<T> addAttribute(unsigned int orbit, const std::string& nameAttr) ;
//template <typename T>
//AttributeHandler_IHM<T> addAttribute(unsigned int orbit, const std::string& nameAttr) ;
template <typename T>
AttributeHandler_IHM<T> getAttribute(unsigned int orbit, const std::string& nameAttr) ;
//template <typename T>
//AttributeHandler_IHM<T> getAttribute(unsigned int orbit, const std::string& nameAttr) ;
/***************************************************
......@@ -117,15 +117,6 @@ public:
virtual bool foreach_dart_of_cc(Dart d, FunctorType& f, unsigned int thread = 0) ;
/****************************************************
* EMBEDDED FUNCTIONS *
****************************************************/
// virtual void cutEdge(Dart d);
// virtual void splitFace(Dart d, Dart e);
// virtual void sewVolumes(Dart d, Dart e);
/***************************************************
* LEVELS MANAGEMENT *
***************************************************/
......@@ -278,42 +269,42 @@ public:
bool coarsenNeighborhoodLevelDiffersByOne(Dart d);
} ;
template <typename T>
class AttributeHandler_IHM : public AttributeHandler<T>
{
public:
typedef T DATA_TYPE ;
AttributeHandler_IHM() : AttributeHandler<T>()
{}
AttributeHandler_IHM(GenericMap* m, AttributeMultiVector<T>* amv) : AttributeHandler<T>(m, amv)
{}
AttributeMultiVector<T>* getDataVector() const
{
return AttributeHandler<T>::getDataVector() ;
}
bool isValid() const
{
return AttributeHandler<T>::isValid() ;
}
T& operator[](Dart d) ;
const T& operator[](Dart d) const ;
T& operator[](unsigned int a)
{
return AttributeHandler<T>::operator[](a) ;
}
const T& operator[](unsigned int a) const
{
return AttributeHandler<T>::operator[](a) ;
}
} ;
//template <typename T>
//class AttributeHandler_IHM : public AttributeHandler<T>
//{
//public:
// typedef T DATA_TYPE ;
//
// AttributeHandler_IHM() : AttributeHandler<T>()
// {}
//
// AttributeHandler_IHM(GenericMap* m, AttributeMultiVector<T>* amv) : AttributeHandler<T>(m, amv)
// {}
//
// AttributeMultiVector<T>* getDataVector() const
// {
// return AttributeHandler<T>::getDataVector() ;
// }
//
// bool isValid() const
// {
// return AttributeHandler<T>::isValid() ;
// }
//
// T& operator[](Dart d) ;
//
// const T& operator[](Dart d) const ;
//
// T& operator[](unsigned int a)
// {
// return AttributeHandler<T>::operator[](a) ;
// }
//
// const T& operator[](unsigned int a) const
// {
// return AttributeHandler<T>::operator[](a) ;
// }
//} ;
} //namespace IHM
......
......@@ -31,37 +31,37 @@ namespace Algo
namespace IHM
{
/***************************************************
* ATTRIBUTES MANAGEMENT *
***************************************************/
template <typename T>
AttributeHandler_IHM<T> ImplicitHierarchicalMap3::addAttribute(unsigned int orbit, const std::string& nameAttr)
{
bool addNextLevelCell = false ;
if(!isOrbitEmbedded(orbit))
addNextLevelCell = true ;
AttributeHandler<T> h = Map3::addAttribute<T>(orbit, nameAttr) ;
if(addNextLevelCell)
{
AttributeContainer& cellCont = m_attribs[orbit] ;
AttributeMultiVector<unsigned int>* amv = cellCont.addAttribute<unsigned int>("nextLevelCell") ;
m_nextLevelCell[orbit] = amv ;
for(unsigned int i = cellCont.begin(); i < cellCont.end(); cellCont.next(i))
amv->operator[](i) = EMBNULL ;
}
return AttributeHandler_IHM<T>(this, h.getDataVector()) ;
}
template <typename T>
AttributeHandler_IHM<T> ImplicitHierarchicalMap3::getAttribute(unsigned int orbit, const std::string& nameAttr)
{
AttributeHandler<T> h = Map2::getAttribute<T>(orbit, nameAttr) ;
return AttributeHandler_IHM<T>(this, h.getDataVector()) ;
}
///***************************************************
// * ATTRIBUTES MANAGEMENT *
// ***************************************************/
//
//template <typename T>
//AttributeHandler_IHM<T> ImplicitHierarchicalMap3::addAttribute(unsigned int orbit, const std::string& nameAttr)
//{
// bool addNextLevelCell = false ;
// if(!isOrbitEmbedded(orbit))
// addNextLevelCell = true ;
//
// AttributeHandler<T> h = Map3::addAttribute<T>(orbit, nameAttr) ;
//
// if(addNextLevelCell)
// {
// AttributeContainer& cellCont = m_attribs[orbit] ;
// AttributeMultiVector<unsigned int>* amv = cellCont.addAttribute<unsigned int>("nextLevelCell") ;
// m_nextLevelCell[orbit] = amv ;
// for(unsigned int i = cellCont.begin(); i < cellCont.end(); cellCont.next(i))
// amv->operator[](i) = EMBNULL ;
// }
//
// return AttributeHandler_IHM<T>(this, h.getDataVector()) ;
//}
//
//template <typename T>
//AttributeHandler_IHM<T> ImplicitHierarchicalMap3::getAttribute(unsigned int orbit, const std::string& nameAttr)
//{
// AttributeHandler<T> h = Map2::getAttribute<T>(orbit, nameAttr) ;
// return AttributeHandler_IHM<T>(this, h.getDataVector()) ;
//}
/***************************************************
* MAP TRAVERSAL *
......@@ -363,66 +363,6 @@ inline bool ImplicitHierarchicalMap3::foreach_dart_of_cc(Dart d, FunctorType& f,
return foreach_dart_of_oriented_volume(d, f) ;
}
/**************************************************
* EMBEDDED FUNCTIONS *
**************************************************/
//void ImplicitHierarchicalMap3::cutEdge(Dart d)
//{
// Dart dd = phi2(d) ;
// EmbeddedMap3::cutEdge(d);
//
// //
// //mise a jour de l'id d'arrete sur chaque moitie d'arete
// //
//
// //
// //mise a jour de l'id de face sur chaque brin de chaque moitie d'arete
// //
//
//}
//
//void ImplicitHierarchicalMap3::splitFace(Dart d, Dart e)
//{
// //
// //Verification que les brins precedents ceux que l'on split n'ont pas le meme id
// //
// if(m_edgeId[d] == m_edgeId[Map3::phi_1(d)])
// {
// unsigned int eId = getNewEdgeId() ;
//
// Dart e = d;
// do
// {
// m_edgeId[e] = eId; //cas ou l'arete n'est pas du tout plonge
// m_edgeId[Map3::phi2(e)] = eId;
//
// e = Map3::alpha2(e);
// } while(e != d);
// }
//
// EmbeddedMap3<Map3>::splitFace(d,e);
//
// //
// //creation d'un id d'arete sur la nouvelle arete
// //
//
// unsigned int eId = getNewEdgeId() ;
// Dart a =Map3:: phi_1(d);
//
// do
// {
// m_edgeId[a] = eId;
// m_edgeId[Map3::phi2(a)] = eId;
//
// a = Map3::alpha2(a);
// } while(a != Map3::phi_1(d));
//
//}
//
//void ImplicitHierarchicalMap3::sewVolumes(Dart d, Dart e)
//{
//
//}
/***************************************************
* LEVELS MANAGEMENT *
......@@ -583,67 +523,67 @@ inline unsigned int ImplicitHierarchicalMap3::edgeLevel(Dart d)
return r;
}
/***************************************************
* ATTRIBUTE HANDLER *
***************************************************/
template <typename T>
T& AttributeHandler_IHM<T>::operator[](Dart d)
{
ImplicitHierarchicalMap3* m = reinterpret_cast<ImplicitHierarchicalMap3*>(this->m_map) ;
assert(m->m_dartLevel[d] <= m->m_curLevel || !"Access to a dart introduced after current level") ;
assert(m->vertexInsertionLevel(d) <= m->m_curLevel || !"Access to the embedding of a vertex inserted after current level") ;
unsigned int orbit = this->getOrbit() ;
unsigned int nbSteps = m->m_curLevel - m->vertexInsertionLevel(d) ;
unsigned int index = m->getEmbedding(orbit, d) ;
if(index == EMBNULL)
{
index = m->embedNewCell(orbit, d) ;
m->m_nextLevelCell[orbit]->operator[](index) = EMBNULL ;
}
AttributeContainer& cont = m->getAttributeContainer(orbit) ;
unsigned int step = 0 ;
while(step < nbSteps)
{
step++ ;
unsigned int nextIdx = m->m_nextLevelCell[orbit]->operator[](index) ;
if (nextIdx == EMBNULL)
{
nextIdx = m->newCell(orbit) ;
m->copyCell(orbit, nextIdx, index) ;
m->m_nextLevelCell[orbit]->operator[](index) = nextIdx ;
m->m_nextLevelCell[orbit]->operator[](nextIdx) = EMBNULL ;
cont.refLine(index) ;
}
index = nextIdx ;
}
return this->m_attrib->operator[](index);
}
template <typename T>
const T& AttributeHandler_IHM<T>::operator[](Dart d) const
{
ImplicitHierarchicalMap3* m = reinterpret_cast<ImplicitHierarchicalMap3*>(this->m_map) ;
assert(m->m_dartLevel[d] <= m->m_curLevel || !"Access to a dart introduced after current level") ;
assert(m->vertexInsertionLevel(d) <= m->m_curLevel || !"Access to the embedding of a vertex inserted after current level") ;
unsigned int orbit = this->getOrbit() ;
unsigned int nbSteps = m->m_curLevel - m->vertexInsertionLevel(d) ;
unsigned int index = m->getEmbedding(orbit, d) ;
unsigned int step = 0 ;
while(step < nbSteps)
{
step++ ;
unsigned int next = m->m_nextLevelCell[orbit]->operator[](index) ;
if(next != EMBNULL) index = next ;
else break ;
}
return this->m_attrib->operator[](index);
}
///***************************************************
// * ATTRIBUTE HANDLER *
// ***************************************************/
//
//template <typename T>
//T& AttributeHandler_IHM<T>::operator[](Dart d)
//{
// ImplicitHierarchicalMap3* m = reinterpret_cast<ImplicitHierarchicalMap3*>(this->m_map) ;
// assert(m->m_dartLevel[d] <= m->m_curLevel || !"Access to a dart introduced after current level") ;
// assert(m->vertexInsertionLevel(d) <= m->m_curLevel || !"Access to the embedding of a vertex inserted after current level") ;
//
// unsigned int orbit = this->getOrbit() ;
// unsigned int nbSteps = m->m_curLevel - m->vertexInsertionLevel(d) ;
// unsigned int index = m->getEmbedding(orbit, d) ;
//
// if(index == EMBNULL)
// {
// index = m->embedNewCell(orbit, d) ;
// m->m_nextLevelCell[orbit]->operator[](index) = EMBNULL ;
// }
//
// AttributeContainer& cont = m->getAttributeContainer(orbit) ;
// unsigned int step = 0 ;
// while(step < nbSteps)
// {
// step++ ;
// unsigned int nextIdx = m->m_nextLevelCell[orbit]->operator[](index) ;
// if (nextIdx == EMBNULL)
// {
// nextIdx = m->newCell(orbit) ;
// m->copyCell(orbit, nextIdx, index) ;
// m->m_nextLevelCell[orbit]->operator[](index) = nextIdx ;
// m->m_nextLevelCell[orbit]->operator[](nextIdx) = EMBNULL ;
// cont.refLine(index) ;
// }
// index = nextIdx ;
// }
// return this->m_attrib->operator[](index);
//}
//
//template <typename T>
//const T& AttributeHandler_IHM<T>::operator[](Dart d) const
//{
// ImplicitHierarchicalMap3* m = reinterpret_cast<ImplicitHierarchicalMap3*>(this->m_map) ;
// assert(m->m_dartLevel[d] <= m->m_curLevel || !"Access to a dart introduced after current level") ;
// assert(m->vertexInsertionLevel(d) <= m->m_curLevel || !"Access to the embedding of a vertex inserted after current level") ;
//
// unsigned int orbit = this->getOrbit() ;
// unsigned int nbSteps = m->m_curLevel - m->vertexInsertionLevel(d) ;
// unsigned int index = m->getEmbedding(orbit, d) ;
//
// unsigned int step = 0 ;
// while(step < nbSteps)
// {
// step++ ;
// unsigned int next = m->m_nextLevelCell[orbit]->operator[](index) ;
// if(next != EMBNULL) index = next ;
// else break ;
// }
// return this->m_attrib->operator[](index);
//}
} //namespace IHM
......
......@@ -67,8 +67,8 @@ template <typename PFP>
Dart Primitive3D<PFP>::HexaGrid1Topo(int nx)
{
// first cube
Dart d0 = createOrientedHexa();
m_tableVertDarts.push_back(d0);
Dart d0 = createOrientedHexa(); //return a dart from the base of the cube
m_tableVertDarts.push_back(d0); //push_back darts frome the base of cubes
Dart d1 = m_map.template phi<2112>(d0);
for (int i=1; i< nx; ++i)
......@@ -80,7 +80,7 @@ Dart Primitive3D<PFP>::HexaGrid1Topo(int nx)
}
// add last vertex (x=nx)
d1 = m_map.phi2(d1);
d1 = m_map.phi2(d1); //TODO can take phi1 instead > same vertex ??
m_tableVertDarts.push_back(d1);
return d0;
......
......@@ -507,6 +507,7 @@ bool ImplicitHierarchicalMap3::faceCanBeCoarsened(Dart d)
}
std::cout << "subdNeighborhood = " << subdNeighborhood << std::endl;
std::cout << "faceCanBeCoarsened ? " << (subd && !subdNeighborhood && subdOnce) << std::endl;
return subd && !subdNeighborhood && subdOnce;
}
......
......@@ -143,6 +143,7 @@ void EmbeddedMap3::splitFace(Dart d, Dart e)
copyDartEmbedding(VOLUME, phi2(phi1(d3)), d3);
}
}
}
void EmbeddedMap3::sewVolumes(Dart d, Dart e)
......@@ -301,39 +302,6 @@ bool EmbeddedMap3::check()
}
}
// if (phi2(phi_1(d)) != phi_1(d) && getEmbedding(VERTEX, d) != getEmbedding(VERTEX, phi2(phi_1(d))))
// {
// std::cout << "Check: different embeddings on vertex" << std::endl ;
// return false ;
// }
//
// if(phi3(d) != d && getEmbedding(VERTEX, d) != getEmbedding(VERTEX, phi1(phi3(d))))
// {
// std::cout << "Check: different embeddings on vertex in the 2 oriented faces" << std::endl ;
// std::cout << "Dart #" << d << std::endl;
// std::cout << "Emb(d) = " << getEmbedding(VERTEX, d) << std::endl;
// std::cout << "Emb(phi32(d)) = " << getEmbedding(VERTEX, phi3(phi2(d))) << std::endl;
// return false ;
// }
// if (isOrbitEmbedded(EDGE))
// {
// if (getEmbedding(EDGE, d) != getEmbedding(EDGE, phi2(d)))
// {
// std::cout << "Check: different embeddings on edge" << std::endl ;
// return false ;
// }
// }
//
// if (isOrbitEmbedded(FACE))
// {
// if (getEmbedding(FACE, d) != getEmbedding(FACE, phi1(d)))
// {
// std::cout << "Check: different embeddings on face" << std::endl ;
// return false ;
// }
// }
}
std::cout << "Check: embedding ok" << std::endl ;
return true ;
......
......@@ -91,12 +91,14 @@ bool Map3::deleteVertex(Dart d)
}
}
for(std::vector<Dart>::iterator it = fstore.begin() ; it != fstore.end() ; ++it)
{
if(!mergeVolumes(*it))
return false;
}
return true;
}
......
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