Commit 6a6f9b63 authored by untereiner's avatar untereiner

debut menage dans la maison 3-carte (emb+topo)

parent 61611d16
......@@ -25,9 +25,10 @@
#ifndef __IMPLICIT_HIERARCHICAL_MAP3__
#define __IMPLICIT_HIERARCHICAL_MAP3__
#include "Topology/map/map3.h"
#include "Topology/generic/embeddedMap3.h"
#include "Container/attributeContainer.h"
//#include "Topology/map/map3.h"
//#include "Topology/generic/embeddedMap3.h"
//#include "Container/attributeContainer.h"
#include "Topology/map/embeddedMap3.h"
namespace CGoGN
{
......@@ -40,7 +41,7 @@ namespace IHM
template<typename T> class AttributeHandler_IHM ;
class ImplicitHierarchicalMap3 : public EmbeddedMap3<Map3>
class ImplicitHierarchicalMap3 : public EmbeddedMap3
{
template<typename T> friend class AttributeHandler_IHM ;
......
......@@ -350,71 +350,83 @@ bool EmbeddedMap3<MAP3>::check()
return false ;
CGoGNout << "Check: embedding begin" << CGoGNendl ;
DartMarker mv(*this);
for(Dart d = MAP3::begin(); d != MAP3::end(); MAP3::next(d))
{
if (MAP3::isOrbitEmbedded(VERTEX))
{
if (MAP3::phi2(MAP3::phi_1(d)) != MAP3::phi_1(d) && MAP3::getEmbedding(VERTEX, d) != MAP3::getEmbedding(VERTEX, MAP3::phi2(MAP3::phi_1(d))))
{
CGoGNout << "Check: different embeddings on vertex" << CGoGNendl ;
return false ;
}
if(MAP3::phi3(d) != d && MAP3::getEmbedding(VERTEX, d) != MAP3::getEmbedding(VERTEX, MAP3::phi1(MAP3::phi3(d))))
{
CGoGNout << "Check: different embeddings on vertex in the 2 oriented faces" << CGoGNendl ;
CGoGNout << "Dart #" << d << CGoGNendl;
CGoGNout << "Emb(d) = " << MAP3::getEmbedding(VERTEX, d) << CGoGNendl;
CGoGNout << "Emb(phi32(d)) = " << MAP3::getEmbedding(VERTEX, MAP3::phi3(MAP3::phi2(d))) << CGoGNendl;
return false ;
}
}
if (MAP3::isOrbitEmbedded(EDGE))
{
if (MAP3::getEmbedding(EDGE, d) != MAP3::getEmbedding(EDGE, MAP3::phi2(d)))
{
CGoGNout << "Check: different embeddings on edge" << CGoGNendl ;
return false ;
}
if (MAP3::getEmbedding(EDGE, d) != MAP3::getEmbedding(EDGE, MAP3::phi3(d)))
{
CGoGNout << "Check: different embeddings on edge" << CGoGNendl ;
return false ;
}
}
if (MAP3::isOrbitEmbedded(FACE))
if(MAP3::isOrbitEmbedded(VERTEX))
{
if (MAP3::getEmbedding(FACE, d) != MAP3::getEmbedding(FACE, MAP3::phi1(d)))
if(!mv.isMarked(d))
{
CGoGNout << "Check: different embeddings on face" << CGoGNendl ;
return false ;
}
if (MAP3::getEmbedding(FACE, d) != MAP3::getEmbedding(FACE, MAP3::phi3(d)))
{
CGoGNout << "Check: different embeddings on face" << CGoGNendl ;
return false ;
mv.markOrbit(VERTEX, d);
unsigned int emb = MAP3::getEmbedding(VERTEX, d);
FunctorCheckEmbedding<MAP3> fce(*this, VERTEX, emb);
MAP3::foreach_dart_of_orbit(VERTEX, d, fce);
}
}
if (MAP3::isOrbitEmbedded(VOLUME))
{
if (MAP3::getEmbedding(VOLUME, d) != MAP3::getEmbedding(VOLUME, MAP3::phi1(d)))
{
CGoGNout << "Check: different embeddings in volume" << CGoGNendl ;
return false ;
}
if (MAP3::getEmbedding(VOLUME, d) != MAP3::getEmbedding(VOLUME, MAP3::phi2(d)))
{
CGoGNout << "Check: different embeddings in volume" << CGoGNendl ;
return false ;
}
}
// if (MAP3::isOrbitEmbedded(VERTEX))
// {
// if (MAP3::phi2(MAP3::phi_1(d)) != MAP3::phi_1(d) && MAP3::getEmbedding(VERTEX, d) != MAP3::getEmbedding(VERTEX, MAP3::phi2(MAP3::phi_1(d))))
// {
// CGoGNout << "Check: different embeddings on vertex" << CGoGNendl ;
// return false ;
// }
//
// if(MAP3::phi3(d) != d && MAP3::getEmbedding(VERTEX, d) != MAP3::getEmbedding(VERTEX, MAP3::phi1(MAP3::phi3(d))))
// {
// CGoGNout << "Check: different embeddings on vertex in the 2 oriented faces" << CGoGNendl ;
// CGoGNout << "Dart #" << d << CGoGNendl;
// CGoGNout << "Emb(d) = " << MAP3::getEmbedding(VERTEX, d) << CGoGNendl;
// CGoGNout << "Emb(phi32(d)) = " << MAP3::getEmbedding(VERTEX, MAP3::phi3(MAP3::phi2(d))) << CGoGNendl;
// return false ;
// }
//
// }
//
// if (MAP3::isOrbitEmbedded(EDGE))
// {
// if (MAP3::getEmbedding(EDGE, d) != MAP3::getEmbedding(EDGE, MAP3::phi2(d)))
// {
// CGoGNout << "Check: different embeddings on edge" << CGoGNendl ;
// return false ;
// }
//
// if (MAP3::getEmbedding(EDGE, d) != MAP3::getEmbedding(EDGE, MAP3::phi3(d)))
// {
// CGoGNout << "Check: different embeddings on edge" << CGoGNendl ;
// return false ;
// }
// }
//
// if (MAP3::isOrbitEmbedded(FACE))
// {
// if (MAP3::getEmbedding(FACE, d) != MAP3::getEmbedding(FACE, MAP3::phi1(d)))
// {
// CGoGNout << "Check: different embeddings on face" << CGoGNendl ;
// return false ;
// }
//
// if (MAP3::getEmbedding(FACE, d) != MAP3::getEmbedding(FACE, MAP3::phi3(d)))
// {
// CGoGNout << "Check: different embeddings on face" << CGoGNendl ;
// return false ;
// }
// }
//
// if (MAP3::isOrbitEmbedded(VOLUME))
// {
// if (MAP3::getEmbedding(VOLUME, d) != MAP3::getEmbedding(VOLUME, MAP3::phi1(d)))
// {
// CGoGNout << "Check: different embeddings in volume" << CGoGNendl ;
// return false ;
// }
//
// if (MAP3::getEmbedding(VOLUME, d) != MAP3::getEmbedding(VOLUME, MAP3::phi2(d)))
// {
// CGoGNout << "Check: different embeddings in volume" << CGoGNendl ;
// return false ;
// }
// }
}
CGoGNout << "Check: embedding ok" << CGoGNendl ;
return true ;
......
......@@ -113,6 +113,25 @@ public:
}
};
// Functor Check Embedding : to check the embeddings of the given map
template <typename MAP>
class FunctorCheckEmbedding : public FunctorMap<MAP>
{
protected:
unsigned int orbit;
unsigned int emb;
public:
FunctorCheckEmbedding(MAP& map, unsigned int orb, unsigned int e) : FunctorMap<MAP>(map), orbit(orb), emb(e)
{}
bool operator()(Dart d)
{
return (this->m_map.getEmbedding(orbit, d) != emb);
}
};
// Search Functor: look for a given dart when applied
/********************************************************/
......@@ -157,6 +176,7 @@ public:
}
};
// Multiple Functor: to apply several Functors in turn to a dart
/********************************************************/
......
......@@ -39,69 +39,55 @@ class EmbeddedMap3 : public Map3
public:
typedef Map3 TOPO_MAP;
//!
/*!
*
*/
virtual void sewVolumes(Dart d, Dart e);
virtual bool deleteVertex(Dart d);
/*! No attribute is attached to the new vertex
* The attributes attached to the old edge are duplicated on both resulting edges
* @param d a dart
*/
virtual void cutEdge(Dart d);
/*! The attributes attached to the edge of d are kept on the resulting edge
* @param d a dart of the edge to cut
*/
virtual void uncutEdge(Dart d);
//!
/*!
*
*/
virtual void unsewVolumes(Dart d);
virtual void splitFace(Dart d, Dart e);
//!
/*!
*
*/
virtual bool mergeVolumes(Dart d);
virtual Dart cutSpike(Dart d);
//! Split a face inserting an edge between two vertices
/*! \pre Dart d and e should belong to the same face and be distinct
* @param d dart of first vertex
* @param e dart of second vertex
* @return the dart of the new edge lying in the vertex of d after the cut
/*!
*
*/
virtual void splitFace(Dart d, Dart e);
virtual void sewVolumes(Dart d, Dart e);
//! Cut the edge of d
/*! @param d a dart of the edge to cut
/*!
*
*/
virtual void cutEdge(Dart d);
virtual void unsewVolumes(Dart d);
//!
/*!
*
*/
virtual Dart cutSpike(Dart d);
virtual bool mergeVolumes(Dart d);
//! Collapse an edge (that is deleted) possibly merging its vertices
/*! If delDegenerateFaces is true, the method checks that no degenerate
* faces are build (faces with less than 3 edges). If it occurs the faces
* are deleted and the adjacencies are updated (see deleteIfDegenerated).
* \warning This may produce two distinct vertices if the edge
* was the only link between two border faces
* @param d a dart in the deleted edge
* @param delDegenerateFaces a boolean (default to true)
*/
virtual int collapseEdge(Dart d, bool delDegenerateFaces = true,
bool delDegenerateVolumes = true);
//!
/*!
*
*/
virtual void collapseFace(Dart d, bool delDegenerateFaces = true,
bool delDegenerateVolumes = true);
virtual bool check();
//????????? fonction de 2-carte
virtual unsigned int closeHole(Dart d);
virtual void closeMap(DartMarker &marker);
virtual bool check();
} ;
} // namespace CGoGN
......
......@@ -305,18 +305,18 @@ public:
*/
bool sameVertex(Dart d, Dart e) ;
/**
* compute the number of edges of the vertex of d
//! Compute the number of edges of the vertex of d
/*! @param d a dart
*/
unsigned int vertexDegree(Dart d) ;
/**
* compute the number of faces in the volume of d
//! Compute the number of faces in the volume of d
/*! @param d a dart
*/
unsigned int volumeDegree(Dart d);
/**
* tell if the vertex of d is on the boundary of the map
//! Tell if the vertex of d is on the boundary of the map
/*! @param d a dart
*/
bool isBoundaryVertex(Dart d) ;
......@@ -373,20 +373,6 @@ public:
*/
bool foreach_dart_of_cc(Dart d, FunctorType& f, unsigned int thread=0);
//!
/*! TODO Ajout a valider
* restreint aux complexes simpliciaux
* Apply a functor on the all darts in the set of the star from orbit
*/
bool foreach_dart_of_star(Dart d, unsigned int orbit, FunctorType& f, unsigned int thread=0);
//!
/*! TODO Ajout a valider
* restreint aux complexes simpliciaux
* Apply a functor on the all darts in the set of the link from orbit
*/
bool foreach_dart_of_link(Dart d, unsigned int orbit, FunctorType& f, unsigned int thread=0);
//@}
};
......
......@@ -86,30 +86,30 @@ public:
protected:
//! Link dart d with dart e by an involution
/* @param d,e the darts to link
/*! @param d,e the darts to link
* - Before: d->d and e->e
* - After: d->e and e->d
*/
void phi3sew(Dart d, Dart e);
//! Unlink the current dart by an involution
/* @param d the dart to unlink
/*! @param d the dart to unlink
* - Before: d->e and e->d
* - After: d->d and e->e
*/
void phi3unsew(Dart d);
public:
/*! @name Generator and Deletor
* To generate or delete volumes in a 3-map
*************************************************************************/
public:
//@{
//! Delete an oriented volume
/*! @param d a dart of the volume
//! Delete a volume erasing all its darts.
/*! The phi3-links around the volume are removed
* @param d a dart of the volume
*/
virtual void deleteOrientedVolume(Dart d);
virtual void deleteVolume(Dart d);
//@}
/*! @name Topological Operators
......@@ -117,22 +117,23 @@ public:
*************************************************************************/
//@{
//! Sew two oriented volumes along their faces.
/*! The oriented faces should not be phi3-linked and have the same length
* @param d a dart of the first volume
* @param e a dart of the second volume
//TODO deleteVertex : works only for boundary vertices
//! Delete the vertex of d
/*! All the faces around the vertex are merged into one face
* @param d a dart of the vertex to delete
* @return true if the deletion has been executed, false otherwise
*/
virtual void sewVolumes(Dart d, Dart e);
virtual bool deleteVertex(Dart d);
//! Unsew two oriented volumes along their faces.
/*! @param d a dart of one volume
//! Cut the edge of d (all darts around edge orbit are cutted)
/*! @param d a dart of the edge to cut
*/
virtual void unsewVolumes(Dart d);
virtual void cutEdge(Dart d);
//! Merge to volume sewed by one face
/*! @param d a dart of common face
//! Uncut the edge of d (all darts around edge orbit are uncutted)
/*! @param d a dart of the edge to uncut
*/
virtual bool mergeVolumes(Dart d);
virtual void uncutEdge(Dart d);
//! Split a face inserting an edge between two vertices
/*! \pre Dart d and e should belong to the same face and be distinct
......@@ -142,93 +143,29 @@ public:
*/
virtual void splitFace(Dart d, Dart e);
//! Cut the edge of d
/*! @param d a dart of the edge to cut
*/
virtual void cutEdge(Dart d);
//! Uncut the edge of d
/*! @param d a dart of the edge to uncut
*/
virtual void uncutEdge(Dart d);
//!
/*!
*
//! Unsew the faces from the one-ring of the vertex of d
/*! @param d a dart
*/
virtual bool deleteVertex(Dart d);
virtual Dart cutSpike(Dart d);
//!
/*! Flip the edge of d (rotation in phi1 order)
* WARNING : works only if the edge is owned by exactly one or two volumes
* @param d the edge to flip
//! Sew two oriented volumes along their faces.
/*! The oriented faces should not be phi3-linked and have the same length
* @param d a dart of the first volume
* @param e a dart of the second volume
*/
//virtual bool flipEdge(Dart d);
virtual void sewVolumes(Dart d, Dart e);
//!
/*! Flip the edge of d (rotation in phi_1 order)
* WARNING : works only if the edge is owned by exactly one or two volumes
* @param d the edge to flip
//! Unsew two oriented volumes along their faces.
/*! @param d a dart of one volume
*/
//virtual bool flipBackEdge(Dart d);
virtual void unsewVolumes(Dart d);
//!
/*!
*
*/
//virtual bool flipFace(Dart d);
//! Insert a face in phi2 along the orbit phi<-1,2,-1>
/*! The cardinality of <phi1>(nF) must be equal to the cardinality of <phi(-1,2,-1)>(d)
* @param d a dart where the face should be inserted
* @param e a dart from the face to insert
*/
//virtual void insertFace(Dart d, Dart e);
//! Collapse an edge (that is deleted) possibly merging its vertices
/*! If delDegenerateFaces is true, the method checks that no degenerate
* faces are build (faces with less than 3 edges). If it occurs the faces
* are deleted and the adjacencies are updated (see deleteIfDegenerated).
* \warning This may produce two distinct vertices if the edge
* was the only link between two border faces
* @param d a dart in the deleted edge
* @param delDegenerateFaces a boolean (default to true)
*/
virtual int collapseEdge(Dart d, bool delDegenerateFaces = true, bool delDegenerateVolumes = true);
//!
/*!
*
* @param
* @param
* @param
*/
virtual void collapseFace(Dart d, bool delDegenerateFaces = true, bool delDegenerateVolumes = true);
//!
/*!
*
* @param
* @param
* @param
*/
virtual void collapseVolume(Dart d, bool delDegenerateFaces = true, bool delDegenerateVolumes = true);
/** Fusion two faces deleting the two edges after d and e
* and their respective phi3 faces
*! \pre Dart d and e should belong to distinct faces
* \pre Dart d and e should not be phi2-linked
* \pre Dart d and e should not be phi3-linked
* @param d a dart in the first face
* @param e a dart in the second face
//! Merge to volume along their common oriented face
/*! @param d a dart of common face
*/
virtual bool mergeFaces(Dart d, Dart e);
virtual bool mergeVolumes(Dart d);
//!
/*!
*
*/
virtual Dart cutSpike(Dart d);
//@}
/*! @name Topological Queries
* Return or set various topological information
......@@ -247,7 +184,16 @@ public:
*/
bool sameVertex(Dart d, Dart e) ;
//@{
//! Compute the number of edges of the vertex of d
/*! @param d a dart
*/
unsigned int vertexDegree(Dart d) ;
//! Tell if the vertex of d is on the boundary
/*! @param d a dart
*/
bool isBoundaryVertex(Dart d);
//! Test if dart d and e belong to the same oriented edge
/*! @param d a dart
* @param e a dart
......@@ -260,28 +206,29 @@ public:
*/
bool sameEdge(Dart d, Dart e) ;
//!
/*
*
//! Compute the number of volumes around the edge of d
/*! @param d a dart
*/
virtual int edgeDegree(Dart d);
int edgeDegree(Dart d);
/**
* compute the number of edges of the vertex of d
//! Test if dart d and e belong to the same oriented face
/*! @param d a dart
* @param e a dart
*/
unsigned int vertexDegree(Dart d) ;
bool sameFace(Dart d, Dart e);
//!
/* Tell if a face of the volume is on the boundary
*
//! Test if the face is on the boundary
/*! @param d a dart from the face
*/
virtual bool isBoundaryVolume(Dart d);
bool isBoundaryFace(Dart d);
/**
*
//! Tell if a face of the volume is on the boundary
/* @param d a dart
*/
virtual bool isBoundaryVertex(Dart d);
bool isBoundaryVolume(Dart d);
// TODO a mettre dans algo ?
virtual bool check();
//@}
/*! @name Cell Functors
......@@ -289,105 +236,43 @@ public:
*************************************************************************/
//@{
/**
* Apply a functor on each dart of a vertex
* @param d a dart of the vertex
* @param fonct the functor
*/
//! Apply a functor on each dart of a vertex
/*! @param d a dart of the vertex
* @param fonct the functor
*/
bool foreach_dart_of_vertex(Dart d, FunctorType& f, unsigned int thread=0);
/**
* Apply a functor on each dart of an edge
* @param d a dart of the oriented edge
* @param fonct the functor
*/
//! Apply a functor on each dart of an edge
/*! @param d a dart of the oriented edge
* @param fonct the functor
*/
bool foreach_dart_of_edge(Dart d, FunctorType& f, unsigned int thread=0);
bool foreach_dart_of_open_edge(Dart d, FunctorType& f, unsigned int thread=0);
/**
* Apply a functor on each dart of an oriented face
* @param d a dart of the oriented face
* @param fonct the functor
*/
//! Apply a functor on each dart of an oriented face
/*! @param d a dart of the oriented face
* @param fonct the functor
*/
bool foreach_dart_of_face(Dart d, FunctorType& f, unsigned int thread=0);
/**
* Apply a functor on each dart of an volume
* @param d a dart of the volume
* @param fonct the functor
*/
// TODO change to oriented volume to handle higher dimension ?
//! Apply a functor on each dart of an volume
/*! @param d a dart of the volume
* @param fonct the functor
*/
bool foreach_dart_of_volume(Dart d, FunctorType& f, unsigned int thread=0)
{
return foreach_dart_of_oriented_volume(d,f);
}
// template<typename TMAP>
// bool foreach_dart_of_parent_cell(int dim, Dart d, FunctorType& f);
/**
* Apply a functor on each dart of a cc
* @param d a dart of the cc
* @param fonct the functor
*/
//! Apply a functor on each dart of a cc
/*! @param d a dart of the cc
* @param fonct the functor
*/
bool foreach_dart_of_cc(Dart d, FunctorType& f, unsigned int thread=0);