Commit 630fb1fd authored by Pierre Kraemer's avatar Pierre Kraemer

suite de la reorganisation des cartes

parent 5b0741d1
This diff is collapsed.
This diff is collapsed.
...@@ -32,91 +32,88 @@ namespace CGoGN ...@@ -32,91 +32,88 @@ namespace CGoGN
class MapMono : public AttribMap class MapMono : public AttribMap
{ {
public:
MapMono()
{}
protected: protected:
std::vector<AttributeMultiVector<Dart>*> m_permutation; std::vector<AttributeMultiVector<Dart>*> m_permutation;
std::vector<AttributeMultiVector<Dart>*> m_permutation_inv; std::vector<AttributeMultiVector<Dart>*> m_permutation_inv;
std::vector<AttributeMultiVector<Dart>*> m_involution; std::vector<AttributeMultiVector<Dart>*> m_involution;
virtual Dart newDart() /****************************************
{ * DARTS MANAGEMENT *
****************************************/
} inline virtual Dart newDart();
void addInvolution() inline virtual void deleteDart(Dart d);
{
std::stringstream sstm;
sstm << "involution_" << m_involution.size();
m_involution.push_back(addRelation(sstm.str()));
}
void addPermutation() inline unsigned int dartIndex(Dart d) const
{ {
std::stringstream sstm; return d.index;
sstm << "permutation_" << m_permutation.size();
m_permutation.push_back(addRelation(sstm.str()));
std::stringstream sstm2;
sstm2 << "permutation_inv_" << m_permutation_inv.size();
m_permutation_inv.push_back(addRelation(sstm2.str()));
} }
/**
* @return the number of darts in the map
*/
inline virtual unsigned int getNbDarts();
/****************************************
* RELATIONS MANAGEMENT *
****************************************/
inline void addInvolution();
inline void addPermutation();
template <int I> template <int I>
Dart getInvolution(Dart d) inline Dart getInvolution(Dart d) const;
{
return (*m_involution[I])[d.index];
}
template <int I> template <int I>
Dart getPermutation(Dart d) inline Dart getPermutation(Dart d) const;
{
return (*m_permutation[I])[d.index];
}
template <int I> template <int I>
Dart getPermutationInv(Dart d) inline Dart getPermutationInv(Dart d) const;
{
return (*m_permutation_inv[I])[d.index];
}
template <int I> template <int I>
void permutationSew(Dart d, Dart e) inline void permutationSew(Dart d, Dart e);
{
Dart f = (*m_permutation[I])[d.index] ;
Dart g = (*m_permutation[I])[e.index] ;
(*m_permutation[I])[d.index] = g ;
(*m_permutation[I])[e.index] = f ;
(*m_permutation_inv[I])[g.index] = d ;
(*m_permutation_inv[I])[f.index] = e ;
}
template <int I> template <int I>
void permutationUnsew(Dart d) inline void permutationUnsew(Dart d);
{
Dart e = (*m_permutation[I])[d.index] ;
Dart f = (*m_permutation[I])[e.index] ;
(*m_permutation[I])[d.index] = f ;
(*m_permutation[I])[e.index] = e ;
(*m_permutation_inv[I])[f.index] = d ;
(*m_permutation_inv[I])[e.index] = e ;
}
template <int I> template <int I>
void involutionSew(Dart d, Dart e) inline void involutionSew(Dart d, Dart e);
{
assert((*m_phi2)[d.index] == d) ;
assert((*m_phi2)[e.index] == e) ;
(*m_involution[I])[d.index] = e ;
(*m_involution[I])[e.index] = d ;
}
template <int I> template <int I>
void involutionUnsew(Dart d) inline void involutionUnsew(Dart d);
{
Dart e = (*m_involution[I])[d.index] ; /****************************************
(*m_involution[I])[d.index] = d ; * DARTS TRAVERSALS *
(*m_involution[I])[e.index] = e ; ****************************************/
}
/**
* Begin of map
* @return the first dart of the map
*/
inline virtual Dart begin() const;
/**
* End of map
* @return the end iterator (next of last) of the map
*/
inline virtual Dart end() const;
/**
* allow to go from a dart to the next
* in the order of storage
* @param d reference to the dart to be modified
*/
inline virtual void next(Dart& d) const;
} ; } ;
} //namespace CGoGN } //namespace CGoGN
#include "Topology/generic/mapMono.hpp"
#endif #endif
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
namespace CGoGN
{
/****************************************
* DARTS MANAGEMENT *
****************************************/
inline virtual Dart MapMono::newDart()
{
Dart d = GenericMap::newDart() ;
for (unsigned int i = 0; i < m_permutation.size(); ++i)
(*m_permutation[i])[d.index] = d ;
for (unsigned int i = 0; i < m_permutation_inv.size(); ++i)
(*m_permutation_inv[i])[d.index] = d ;
for (unsigned int i = 0; i < m_involution.size(); ++i)
(*m_involution[i])[d.index] = d ;
return d ;
}
inline void MapMono::deleteDart(Dart d)
{
deleteDartLine(d.index) ;
}
/****************************************
* RELATIONS MANAGEMENT *
****************************************/
inline void MapMono::addInvolution()
{
std::stringstream sstm;
sstm << "involution_" << m_involution.size();
m_involution.push_back(addRelation(sstm.str()));
}
inline void MapMono::addPermutation()
{
std::stringstream sstm;
sstm << "permutation_" << m_permutation.size();
m_permutation.push_back(addRelation(sstm.str()));
std::stringstream sstm2;
sstm2 << "permutation_inv_" << m_permutation_inv.size();
m_permutation_inv.push_back(addRelation(sstm2.str()));
}
template <int I>
inline Dart MapMono::getInvolution(Dart d)
{
return (*m_involution[I])[d.index];
}
template <int I>
inline Dart MapMono::getPermutation(Dart d)
{
return (*m_permutation[I])[d.index];
}
template <int I>
inline Dart MapMono::getPermutationInv(Dart d)
{
return (*m_permutation_inv[I])[d.index];
}
template <int I>
inline void MapMono::permutationSew(Dart d, Dart e)
{
Dart f = (*m_permutation[I])[d.index] ;
Dart g = (*m_permutation[I])[e.index] ;
(*m_permutation[I])[d.index] = g ;
(*m_permutation[I])[e.index] = f ;
(*m_permutation_inv[I])[g.index] = d ;
(*m_permutation_inv[I])[f.index] = e ;
}
template <int I>
inline void MapMono::permutationUnsew(Dart d)
{
Dart e = (*m_permutation[I])[d.index] ;
Dart f = (*m_permutation[I])[e.index] ;
(*m_permutation[I])[d.index] = f ;
(*m_permutation[I])[e.index] = e ;
(*m_permutation_inv[I])[f.index] = d ;
(*m_permutation_inv[I])[e.index] = e ;
}
template <int I>
inline void MapMono::involutionSew(Dart d, Dart e)
{
assert((*m_phi2)[d.index] == d) ;
assert((*m_phi2)[e.index] == e) ;
(*m_involution[I])[d.index] = e ;
(*m_involution[I])[e.index] = d ;
}
template <int I>
inline void MapMono::involutionUnsew(Dart d)
{
Dart e = (*m_involution[I])[d.index] ;
(*m_involution[I])[d.index] = d ;
(*m_involution[I])[e.index] = e ;
}
/****************************************
* DARTS TRAVERSALS *
****************************************/
inline virtual Dart MapMono::begin() const
{
return Dart::create(m_attribs[DART].begin()) ;
}
inline virtual Dart MapMono::end() const
{
return Dart::create(m_attribs[DART].end()) ;
}
inline virtual void MapMono::next(Dart& d) const
{
m_attribs[DART].next(d.index) ;
}
} // namespace CGoGN
...@@ -32,10 +32,242 @@ namespace CGoGN ...@@ -32,10 +32,242 @@ namespace CGoGN
class MapMulti : public AttribMap class MapMulti : public AttribMap
{ {
public:
MapMulti()
{
initMR();
}
} ; virtual void clear(bool removeAttrib)
{
AttribMap::clear(removeAttrib);
initMR();
}
protected:
std::vector<AttributeMultiVector<Dart>*> m_permutation;
std::vector<AttributeMultiVector<Dart>*> m_permutation_inv;
std::vector<AttributeMultiVector<Dart>*> m_involution;
/**
* container for multiresolution darts
*/
AttributeContainer m_mrattribs ;
/**
* pointers to attributes of m_mrattribs that store indices of m_attribs[DART]
* (one for each level)
*/
std::vector< AttributeMultiVector<unsigned int>* > m_mrDarts ;
/**
* pointer to attribute of m_mrattribs that stores darts insertion levels
*/
AttributeMultiVector<unsigned int>* m_mrLevels ;
/**
* vector that stores the number of darts inserted on each resolution level
*/
std::vector<unsigned int> m_mrNbDarts ;
/**
* current level in multiresolution map
*/
unsigned int m_mrCurrentLevel ;
/**
* stack for current level temporary storage
*/
std::vector<unsigned int> m_mrLevelStack ;
/****************************************
* DARTS MANAGEMENT *
****************************************/
inline virtual Dart newDart();
inline virtual void deleteDart(Dart d);
inline virtual unsigned int dartIndex(Dart d) const;
/**
* get the number of darts inserted in the given leveldart
*/
unsigned int getNbInsertedDarts(unsigned int level) ;
/**
* get the number of darts that define the map of the given leveldart
*/
virtual unsigned int getNbDarts(unsigned int level) ;
/**
* @return the number of darts in the map
*/
virtual unsigned int getNbDarts() ;
/**
* get the insertion level of a dart
*/
unsigned int getDartLevel(Dart d) const ;
/**
*
*/
void incDartLevel(Dart d) const ;
/**
* duplicate a dart starting from current level
*/
void duplicateDart(Dart d) ;
void duplicateDartAtOneLevel(Dart d, unsigned int level) ;
/****************************************
* RELATIONS MANAGEMENT *
****************************************/
inline void addInvolution();
inline void addPermutation();
template <int I>
inline Dart getInvolution(Dart d) const;
template <int I>
inline Dart getPermutation(Dart d) const;
template <int I>
inline Dart getPermutationInv(Dart d) const;
template <int I>
inline void permutationSew(Dart d, Dart e);
template <int I>
inline void permutationUnsew(Dart d);
template <int I>
inline void involutionSew(Dart d, Dart e);
template <int I>
inline void involutionUnsew(Dart d);
/****************************************
* MR CONTAINER MANAGEMENT *
****************************************/
/**
* get the MR attribute container
*/
AttributeContainer& getMRAttributeContainer() ;
/**
* get the MR attribute container
*/
AttributeMultiVector<unsigned int>* getMRDartAttributeVector(unsigned int level) ;
AttributeMultiVector<unsigned int>* getMRLevelAttributeVector();
/****************************************
* RESOLUTION LEVELS MANAGEMENT *
****************************************/
void printMR() ;
/**
* initialize the multiresolution attribute container
*/
void initMR() ;
/**
* get the current resolution level
*/
unsigned int getCurrentLevel() ;
/**
* set the current resolution level
*/
void setCurrentLevel(unsigned int l) ;
/**
* increment the current resolution level
*/
void incCurrentLevel() ;
/**
* decrement the current resolution level
*/
void decCurrentLevel() ;
/**
* store current resolution level on a stack
*/
void pushLevel() ;
/**
* set as current the resolution level of the top of the stack
*/
void popLevel() ;
/**
* get the maximum resolution level
*/
unsigned int getMaxLevel() ;
/**
* add a resolution level in the back of the level table
*/
void addLevelBack() ;
/**
* add a resolution level in the front of the level table
*/
void addLevelFront();
/**
* remove last resolution level
*/
void removeLevelBack() ;
/**
* remove first resolution level
*/
void removeLevelFront();
/**
* copy MRDarts from level-1 to level
*/
void copyLevel(unsigned int level);
/**
* duplicate darts from level-1 to level
*/
void duplicateDarts(unsigned int newlevel);
/****************************************
* DARTS TRAVERSALS *
****************************************/
/**
* Begin of map
* @return the first dart of the map
*/
inline virtual Dart begin() const;
/**
* End of map
* @return the end iterator (next of last) of the map
*/
inline virtual Dart end() const;
/**
* allow to go from a dart to the next
* in the order of storage
* @param d reference to the dart to be modified
*/
inline virtual void next(Dart& d) const;
} ;
} //namespace CGoGN } //namespace CGoGN
#include "Topology/generic/mapMulti.hpp"
#endif #endif
This diff is collapsed.
...@@ -77,36 +77,6 @@ public: ...@@ -77,36 +77,6 @@ public:
} ; } ;
template <unsigned int ORBIT>
class TraversorCell<GenericMap, ORBIT> //: public Traversor<GenericMap>
{
private:
const GenericMap& m ;
const AttributeContainer* cont ;
unsigned int qCurrent ;
DartMarker* dmark ;
CellMarker<ORBIT>* cmark ;
const AttributeMultiVector<Dart>* quickTraversal ;
Dart current ;
bool firstTraversal ;
public:
TraversorCell(const GenericMap& map, bool forceDartMarker = false, unsigned int thread = 0) ;
~TraversorCell() ;
inline Dart begin() ;
inline Dart end() ;
inline Dart next() ;
inline void skip(Dart d);
} ;
template <typename MAP> template <typename MAP>
class TraversorV : public TraversorCell<MAP, VERTEX> class TraversorV : public TraversorCell<MAP, VERTEX>
......
...@@ -159,143 +159,4 @@ void TraversorCell<MAP, ORBIT>::skip(Dart d) ...@@ -159,143 +159,4 @@ void TraversorCell<MAP, ORBIT>::skip(Dart d)
cmark->mark(d) ; cmark->mark(d) ;
} }
//special version (partial specialization) for Genric Map
template <unsigned int ORBIT>
TraversorCell<GenericMap, ORBIT>::TraversorCell(const GenericMap& map, bool forceDartMarker, unsigned int thread) :
m(map), dmark(NULL), cmark(NULL), quickTraversal(NULL), current(NIL), firstTraversal(true)
{
if(forceDartMarker)
dmark = new DartMarker(map, thread) ;
else
{
quickTraversal = map.template getQuickTraversal<ORBIT>() ;
if(quickTraversal != NULL)
{
cont = &(map.template getAttributeContainer<ORBIT>()) ;
}
else
{
if(map.template isOrbitEmbedded<ORBIT>())
cmark = new CellMarker<ORBIT>(map, thread) ;