Commit 6346fca0 authored by Pierre Kraemer's avatar Pierre Kraemer

calcul dual ok + reverse orientation

parent db4115a5
...@@ -536,11 +536,10 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y) ...@@ -536,11 +536,10 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y)
case 'd': case 'd':
{ {
myMap.removeAttribute<PFP::VEC3>(normal) ; AttributeHandler<PFP::VEC3> positionF = myMap.getAttribute<PFP::VEC3>(FACE_ORBIT, "position") ;
myMap.removeAttribute<PFP::VEC3>(laplacian) ; if(!positionF.isValid())
positionF = myMap.addAttribute<PFP::VEC3>(FACE_ORBIT, "position") ;
AttributeHandler<PFP::VEC3> newPosition = myMap.addAttribute<PFP::VEC3>(FACE_ORBIT, "position") ; Algo::Geometry::computeCentroidFaces<PFP>(myMap, position, positionF) ;
Algo::Geometry::computeCentroidFaces<PFP>(myMap, position, newPosition) ;
GLint t1 = glutGet(GLUT_ELAPSED_TIME); GLint t1 = glutGet(GLUT_ELAPSED_TIME);
...@@ -550,12 +549,14 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y) ...@@ -550,12 +549,14 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y)
GLfloat seconds = (t2 - t1) / 1000.0f; GLfloat seconds = (t2 - t1) / 1000.0f;
std::cout << "dual computation: "<< seconds << "sec" << std::endl; std::cout << "dual computation: "<< seconds << "sec" << std::endl;
newPosition = myMap.getAttribute<PFP::VEC3>(FACE_ORBIT, "position") ;
myMap.removeAttribute<PFP::VEC3>(newPosition) ;
position = myMap.getAttribute<PFP::VEC3>(VERTEX_ORBIT, "position") ; position = myMap.getAttribute<PFP::VEC3>(VERTEX_ORBIT, "position") ;
normal = myMap.addAttribute<PFP::VEC3>(VERTEX_ORBIT, "normal") ;
laplacian = myMap.addAttribute<PFP::VEC3>(VERTEX_ORBIT, "laplacian") ; normal = myMap.getAttribute<PFP::VEC3>(VERTEX_ORBIT, "normal") ;
if(!normal.isValid())
normal = myMap.addAttribute<PFP::VEC3>(VERTEX_ORBIT, "normal") ;
laplacian = myMap.getAttribute<PFP::VEC3>(VERTEX_ORBIT, "laplacian") ;
if(!laplacian.isValid())
laplacian = myMap.addAttribute<PFP::VEC3>(VERTEX_ORBIT, "laplacian") ;
t1 = glutGet(GLUT_ELAPSED_TIME); t1 = glutGet(GLUT_ELAPSED_TIME);
updateVBOprimitives(Algo::Render::VBO::TRIANGLES | Algo::Render::VBO::LINES | Algo::Render::VBO::POINTS) ; updateVBOprimitives(Algo::Render::VBO::TRIANGLES | Algo::Render::VBO::LINES | Algo::Render::VBO::POINTS) ;
......
...@@ -343,7 +343,7 @@ T& AttributeHandler_IHM<T>::operator[](Dart d) ...@@ -343,7 +343,7 @@ T& AttributeHandler_IHM<T>::operator[](Dart d)
assert(m->m_dartLevel[d] <= m->m_curLevel || !"Access to a dart introduced after current level") ; 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") ; assert(m->vertexInsertionLevel(d) <= m->m_curLevel || !"Access to the embedding of a vertex inserted after current level") ;
unsigned int orbit = this->m_orbit ; unsigned int orbit = this->getOrbit() ;
unsigned int nbSteps = m->m_curLevel - m->vertexInsertionLevel(d) ; unsigned int nbSteps = m->m_curLevel - m->vertexInsertionLevel(d) ;
unsigned int index = m->getEmbedding(d, orbit) ; unsigned int index = m->getEmbedding(d, orbit) ;
...@@ -380,7 +380,7 @@ const T& AttributeHandler_IHM<T>::operator[](Dart d) const ...@@ -380,7 +380,7 @@ const T& AttributeHandler_IHM<T>::operator[](Dart d) const
assert(m->m_dartLevel[d] <= m->m_curLevel || !"Access to a dart introduced after current level") ; 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") ; assert(m->vertexInsertionLevel(d) <= m->m_curLevel || !"Access to the embedding of a vertex inserted after current level") ;
unsigned int orbit = this->m_orbit ; unsigned int orbit = this->getOrbit() ;
unsigned int nbSteps = m->m_curLevel - m->vertexInsertionLevel(d) ; unsigned int nbSteps = m->m_curLevel - m->vertexInsertionLevel(d) ;
unsigned int index = m->getEmbedding(d, orbit) ; unsigned int index = m->getEmbedding(d, orbit) ;
......
...@@ -91,6 +91,12 @@ void LoopSubdivision(typename PFP::MAP& map, EMBV& attributs, const FunctorSelec ...@@ -91,6 +91,12 @@ void LoopSubdivision(typename PFP::MAP& map, EMBV& attributs, const FunctorSelec
template <typename PFP> template <typename PFP>
void LoopSubdivision(typename PFP::MAP& map, typename PFP::TVEC3& position, const FunctorSelect& selected = SelectorTrue()) ; void LoopSubdivision(typename PFP::MAP& map, typename PFP::TVEC3& position, const FunctorSelect& selected = SelectorTrue()) ;
/**
* Reverse the orientation of the map
*/
template <typename PFP>
void reverseOrientation(typename PFP::MAP& map) ;
/** /**
* Dual mesh computation * Dual mesh computation
*/ */
......
...@@ -434,6 +434,24 @@ void LoopSubdivision(typename PFP::MAP& map, typename PFP::TVEC3& position, cons ...@@ -434,6 +434,24 @@ void LoopSubdivision(typename PFP::MAP& map, typename PFP::TVEC3& position, cons
LoopSubdivision<PFP, typename PFP::TVEC3, typename PFP::VEC3>(map, position, selected) ; LoopSubdivision<PFP, typename PFP::TVEC3, typename PFP::VEC3>(map, position, selected) ;
} }
template <typename PFP>
void reverseOrientation(typename PFP::MAP& map)
{
AttributeHandler<unsigned int> emb0(&map, map.getEmbeddingAttributeVector(VERTEX_ORBIT)) ;
if(emb0.isValid())
{
AttributeHandler<unsigned int> new_emb0 = map.template addAttribute<unsigned int>(DART_ORBIT, "new_EMB_0") ;
for(Dart d = map.begin(); d != map.end(); map.next(d))
new_emb0[d] = emb0[map.phi1(d)] ;
map.template swapAttributes<unsigned int>(emb0, new_emb0) ;
map.template removeAttribute<unsigned int>(new_emb0) ;
}
AttributeHandler<Dart> phi1 = map.template getAttribute<Dart>(DART_ORBIT, "phi1") ;
AttributeHandler<Dart> phi_1 = map.template getAttribute<Dart>(DART_ORBIT, "phi_1") ;
map.template swapAttributes<Dart>(phi1, phi_1) ;
}
template <typename PFP> template <typename PFP>
void computeDual(typename PFP::MAP& map, const FunctorSelect& selected) void computeDual(typename PFP::MAP& map, const FunctorSelect& selected)
{ {
...@@ -456,12 +474,14 @@ void computeDual(typename PFP::MAP& map, const FunctorSelect& selected) ...@@ -456,12 +474,14 @@ void computeDual(typename PFP::MAP& map, const FunctorSelect& selected)
map.template removeAttribute<Dart>(new_phi_1) ; map.template removeAttribute<Dart>(new_phi_1) ;
map.swapEmbeddingContainers(VERTEX_ORBIT, FACE_ORBIT) ; map.swapEmbeddingContainers(VERTEX_ORBIT, FACE_ORBIT) ;
reverseOrientation<PFP>(map) ;
} }
template <typename PFP> template <typename PFP>
void Sqrt3Subdivision(typename PFP::MAP& map, typename PFP::TVEC3& position, const FunctorSelect& selected) void Sqrt3Subdivision(typename PFP::MAP& map, typename PFP::TVEC3& position, const FunctorSelect& selected)
{ {
// computeDual<PFP>(map, selected); computeDual<PFP>(map, selected);
trianguleFaces<PFP>(map, position, selected); trianguleFaces<PFP>(map, position, selected);
} }
......
...@@ -292,8 +292,10 @@ AttributeMultiVector<T>* AttributeContainer::getDataVector(const std::string& at ...@@ -292,8 +292,10 @@ AttributeMultiVector<T>* AttributeContainer::getDataVector(const std::string& at
inline AttributeMultiVectorGen* AttributeContainer::getVirtualDataVector(const std::string& attribName) inline AttributeMultiVectorGen* AttributeContainer::getVirtualDataVector(const std::string& attribName)
{ {
unsigned int index = getAttributeIndex(attribName) ; unsigned int index = getAttributeIndex(attribName) ;
assert(index != UNKNOWN) ; if(index == UNKNOWN)
return m_tableAttribs[index]; return NULL ;
else
return m_tableAttribs[index];
} }
template <typename T> template <typename T>
......
...@@ -44,7 +44,6 @@ inline bool AttribMap::removeAttribute(AttributeHandler<T>& attr) ...@@ -44,7 +44,6 @@ inline bool AttribMap::removeAttribute(AttributeHandler<T>& attr)
template <typename T> template <typename T>
inline AttributeHandler<T> AttribMap::getAttribute(unsigned int orbit, const std::string& nameAttr) inline AttributeHandler<T> AttribMap::getAttribute(unsigned int orbit, const std::string& nameAttr)
{ {
assert(isOrbitEmbedded(orbit) || !"Invalid parameter: orbit not embedded");
AttributeMultiVector<T>* amv = m_attribs[orbit].getDataVector<T>(nameAttr) ; AttributeMultiVector<T>* amv = m_attribs[orbit].getDataVector<T>(nameAttr) ;
return AttributeHandler<T>(this, amv) ; return AttributeHandler<T>(this, amv) ;
} }
...@@ -77,7 +76,6 @@ inline bool AttribMap::copyAttribute(AttributeHandler<T>& dst, AttributeHandler< ...@@ -77,7 +76,6 @@ inline bool AttribMap::copyAttribute(AttributeHandler<T>& dst, AttributeHandler<
inline unsigned int AttribMap::getNbCells(unsigned int orbit) inline unsigned int AttribMap::getNbCells(unsigned int orbit)
{ {
assert(isOrbitEmbedded(orbit) || !"Invalid parameter: orbit not embedded");
return this->m_attribs[orbit].size() ; return this->m_attribs[orbit].size() ;
} }
...@@ -88,7 +86,6 @@ inline unsigned int AttribMap::getNbCells(unsigned int orbit) ...@@ -88,7 +86,6 @@ inline unsigned int AttribMap::getNbCells(unsigned int orbit)
inline AttributeMultiVector<Dart>* AttribMap::addRelation(const std::string& name) inline AttributeMultiVector<Dart>* AttribMap::addRelation(const std::string& name)
{ {
AttributeContainer& cont = m_attribs[DART_ORBIT] ; AttributeContainer& cont = m_attribs[DART_ORBIT] ;
AttributeMultiVector<Dart>* amv = cont.addAttribute<Dart>(name) ; AttributeMultiVector<Dart>* amv = cont.addAttribute<Dart>(name) ;
// set new relation to fix point for all the darts of the map // set new relation to fix point for all the darts of the map
......
...@@ -43,8 +43,6 @@ namespace CGoGN ...@@ -43,8 +43,6 @@ namespace CGoGN
template <typename T> template <typename T>
class AttributeHandler class AttributeHandler
{ {
friend class AttribMap ;
protected: protected:
// we need the map to use dart as index // we need the map to use dart as index
GenericMap* m_map; GenericMap* m_map;
...@@ -52,19 +50,17 @@ protected: ...@@ -52,19 +50,17 @@ protected:
// access to the data // access to the data
AttributeMultiVector<T>* m_attrib; AttributeMultiVector<T>* m_attrib;
protected: public:
typedef T DATA_TYPE ;
/** /**
* Constructor * Constructor
* @param m the map which belong attribute * @param m the map which belong attribute
* @param orbit orbit of attribute * @param amv a pointer to the AttributeMultiVector
* @param orbit index of attribute
*/ */
AttributeHandler(GenericMap* m, AttributeMultiVector<T>* amv) ; AttributeHandler(GenericMap* m, AttributeMultiVector<T>* amv) ;
public: AttributeHandler() ;
typedef T DATA_TYPE ;
AttributeHandler() : m_map(NULL), m_attrib(NULL) {}
/** /**
* Copy constructor * Copy constructor
......
...@@ -30,6 +30,11 @@ AttributeHandler<T>::AttributeHandler(GenericMap* m, AttributeMultiVector<T>* am ...@@ -30,6 +30,11 @@ AttributeHandler<T>::AttributeHandler(GenericMap* m, AttributeMultiVector<T>* am
m_map(m), m_attrib(amv) m_map(m), m_attrib(amv)
{} {}
template <typename T>
AttributeHandler<T>::AttributeHandler():
m_map(NULL), m_attrib(NULL)
{}
template <typename T> template <typename T>
AttributeHandler<T>::AttributeHandler(const AttributeHandler<T>& ta): AttributeHandler<T>::AttributeHandler(const AttributeHandler<T>& ta):
m_map(ta.m_map), m_attrib(ta.m_attrib) m_map(ta.m_map), m_attrib(ta.m_attrib)
...@@ -79,9 +84,9 @@ const std::string& AttributeHandler<T>::name() const ...@@ -79,9 +84,9 @@ const std::string& AttributeHandler<T>::name() const
template <typename T> template <typename T>
bool AttributeHandler<T>::isValid() const bool AttributeHandler<T>::isValid() const
{ {
return (m_map != NULL && return !(m_map == NULL ||
m_attrib != NULL && m_attrib == NULL ||
m_attrib->getIndex() != AttributeContainer::UNKNOWN) ; m_attrib->getIndex() == AttributeContainer::UNKNOWN) ;
} }
template <typename T> template <typename T>
......
...@@ -84,7 +84,7 @@ protected: ...@@ -84,7 +84,7 @@ protected:
*/ */
AttributeContainer m_attribs[NB_ORBITS] ; AttributeContainer m_attribs[NB_ORBITS] ;
static std::map< std::string, RegisteredBaseAttribute* >* m_attributes_registry_map ; static std::map<std::string, RegisteredBaseAttribute*>* m_attributes_registry_map ;
/** /**
* Direct access to the Dart attributes that store the orbits embeddings * Direct access to the Dart attributes that store the orbits embeddings
...@@ -272,17 +272,16 @@ protected: ...@@ -272,17 +272,16 @@ protected:
* @param orbit the orbit of cell to use (xxx_ORBIT) * @param orbit the orbit of cell to use (xxx_ORBIT)
* @return the marker to use * @return the marker to use
*/ */
Marker getNewMarker(unsigned int cell = DART_ORBIT, unsigned int thread=0); Marker getNewMarker(unsigned int cell = DART_ORBIT, unsigned int thread = 0);
/** /**
* release a marker of cell. * release a marker of cell.
* @param m the marker to release * @param m the marker to release
*/ */
void releaseMarker(Marker m, unsigned int thread=0); void releaseMarker(Marker m, unsigned int thread = 0);
/**************************************** /****************************************
* THREAD MANAGEMENT * * THREAD MANAGEMENT *
****************************************/ ****************************************/
public: public:
/** /**
...@@ -304,7 +303,6 @@ public: ...@@ -304,7 +303,6 @@ public:
*/ */
void removeThreadMarker(unsigned int nb); void removeThreadMarker(unsigned int nb);
/**************************************** /****************************************
* SAVE & LOAD * * SAVE & LOAD *
****************************************/ ****************************************/
...@@ -384,13 +382,13 @@ public: ...@@ -384,13 +382,13 @@ public:
* @param d a dart of the orbit * @param d a dart of the orbit
* @param f a functor obj * @param f a functor obj
*/ */
bool foreach_dart_of_orbit(unsigned int orbit, Dart d, FunctorType& f, unsigned int thread=0); bool foreach_dart_of_orbit(unsigned int orbit, Dart d, FunctorType& f, unsigned int thread = 0);
virtual bool foreach_dart_of_vertex(Dart d, FunctorType& f, unsigned int thread=0) = 0; virtual bool foreach_dart_of_vertex(Dart d, FunctorType& f, unsigned int thread = 0) = 0;
virtual bool foreach_dart_of_edge(Dart d, FunctorType& f, unsigned int thread=0) = 0; virtual bool foreach_dart_of_edge(Dart d, FunctorType& f, unsigned int thread = 0) = 0;
virtual bool foreach_dart_of_face(Dart d, FunctorType& f, unsigned int thread=0) = 0; virtual bool foreach_dart_of_face(Dart d, FunctorType& f, unsigned int thread = 0) = 0;
virtual bool foreach_dart_of_volume(Dart d, FunctorType& f, unsigned int thread=0) = 0; virtual bool foreach_dart_of_volume(Dart d, FunctorType& f, unsigned int thread = 0) = 0;
virtual bool foreach_dart_of_cc(Dart d, FunctorType& f, unsigned int thread=0) = 0; virtual bool foreach_dart_of_cc(Dart d, FunctorType& f, unsigned int thread = 0) = 0;
/** /**
* execute functor for each orbit * execute functor for each orbit
...@@ -398,7 +396,7 @@ public: ...@@ -398,7 +396,7 @@ public:
* @param f the functor * @param f the functor
* @param good the selector of darts * @param good the selector of darts
*/ */
bool foreach_orbit(unsigned int orbit, FunctorType& f, const FunctorSelect& good = SelectorTrue(),unsigned int thread=0); bool foreach_orbit(unsigned int orbit, FunctorType& f, const FunctorSelect& good = SelectorTrue(), unsigned int thread = 0);
//! Count the number of orbits of dimension dim in the map //! Count the number of orbits of dimension dim in the map
/*! @param dim the dimension of the orbit /*! @param dim the dimension of the orbit
......
...@@ -242,9 +242,7 @@ inline void GenericMap::swapEmbeddingContainers(unsigned int orbit1, unsigned in ...@@ -242,9 +242,7 @@ inline void GenericMap::swapEmbeddingContainers(unsigned int orbit1, unsigned in
m_attribs[orbit1].setOrbit(orbit1) ; // to update the orbit information m_attribs[orbit1].setOrbit(orbit1) ; // to update the orbit information
m_attribs[orbit2].setOrbit(orbit2) ; // in the contained AttributeMultiVectors m_attribs[orbit2].setOrbit(orbit2) ; // in the contained AttributeMultiVectors
AttributeMultiVector<unsigned int>* e = m_embeddings[orbit1] ; m_embeddings[orbit1]->swap(m_embeddings[orbit2]) ;
m_embeddings[orbit1] = m_embeddings[orbit2] ;
m_embeddings[orbit2] = e ;
for(unsigned int t = 0; t < m_nbThreads; ++t) for(unsigned int t = 0; t < m_nbThreads; ++t)
{ {
......
...@@ -235,13 +235,6 @@ public: ...@@ -235,13 +235,6 @@ public:
* @param marker * @param marker
*/ */
void closeMap(DartMarker& marker); void closeMap(DartMarker& marker);
// TODO a mettre en algo
/**
* Reverse orientation of map (reverse orientation of all faces)
* no dart created, each dart keeps its embedding, only changing phi1 and phi2
*/
void reverseOrientation();
//@} //@}
/*! @name Topological Queries /*! @name Topological Queries
......
...@@ -125,8 +125,7 @@ const std::string& AttributeContainer::getAttributeName(unsigned int index) ...@@ -125,8 +125,7 @@ const std::string& AttributeContainer::getAttributeName(unsigned int index)
assert(index < m_tableAttribs.size() || !"getAttributeName: attribute index out of bounds"); assert(index < m_tableAttribs.size() || !"getAttributeName: attribute index out of bounds");
assert(m_tableAttribs[index] != NULL || !"getAttributeName: attribute does not exist"); assert(m_tableAttribs[index] != NULL || !"getAttributeName: attribute does not exist");
if(m_tableAttribs[index] != NULL) return m_tableAttribs[index]->getName() ;
return m_tableAttribs[index]->getName() ;
} }
template <typename T> template <typename T>
......
...@@ -56,7 +56,9 @@ void AttribMap::addEmbedding(unsigned int orbit) ...@@ -56,7 +56,9 @@ void AttribMap::addEmbedding(unsigned int orbit)
AttributeContainer& cellCont = m_attribs[orbit]; AttributeContainer& cellCont = m_attribs[orbit];
for (unsigned int t = 0; t < m_nbThreads; ++t) for (unsigned int t = 0; t < m_nbThreads; ++t)
{ {
AttributeMultiVector<Mark>* amvMark = cellCont.addAttribute<Mark>("Mark") ; std::stringstream ss ;
ss << "Mark_"<< t ;
AttributeMultiVector<Mark>* amvMark = cellCont.addAttribute<Mark>(ss.str()) ;
m_markerTables[orbit][t] = amvMark ; m_markerTables[orbit][t] = amvMark ;
} }
} }
......
...@@ -33,8 +33,7 @@ namespace CGoGN ...@@ -33,8 +33,7 @@ namespace CGoGN
std::map<std::string, RegisteredBaseAttribute*>* GenericMap::m_attributes_registry_map = NULL ; std::map<std::string, RegisteredBaseAttribute*>* GenericMap::m_attributes_registry_map = NULL ;
GenericMap::GenericMap() GenericMap::GenericMap() : m_nbThreads(1)
:m_nbThreads(1)
{ {
if(m_attributes_registry_map == NULL) if(m_attributes_registry_map == NULL)
m_attributes_registry_map = new std::map<std::string, RegisteredBaseAttribute*> ; m_attributes_registry_map = new std::map<std::string, RegisteredBaseAttribute*> ;
...@@ -114,7 +113,6 @@ void GenericMap::setDartEmbedding(unsigned int orbit, Dart d, unsigned int emb) ...@@ -114,7 +113,6 @@ void GenericMap::setDartEmbedding(unsigned int orbit, Dart d, unsigned int emb)
(*m_embeddings[orbit])[d.index] = emb ; (*m_embeddings[orbit])[d.index] = emb ;
} }
/**************************************** /****************************************
* ATTRIBUTES MANAGEMENT * * ATTRIBUTES MANAGEMENT *
****************************************/ ****************************************/
...@@ -150,6 +148,58 @@ bool GenericMap::registerAttribute(const std::string &nameType) ...@@ -150,6 +148,58 @@ bool GenericMap::registerAttribute(const std::string &nameType)
return true; return true;
} }
/****************************************
* THREAD MANAGEMENT *
****************************************/
void GenericMap::addThreadMarker(unsigned int nb)
{
unsigned int th ;
for (unsigned int j = 0; j < nb; ++j)
{
th = m_nbThreads ;
m_nbThreads++ ;
for (unsigned int i = 0; i < NB_ORBITS; ++i)
{
if (isOrbitEmbedded(i))
{
std::stringstream ss ;
ss << "Mark_"<< th ;
AttributeContainer& cellCont = m_attribs[i] ;
AttributeMultiVector<Mark>* amvMark = cellCont.addAttribute<Mark>(ss.str()) ;
m_markerTables[i][th] = amvMark ;
}
}
}
}
unsigned int GenericMap::getNbThreadMarkers()
{
return m_nbThreads;
}
void GenericMap::removeThreadMarker(unsigned int nb)
{
unsigned int th = 0;
while ((m_nbThreads > 1) && (nb > 0))
{
th = --m_nbThreads ;
--nb;
for (unsigned int i = 0; i < NB_ORBITS; ++i)
{
if (isOrbitEmbedded(i))
{
std::stringstream ss ;
ss << "Mark_"<< th ;
AttributeContainer& cellCont = m_attribs[i] ;
cellCont.removeAttribute(ss.str()) ;
m_markerTables[i][th] = NULL ;
}
}
}
}
/**************************************** /****************************************
* SAVE & LOAD * * SAVE & LOAD *
...@@ -464,7 +514,6 @@ bool GenericMap::loadMapBin(const std::string& filename) ...@@ -464,7 +514,6 @@ bool GenericMap::loadMapBin(const std::string& filename)
return true; return true;
} }
/**************************************** /****************************************
* DARTS TRAVERSALS * * DARTS TRAVERSALS *
****************************************/ ****************************************/
...@@ -524,55 +573,4 @@ unsigned int GenericMap::getNbOrbits(unsigned int orbit, const FunctorSelect& go ...@@ -524,55 +573,4 @@ unsigned int GenericMap::getNbOrbits(unsigned int orbit, const FunctorSelect& go
return fcount.getNb(); return fcount.getNb();
} }
void GenericMap::addThreadMarker(unsigned int nb)
{
unsigned int th ;
for (unsigned int j = 0; j < nb; ++j)
{
th = m_nbThreads ;
m_nbThreads++ ;
for (unsigned int i = 0; i < NB_ORBITS; ++i)
{
if (isOrbitEmbedded(i))
{
AttributeContainer& cellCont = m_attribs[i] ;
std::stringstream ss ;
ss << "Mark_"<< th ;
AttributeMultiVector<Mark>* amvMark = cellCont.addAttribute<Mark>(ss.str()) ;
m_markerTables[i][th] = amvMark ;
}
}
}
}
unsigned int GenericMap::getNbThreadMarkers()
{
return m_nbThreads;
}
void GenericMap::removeThreadMarker(unsigned int nb)
{
unsigned int th = 0;
while ((m_nbThreads > 1) && (nb > 0))
{
th = --m_nbThreads ;
--nb;
for (unsigned int i = 0; i < NB_ORBITS; ++i)
{
if (isOrbitEmbedded(i))
{
AttributeContainer& cellCont = m_attribs[i] ;
std::stringstream ss ;
ss << "Mark_"<< th ;
cellCont.removeAttribute(ss.str()) ;
m_markerTables[i][th] = NULL ;
}
}
}
}
} // namespace CGoGN } // namespace CGoGN
...@@ -353,46 +353,6 @@ void Map2::closeMap(DartMarker& marker) ...@@ -353,46 +353,6 @@ void Map2::closeMap(DartMarker& marker)
} }
} }
void Map2::reverseOrientation()
{
DartMarkerNoUnmark mf(*this);
// reverse all faces (only phi1 is modified)
for (Dart d = begin(); d != end(); next(d))
{
if (!mf.isMarked(d))
{
reverseFace(d);
mf.markOrbit(FACE_ORBIT, d);
}
}
// store all new phi2
std::vector<Dart> vd;
vd.reserve(getNbDarts());
for (Dart d = begin(); d != end(); next(d))
{
Dart e = phi_1(phi2(phi1(d)));
vd.push_back(e);
}
// apply the phi2sew with stored phi2 on all darts
std::vector<Dart>::iterator id = vd.begin();
for (Dart d = begin(); d != end(); next(d),++id)
{
if (mf.isMarked(d))
{
mf.unmark(d); // unmark the two darts
mf.unmark(*id);
if (phi2(d) != d)
phi2unsew(d); // unsew the two darts if necessary
if (phi2(*id) != *id)
phi2unsew(*id);
phi2sew(d, *id); // sew the darts
}
}
}
/*! @name Topological Queries /*! @name Topological Queries
* Return or set various topological information * Return or set various topological information
*************************************************************************/ *************************************************************************/
......