Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
David Cazier
CGoGN
Commits
fe862269
Commit
fe862269
authored
Jun 05, 2013
by
Sylvain Thery
Browse files
remove polymorphism in markers
parent
f3916a06
Changes
8
Hide whitespace changes
Inline
Side-by-side
include/Topology/generic/cellmarker.h
View file @
fe862269
...
...
@@ -32,7 +32,10 @@
namespace
CGoGN
{
/**
* @brief The CellMarkerGen class
* @warning CellMarkerGen is no polymorphic version of CellMarker
*/
class
CellMarkerGen
{
friend
class
GenericMap
;
...
...
@@ -53,7 +56,7 @@ public:
releaseOnDestruct
(
true
)
{}
virtual
~
CellMarkerGen
()
~
CellMarkerGen
()
{}
unsigned
int
getThread
()
{
return
m_thread
;
}
...
...
@@ -66,15 +69,15 @@ public:
*/
void
setReleaseOnDestruct
(
bool
b
)
{
releaseOnDestruct
=
b
;
}
virtual
void
mark
(
Dart
d
)
=
0
;
virtual
void
unmark
(
Dart
d
)
=
0
;
virtual
bool
isMarked
(
Dart
d
)
const
=
0
;
virtual
void
mark
(
unsigned
int
em
)
=
0
;
virtual
void
unmark
(
unsigned
int
em
)
=
0
;
virtual
bool
isMarked
(
unsigned
int
em
)
const
=
0
;
virtual
void
markAll
()
=
0
;
virtual
void
unmarkAll
()
=
0
;
virtual
bool
isAllUnmarked
()
=
0
;
//
virtual void mark(Dart d) = 0 ;
//
virtual void unmark(Dart d) = 0 ;
//
virtual bool isMarked(Dart d) const = 0 ;
//
virtual void mark(unsigned int em) = 0 ;
//
virtual void unmark(unsigned int em) = 0 ;
//
virtual bool isMarked(unsigned int em) const = 0 ;
//
virtual void markAll() = 0 ;
//
virtual void unmarkAll() = 0 ;
//
virtual bool isAllUnmarked() = 0 ;
};
/**
...
...
@@ -98,7 +101,7 @@ public:
m_map
.
cellMarkers
[
m_thread
].
push_back
(
this
)
;
}
virtual
~
CellMarkerBase
()
/*
virtual
*/
~
CellMarkerBase
()
{
if
(
releaseOnDestruct
)
{
...
...
@@ -126,7 +129,7 @@ public:
/**
* mark the cell of dart
*/
virtual
void
mark
(
Dart
d
)
inline
void
mark
(
Dart
d
)
{
assert
(
m_map
.
getMarkerSet
<
CELL
>
(
m_thread
).
testMark
(
m_mark
));
assert
(
m_markVector
!=
NULL
);
...
...
@@ -140,7 +143,7 @@ public:
/**
* unmark the cell of dart
*/
virtual
void
unmark
(
Dart
d
)
inline
void
unmark
(
Dart
d
)
{
assert
(
m_map
.
getMarkerSet
<
CELL
>
(
m_thread
).
testMark
(
m_mark
));
assert
(
m_markVector
!=
NULL
);
...
...
@@ -154,7 +157,7 @@ public:
/**
* test if cell of dart is marked
*/
virtual
bool
isMarked
(
Dart
d
)
const
inline
bool
isMarked
(
Dart
d
)
const
{
assert
(
m_map
.
getMarkerSet
<
CELL
>
(
m_thread
).
testMark
(
m_mark
));
assert
(
m_markVector
!=
NULL
);
...
...
@@ -168,7 +171,7 @@ public:
/**
* mark the cell
*/
virtual
void
mark
(
unsigned
int
em
)
inline
void
mark
(
unsigned
int
em
)
{
assert
(
m_map
.
getMarkerSet
<
CELL
>
(
m_thread
).
testMark
(
m_mark
));
assert
(
m_markVector
!=
NULL
);
...
...
@@ -179,7 +182,7 @@ public:
/**
* unmark the cell
*/
virtual
void
unmark
(
unsigned
int
em
)
inline
void
unmark
(
unsigned
int
em
)
{
assert
(
m_map
.
getMarkerSet
<
CELL
>
(
m_thread
).
testMark
(
m_mark
));
assert
(
m_markVector
!=
NULL
);
...
...
@@ -190,7 +193,7 @@ public:
/**
* test if cell is marked
*/
virtual
bool
isMarked
(
unsigned
int
em
)
const
inline
bool
isMarked
(
unsigned
int
em
)
const
{
assert
(
m_map
.
getMarkerSet
<
CELL
>
(
m_thread
).
testMark
(
m_mark
));
assert
(
m_markVector
!=
NULL
);
...
...
@@ -201,7 +204,7 @@ public:
/**
* mark all the cells
*/
virtual
void
markAll
()
inline
void
markAll
()
{
assert
(
m_map
.
getMarkerSet
<
CELL
>
(
m_thread
).
testMark
(
m_mark
));
assert
(
m_markVector
!=
NULL
);
...
...
@@ -211,7 +214,7 @@ public:
m_markVector
->
operator
[](
i
).
setMark
(
m_mark
)
;
}
virtual
bool
isAllUnmarked
()
inline
bool
isAllUnmarked
()
{
assert
(
m_map
.
getMarkerSet
<
CELL
>
(
m_thread
).
testMark
(
m_mark
));
assert
(
m_markVector
!=
NULL
);
...
...
@@ -235,7 +238,7 @@ public:
CellMarker
(
GenericMap
&
map
,
unsigned
int
thread
=
0
)
:
CellMarkerBase
<
CELL
>
(
map
,
thread
)
{}
virtual
~
CellMarker
()
~
CellMarker
()
{
unmarkAll
()
;
}
...
...
@@ -245,7 +248,7 @@ protected:
{}
public:
virtual
void
unmarkAll
()
inline
void
unmarkAll
()
{
assert
(
this
->
m_map
.
template
getMarkerSet
<
CELL
>(
this
->
m_thread
).
testMark
(
this
->
m_mark
));
assert
(
this
->
m_markVector
!=
NULL
);
...
...
@@ -271,7 +274,7 @@ public:
CellMarkerStore
(
GenericMap
&
map
,
unsigned
int
thread
=
0
)
:
CellMarkerBase
<
CELL
>
(
map
,
thread
)
{}
virtual
~
CellMarkerStore
()
~
CellMarkerStore
()
{
unmarkAll
()
;
// assert(isAllUnmarked);
...
...
@@ -283,19 +286,19 @@ protected:
{}
public:
void
mark
(
Dart
d
)
inline
void
mark
(
Dart
d
)
{
CellMarkerBase
<
CELL
>::
mark
(
d
)
;
m_markedCells
.
push_back
(
this
->
m_map
.
template
getEmbedding
<
CELL
>(
d
))
;
}
void
mark
(
unsigned
int
em
)
inline
void
mark
(
unsigned
int
em
)
{
CellMarkerBase
<
CELL
>::
mark
(
em
)
;
m_markedCells
.
push_back
(
em
)
;
}
void
unmarkAll
()
inline
void
unmarkAll
()
{
assert
(
this
->
m_map
.
template
getMarkerSet
<
CELL
>(
this
->
m_thread
).
testMark
(
this
->
m_mark
));
assert
(
this
->
m_markVector
!=
NULL
);
...
...
@@ -319,7 +322,7 @@ public:
CellMarkerMemo
(
GenericMap
&
map
,
unsigned
int
thread
=
0
)
:
CellMarkerBase
<
CELL
>
(
map
,
thread
)
{}
virtual
~
CellMarkerMemo
()
~
CellMarkerMemo
()
{
unmarkAll
()
;
// assert(isAllUnmarked);
...
...
@@ -331,7 +334,7 @@ protected:
{}
public:
void
mark
(
Dart
d
)
inline
void
mark
(
Dart
d
)
{
if
(
!
this
->
isMarked
(
d
))
{
...
...
@@ -340,7 +343,7 @@ public:
}
}
void
unmarkAll
()
inline
void
unmarkAll
()
{
assert
(
this
->
m_map
.
template
getMarkerSet
<
CELL
>(
this
->
m_thread
).
testMark
(
this
->
m_mark
));
assert
(
this
->
m_markVector
!=
NULL
);
...
...
@@ -351,7 +354,8 @@ public:
m_markedDarts
.
clear
();
}
std
::
vector
<
Dart
>
get_markedCells
()
inline
std
::
vector
<
Dart
>
get_markedCells
()
{
return
m_markedDarts
;
}
...
...
@@ -368,7 +372,7 @@ public:
CellMarkerNoUnmark
(
GenericMap
&
map
,
unsigned
int
thread
=
0
)
:
CellMarkerBase
<
CELL
>
(
map
,
thread
)
{}
virtual
~
CellMarkerNoUnmark
()
~
CellMarkerNoUnmark
()
{
// assert(isAllUnmarked()) ;
// CGoGN_ASSERT(this->isAllUnmarked())
...
...
@@ -379,7 +383,7 @@ protected:
{}
public:
void
unmarkAll
()
inline
void
unmarkAll
()
{
assert
(
this
->
m_map
.
template
getMarkerSet
<
CELL
>(
this
->
m_thread
).
testMark
(
this
->
m_mark
));
assert
(
this
->
m_markVector
!=
NULL
);
...
...
@@ -401,13 +405,13 @@ protected:
const
CellMarkerBase
<
CELL
>&
m_cmarker
;
public:
SelectorCellMarked
(
const
CellMarkerBase
<
CELL
>&
cm
)
:
m_cmarker
(
cm
)
{}
bool
operator
()(
Dart
d
)
const
inline
bool
operator
()(
Dart
d
)
const
{
if
(
m_cmarker
.
isMarked
(
d
))
return
true
;
return
false
;
}
FunctorSelect
*
copy
()
const
{
return
new
SelectorCellMarked
(
m_cmarker
);
}
inline
FunctorSelect
*
copy
()
const
{
return
new
SelectorCellMarked
(
m_cmarker
);
}
};
template
<
unsigned
int
CELL
>
...
...
@@ -417,13 +421,13 @@ protected:
const
CellMarkerBase
<
CELL
>&
m_cmarker
;
public:
SelectorCellUnmarked
(
const
CellMarkerBase
<
CELL
>&
cm
)
:
m_cmarker
(
cm
)
{}
bool
operator
()(
Dart
d
)
const
inline
bool
operator
()(
Dart
d
)
const
{
if
(
!
m_cmarker
.
isMarked
(
d
))
return
true
;
return
false
;
}
FunctorSelect
*
copy
()
const
{
return
new
SelectorCellUnmarked
(
m_cmarker
);
}
inline
FunctorSelect
*
copy
()
const
{
return
new
SelectorCellUnmarked
(
m_cmarker
);
}
};
// Functor version (needed for use with foreach_xxx)
...
...
@@ -435,7 +439,7 @@ protected:
CellMarkerBase
<
CELL
>&
m_marker
;
public:
FunctorCellIsMarked
(
CellMarkerBase
<
CELL
>&
cm
)
:
m_marker
(
cm
)
{}
bool
operator
()(
Dart
d
)
inline
bool
operator
()(
Dart
d
)
{
return
m_marker
.
isMarked
(
d
);
}
...
...
@@ -448,7 +452,7 @@ protected:
CellMarkerBase
<
CELL
>&
m_marker
;
public:
FunctorCellIsUnmarked
(
CellMarkerBase
<
CELL
>&
cm
)
:
m_marker
(
cm
)
{}
bool
operator
()(
Dart
d
)
inline
bool
operator
()(
Dart
d
)
{
return
!
m_marker
.
isMarked
(
d
);
}
...
...
include/Topology/generic/dartmarker.h
View file @
fe862269
...
...
@@ -61,7 +61,7 @@ public:
m_map
.
dartMarkers
[
m_thread
].
push_back
(
this
)
;
}
virtual
~
DartMarkerGen
()
~
DartMarkerGen
()
{
if
(
releaseOnDestruct
)
{
...
...
@@ -79,12 +79,12 @@ public:
}
}
unsigned
int
getThread
()
inline
unsigned
int
getThread
()
{
return
m_thread
;
}
void
updateMarkVector
(
AttributeMultiVector
<
Mark
>*
amv
)
inline
void
updateMarkVector
(
AttributeMultiVector
<
Mark
>*
amv
)
{
m_markVector
=
amv
;
}
...
...
@@ -99,7 +99,7 @@ protected:
/**
* set if the mark has to be release on destruction or not
*/
void
setReleaseOnDestruct
(
bool
b
)
inline
void
setReleaseOnDestruct
(
bool
b
)
{
releaseOnDestruct
=
b
;
}
...
...
@@ -108,7 +108,7 @@ public:
/**
* mark the dart
*/
virtual
void
mark
(
Dart
d
)
inline
void
mark
(
Dart
d
)
{
assert
(
m_map
.
getMarkerSet
<
DART
>
(
m_thread
).
testMark
(
m_mark
));
unsigned
int
d_index
=
m_map
.
dartIndex
(
d
)
;
...
...
@@ -118,7 +118,7 @@ public:
/**
* unmark the dart
*/
virtual
void
unmark
(
Dart
d
)
inline
void
unmark
(
Dart
d
)
{
assert
(
m_map
.
getMarkerSet
<
DART
>
(
m_thread
).
testMark
(
m_mark
));
unsigned
int
d_index
=
m_map
.
dartIndex
(
d
)
;
...
...
@@ -128,7 +128,7 @@ public:
/**
* test if dart is marked
*/
virtual
bool
isMarked
(
Dart
d
)
const
inline
bool
isMarked
(
Dart
d
)
const
{
assert
(
m_map
.
getMarkerSet
<
DART
>
(
m_thread
).
testMark
(
m_mark
));
unsigned
int
d_index
=
m_map
.
dartIndex
(
d
)
;
...
...
@@ -139,7 +139,7 @@ public:
* mark the darts of the given orbit of d
*/
template
<
unsigned
int
ORBIT
>
void
markOrbit
(
Dart
d
)
inline
void
markOrbit
(
Dart
d
)
{
assert
(
m_map
.
getMarkerSet
<
DART
>
(
m_thread
).
testMark
(
m_mark
));
FunctorMark
<
GenericMap
>
fm
(
m_map
,
m_mark
,
m_markVector
)
;
...
...
@@ -150,7 +150,7 @@ public:
* unmark the darts of the given orbit of d
*/
template
<
unsigned
int
ORBIT
>
void
unmarkOrbit
(
Dart
d
)
inline
void
unmarkOrbit
(
Dart
d
)
{
assert
(
m_map
.
getMarkerSet
<
DART
>
(
m_thread
).
testMark
(
m_mark
));
FunctorUnmark
<
GenericMap
>
fm
(
m_map
,
m_mark
,
m_markVector
)
;
...
...
@@ -182,7 +182,7 @@ public:
/**
* mark all darts
*/
virtual
void
markAll
()
inline
void
markAll
()
{
assert
(
m_map
.
getMarkerSet
<
DART
>
(
m_thread
).
testMark
(
m_mark
));
AttributeContainer
&
cont
=
m_map
.
getAttributeContainer
<
DART
>
()
;
...
...
@@ -193,9 +193,9 @@ public:
/**
* unmark all darts
*/
virtual
void
unmarkAll
()
=
0
;
//
virtual void unmarkAll() = 0 ;
bool
isAllUnmarked
()
inline
bool
isAllUnmarked
()
{
assert
(
m_map
.
getMarkerSet
<
DART
>
(
m_thread
).
testMark
(
m_mark
));
assert
(
m_markVector
!=
NULL
);
...
...
@@ -224,7 +224,7 @@ public:
{
}
virtual
~
DartMarker
()
~
DartMarker
()
{
unmarkAll
()
;
}
...
...
@@ -236,7 +236,7 @@ protected:
}
public:
void
unmarkAll
()
inline
void
unmarkAll
()
{
assert
(
m_map
.
getMarkerSet
<
DART
>
(
m_thread
).
testMark
(
m_mark
));
AttributeContainer
&
cont
=
m_map
.
getAttributeContainer
<
DART
>
()
;
...
...
@@ -280,7 +280,7 @@ protected:
}
public:
void
mark
(
Dart
d
)
inline
void
mark
(
Dart
d
)
{
DartMarkerGen
::
mark
(
d
)
;
unsigned
int
d_index
=
m_map
.
dartIndex
(
d
)
;
...
...
@@ -288,7 +288,7 @@ public:
}
template
<
unsigned
int
ORBIT
>
void
markOrbit
(
Dart
d
)
inline
void
markOrbit
(
Dart
d
)
{
assert
(
m_map
.
getMarkerSet
<
DART
>
(
m_thread
).
testMark
(
m_mark
));
FunctorMarkStore
<
GenericMap
>
fm
(
m_map
,
m_mark
,
m_markVector
,
m_markedDarts
)
;
...
...
@@ -309,7 +309,7 @@ public:
// m_markedDarts.push_back(d) ;
// }
void
unmarkAll
()
inline
void
unmarkAll
()
{
assert
(
m_map
.
getMarkerSet
<
DART
>
(
m_thread
).
testMark
(
m_mark
));
for
(
std
::
vector
<
unsigned
int
>::
iterator
it
=
m_markedDarts
.
begin
();
it
!=
m_markedDarts
.
end
();
++
it
)
...
...
@@ -348,7 +348,7 @@ protected:
}
public:
void
unmarkAll
()
inline
void
unmarkAll
()
{
assert
(
m_map
.
getMarkerSet
<
DART
>
(
m_thread
).
testMark
(
m_mark
));
AttributeContainer
&
cont
=
m_map
.
getAttributeContainer
<
DART
>
()
;
...
...
@@ -369,11 +369,11 @@ public:
m_marker
(
m
)
{
}
bool
operator
()(
Dart
d
)
const
inline
bool
operator
()(
Dart
d
)
const
{
return
m_marker
.
isMarked
(
d
)
;
}
FunctorSelect
*
copy
()
const
inline
FunctorSelect
*
copy
()
const
{
return
new
SelectorMarked
(
m_marker
)
;
}
...
...
@@ -388,11 +388,11 @@ public:
m_marker
(
m
)
{
}
bool
operator
()(
Dart
d
)
const
inline
bool
operator
()(
Dart
d
)
const
{
return
!
m_marker
.
isMarked
(
d
)
;
}
FunctorSelect
*
copy
()
const
inline
FunctorSelect
*
copy
()
const
{
return
new
SelectorUnmarked
(
m_marker
)
;
}
...
...
@@ -409,7 +409,7 @@ public:
m_marker
(
dm
)
{
}
bool
operator
()(
Dart
d
)
inline
bool
operator
()(
Dart
d
)
{
return
m_marker
.
isMarked
(
d
)
;
}
...
...
@@ -424,7 +424,7 @@ public:
m_marker
(
dm
)
{
}
bool
operator
()(
Dart
d
)
inline
bool
operator
()(
Dart
d
)
{
return
!
m_marker
.
isMarked
(
d
)
;
}
...
...
include/Topology/generic/traversor2Virt.hpp~
deleted
100644 → 0
View file @
f3916a06
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
namespace CGoGN
{
/*******************************************************************************
VERTEX CENTERED TRAVERSALS
*******************************************************************************/
// Traversor2VE
template <typename MAP>
Traversor2VE<MAP>::Traversor2VE(MAP& map, Dart dart) : m(map), start(dart),m_QLT(NULL)
{
AttributeMultiVector<NoTypeNameAttribute<std::vector<Dart> > >* quickTraversal = map.template getQuickIncidentTraversal<VERTEX,EDGE>() ;
if (quickTraversal != NULL)
{
m_QLT = &(quickTraversal->operator[](map.template getEmbedding<VERTEX>(dart)));
}
}
template <typename MAP>
Dart Traversor2VE<MAP>::begin()
{
if(m_QLT != NULL)
{
m_ItDarts = m_QLT->begin();
return *m_ItDarts++;
}
current = start ;
return current ;
}
template <typename MAP>
Dart Traversor2VE<MAP>::end()
{
return NIL ;
}
template <typename MAP>
Dart Traversor2VE<MAP>::next()
{
if(m_QLT != NULL)
{
return *m_ItDarts++;
}
if(current != NIL)
{
// current = m.alpha1(current) ;
current = m.phi2(m.phi_1(current)) ;
if(current == start)
current = NIL ;
}
return current ;
}
// Traversor2VF
template <typename MAP>
Traversor2VF<MAP>::Traversor2VF(MAP& map, Dart dart) : m(map), start(dart),m_QLT(NULL)
{
AttributeMultiVector<NoTypeNameAttribute<std::vector<Dart> > >* quickTraversal = map.template getQuickIncidentTraversal<VERTEX,FACE>() ;
if (quickTraversal != NULL)
{
m_QLT = &(quickTraversal->operator[](map.template getEmbedding<VERTEX>(dart)));
}
else
{
if(m.isBoundaryMarked2(start)) // jump over a boundary face
start = m.phi2(m.phi_1(start)) ;
}
}
template <typename MAP>
Dart Traversor2VF<MAP>::begin()
{
if(m_QLT != NULL)
{
m_ItDarts = m_QLT->begin();
return *m_ItDarts++;
}
current = start ;
return current ;
}
template <typename MAP>
Dart Traversor2VF<MAP>::end()
{
return NIL ;
}
template <typename MAP>
Dart Traversor2VF<MAP>::next()
{
if(m_QLT != NULL)
{
return *m_ItDarts++;
}
if(current != NIL)
{
current = m.phi2(m.phi_1(current)) ;
if(m.isBoundaryMarked2(current)) // jump over a boundary face
current = m.phi2(m.phi_1(current)) ;
if(current == start)
current = NIL ;
}
return current ;
}
// Traversor2VVaE
template <typename MAP>
Traversor2VVaE<MAP>::Traversor2VVaE(MAP& map, Dart dart) : m(map),m_QLT(NULL)
{
AttributeMultiVector<NoTypeNameAttribute<std::vector<Dart> > >* quickTraversal = map.template getQuickAdjacentTraversal<VERTEX,EDGE>() ;
if (quickTraversal != NULL)
{
m_QLT = &(quickTraversal->operator[](map.template getEmbedding<VERTEX>(dart)));
}
else
{
start = m.phi2(dart) ;
}
}
template <typename MAP>
Dart Traversor2VVaE<MAP>::begin()
{
if(m_QLT != NULL)
{
m_ItDarts = m_QLT->begin();
return *m_ItDarts++;
}
current = start ;
return current ;
}
template <typename MAP>
Dart Traversor2VVaE<MAP>::end()
{
return NIL ;
}
template <typename MAP>
Dart Traversor2VVaE<MAP>::next()
{
if(m_QLT != NULL)