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
Thomas Pitiot
CGoGN
Commits
22d81ee3
Commit
22d81ee3
authored
Jun 11, 2014
by
Sylvain Thery
Browse files
Merge branch 'thread++11' into develop
Conflicts: src/Topology/generic/genericmap.cpp
parents
dc4c5b2d
c4c16e07
Changes
26
Expand all
Hide whitespace changes
Inline
Side-by-side
Apps/Examples/viewer.cpp
View file @
22d81ee3
...
...
@@ -459,55 +459,35 @@ void Viewer::cb_keyPress(int keycode)
Utils
::
Chrono
ch
;
ch
.
start
();
for
(
unsigned
int
i
=
0
;
i
<
4
;
++
i
)
Algo
::
Surface
::
Geometry
::
computeNormalVertices
<
PFP
>
(
myMap
,
position
,
normal
)
;
std
::
cout
<<
"Algo::Surface::Geometry::Parallel::computeNormalVertices "
<<
ch
.
elapsed
()
<<
" ms "
<<
std
::
endl
;
ch
.
start
();
CGoGN
::
Parallel
::
NumberOfThreads
=
1
;
for
(
unsigned
int
i
=
0
;
i
<
4
;
++
i
)
Algo
::
Surface
::
Geometry
::
Parallel
::
computeNormalVertices
<
PFP
>
(
myMap
,
position
,
normal
)
;
std
::
cout
<<
"Algo::Surface::Geometry::Parallel::computeNormalVertices1 "
<<
ch
.
elapsed
()
<<
" ms "
<<
std
::
endl
;
ch
.
start
();
CGoGN
::
Parallel
::
NumberOfThreads
=
2
;
for
(
unsigned
int
i
=
0
;
i
<
4
;
++
i
)
Algo
::
Surface
::
Geometry
::
Parallel
::
computeNormalVertices
<
PFP
>
(
myMap
,
position
,
normal
)
;
std
::
cout
<<
"Algo::Surface::Geometry::Parallel::computeNormalVertices2 "
<<
ch
.
elapsed
()
<<
" ms "
<<
std
::
endl
;
ch
.
start
();
CGoGN
::
Parallel
::
NumberOfThreads
=
3
;
for
(
unsigned
int
i
=
0
;
i
<
4
;
++
i
)
Algo
::
Surface
::
Geometry
::
Parallel
::
computeNormalVertices
<
PFP
>
(
myMap
,
position
,
normal
)
;
std
::
cout
<<
"Algo::Surface::Geometry::Parallel::computeNormalVertices3 "
<<
ch
.
elapsed
()
<<
" ms "
<<
std
::
endl
;
ch
.
start
();
CGoGN
::
Parallel
::
NumberOfThreads
=
4
;
for
(
unsigned
int
i
=
0
;
i
<
4
;
++
i
)
Algo
::
Surface
::
Geometry
::
Parallel
::
computeNormalVertices
<
PFP
>
(
myMap
,
position
,
normal
)
;
std
::
cout
<<
"Algo::Surface::Geometry::Parallel::computeNormalVertices4 "
<<
ch
.
elapsed
()
<<
" ms "
<<
std
::
endl
;
ch
.
start
();
CGoGN
::
Parallel
::
NumberOfThreads
=
8
;
for
(
unsigned
int
i
=
0
;
i
<
4
;
++
i
)
Algo
::
Surface
::
Geometry
::
Parallel
::
computeNormalVertices
<
PFP
>
(
myMap
,
position
,
normal
)
;
std
::
cout
<<
"Algo::Surface::Geometry::Parallel::computeNormalVertices8 "
<<
ch
.
elapsed
()
<<
" ms "
<<
std
::
endl
;
ch
.
start
();
for
(
unsigned
int
i
=
0
;
i
<
4
;
++
i
)
Parallel
::
foreach_cell
<
VERTEX
>
(
myMap
,
[
&
]
(
Vertex
v
,
unsigned
int
th
)
{
normal
[
v
]
=
Algo
::
Surface
::
Geometry
::
vertexNormal
<
PFP
>
(
myMap
,
v
,
position
);
},
false
,
FORCE_CELL_MARKING
);
std
::
cout
<<
"Parallel::foreach_cell "
<<
ch
.
elapsed
()
<<
" ms "
<<
std
::
endl
;
// ch.start();
// Parallel::foreach_cell_EO<VERTEX>(myMap,[&](Vertex v, unsigned int thr)
...
...
Apps/Examples/volumeExplorer.cpp
View file @
22d81ee3
...
...
@@ -439,8 +439,8 @@ int main(int argc, char **argv)
position
=
myMap
.
addAttribute
<
VEC3
,
VERTEX
,
MAP
>
(
"position"
);
int
nb
=
8
;
Algo
::
Volume
::
Tilings
::
Cubic
::
Grid
<
PFP
>
cubic
(
myMap
,
nb
,
nb
,
nb
);
cubic
.
embedIntoGrid
(
position
,
1.0
f
,
1.0
f
,
1
.0
f
);
Algo
::
Volume
::
Tilings
::
Cubic
::
Grid
<
PFP
>
cubic
(
myMap
,
nb
,
nb
,
1
);
cubic
.
embedIntoGrid
(
position
,
1.0
f
,
1.0
f
,
0
.0
f
);
for
(
unsigned
int
i
=
position
.
begin
();
i
!=
position
.
end
();
position
.
next
(
i
))
{
...
...
Apps/Tuto/Traversals/traverse_cells.cpp
View file @
22d81ee3
...
...
@@ -108,7 +108,7 @@ int main()
{
position
[
v
]
+=
VEC3
(
0.0
,
0.0
,
PFP
::
REAL
(
thread
)
*
0.1
f
);
// WARNING thread vary here from 1 to 4 (and not from 0 to 3) !!!!
}
,
false
);
// 4:4 thread, false for no need for markers in threaded code.
});
// 4:4 thread, false for no need for markers in threaded code.
std
::
cout
<<
"After // processing"
<<
std
::
endl
;
foreach_cell
<
VERTEX
>
(
myMap
,
[
&
]
(
Vertex
v
)
// for each Vertex v of the MAP myMap
...
...
@@ -132,7 +132,7 @@ int main()
{
// for each face add surface to accumulator (-1 because counter between 1-3 not 0-3)
surf
[
thr
-
1
]
+=
Algo
::
Surface
::
Geometry
::
convexFaceArea
<
PFP
>
(
myMap
,
f
,
position
);
}
,
false
);
});
std
::
cout
<<
surf
[
0
]
<<
"/"
<<
surf
[
1
]
<<
"/"
<<
surf
[
2
]
<<
"/"
<<
std
::
endl
;
std
::
cout
<<
"Total="
<<
surf
[
0
]
+
surf
[
1
]
+
surf
[
2
]
<<
std
::
endl
;
...
...
apps_cmake.txt
View file @
22d81ee3
...
...
@@ -113,6 +113,8 @@ IF(WIN32)
set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING "Only Release or Debug" FORCE)
ELSE(WIN32)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -fPIC -std=c++11")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg")
if(CMAKE_COMPILER_IS_GNUCXX)
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
if (GCC_VERSION VERSION_GREATER 4.8 OR GCC_VERSION VERSION_EQUAL 4.8)
...
...
include/Algo/Geometry/area.hpp
View file @
22d81ee3
...
...
@@ -236,7 +236,7 @@ void computeAreaFaces(typename PFP::MAP& map, const VertexAttribute<typename PFP
CGoGN
::
Parallel
::
foreach_cell
<
FACE
>
(
map
,[
&
](
Face
f
,
unsigned
int
thr
)
{
area
[
f
]
=
convexFaceArea
<
PFP
>
(
map
,
f
,
position
)
;
}
,
false
,
AUTO
);
});
}
...
...
@@ -246,7 +246,7 @@ void computeOneRingAreaVertices(typename PFP::MAP& map, const VertexAttribute<ty
CGoGN
::
Parallel
::
foreach_cell
<
VERTEX
>
(
map
,[
&
](
Vertex
v
,
unsigned
int
thr
)
{
area
[
v
]
=
vertexOneRingArea
<
PFP
>
(
map
,
v
,
position
)
;
},
false
,
FORCE_CELL_MARKING
);
},
FORCE_CELL_MARKING
);
}
template
<
typename
PFP
>
...
...
@@ -256,7 +256,7 @@ void computeBarycentricAreaVertices(typename PFP::MAP& map, const VertexAttribut
{
vertex_area
[
v
]
=
vertexBarycentricArea
<
PFP
>
(
map
,
v
,
position
)
;
}
,
false
,
FORCE_CELL_MARKING
);
,
FORCE_CELL_MARKING
);
}
template
<
typename
PFP
>
...
...
@@ -265,7 +265,7 @@ void computeVoronoiAreaVertices(typename PFP::MAP& map, const VertexAttribute<ty
CGoGN
::
Parallel
::
foreach_cell
<
VERTEX
>
(
map
,[
&
](
Vertex
v
,
unsigned
int
thr
)
{
area
[
v
]
=
vertexVoronoiArea
<
PFP
>
(
map
,
v
,
position
)
;
},
false
,
FORCE_CELL_MARKING
);
},
FORCE_CELL_MARKING
);
}
}
// namespace Parallel
...
...
include/Algo/Geometry/centroid.hpp
View file @
22d81ee3
...
...
@@ -187,7 +187,7 @@ void computeCentroidFaces(typename PFP::MAP& map, const V_ATT& position, F_ATT&
CGoGN
::
Parallel
::
foreach_cell
<
FACE
>
(
map
,[
&
](
Face
f
,
unsigned
int
thr
)
{
face_centroid
[
f
]
=
faceCentroid
<
PFP
>
(
map
,
f
,
position
)
;
}
,
false
,
AUTO
);
});
}
template
<
typename
PFP
,
typename
V_ATT
,
typename
F_ATT
>
...
...
@@ -196,7 +196,7 @@ void computeCentroidELWFaces(typename PFP::MAP& map, const V_ATT& position, F_AT
CGoGN
::
Parallel
::
foreach_cell
<
FACE
>
(
map
,[
&
](
Face
f
,
unsigned
int
thr
)
{
face_centroid
[
f
]
=
faceCentroidELW
<
PFP
>
(
map
,
f
,
position
)
;
}
,
false
,
AUTO
);
});
}
...
...
@@ -207,7 +207,7 @@ void computeNeighborhoodCentroidVertices(typename PFP::MAP& map,
CGoGN
::
Parallel
::
foreach_cell
<
VERTEX
>
(
map
,[
&
](
Vertex
v
,
unsigned
int
thr
)
{
vertex_centroid
[
v
]
=
vertexNeighborhoodCentroid
<
PFP
>
(
map
,
v
,
position
)
;
},
false
,
FORCE_CELL_MARKING
);
},
FORCE_CELL_MARKING
);
}
}
// namespace Parallel
...
...
@@ -297,7 +297,7 @@ void computeCentroidVolumes(typename PFP::MAP& map, const V_ATT& position, W_ATT
CGoGN
::
Parallel
::
foreach_cell
<
VOLUME
>
(
map
,[
&
](
Vol
v
,
unsigned
int
thr
)
{
vol_centroid
[
v
]
=
Surface
::
Geometry
::
volumeCentroid
<
PFP
,
V_ATT
>
(
map
,
v
,
position
,
thr
)
;
}
,
true
,
AUTO
);
});
}
template
<
typename
PFP
,
typename
V_ATT
,
typename
W_ATT
>
...
...
@@ -306,7 +306,7 @@ void computeCentroidELWVolumes(typename PFP::MAP& map, const V_ATT& position, W_
CGoGN
::
Parallel
::
foreach_cell
<
VOLUME
>
(
map
,[
&
](
Vol
v
,
unsigned
int
thr
)
{
vol_centroid
[
v
]
=
Surface
::
Geometry
::
volumeCentroidELW
<
PFP
,
V_ATT
>
(
map
,
v
,
position
,
thr
)
;
}
,
true
,
AUTO
);
});
}
...
...
include/Algo/Geometry/curvature.hpp
View file @
22d81ee3
...
...
@@ -667,7 +667,7 @@ void computeCurvatureVertices_NormalCycles(
CGoGN
::
Parallel
::
foreach_cell
<
VERTEX
>
(
map
,[
&
](
Vertex
v
,
unsigned
int
threadID
)
{
computeCurvatureVertex_NormalCycles
<
PFP
>
(
map
,
v
,
radius
,
position
,
normal
,
edgeangle
,
kmax
,
kmin
,
Kmax
,
Kmin
,
Knormal
,
threadID
)
;
},
true
,
FORCE_CELL_MARKING
);
},
FORCE_CELL_MARKING
);
}
template
<
typename
PFP
>
...
...
@@ -696,7 +696,7 @@ void computeCurvatureVertices_NormalCycles_Projected(
CGoGN
::
Parallel
::
foreach_cell
<
VERTEX
>
(
map
,[
&
](
Vertex
v
,
unsigned
int
threadID
)
{
computeCurvatureVertex_NormalCycles_Projected
<
PFP
>
(
map
,
v
,
radius
,
position
,
normal
,
edgeangle
,
kmax
,
kmin
,
Kmax
,
Kmin
,
Knormal
,
threadID
)
;
},
true
,
FORCE_CELL_MARKING
);
},
FORCE_CELL_MARKING
);
}
...
...
@@ -714,7 +714,7 @@ void computeCurvatureVertices_QuadraticFitting(
CGoGN
::
Parallel
::
foreach_cell
<
VERTEX
>
(
map
,[
&
](
Vertex
v
,
unsigned
int
threadID
)
{
computeCurvatureVertex_QuadraticFitting
<
PFP
>
(
map
,
v
,
position
,
normal
,
kmax
,
kmin
,
Kmax
,
Kmin
,
threadID
)
;
},
true
,
FORCE_CELL_MARKING
);
},
FORCE_CELL_MARKING
);
}
...
...
include/Algo/Geometry/normal.hpp
View file @
22d81ee3
...
...
@@ -235,7 +235,7 @@ void computeNormalVertices(typename PFP::MAP& map, const V_ATT& position, V_ATT&
CGoGN
::
Parallel
::
foreach_cell
<
VERTEX
>
(
map
,[
&
](
Vertex
v
,
unsigned
int
/*thr*/
)
{
normal
[
v
]
=
vertexNormal
<
PFP
>
(
map
,
v
,
position
)
;
},
true
,
FORCE_CELL_MARKING
);
},
FORCE_CELL_MARKING
);
}
template
<
typename
PFP
,
typename
V_ATT
,
typename
F_ATT
>
...
...
@@ -244,7 +244,7 @@ void computeNormalFaces(typename PFP::MAP& map, const V_ATT& position, F_ATT& no
CGoGN
::
Parallel
::
foreach_cell
<
FACE
>
(
map
,[
&
](
Face
f
,
unsigned
int
thr
)
{
normal
[
f
]
=
faceNormal
<
PFP
>
(
map
,
f
,
position
)
;
}
,
true
,
AUTO
);
});
}
...
...
@@ -254,7 +254,7 @@ void computeAnglesBetweenNormalsOnEdges(typename PFP::MAP& map, const V_ATT& pos
CGoGN
::
Parallel
::
foreach_cell
<
EDGE
>
(
map
,[
&
](
Edge
e
,
unsigned
int
thr
)
{
angles
[
e
]
=
computeAngleBetweenNormalsOnEdge
<
PFP
>
(
map
,
e
,
position
)
;
}
,
true
,
AUTO
);
});
}
}
// namespace Parallel
...
...
include/Algo/Parallel/parallel_foreach.hpp
View file @
22d81ee3
...
...
@@ -177,14 +177,7 @@ void foreach_cell(MAP& map, std::vector<FunctorMapThreaded<MAP>*>& funcs, bool n
boost
::
barrier
sync1
(
nbth
+
1
);
boost
::
barrier
sync2
(
nbth
+
1
);
bool
finished
=
false
;
// lauch threads
if
(
needMarkers
)
{
unsigned
int
nbth_prec
=
map
.
getNbThreadMarkers
();
if
(
nbth_prec
<
nbth
+
1
)
map
.
addThreadMarker
(
nbth
+
1
-
nbth_prec
);
}
// launch threads
boost
::
thread
**
threads
=
new
boost
::
thread
*
[
nbth
];
ThreadFunction
<
MAP
>**
tfs
=
new
ThreadFunction
<
MAP
>*
[
nbth
];
...
...
include/Container/attributeMultiVector.h
View file @
22d81ee3
...
...
@@ -128,7 +128,7 @@ public:
virtual
unsigned
int
getNbBlocks
()
const
=
0
;
virtual
void
addBlocksBefore
(
unsigned
int
nbb
)
=
0
;
//
virtual void addBlocksBefore(unsigned int nbb) = 0;
virtual
bool
copy
(
const
AttributeMultiVectorGen
*
atmvg
)
=
0
;
...
...
@@ -311,6 +311,7 @@ public:
}
// namespace CGoGN
#include
"attributeMultiVectorBool.hpp"
#include
"attributeMultiVector.hpp"
#endif
include/Container/attributeMultiVectorBool.hpp
0 → 100644
View file @
22d81ee3
This diff is collapsed.
Click to expand it.
include/Topology/generic/attributeHandler.hpp
View file @
22d81ee3
...
...
@@ -22,8 +22,8 @@
* *
*******************************************************************************/
#include
<boost
/thread
.hpp>
#include
<boost/thread/barrier.hpp>
#include
"Utils
/thread
barrier.h"
#include
<vector>
namespace
CGoGN
...
...
@@ -32,7 +32,7 @@ namespace CGoGN
template
<
typename
T
,
unsigned
int
ORBIT
,
typename
MAP
>
inline
void
AttributeHandler
<
T
,
ORBIT
,
MAP
>::
registerInMap
()
{
boo
st
::
mutex
::
scoped_lock
lockAH
(
m_map
->
attributeHandlersMutex
);
std
::
lock_guard
<
st
d
::
mutex
>
lockAH
(
m_map
->
attributeHandlersMutex
);
m_map
->
attributeHandlers
.
insert
(
std
::
pair
<
AttributeMultiVectorGen
*
,
AttributeHandlerGen
*>
(
m_attrib
,
this
))
;
}
...
...
@@ -41,7 +41,7 @@ inline void AttributeHandler<T, ORBIT, MAP>::unregisterFromMap()
{
typedef
std
::
multimap
<
AttributeMultiVectorGen
*
,
AttributeHandlerGen
*>::
iterator
IT
;
boo
st
::
mutex
::
scoped_lock
lockAH
(
m_map
->
attributeHandlersMutex
);
std
::
lock_guard
<
st
d
::
mutex
>
lockAH
(
m_map
->
attributeHandlersMutex
);
std
::
pair
<
IT
,
IT
>
bounds
=
m_map
->
attributeHandlers
.
equal_range
(
m_attrib
)
;
for
(
IT
i
=
bounds
.
first
;
i
!=
bounds
.
second
;
++
i
)
{
...
...
@@ -276,13 +276,13 @@ class ThreadFunctionAttrib
{
protected:
std
::
vector
<
unsigned
int
>&
m_ids
;
boost
::
b
arrier
&
m_sync1
;
boost
::
b
arrier
&
m_sync2
;
Utils
::
B
arrier
&
m_sync1
;
Utils
::
B
arrier
&
m_sync2
;
bool
&
m_finished
;
unsigned
int
m_id
;
FUNC
m_lambda
;
public:
ThreadFunctionAttrib
(
FUNC
func
,
std
::
vector
<
unsigned
int
>&
vid
,
boost
::
b
arrier
&
s1
,
boost
::
b
arrier
&
s2
,
bool
&
finished
,
unsigned
int
id
)
:
ThreadFunctionAttrib
(
FUNC
func
,
std
::
vector
<
unsigned
int
>&
vid
,
Utils
::
B
arrier
&
s1
,
Utils
::
B
arrier
&
s2
,
bool
&
finished
,
unsigned
int
id
)
:
m_ids
(
vid
),
m_sync1
(
s1
),
m_sync2
(
s2
),
m_finished
(
finished
),
m_id
(
id
),
m_lambda
(
func
)
{
}
...
...
@@ -322,18 +322,18 @@ void foreach_attribute(ATTR& attribute, FUNC func, unsigned int nbthread)
nb
++
;
attribute
.
next
(
attIdx
);
}
boost
::
b
arrier
sync1
(
nbth
+
1
);
boost
::
b
arrier
sync2
(
nbth
+
1
);
Utils
::
B
arrier
sync1
(
nbth
+
1
);
Utils
::
B
arrier
sync2
(
nbth
+
1
);
bool
finished
=
false
;
boo
st
::
thread
**
threads
=
new
boo
st
::
thread
*
[
nbth
];
st
d
::
thread
**
threads
=
new
st
d
::
thread
*
[
nbth
];
ThreadFunctionAttrib
<
FUNC
>**
tfs
=
new
ThreadFunctionAttrib
<
FUNC
>*
[
nbth
];
for
(
unsigned
int
i
=
0
;
i
<
nbth
;
++
i
)
{
tfs
[
i
]
=
new
ThreadFunctionAttrib
<
FUNC
>
(
func
,
vd
[
i
],
sync1
,
sync2
,
finished
,
1
+
i
);
threads
[
i
]
=
new
boo
st
::
thread
(
boo
st
::
ref
(
*
(
tfs
[
i
])
)
);
tfs
[
i
]
=
new
ThreadFunctionAttrib
<
FUNC
>
(
func
,
vd
[
i
],
sync1
,
sync2
,
finished
,
i
);
threads
[
i
]
=
new
st
d
::
thread
(
st
d
::
ref
(
*
(
tfs
[
i
])
)
);
}
// and continue to traverse the map
...
...
include/Topology/generic/cellmarker.h
View file @
22d81ee3
...
...
@@ -43,40 +43,27 @@ class CellMarkerGen
friend
class
GenericMap
;
protected:
Mark
m_mark
;
AttributeMultiVector
<
Mark
>*
m_markVector
;
unsigned
int
m_thread
;
AttributeMultiVector
<
MarkerBool
>*
m_markVector
;
unsigned
int
m_cell
;
unsigned
int
m_thread
;
public:
CellMarkerGen
(
unsigned
int
cell
,
unsigned
int
thread
=
0
)
:
m_thread
(
thread
),
m_cell
(
cell
)
m_cell
(
cell
),
m_thread
(
thread
)
{}
virtual
~
CellMarkerGen
()
{}
unsigned
int
getThread
()
{
return
m_thread
;
}
unsigned
int
getCell
()
{
return
m_cell
;
}
void
updateMarkVector
(
AttributeMultiVector
<
Mark
>*
amv
)
{
m_markVector
=
amv
;
}
void
updateMarkVector
(
AttributeMultiVector
<
Mark
erBool
>*
amv
)
{
m_markVector
=
amv
;
}
protected:
// protected copy constructor to forbid its usage
CellMarkerGen
(
const
CellMarkerGen
&
/*cm*/
)
{}
// 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 ;
};
/**
...
...
@@ -100,8 +87,7 @@ public:
{
if
(
!
m_map
.
template
isOrbitEmbedded
<
CELL
>())
m_map
.
template
addEmbedding
<
CELL
>()
;
m_mark
=
m_map
.
template
getMarkerSet
<
CELL
>(
m_thread
).
getNewMark
()
;
m_markVector
=
m_map
.
template
getMarkVector
<
CELL
>(
m_thread
)
;
m_markVector
=
m_map
.
template
askMarkVector
<
CELL
>(
m_thread
);
}
CellMarkerBase
(
const
MAP
&
map
,
unsigned
int
thread
=
0
)
:
...
...
@@ -110,16 +96,23 @@ public:
{
if
(
!
m_map
.
template
isOrbitEmbedded
<
CELL
>())
m_map
.
template
addEmbedding
<
CELL
>()
;
m_mark
=
m_map
.
template
getMarkerSet
<
CELL
>(
m_thread
).
getNewMark
()
;
m_markVector
=
m_map
.
template
getMarkVector
<
CELL
>(
m_thread
)
;
m_markVector
=
m_map
.
template
askMarkVector
<
CELL
>(
m_thread
);
}
virtual
~
CellMarkerBase
()
{
if
(
GenericMap
::
alive
(
&
m_map
))
m_map
.
template
getMarkerSet
<
CELL
>(
m_thread
).
releaseMark
(
m_mark
)
;
m_map
.
template
releaseMarkVector
<
CELL
>(
m_markVector
,
m_thread
)
;
}
void
update
()
{
if
(
!
m_map
.
template
isOrbitEmbedded
<
CELL
>())
m_map
.
template
addEmbedding
<
CELL
>()
;
m_markVector
=
m_map
.
template
askMarkVector
<
CELL
>(
m_thread
);
}
protected:
// protected copy constructor to forbid its usage
CellMarkerBase
(
const
CellMarkerBase
<
MAP
,
CELL
>&
cm
)
:
...
...
@@ -133,7 +126,6 @@ public:
*/
inline
void
mark
(
Cell
<
CELL
>
c
)
{
assert
(
m_map
.
template
getMarkerSet
<
CELL
>(
m_thread
).
testMark
(
m_mark
));
assert
(
m_markVector
!=
NULL
);
unsigned
int
a
=
m_map
.
getEmbedding
(
c
)
;
...
...
@@ -141,7 +133,7 @@ public:
if
(
a
==
EMBNULL
)
a
=
Algo
::
Topo
::
setOrbitEmbeddingOnNewCell
(
m_map
,
c
)
;
(
*
m_markVector
)[
a
].
setMark
(
m_mark
)
;
m_markVector
->
setTrue
(
a
)
;
}
/**
...
...
@@ -149,7 +141,6 @@ public:
*/
inline
void
unmark
(
Cell
<
CELL
>
c
)
{
assert
(
m_map
.
template
getMarkerSet
<
CELL
>(
m_thread
).
testMark
(
m_mark
));
assert
(
m_markVector
!=
NULL
);
unsigned
int
a
=
m_map
.
getEmbedding
(
c
)
;
...
...
@@ -157,7 +148,7 @@ public:
if
(
a
==
EMBNULL
)
a
=
Algo
::
Topo
::
setOrbitEmbeddingOnNewCell
(
m_map
,
c
)
;
(
*
m_markVector
)[
a
].
unsetMark
(
m_mark
)
;
m_markVector
->
setFalse
(
a
)
;
}
/**
...
...
@@ -165,7 +156,6 @@ public:
*/
inline
bool
isMarked
(
Cell
<
CELL
>
c
)
const
{
assert
(
m_map
.
template
getMarkerSet
<
CELL
>(
m_thread
).
testMark
(
m_mark
));
assert
(
m_markVector
!=
NULL
);
unsigned
int
a
=
m_map
.
getEmbedding
(
c
)
;
...
...
@@ -173,7 +163,7 @@ public:
if
(
a
==
EMBNULL
)
return
false
;
return
(
*
m_markVector
)[
a
].
testMark
(
m_mark
)
;
return
m_markVector
->
operator
[](
a
)
;
}
/**
...
...
@@ -181,10 +171,8 @@ public:
*/
inline
void
mark
(
unsigned
int
em
)
{
assert
(
m_map
.
template
getMarkerSet
<
CELL
>(
m_thread
).
testMark
(
m_mark
));
assert
(
m_markVector
!=
NULL
);
(
*
m_markVector
)[
em
].
setMark
(
m_mark
)
;
m_markVector
->
setTrue
(
em
);
}
/**
...
...
@@ -192,10 +180,8 @@ public:
*/
inline
void
unmark
(
unsigned
int
em
)
{
assert
(
m_map
.
template
getMarkerSet
<
CELL
>(
m_thread
).
testMark
(
m_mark
));
assert
(
m_markVector
!=
NULL
);
(
*
m_markVector
)[
em
].
unsetMark
(
m_mark
)
;
m_markVector
->
setFalse
(
em
);
}
/**
...
...
@@ -203,12 +189,11 @@ public:
*/
inline
bool
isMarked
(
unsigned
int
em
)
const
{
assert
(
m_map
.
template
getMarkerSet
<
CELL
>(
m_thread
).
testMark
(
m_mark
));
assert
(
m_markVector
!=
NULL
);
if
(
em
==
EMBNULL
)
return
false
;
return
(
*
m_markVector
)[
em
].
testMark
(
m_mark
)
;
return
m_markVector
->
operator
[](
em
)
;
}
/**
...
...
@@ -216,22 +201,17 @@ public:
*/
inline
void
markAll
()
{
assert
(
m_map
.
template
getMarkerSet
<
CELL
>(
m_thread
).
testMark
(
m_mark
));
assert
(
m_markVector
!=
NULL
);
AttributeContainer
&
cont
=
m_map
.
template
getAttributeContainer
<
CELL
>()
;
for
(
unsigned
int
i
=
cont
.
begin
();
i
!=
cont
.
end
();
cont
.
next
(
i
))
(
*
m_markVector
)[
i
].
setMark
(
m_mark
)
;
m_markVector
->
allFalse
();
}
inline
bool
isAllUnmarked
()
{
assert
(
m_map
.
template
getMarkerSet
<
CELL
>(
m_thread
).
testMark
(
m_mark
));
assert
(
m_markVector
!=
NULL
);
AttributeContainer
&
cont
=
m_map
.
template
getAttributeContainer
<
CELL
>()
;
for
(
unsigned
int
i
=
cont
.
begin
();
i
!=
cont
.
end
();
cont
.
next
(
i
))
if
(
(
*
m_markVector
)[
i
].
testMark
(
m_mark
))
if
(
m_markVector
->
operator
[](
i
))
return
false
;
return
true
;
}
...
...
@@ -265,12 +245,8 @@ protected:
public:
inline
void
unmarkAll
()
{
assert
(
this
->
m_map
.
template
getMarkerSet
<
CELL
>(
this
->
m_thread
).
testMark
(
this
->
m_mark
));
assert
(
this
->
m_markVector
!=
NULL
);
AttributeContainer
&
cont
=
this
->
m_map
.
template
getAttributeContainer
<
CELL
>()
;
for
(
unsigned
int
i
=
cont
.
realBegin
();
i
!=
cont
.
realEnd
();
cont
.
realNext
(
i
))
this
->
m_markVector
->
operator
[](
i
).
unsetMark
(
this
->
m_mark
)
;
this
->
m_markVector
->
allFalse
();
}
};
...
...
@@ -283,24 +259,27 @@ template <typename MAP, unsigned int CELL>
class
CellMarkerStore
:
public
CellMarkerBase
<
MAP
,
CELL
>
{
protected:
std
::
vector
<
unsigned
int
>
m_markedCells
;
std
::
vector
<
unsigned
int
>
*
m_markedCells
;
public:
CellMarkerStore
(
MAP
&
map
,
unsigned
int
thread
=
0
)
:
CellMarkerBase
<
MAP
,
CELL
>
(
map
,
thread
)
{
m_markedCells
.
reserve
(
128
);
// m_markedCells.reserve(128);
m_markedCells
=
GenericMap
::
askUIntBuffer
(
thread
);
}
CellMarkerStore
(
const
MAP
&
map
,
unsigned
int
thread
=
0
)
:
CellMarkerBase
<
MAP
,
CELL
>
(
map
,
thread
)
{
m_markedCells
.
reserve
(
128
);
// m_markedCells.reserve(128);
m_markedCells
=
GenericMap
::
askUIntBuffer
(
thread
);
}
virtual
~
CellMarkerStore
()
{
unmarkAll
()
;
GenericMap
::
releaseUIntBuffer
(
m_markedCells
,
this
->
m_thread
);
// assert(isAllUnmarked);
// CGoGN_ASSERT(this->isAllUnmarked())
}
...
...
@@ -314,22 +293,21 @@ public:
inline
void
mark
(
Cell
<
CELL
>
d
)
{
CellMarkerBase
<
MAP
,
CELL
>::
mark
(
d
)
;
m_markedCells
.
push_back
(
this
->
m_map
.
template
getEmbedding
<
CELL
>(
d
))
;
m_markedCells
->
push_back
(
this
->
m_map
.
template
getEmbedding
<
CELL
>(
d
))
;
}
inline
void
mark
(
unsigned
int
em
)
{
CellMarkerBase
<
MAP
,
CELL
>::
mark
(
em
)
;
m_markedCells
.
push_back
(
em
)
;
m_markedCells
->
push_back
(
em
)
;
}
inline
void
unmarkAll
()
{
assert
(
this
->
m_map
.
template
getMarkerSet
<
CELL
>(
this
->
m_thread
).
testMark
(
this
->
m_mark
));
assert
(
this
->
m_markVector
!=
NULL
);
for
(
std
::
vector
<
unsigned
int
>::
iterator
it
=
m_markedCells
.
begin
();
it
!=
m_markedCells
.
end
();
++
it
)
this
->
m_markVector
->
operator
[](
*
it
).
unsetMark
(
this
->
m_mark
)
;
for
(
std
::
vector
<
unsigned
int
>::
iterator
it
=
m_markedCells
->
begin
();
it
!=
m_markedCells
->
end
();
++
it
)
this
->
m_markVector
->
setFalse
(
*
it
)
;
}
};
...
...
@@ -381,7 +359,6 @@ public: