Commit ea955ff5 authored by Sylvain Thery's avatar Sylvain Thery

Merge cgogn:~cgogn/CGoGN into CGoGN_MT

Conflicts:
	include/Topology/generic/cellmarker.h
	include/Topology/generic/genericmap.hpp
parents 28febb3c 44019bb7
...@@ -165,7 +165,9 @@ void coarsenFace(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position) ...@@ -165,7 +165,9 @@ void coarsenFace(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position)
unsigned int cur = map.getCurrentLevel() ; unsigned int cur = map.getCurrentLevel() ;
map.setCurrentLevel(cur + 1) ; map.setCurrentLevel(cur + 1) ;
map.deleteVertex(map.phi1(map.phi1(d))) ; Dart cv = map.phi1(map.phi1(d)) ;
map.setCurrentLevel(map.getMaxLevel()) ;
map.deleteVertex(cv) ;
map.setCurrentLevel(cur) ; map.setCurrentLevel(cur) ;
Dart fit = d ; Dart fit = d ;
do do
......
...@@ -40,6 +40,8 @@ class ParticleCell2D : public ParticleBase ...@@ -40,6 +40,8 @@ class ParticleCell2D : public ParticleBase
DartMarker& obstacle; DartMarker& obstacle;
bool changeCell ;
ParticleCell2D() {} ParticleCell2D() {}
ParticleCell2D(Map& map, Dart belonging_cell, VEC3 pos, TAB_POS tabPos, DartMarker& obst) : ParticleBase(pos), m(map), d(belonging_cell), m_positions(tabPos), obstacle(obst) ParticleCell2D(Map& map, Dart belonging_cell, VEC3 pos, TAB_POS tabPos, DartMarker& obst) : ParticleBase(pos), m(map), d(belonging_cell), m_positions(tabPos), obstacle(obst)
...@@ -71,6 +73,7 @@ class ParticleCell2D : public ParticleBase ...@@ -71,6 +73,7 @@ class ParticleCell2D : public ParticleBase
void move(const VEC3& newCurrent) void move(const VEC3& newCurrent)
{ {
changeCell = false ;
if(!Geom::arePointsEquals(newCurrent, m_position)) { if(!Geom::arePointsEquals(newCurrent, m_position)) {
prevPos = m_position; prevPos = m_position;
...@@ -88,7 +91,6 @@ class ParticleCell2D : public ParticleBase ...@@ -88,7 +91,6 @@ class ParticleCell2D : public ParticleBase
}; };
#include "particle_cell_2D.hpp" #include "particle_cell_2D.hpp"
//namespace
} }
......
...@@ -69,6 +69,7 @@ void ParticleCell2D<PFP>::vertexState(const VEC3& current) ...@@ -69,6 +69,7 @@ void ParticleCell2D<PFP>::vertexState(const VEC3& current)
#endif #endif
assert(std::isfinite(current[0]) && std::isfinite(current[1]) && std::isfinite(current[2])); assert(std::isfinite(current[0]) && std::isfinite(current[1]) && std::isfinite(current[2]));
changeCell = true;
if(Algo::Geometry::isPointOnVertex<PFP>(m,d,m_positions,current)) { if(Algo::Geometry::isPointOnVertex<PFP>(m,d,m_positions,current)) {
state = VERTEX_ORBIT; state = VERTEX_ORBIT;
return; return;
...@@ -88,23 +89,20 @@ void ParticleCell2D<PFP>::vertexState(const VEC3& current) ...@@ -88,23 +89,20 @@ void ParticleCell2D<PFP>::vertexState(const VEC3& current)
if(dd_vert==d) { if(dd_vert==d) {
//orbit with 2 edges : point on one edge //orbit with 2 edges : point on one edge
if(m.alpha1(m.alpha1(d))==d) { if(m.alpha1(m.alpha1(d))==d) {
if(!Algo::Geometry::isPointOnHalfEdge<PFP>(m,d,m_positions,current)) { if(!Algo::Geometry::isPointOnHalfEdge<PFP>(m,d,m_positions,current)) {
d = m.alpha1(d); d = m.alpha1(d);
} }
} }
else { else {
state = VERTEX_ORBIT; state = VERTEX_ORBIT;
return; return;
} }
} }
} }
else { else {
std::cout << "ploc" << std::endl;
Dart dd_vert = m.alpha1(d); Dart dd_vert = m.alpha1(d);
while(getOrientationEdge(current,d)==Geom::RIGHT && dd_vert!=d) { while(getOrientationEdge(current,d)==Geom::RIGHT && dd_vert!=d) {
std::cout << "tourne" << std::endl;
d = m.alpha_1(d); d = m.alpha_1(d);
if(m_positions[d][0]==m_positions[m.phi1(d)][0] && m_positions[d][1]==m_positions[m.phi1(d)][1]) { if(m_positions[d][0]==m_positions[m.phi1(d)][0] && m_positions[d][1]==m_positions[m.phi1(d)][1]) {
d=m.alpha_1(d); d=m.alpha_1(d);
} }
...@@ -114,7 +112,6 @@ void ParticleCell2D<PFP>::vertexState(const VEC3& current) ...@@ -114,7 +112,6 @@ void ParticleCell2D<PFP>::vertexState(const VEC3& current)
//displacement step //displacement step
// if(!obstacle.isMarked(d)) { // if(!obstacle.isMarked(d)) {
if(getOrientationEdge(current,d)==Geom::ALIGNED && Algo::Geometry::isPointOnHalfEdge<PFP>(m,d,m_positions,current)) { if(getOrientationEdge(current,d)==Geom::ALIGNED && Algo::Geometry::isPointOnHalfEdge<PFP>(m,d,m_positions,current)) {
std::cout << m.vertexDegree(d) << std::endl;
edgeState(current); edgeState(current);
} }
else { else {
...@@ -135,6 +132,7 @@ void ParticleCell2D<PFP>::edgeState(const VEC3& current, Geom::Orientation2D sid ...@@ -135,6 +132,7 @@ void ParticleCell2D<PFP>::edgeState(const VEC3& current, Geom::Orientation2D sid
assert(std::isfinite(current[0]) && std::isfinite(current[1]) && std::isfinite(current[2])); assert(std::isfinite(current[0]) && std::isfinite(current[1]) && std::isfinite(current[2]));
// assert(Algo::Geometry::isPointOnEdge<PFP>(m,d,m_positions,m_position)); // assert(Algo::Geometry::isPointOnEdge<PFP>(m,d,m_positions,m_position));
changeCell = true;
if(sideOfEdge==Geom::ALIGNED) if(sideOfEdge==Geom::ALIGNED)
sideOfEdge = getOrientationEdge(current,d); sideOfEdge = getOrientationEdge(current,d);
......
...@@ -33,6 +33,10 @@ namespace CGoGN ...@@ -33,6 +33,10 @@ namespace CGoGN
class AttribMap : public GenericMap class AttribMap : public GenericMap
{ {
friend class CellMarker ;
friend class CellMarkerStore ;
friend class CellMarkerNoUnmark ;
template<typename T> friend class AutoAttributeHandler ; template<typename T> friend class AutoAttributeHandler ;
public: public:
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#define __CELL_MARKER__ #define __CELL_MARKER__
#include "Topology/generic/marker.h" #include "Topology/generic/marker.h"
#include "Topology/generic/genericmap.h" #include "Topology/generic/attribmap.h"
#define VERTEX_CELL VERTEX_ORBIT #define VERTEX_CELL VERTEX_ORBIT
#define EDGE_CELL EDGE_ORBIT #define EDGE_CELL EDGE_ORBIT
...@@ -45,8 +45,9 @@ class CellMarker ...@@ -45,8 +45,9 @@ class CellMarker
{ {
protected: protected:
Marker m_marker; Marker m_marker;
GenericMap& m_map; AttribMap& m_map;
unsigned int m_thread; unsigned int m_thread;
public: public:
/** /**
* constructor * constructor
...@@ -54,12 +55,15 @@ public: ...@@ -54,12 +55,15 @@ public:
* @param cell the type of cell we want to mark VERTEX_CELL, EDGE_CELL,... * @param cell the type of cell we want to mark VERTEX_CELL, EDGE_CELL,...
* \pre the cell is embedded in the map * \pre the cell is embedded in the map
*/ */
CellMarker(GenericMap& map, unsigned int cell): m_map(map), m_thread(0)
CellMarker(AttribMap& map, unsigned int cell): m_map(map), m_thread(0)
{ {
if(!map.isOrbitEmbedded(cell))
map.addEmbedding(cell) ;
m_marker = map.getNewMarker(cell); m_marker = map.getNewMarker(cell);
} }
CellMarker(GenericMap& map, unsigned int cell, unsigned int thread): m_map(map), m_thread(thread) CellMarker(AttribMap& map, unsigned int cell, unsigned int thread): m_map(map), m_thread(thread)
{ {
m_marker = map.getNewMarker(cell,thread); m_marker = map.getNewMarker(cell,thread);
} }
...@@ -173,10 +177,10 @@ public: ...@@ -173,10 +177,10 @@ public:
* @param cell the type of cell we want to mark VERTEX_CELL, EDGE_CELL,... * @param cell the type of cell we want to mark VERTEX_CELL, EDGE_CELL,...
* \pre the cell is embedded in the map * \pre the cell is embedded in the map
*/ */
CellMarkerStore(GenericMap& map, unsigned int cell): CellMarker(map, cell) CellMarkerStore(AttribMap& map, unsigned int cell): CellMarker(map, cell)
{} {}
CellMarkerStore(GenericMap& map, unsigned int cell, unsigned int thread): CellMarker(map, cell,thread) CellMarkerStore(AttribMap& map, unsigned int cell, unsigned int thread): CellMarker(map, cell,thread)
{} {}
protected: protected:
...@@ -226,11 +230,11 @@ public: ...@@ -226,11 +230,11 @@ public:
* @param cell the type of cell we want to mark VERTEX_CELL, EDGE_CELL,... * @param cell the type of cell we want to mark VERTEX_CELL, EDGE_CELL,...
* \pre the cell is embedded in the map * \pre the cell is embedded in the map
*/ */
CellMarkerNoUnmark(GenericMap& map, unsigned int cell): CellMarker(map, cell) CellMarkerNoUnmark(AttribMap& map, unsigned int cell): CellMarker(map, cell)
{} {}
CellMarkerNoUnmark(GenericMap& map, unsigned int cell, unsigned int thread): CellMarker(map, cell,thread) CellMarkerNoUnmark(AttribMap& map, unsigned int cell, unsigned int thread): CellMarker(map, cell,thread)
{} {}
~CellMarkerNoUnmark() ~CellMarkerNoUnmark()
......
...@@ -186,7 +186,7 @@ bool EmbeddedMap2<MAP2>::edgeCanCollapse(Dart d) ...@@ -186,7 +186,7 @@ bool EmbeddedMap2<MAP2>::edgeCanCollapse(Dart d)
template <typename MAP2> template <typename MAP2>
void EmbeddedMap2<MAP2>::collapseEdge(Dart d, bool delDegenerateFaces) void EmbeddedMap2<MAP2>::collapseEdge(Dart d, bool delDegenerateFaces)
{ {
Dart dPrev = MAP2::phi_1(d) ; Dart dPrev2 = MAP2::phi2(MAP2::phi_1(d)) ;
unsigned int vEmb = EMBNULL ; unsigned int vEmb = EMBNULL ;
if (MAP2::isOrbitEmbedded(VERTEX_ORBIT)) if (MAP2::isOrbitEmbedded(VERTEX_ORBIT))
...@@ -198,9 +198,7 @@ void EmbeddedMap2<MAP2>::collapseEdge(Dart d, bool delDegenerateFaces) ...@@ -198,9 +198,7 @@ void EmbeddedMap2<MAP2>::collapseEdge(Dart d, bool delDegenerateFaces)
if (MAP2::isOrbitEmbedded(VERTEX_ORBIT)) if (MAP2::isOrbitEmbedded(VERTEX_ORBIT))
{ {
Dart dPrev2 = MAP2::phi2(dPrev) ; MAP2::embedOrbit(VERTEX_ORBIT, dPrev2, vEmb) ;
if(dPrev2 != dPrev)
MAP2::embedOrbit(VERTEX_ORBIT, dPrev2, vEmb) ;
} }
} }
......
...@@ -76,10 +76,6 @@ class GenericMap : public MapBrowser ...@@ -76,10 +76,6 @@ class GenericMap : public MapBrowser
friend class DartMarkerStore ; friend class DartMarkerStore ;
friend class DartMarkerNoUnmark ; friend class DartMarkerNoUnmark ;
friend class CellMarker ;
friend class CellMarkerStore ;
friend class CellMarkerNoUnmark ;
template<typename T> friend class AutoAttributeHandler ; template<typename T> friend class AutoAttributeHandler ;
protected: protected:
......
...@@ -243,7 +243,6 @@ inline AttribMultiVectGen& GenericMap::getMultiVec(unsigned int idAttr) ...@@ -243,7 +243,6 @@ inline AttribMultiVectGen& GenericMap::getMultiVec(unsigned int idAttr)
inline AttribContainer& GenericMap::getAttributeContainer(unsigned int orbit) inline AttribContainer& GenericMap::getAttributeContainer(unsigned int orbit)
{ {
// assert(isOrbitEmbedded(orbit) || !"Invalid parameter: orbit not embedded");
return m_attribs[orbit] ; return m_attribs[orbit] ;
} }
...@@ -253,7 +252,8 @@ inline AttribContainer& GenericMap::getAttributeContainer(unsigned int orbit) ...@@ -253,7 +252,8 @@ inline AttribContainer& GenericMap::getAttributeContainer(unsigned int orbit)
inline Marker GenericMap::getNewMarker(unsigned int cell, unsigned int thread) inline Marker GenericMap::getNewMarker(unsigned int cell, unsigned int thread)
{ {
assert(isOrbitEmbedded(cell) || !"Try to get a marker on non embedded cell! ") ;
// assert(isOrbitEmbedded(cell) || !"Try to get a marker on non embedded cell! ") ;
return m_orbMarker[cell][thread].getNewMarker(cell) ; return m_orbMarker[cell][thread].getNewMarker(cell) ;
} }
......
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