Commit 7114af20 authored by Sylvain Thery's avatar Sylvain Thery
Browse files

Merge branch 'master' into 'master'

Master

once upon a time

See merge request !39
parents 7576a3e9 21e86c78
......@@ -44,7 +44,7 @@ template<typename T, unsigned int ORBIT> class AttributeHandler_IHM ;
class ImplicitHierarchicalMap3 : public EmbeddedMap3
{
template<typename T, unsigned int ORBIT> friend class AttributeHandler_IHM ;
template<typename T, unsigned int ORBIT> friend class AttributeHandler_IHM ;
public:
FunctorType* vertexVertexFunctor ;
......@@ -52,92 +52,92 @@ public:
FunctorType* faceVertexFunctor ;
FunctorType* volumeVertexFunctor ;
unsigned int m_curLevel ;
unsigned int m_maxLevel ;
unsigned int m_edgeIdCount ;
unsigned int m_faceIdCount;
unsigned int m_curLevel ;
unsigned int m_maxLevel ;
unsigned int m_edgeIdCount ;
unsigned int m_faceIdCount;
DartAttribute<unsigned int, ImplicitHierarchicalMap3> m_dartLevel ;
DartAttribute<unsigned int, ImplicitHierarchicalMap3> m_edgeId ;
DartAttribute<unsigned int, ImplicitHierarchicalMap3> m_faceId ;
DartAttribute<unsigned int, EmbeddedMap3> m_dartLevel ;
DartAttribute<unsigned int, EmbeddedMap3> m_edgeId ;
DartAttribute<unsigned int, EmbeddedMap3> m_faceId ;
AttributeMultiVector<unsigned int>* m_nextLevelCell[NB_ORBITS] ;
AttributeMultiVector<unsigned int>* m_nextLevelCell[NB_ORBITS] ;
// std::vector<Algo::MR::Filter*> synthesisFilters ;
// std::vector<Algo::MR::Filter*> analysisFilters ;
public:
ImplicitHierarchicalMap3() ;
ImplicitHierarchicalMap3() ;
~ImplicitHierarchicalMap3() ;
~ImplicitHierarchicalMap3() ;
static const unsigned int DIMENSION = 3 ;
static const unsigned int DIMENSION = 3 ;
//!
/*!
*
*/
void update_topo_shortcuts();
//!
/*!
*
*/
void update_topo_shortcuts();
//!
/*!
*
*/
void initImplicitProperties() ;
//!
/*!
*
*/
void initImplicitProperties() ;
/**
* clear the map
* @param remove attrib remove attribute (not only clear the content)
*/
void clear(bool removeAttrib);
/**
* clear the map
* @param remove attrib remove attribute (not only clear the content)
*/
void clear(bool removeAttrib);
/*! @name Attributes Management
* To handles Attributes for each level of an implicit 3-map
*************************************************************************/
/*! @name Attributes Management
* To handles Attributes for each level of an implicit 3-map
*************************************************************************/
//@{
//!
/*!
*
*/
template <typename T, unsigned int ORBIT>
AttributeHandler_IHM<T, ORBIT> addAttribute(const std::string& nameAttr) ;
//@{
//!
/*!
*
*/
// template <typename T, unsigned int ORBIT>
// AttributeHandler_IHM<T, ORBIT> addAttribute(const std::string& nameAttr) ;
//!
/*!
*
*/
template <typename T, unsigned int ORBIT>
AttributeHandler_IHM<T, ORBIT> getAttribute(const std::string& nameAttr) ;
//@}
//!
/*!
*
*/
// template <typename T, unsigned int ORBIT>
// AttributeHandler_IHM<T, ORBIT> getAttribute(const std::string& nameAttr) ;
//@}
/*! @name Basic Topological Operators
* Redefinition of the basic topological operators
*************************************************************************/
/*! @name Basic Topological Operators
* Redefinition of the basic topological operators
*************************************************************************/
//@{
virtual Dart newDart() ;
//@{
virtual Dart newDart() ;
Dart phi1(Dart d) const;
Dart phi1(Dart d) const;
Dart phi_1(Dart d) const;
Dart phi_1(Dart d) const;
Dart phi2(Dart d) const;
Dart phi2(Dart d) const;
private:
Dart phi2bis(Dart d) const;
Dart phi2bis(Dart d) const;
public:
Dart phi3(Dart d) const;
Dart phi3(Dart d) const;
Dart alpha0(Dart d) const;
Dart alpha0(Dart d) const;
Dart alpha1(Dart d) const;
Dart alpha1(Dart d) const;
Dart alpha2(Dart d) const;
Dart alpha2(Dart d) const;
Dart alpha_2(Dart d) const;
//@}
Dart alpha_2(Dart d) const;
//@}
/*! @name Topological Operators with Cells id management
* Topological operations on Hierarchical Implicit 3-maps
......@@ -195,41 +195,41 @@ public:
* Operations to manage the levels of an Implicit Hierarchical 3-map
*************************************************************************/
void incCurrentLevel();
void decCurrentLevel();
//@{
//!
/*!
*
*/
unsigned int getCurrentLevel() const ;
//!
/*!
*
*/
void setCurrentLevel(unsigned int l) ;
//!
/*!
*
*/
unsigned int getMaxLevel() const ;
//!
/*!
*
*/
unsigned int getDartLevel(Dart d) const ;
//!
/*!
*
*/
void setDartLevel(Dart d, unsigned int i) ;
void incCurrentLevel();
void decCurrentLevel();
//@{
//!
/*!
*
*/
unsigned int getCurrentLevel() const ;
//!
/*!
*
*/
void setCurrentLevel(unsigned int l) ;
//!
/*!
*
*/
unsigned int getMaxLevel() const ;
//!
/*!
*
*/
unsigned int getDartLevel(Dart d) const ;
//!
/*!
*
*/
void setDartLevel(Dart d, unsigned int i) ;
//@}
/*! @name Id Management
......@@ -237,47 +237,47 @@ public:
*************************************************************************/
//@{
//! Give a new unique id to all the edges of the map
/*!
*/
void initEdgeId() ;
//! Return the next available edge id
/*!
*/
unsigned int getNewEdgeId() ;
//! Return the id of the edge of d
/*!
*/
unsigned int getEdgeId(Dart d) ;
//! Set an edge id to all darts from an orbit of d
/*!
*/
void setEdgeId(Dart d, unsigned int i, unsigned int orbit); //TODO a virer
void setEdgeId(Dart d, unsigned int i);
//! Give a new unique id to all the faces of the map
/*!
*/
void initFaceId() ;
//! Return the next available face id
/*!
*/
unsigned int getNewFaceId() ;
//! Return the id of the face of d
/*!
*/
unsigned int getFaceId(Dart d) ;
//! Set a face id to all darts from an orbit of d
/*!
*/
void setFaceId(Dart d, unsigned int i, unsigned int orbit); //TODO a virer
void setFaceId(unsigned int orbit, Dart d);
//! Give a new unique id to all the edges of the map
/*!
*/
void initEdgeId() ;
//! Return the next available edge id
/*!
*/
unsigned int getNewEdgeId() ;
//! Return the id of the edge of d
/*!
*/
unsigned int getEdgeId(Dart d) ;
//! Set an edge id to all darts from an orbit of d
/*!
*/
void setEdgeId(Dart d, unsigned int i, unsigned int orbit); //TODO a virer
void setEdgeId(Dart d, unsigned int i);
//! Give a new unique id to all the faces of the map
/*!
*/
void initFaceId() ;
//! Return the next available face id
/*!
*/
unsigned int getNewFaceId() ;
//! Return the id of the face of d
/*!
*/
unsigned int getFaceId(Dart d) ;
//! Set a face id to all darts from an orbit of d
/*!
*/
void setFaceId(Dart d, unsigned int i, unsigned int orbit); //TODO a virer
void setFaceId(unsigned int orbit, Dart d);
//@}
/*! @name Cells Information
......@@ -285,10 +285,10 @@ public:
*************************************************************************/
//@{
//! Return the level of insertion of the vertex of d
/*!
*/
unsigned int vertexInsertionLevel(Dart d) const;
//! Return the level of insertion of the vertex of d
/*!
*/
unsigned int vertexInsertionLevel(Dart d) const;
//! Return the level of the edge of d in the current level map
/*!
......@@ -371,11 +371,11 @@ public:
*************************************************************************/
//@{
Dart begin() const;
Dart begin() const;
Dart end() const;
Dart end() const;
void next(Dart& d) const ;
void next(Dart& d) const ;
template <unsigned int ORBIT, typename FUNC>
void foreach_dart_of_orbit(Cell<ORBIT> c, FUNC f) const ;
......@@ -419,8 +419,8 @@ public:
void foreach_dart_of_cc(Dart d, FUNC& f) const ;
//@}
template <unsigned int ORBIT>
unsigned int getEmbedding(Cell<ORBIT> c) const;
// template <unsigned int ORBIT>
// unsigned int getEmbedding(Cell<ORBIT> c) const;
} ;
template <typename T, unsigned int ORBIT>
......
......@@ -37,44 +37,44 @@ namespace IHM
/***************************************************
* ATTRIBUTES MANAGEMENT *
***************************************************/
/*
template <typename T, unsigned int ORBIT>
AttributeHandler_IHM<T, ORBIT> ImplicitHierarchicalMap3::addAttribute(const std::string& nameAttr)
{
bool addNextLevelCell = false ;
if(!isOrbitEmbedded<ORBIT>())
addNextLevelCell = true ;
bool addNextLevelCell = false ;
if(!isOrbitEmbedded<ORBIT>())
addNextLevelCell = true ;
AttributeHandler<T, ORBIT, ImplicitHierarchicalMap3> h = Map3::addAttribute<T, ORBIT, ImplicitHierarchicalMap3>(nameAttr) ;
AttributeHandler<T, ORBIT, ImplicitHierarchicalMap3> h = Map3::addAttribute<T, ORBIT, ImplicitHierarchicalMap3>(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 ;
}
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, ORBIT>(this, h.getDataVector()) ;
return AttributeHandler_IHM<T, ORBIT>(this, h.getDataVector()) ;
}
template <typename T, unsigned int ORBIT>
AttributeHandler_IHM<T, ORBIT> ImplicitHierarchicalMap3::getAttribute(const std::string& nameAttr)
{
AttributeHandler<T, ORBIT, ImplicitHierarchicalMap3> h = Map3::getAttribute<T, ORBIT, ImplicitHierarchicalMap3>(nameAttr) ;
return AttributeHandler_IHM<T, ORBIT>(this, h.getDataVector()) ;
AttributeHandler<T, ORBIT, ImplicitHierarchicalMap3> h = Map3::getAttribute<T, ORBIT, ImplicitHierarchicalMap3>(nameAttr) ;
return AttributeHandler_IHM<T, ORBIT>(this, h.getDataVector()) ;
}
*/
inline void ImplicitHierarchicalMap3::update_topo_shortcuts()
{
// Map3::update_topo_shortcuts();
m_dartLevel = Map3::getAttribute<unsigned int, DART, ImplicitHierarchicalMap3>("dartLevel") ;
m_faceId = Map3::getAttribute<unsigned int, DART, ImplicitHierarchicalMap3>("faceId") ;
m_edgeId = Map3::getAttribute<unsigned int, DART, ImplicitHierarchicalMap3>("edgeId") ;
m_dartLevel = Map3::getAttribute<unsigned int, DART, EmbeddedMap3>("dartLevel") ;
m_faceId = Map3::getAttribute<unsigned int, DART, EmbeddedMap3>("faceId") ;
m_edgeId = Map3::getAttribute<unsigned int, DART, EmbeddedMap3>("edgeId") ;
//AttributeContainer& cont = m_attribs[DART] ;
//m_nextLevelCell = cont.getDataVector<unsigned int>(cont.getAttributeIndex("nextLevelCell")) ;
//AttributeContainer& cont = m_attribs[DART] ;
//m_nextLevelCell = cont.getDataVector<unsigned int>(cont.getAttributeIndex("nextLevelCell")) ;
}
......@@ -84,144 +84,144 @@ inline void ImplicitHierarchicalMap3::update_topo_shortcuts()
inline Dart ImplicitHierarchicalMap3::newDart()
{
Dart d = Map3::newDart() ;
m_dartLevel[d] = m_curLevel ;
if(m_curLevel > m_maxLevel) // update max level
m_maxLevel = m_curLevel ; // if needed
return d ;
Dart d = Map3::newDart() ;
m_dartLevel[d] = m_curLevel ;
if(m_curLevel > m_maxLevel) // update max level
m_maxLevel = m_curLevel ; // if needed
return d ;
}
inline Dart ImplicitHierarchicalMap3::phi1(Dart d) const
{
assert(m_dartLevel[d] <= m_curLevel || !"Access to a dart introduced after current level") ;
bool finished = false ;
assert(m_dartLevel[d] <= m_curLevel || !"Access to a dart introduced after current level") ;
bool finished = false ;
unsigned int edgeId = m_edgeId[d] ;
Dart it = d ;
unsigned int edgeId = m_edgeId[d] ;
Dart it = d ;
do
{
do
{
it = Map3::phi1(it) ;
if(m_dartLevel[it] <= m_curLevel)
finished = true ;
else
{
while(m_edgeId[it] != edgeId)
it = Map3::phi1(phi2bis(it));
it = Map3::phi1(it) ;
if(m_dartLevel[it] <= m_curLevel)
finished = true ;
else
{
while(m_edgeId[it] != edgeId)
it = Map3::phi1(phi2bis(it));
}
} while(!finished) ;
}
} while(!finished) ;
return it ;
return it ;
}
inline Dart ImplicitHierarchicalMap3::phi_1(Dart d) const
{
assert(m_dartLevel[d] <= m_curLevel || !"Access to a dart introduced after current level") ;
bool finished = false ;
assert(m_dartLevel[d] <= m_curLevel || !"Access to a dart introduced after current level") ;
bool finished = false ;
Dart it = Map3::phi_1(d) ;
unsigned int edgeId = m_edgeId[it] ;
do
{
if(m_dartLevel[it] <= m_curLevel)
finished = true ;
else
{
it = Map3::phi_1(it) ;
while(m_edgeId[it] != edgeId)
it = Map3::phi_1(phi2bis(it));
}
} while(!finished) ;
Dart it = Map3::phi_1(d) ;
unsigned int edgeId = m_edgeId[it] ;
do
{
if(m_dartLevel[it] <= m_curLevel)
finished = true ;
else
{
it = Map3::phi_1(it) ;
while(m_edgeId[it] != edgeId)
it = Map3::phi_1(phi2bis(it));
}
} while(!finished) ;
return it ;
return it ;
}
inline Dart ImplicitHierarchicalMap3::phi2bis(Dart d) const
{
unsigned int faceId = m_faceId[d];
Dart it = d;
unsigned int faceId = m_faceId[d];
Dart it = d;
it = Map3::phi2(it) ;
it = Map3::phi2(it) ;
/* du cote des volumes non subdivise (subdiv adapt) */
if(m_faceId[it] == faceId)
return it;
else
{
do
{
it = Map3::phi2(Map3::phi3(it));
}
while(m_faceId[it] != faceId);
/* du cote des volumes non subdivise (subdiv adapt) */
if(m_faceId[it] == faceId)
return it;
else
{
do
{
it = Map3::phi2(Map3::phi3(it));
}
while(m_faceId[it] != faceId);
return it;
}
return it;
}
}
inline Dart ImplicitHierarchicalMap3::phi2(Dart d) const
{
assert(m_dartLevel[d] <= m_curLevel || !"Access to a dart introduced after current level") ;
assert(m_dartLevel[d] <= m_curLevel || !"Access to a dart introduced after current level") ;
return Map3::phi2(Map3::phi_1(phi1(d))) ;
return Map3::phi2(Map3::phi_1(phi1(d))) ;
}
inline Dart ImplicitHierarchicalMap3::phi3(Dart d) const
{
assert(m_dartLevel[d] <= m_curLevel || !"Access to a dart introduced after current level") ;
assert(m_dartLevel[d] <= m_curLevel || !"Access to a dart introduced after current level") ;
if(Map3::phi3(d) == d)
return d;
if(Map3::phi3(d) == d)
return d;
return Map3::phi3(Map3::phi_1(phi1(d)));
return Map3::phi3(Map3::phi_1(phi1(d)));
}
inline Dart ImplicitHierarchicalMap3::alpha0(Dart d) const
{
return phi3(d) ;
return phi3(d) ;
}
inline Dart ImplicitHierarchicalMap3::alpha1(Dart d) const
{
//assert(m_dartLevel[d] <= m_curLevel || !"Access to a dart introduced after current level") ;
//assert(m_dartLevel[d] <= m_curLevel || !"Access to a dart introduced after current level") ;