Coupure prévue mardi 3 Août au matin pour maintenance du serveur. Nous faisons au mieux pour que celle-ci soit la plus brève possible.

Commit 652ebcbd authored by Pierre Kraemer's avatar Pierre Kraemer
Browse files

Merge remote-tracking branch 'cgogn/develop' into develop

parents 730a9724 4dc1bdba
......@@ -998,7 +998,7 @@ bool exportChoupi(typename PFP::MAP& map, const VertexAttribute<typename PFP::VE
return false ;
}
out << map.template getNbOrbits<VERTEX>() << " " << map.template getNbOrbits<EDGE>() << std::endl;
out << Algo::Topo::getNbOrbits<VERTEX>(map) << " " << Algo::Topo::getNbOrbits<EDGE>(map) << std::endl;
TraversorV<MAP> travV(map);
for(Dart dit = travV.begin() ; dit != travV.end() ; dit = travV.next())
......
......@@ -125,6 +125,9 @@ template <typename PFP>
bool exportTetmesh(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position, const char* filename);
template <typename PFP>
bool exportBoundaryOFF(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position, const char* filename);
} // namespace Export
} // namespace Volume
......
......@@ -853,6 +853,81 @@ bool exportMesh(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3
}
}
template <typename PFP>
bool exportBoundaryOFF(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position, const char* filename)
{
typedef typename PFP::MAP MAP;
typedef typename PFP::VEC3 VEC3;
std::ofstream out(filename, std::ios::out) ;
if (!out.good())
{
CGoGNerr << "Unable to open file " << CGoGNendl ;
return false ;
}
unsigned int nbDarts = map.getNbDarts() ;
std::vector<unsigned int> facesSize ;
std::vector<std::vector<unsigned int> > facesIdx ;
facesSize.reserve(nbDarts/3) ;
facesIdx.reserve(nbDarts/3) ;
std::map<unsigned int, unsigned int> vIndex ;
unsigned int vCpt = 0 ;
std::vector<unsigned int> vertices ;
vertices.reserve(nbDarts/6) ;
CellMarker<typename PFP::MAP,VERTEX> markV(map) ;
TraversorF<MAP> t(map) ;
for(Dart d = t.begin(); d != t.end(); d = t.next())
{
if(map.isBoundaryFace(d))
{
Dart db = d;
if(!map.template isBoundaryMarked<3>(db))
db = map.phi3(db);
std::vector<unsigned int> fidx ;
fidx.reserve(8) ;
unsigned int degree = 0 ;
Traversor2FV<typename PFP::MAP> tfv(map, db) ;
for(Dart it = tfv.begin(); it != tfv.end(); it = tfv.next())
{
++degree ;
unsigned int vNum = map.template getEmbedding<VERTEX>(it) ;
if(!markV.isMarked(it))
{
markV.mark(it) ;
vIndex[vNum] = vCpt++ ;
vertices.push_back(vNum) ;
}
fidx.push_back(vIndex[vNum]) ;
}
facesSize.push_back(degree) ;
facesIdx.push_back(fidx) ;
}
}
out << "OFF" << std::endl ;
out << vertices.size() << " " << facesSize.size() << " " << 0 << std::endl ;
for(unsigned int i = 0; i < vertices.size(); ++i)
{
const VEC3& v = position[vertices[i]] ;
out << v[0] << " " << v[1] << " " << v[2] << std::endl ;
}
for(unsigned int i = 0; i < facesSize.size(); ++i)
{
out << facesSize[i] ;
for(unsigned int j = 0; j < facesIdx[i].size(); ++j)
out << " " << facesIdx[i][j] ;
out << std::endl ;
}
out.close() ;
return true ;
}
} // namespace Export
} // namespace Volume
......
......@@ -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 ;