Commit a91ee675 authored by untereiner's avatar untereiner

moving primal adaptive map2mr to algorithms

parent 7d1ab606
......@@ -31,14 +31,17 @@
namespace CGoGN
{
namespace Multiresolution
namespace Algo
{
class MRFilter
namespace MR
{
class Filter
{
public:
MRFilter() {}
virtual ~MRFilter() {}
Filter() {}
virtual ~Filter() {}
virtual void operator() () = 0 ;
} ;
......@@ -94,7 +97,7 @@ typename PFP::VEC3 loopEvenVertex(typename PFP::MAP& map, const VertexAttribute<
*********************************************************************************/
template <typename PFP>
class LoopOddAnalysisFilter : public MRFilter
class LoopOddAnalysisFilter : public Filter
{
protected:
typename PFP::MAP& m_map ;
......@@ -122,7 +125,7 @@ public:
} ;
template <typename PFP>
class LoopEvenAnalysisFilter : public MRFilter
class LoopEvenAnalysisFilter : public Filter
{
protected:
typename PFP::MAP& m_map ;
......@@ -144,7 +147,7 @@ public:
} ;
template <typename PFP>
class LoopNormalisationAnalysisFilter : public MRFilter
class LoopNormalisationAnalysisFilter : public Filter
{
protected:
typename PFP::MAP& m_map ;
......@@ -173,7 +176,7 @@ public:
*********************************************************************************/
template <typename PFP>
class LoopOddSynthesisFilter : public MRFilter
class LoopOddSynthesisFilter : public Filter
{
protected:
typename PFP::MAP& m_map ;
......@@ -201,7 +204,7 @@ public:
} ;
template <typename PFP>
class LoopEvenSynthesisFilter : public MRFilter
class LoopEvenSynthesisFilter : public Filter
{
protected:
typename PFP::MAP& m_map ;
......@@ -223,7 +226,7 @@ public:
} ;
template <typename PFP>
class LoopNormalisationSynthesisFilter : public MRFilter
class LoopNormalisationSynthesisFilter : public Filter
{
protected:
typename PFP::MAP& m_map ;
......@@ -550,6 +553,8 @@ public:
} // namespace Multiresolution
}
} // namespace CGoGN
#endif
......
......@@ -34,9 +34,30 @@
namespace CGoGN
{
class Map2MR_PrimalAdapt : public EmbeddedMap2
}
namespace Algo
{
namespace MR
{
namespace Primal
{
namespace Adaptive
{
template <typename PFP>
class Map2MR
{
public:
typedef typename PFP::MAP MAP ;
typedef typename PFP::VEC3 VEC3 ;
typedef typename PFP::REAL REAL ;
protected:
MAP& m_map;
bool shareVertexEmbeddings ;
FunctorType* vertexVertexFunctor ;
......@@ -44,9 +65,8 @@ protected:
FunctorType* faceVertexFunctor ;
public:
Map2MR_PrimalAdapt() ;
Map2MR(MAP& map) ;
virtual std::string mapTypeName() const { return "Map2MR_PrimalAdapt" ; }
/***************************************************
* CELLS INFORMATION *
......@@ -150,6 +170,16 @@ public:
void setFaceVertexFunctor(FunctorType* f) { faceVertexFunctor = f ; }
} ;
} // namespace Adaptive
} // namespace Primal
} // namespace MR
} // namespace Algo
} // namespace CGoGN
#include "Algo/Multiresolution/map2MR/map2MR_PrimalAdapt.hpp"
#endif
......@@ -22,25 +22,39 @@
* *
*******************************************************************************/
#include "Topology/map/map2MR/map2MR_PrimalAdapt.h"
#include "Algo/Multiresolution/map2MR/map2MR_PrimalAdapt.h"
namespace CGoGN
{
Map2MR_PrimalAdapt::Map2MR_PrimalAdapt() :
namespace Algo
{
namespace MR
{
namespace Primal
{
namespace Adaptive
{
template <typename PFP>
Map2MR<PFP>::Map2MR(typename PFP::MAP& map) :
m_map(map),
shareVertexEmbeddings(true),
vertexVertexFunctor(NULL),
edgeVertexFunctor(NULL),
faceVertexFunctor(NULL)
{
initMR() ;
}
/***************************************************
* CELLS INFORMATION *
***************************************************/
unsigned int Map2MR_PrimalAdapt::edgeLevel(Dart d)
template <typename PFP>
unsigned int Map2MR<PFP>::edgeLevel(Dart d)
{
assert(getDartLevel(d) <= getCurrentLevel() || !"edgeLevel : called with a dart inserted after current level") ;
......@@ -49,7 +63,8 @@ unsigned int Map2MR_PrimalAdapt::edgeLevel(Dart d)
return ld > ldd ? ld : ldd ; // insertion levels of its two darts
}
unsigned int Map2MR_PrimalAdapt::faceLevel(Dart d)
template <typename PFP>
unsigned int Map2MR<PFP>::faceLevel(Dart d)
{
assert(getDartLevel(d) <= getCurrentLevel() || !"faceLevel : called with a dart inserted after current level") ;
......@@ -88,7 +103,8 @@ unsigned int Map2MR_PrimalAdapt::faceLevel(Dart d)
return min2 ;
}
Dart Map2MR_PrimalAdapt::faceOrigin(Dart d)
template <typename PFP>
Dart Map2MR<PFP>::faceOrigin(Dart d)
{
assert(getDartLevel(d) <= getCurrentLevel() || !"faceOrigin : called with a dart inserted after current level") ;
......@@ -105,7 +121,8 @@ Dart Map2MR_PrimalAdapt::faceOrigin(Dart d)
return p ;
}
Dart Map2MR_PrimalAdapt::faceOldestDart(Dart d)
template <typename PFP>
Dart Map2MR<PFP>::faceOldestDart(Dart d)
{
assert(getDartLevel(d) <= getCurrentLevel() || !"faceOldestDart : called with a dart inserted after current level") ;
......@@ -127,7 +144,8 @@ Dart Map2MR_PrimalAdapt::faceOldestDart(Dart d)
return oldest ;
}
bool Map2MR_PrimalAdapt::edgeIsSubdivided(Dart d)
template <typename PFP>
bool Map2MR<PFP>::edgeIsSubdivided(Dart d)
{
assert(getDartLevel(d) <= getCurrentLevel() || !"edgeIsSubdivided : called with a dart inserted after current level") ;
......@@ -144,7 +162,8 @@ bool Map2MR_PrimalAdapt::edgeIsSubdivided(Dart d)
return false ;
}
bool Map2MR_PrimalAdapt::edgeCanBeCoarsened(Dart d)
template <typename PFP>
bool Map2MR<PFP>::edgeCanBeCoarsened(Dart d)
{
assert(getDartLevel(d) <= getCurrentLevel() || !"edgeCanBeCoarsened : called with a dart inserted after current level") ;
......@@ -169,7 +188,8 @@ bool Map2MR_PrimalAdapt::edgeCanBeCoarsened(Dart d)
return false ;
}
bool Map2MR_PrimalAdapt::faceIsSubdivided(Dart d)
template <typename PFP>
bool Map2MR<PFP>::faceIsSubdivided(Dart d)
{
assert(getDartLevel(d) <= getCurrentLevel() || !"faceIsSubdivided : called with a dart inserted after current level") ;
......@@ -188,7 +208,8 @@ bool Map2MR_PrimalAdapt::faceIsSubdivided(Dart d)
return subd ;
}
bool Map2MR_PrimalAdapt::faceIsSubdividedOnce(Dart d)
template <typename PFP>
bool Map2MR<PFP>::faceIsSubdividedOnce(Dart d)
{
assert(getDartLevel(d) <= getCurrentLevel() || !"faceIsSubdividedOnce : called with a dart inserted after current level") ;
......@@ -250,12 +271,14 @@ bool Map2MR_PrimalAdapt::faceIsSubdividedOnce(Dart d)
* SUBDIVISION *
***************************************************/
void Map2MR_PrimalAdapt::addNewLevel(bool embedNewVertices)
template <typename PFP>
void Map2MR<PFP>::addNewLevel(bool embedNewVertices)
{
addLevelBack() ;
}
void Map2MR_PrimalAdapt::propagateDartRelation(Dart d, AttributeMultiVector<Dart>* rel)
template <typename PFP>
void Map2MR<PFP>::propagateDartRelation(Dart d, AttributeMultiVector<Dart>* rel)
{
Dart dd = (*rel)[dartIndex(d)] ;
pushLevel() ;
......@@ -267,8 +290,9 @@ void Map2MR_PrimalAdapt::propagateDartRelation(Dart d, AttributeMultiVector<Dart
popLevel() ;
}
template <typename PFP>
template <unsigned int ORBIT>
void Map2MR_PrimalAdapt::propagateDartEmbedding(Dart d)
void Map2MR<PFP>::propagateDartEmbedding(Dart d)
{
unsigned int emb = getEmbedding<ORBIT>(d) ;
pushLevel() ;
......@@ -280,8 +304,9 @@ void Map2MR_PrimalAdapt::propagateDartEmbedding(Dart d)
popLevel() ;
}
template <typename PFP>
template <unsigned int ORBIT>
void Map2MR_PrimalAdapt::propagateOrbitEmbedding(Dart d)
void Map2MR<PFP>::propagateOrbitEmbedding(Dart d)
{
unsigned int emb = getEmbedding<ORBIT>(d) ;
pushLevel() ;
......@@ -293,7 +318,7 @@ void Map2MR_PrimalAdapt::propagateOrbitEmbedding(Dart d)
popLevel() ;
}
//Dart Map2MR_PrimalAdapt::cutEdge(Dart d)
//Dart Map2MR::cutEdge(Dart d)
//{
// Dart dd = phi2(d) ;
//
......@@ -323,7 +348,8 @@ void Map2MR_PrimalAdapt::propagateOrbitEmbedding(Dart d)
// return d1 ;
//}
Dart Map2MR_PrimalAdapt::cutEdge(Dart d)
template <typename PFP>
Dart Map2MR<PFP>::cutEdge(Dart d)
{
Dart dd = phi2(d) ;
Dart d1 = EmbeddedMap2::cutEdge(d) ;
......@@ -347,7 +373,7 @@ Dart Map2MR_PrimalAdapt::cutEdge(Dart d)
return d1 ;
}
//void Map2MR_PrimalAdapt::splitFace(Dart d, Dart e)
//void Map2MR::splitFace(Dart d, Dart e)
//{
// Dart dprev = phi_1(d) ;
// Dart eprev = phi_1(e) ;
......@@ -378,7 +404,8 @@ Dart Map2MR_PrimalAdapt::cutEdge(Dart d)
// popLevel() ;
//}
void Map2MR_PrimalAdapt::splitFace(Dart d, Dart e)
template <typename PFP>
void Map2MR<PFP>::splitFace(Dart d, Dart e)
{
Dart dprev = phi_1(d) ;
Dart eprev = phi_1(e) ;
......@@ -401,7 +428,8 @@ void Map2MR_PrimalAdapt::splitFace(Dart d, Dart e)
propagateDartEmbedding<VERTEX>(ee) ;
}
void Map2MR_PrimalAdapt::subdivideEdge(Dart d)
template <typename PFP>
void Map2MR<PFP>::subdivideEdge(Dart d)
{
assert(getDartLevel(d) <= getCurrentLevel() || !"subdivideEdge : called with a dart inserted after current level") ;
assert(!edgeIsSubdivided(d) || !"Trying to subdivide an already subdivided edge") ;
......@@ -420,7 +448,8 @@ void Map2MR_PrimalAdapt::subdivideEdge(Dart d)
decCurrentLevel() ;
}
void Map2MR_PrimalAdapt::coarsenEdge(Dart d)
template <typename PFP>
void Map2MR<PFP>::coarsenEdge(Dart d)
{
assert(getDartLevel(d) <= getCurrentLevel() || !"coarsenEdge : called with a dart inserted after current level") ;
assert(edgeCanBeCoarsened(d) || !"Trying to coarsen an edge that can not be coarsened") ;
......@@ -434,7 +463,8 @@ void Map2MR_PrimalAdapt::coarsenEdge(Dart d)
removeLevelBack() ;
}
unsigned int Map2MR_PrimalAdapt::subdivideFace(Dart d)
template <typename PFP>
unsigned int Map2MR<PFP>::subdivideFace(Dart d)
{
assert(getDartLevel(d) <= getCurrentLevel() || !"subdivideFace : called with a dart inserted after current level") ;
assert(!faceIsSubdivided(d) || !"Trying to subdivide an already subdivided face") ;
......@@ -520,7 +550,8 @@ unsigned int Map2MR_PrimalAdapt::subdivideFace(Dart d)
return fLevel ;
}
void Map2MR_PrimalAdapt::coarsenFace(Dart d)
template <typename PFP>
void Map2MR<PFP>::coarsenFace(Dart d)
{
assert(getDartLevel(d) <= getCurrentLevel() || !"coarsenFace : called with a dart inserted after current level") ;
assert(faceIsSubdividedOnce(d) || !"Trying to coarsen a non-subdivided face or a more than once subdivided face") ;
......@@ -568,4 +599,12 @@ void Map2MR_PrimalAdapt::coarsenFace(Dart d)
removeLevelBack() ;
}
} // namespace Adaptive
} // namespace Primal
} // namespace MR
} // namespace Algo
} // namespace CGoGN
......@@ -29,7 +29,7 @@
#include "Topology/generic/traversorCell.h"
#include "Topology/generic/traversor2.h"
#include "Topology/map/map2MR/filters_Primal.h"
#include "Algo/Multiresolution/map2MR/filters_Primal.h"
namespace CGoGN
{
......@@ -59,8 +59,8 @@ protected:
MAP& m_map;
bool shareVertexEmbeddings ;
std::vector<CGoGN::Multiresolution::MRFilter*> synthesisFilters ;
std::vector<CGoGN::Multiresolution::MRFilter*> analysisFilters ;
std::vector<CGoGN::Algo::MR::Filter*> synthesisFilters ;
std::vector<CGoGN::Algo::MR::Filter*> analysisFilters ;
public:
Map2MR(MAP& map) ;
......@@ -68,8 +68,8 @@ public:
void addNewLevel(bool embedNewVertices = true) ;
void addSynthesisFilter(CGoGN::Multiresolution::MRFilter* f) { synthesisFilters.push_back(f) ; }
void addAnalysisFilter(CGoGN::Multiresolution::MRFilter* f) { analysisFilters.push_back(f) ; }
void addSynthesisFilter(CGoGN::Algo::MR::Filter* f) { synthesisFilters.push_back(f) ; }
void addAnalysisFilter(CGoGN::Algo::MR::Filter* f) { analysisFilters.push_back(f) ; }
void clearSynthesisFilters() { synthesisFilters.clear() ; }
void clearAnalysisFilters() { analysisFilters.clear() ; }
......
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