Création d'un compte pour un collaborateur extérieur au laboratoire depuis l'intranet ICube : https://intranet.icube.unistra.fr/fr/labs/member/profile

Commit 5d492710 authored by Pierre Kraemer's avatar Pierre Kraemer
Browse files

Merge branch 'no_boundary' of cgogn:~thery/CGoGN into no_boundary

parents e8669802 d05ecf9e
......@@ -32,64 +32,6 @@
namespace CGoGN
{
// Marker Functors
/********************************************************/
template <typename MAP>
class FunctorMarker : public FunctorMap<MAP>
{
protected:
Mark m_mark ;
AttributeMultiVector<Mark>* m_markTable ;
public:
FunctorMarker(MAP& map, Mark m, AttributeMultiVector<Mark>* mTable) : FunctorMap<MAP>(map), m_mark(m), m_markTable(mTable)
{}
// Mark getMark() { return m_mark ; }
} ;
template <typename MAP>
class FunctorMark : public FunctorMarker<MAP>
{
public:
FunctorMark(MAP& map, Mark m, AttributeMultiVector<Mark>* mTable) : FunctorMarker<MAP>(map, m, mTable)
{}
bool operator()(Dart d)
{
this->m_markTable->operator[](d.index).setMark(this->m_mark) ;
return false ;
}
} ;
template <typename MAP>
class FunctorMarkStore : public FunctorMarker<MAP>
{
protected:
std::vector<unsigned int>& m_markedDarts ;
public:
FunctorMarkStore(MAP& map, Mark m, AttributeMultiVector<Mark>* mTable, std::vector<unsigned int>& marked) :
FunctorMarker<MAP>(map, m, mTable),
m_markedDarts(marked)
{}
bool operator()(Dart d)
{
this->m_markTable->operator[](d.index).setMark(this->m_mark) ;
m_markedDarts.push_back(d.index) ;
return false ;
}
} ;
template <typename MAP>
class FunctorUnmark : public FunctorMarker<MAP>
{
public:
FunctorUnmark(MAP& map, Mark m, AttributeMultiVector<Mark>* mTable) : FunctorMarker<MAP>(map, m, mTable)
{}
bool operator()(Dart d)
{
this->m_markTable->operator[](d.index).unsetMark(this->m_mark) ;
return false ;
}
} ;
/**
* generic class that allows the marking of darts
......
......@@ -27,6 +27,7 @@
#include "Topology/generic/dart.h"
#include "Topology/generic/marker.h"
#include "Container/attributeMultiVector.h"
#include <vector>
namespace CGoGN
......@@ -174,6 +175,67 @@ public:
}
};
// Marker Functors
/********************************************************/
template <typename MAP>
class FunctorMarker : public FunctorMap<MAP>
{
protected:
Mark m_mark ;
AttributeMultiVector<Mark>* m_markTable ;
public:
FunctorMarker(MAP& map, Mark m, AttributeMultiVector<Mark>* mTable) : FunctorMap<MAP>(map), m_mark(m), m_markTable(mTable)
{}
// Mark getMark() { return m_mark ; }
} ;
template <typename MAP>
class FunctorMark : public FunctorMarker<MAP>
{
public:
FunctorMark(MAP& map, Mark m, AttributeMultiVector<Mark>* mTable) : FunctorMarker<MAP>(map, m, mTable)
{}
bool operator()(Dart d)
{
this->m_markTable->operator[](d.index).setMark(this->m_mark) ;
return false ;
}
} ;
template <typename MAP>
class FunctorMarkStore : public FunctorMarker<MAP>
{
protected:
std::vector<unsigned int>& m_markedDarts ;
public:
FunctorMarkStore(MAP& map, Mark m, AttributeMultiVector<Mark>* mTable, std::vector<unsigned int>& marked) :
FunctorMarker<MAP>(map, m, mTable),
m_markedDarts(marked)
{}
bool operator()(Dart d)
{
this->m_markTable->operator[](d.index).setMark(this->m_mark) ;
m_markedDarts.push_back(d.index) ;
return false ;
}
} ;
template <typename MAP>
class FunctorUnmark : public FunctorMarker<MAP>
{
public:
FunctorUnmark(MAP& map, Mark m, AttributeMultiVector<Mark>* mTable) : FunctorMarker<MAP>(map, m, mTable)
{}
bool operator()(Dart d)
{
this->m_markTable->operator[](d.index).unsetMark(this->m_mark) ;
return false ;
}
} ;
} //namespace CGoGN
#endif
......@@ -403,6 +403,42 @@ public:
* print attributes name of map in std::cout (for debugging)
*/
void viewAttributesTables();
protected:
/// boundary marker
Mark m_boundaryMarker;
/**
* mark a dart as belonging to boundary
*/
void boundaryMark(Dart d);
/**
* unmark a dart from the boundary
*/
void boundaryUnmark(Dart d);
/**
* test if a dart belong to the boundary
*/
bool isBoundaryMarked(Dart d);
/**
* mark an orbit of dart as belonging to boundary
*/
void boundaryMarkOrbit(unsigned int orbit, Dart d);
/**
* unmark an orbit of dart from the boundary
*/
void boundaryUnmarkOrbit(unsigned int orbit, Dart d);
/**
* clear all boundary markers
*/
void boundaryUnmarkAll();
} ;
......
......@@ -95,6 +95,14 @@ protected:
*/
void phi2unsew(Dart d);
//! merge a face that has been tag as boundary with existing boundary if needed
/* @param d a dart of the face
*/
void mergeFacewithBoundary(Dart d);
/*! @name Generator and Deletor
* To generate or delete faces in a 2-map
*************************************************************************/
......@@ -104,8 +112,7 @@ protected:
/*! The phi2-links around the face are removed
* @param d a dart of the face
*/
void deleteOrientedFace(Dart d) ; //TODO remove ?
void deleteOrientedFace(Dart d) ;
public:
virtual void deleteFace(Dart d) ;
......
......@@ -96,57 +96,55 @@ inline Dart Map2::alpha0(Dart d)
return phi2(d) ;
}
#ifdef NO_BOUND_MAP
inline Dart Map2::alpha1(Dart d)
{
return phi2(phi_1(d)) ;
}
#else
// alpha1 avec bord
inline Dart Map2::alpha1(Dart d)
{
Dart e = phi_1(d);
Dart f = phi2(e);
if (f != e)
return f;
// alpha1 avec bord: bye bye
//inline Dart Map2::alpha1(Dart d)
//{
// Dart e = phi_1(d);
// Dart f = phi2(e);
//
// if (f != e)
// return f;
//
// f = d;
// e = phi2(f);
// while (e != f)
// {
// f = phi1(e);
// e = phi2(f);
// }
// return f;
//}
f = d;
e = phi2(f);
while (e != f)
{
f = phi1(e);
e = phi2(f);
}
return f;
}
#endif
#ifdef NO_BOUND_MAP
inline Dart Map2::alpha_1(Dart d)
{
return phi1(phi2(d)) ;
}
#else
// alpha_1 avec bord
inline Dart Map2::alpha_1(Dart d)
{
Dart e = phi2(d);
if (e != d)
return phi1(e);
// alpha_1 avec bord : bye bye !!
//inline Dart Map2::alpha_1(Dart d)
//{
// Dart e = phi2(d);
//
// if (e != d)
// return phi1(e);
//
// e = d;
// Dart f = phi_1(d);
// while (phi2(f) != f)
// {
// e = phi2(f);
// f = phi_1(e);
// }
// return e;
//}
e = d;
Dart f = phi_1(d);
while (phi2(f) != f)
{
e = phi2(f);
f = phi_1(e);
}
return e;
}
#endif
inline void Map2::phi2sew(Dart d, Dart e)
{
......
......@@ -78,10 +78,16 @@ GenericMap::GenericMap() : m_nbThreads(1)
m_markTables[i][j] = NULL ;
}
}
// get & lock marker for boundary
m_boundaryMarker = m_marksets[DART][0].getNewMark();
}
GenericMap::~GenericMap()
{
// release marker for boundary
m_marksets[DART][0].releaseMark(m_boundaryMarker);
for(unsigned int i = 0; i < NB_ORBITS; ++i)
{
if(isOrbitEmbedded(i))
......@@ -641,4 +647,44 @@ void GenericMap::viewAttributesTables()
}
void GenericMap::boundaryMark(Dart d)
{
m_markTables[DART][0]->operator[](d.index).setMark(m_boundaryMarker);
}
void GenericMap::boundaryUnmark(Dart d)
{
m_markTables[DART][0]->operator[](d.index).unsetMark(m_boundaryMarker);
}
bool GenericMap::isBoundaryMarked(Dart d)
{
return m_markTables[DART][0]->operator[](d.index).testMark(m_boundaryMarker);
}
void GenericMap::boundaryMarkOrbit(unsigned int orbit, Dart d)
{
FunctorMark<GenericMap> fm(*this, m_boundaryMarker, m_markTables[DART][0]) ;
foreach_dart_of_orbit(orbit, d, fm, 0) ;
}
void GenericMap::boundaryUnmarkOrbit(unsigned int orbit, Dart d)
{
FunctorUnmark<GenericMap> fm(*this, m_boundaryMarker, m_markTables[DART][0]) ;
foreach_dart_of_orbit(orbit, d, fm, 0) ;
}
void GenericMap::boundaryUnmarkAll()
{
AttributeContainer& cont = getAttributeContainer(DART) ;
for (unsigned int i = cont.begin(); i != cont.end(); cont.next(i))
m_markTables[DART][0]->operator[](i).unsetMark(m_boundaryMarker);
}
} // namespace CGoGN
......@@ -31,15 +31,34 @@ namespace CGoGN
* To generate or delete faces in a 2-map
*************************************************************************/
void Map2::deleteOrientedFace(Dart d)
void Map2::mergeFacewithBoundary(Dart d)
{
Dart e = d ;
do
do // foreach edge of face
{
phi2unsew(e) ; // unsew the face of d
e = phi1(e) ; // from all its adjacent faces
Dart f = phi2(e);
if (isBoundaryMarked(f)) // if sewed to boundary
{
phi2unsew(e);// ?? not necessary
Dart ff = phi_1(f);
if (e != ff)
phi1sew(e, ff) ; // merge with it
Dart ee = phi_1(e);
if (f != ee)
phi1sew(f, ee) ;
deleteOrientedFace(e) ;
}
e = phi1(e) ;
} while (e != d) ;
Map1::deleteOrientedFace(d); // delete the face
}
void Map2::deleteOrientedFace(Dart d)
{
// tag face in boundary
boundaryMarkOrbit(FACE,d);
mergeFacewithBoundary(d);
}
/*! @name Topological Operators
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment