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
8f89cbb4
Commit
8f89cbb4
authored
May 07, 2014
by
Sylvain Thery
Browse files
add optim/specialize parameter (of traversal) on parallel::foreach_cell
parent
015335b1
Changes
3
Hide whitespace changes
Inline
Side-by-side
include/Algo/Geometry/centroid.hpp
View file @
8f89cbb4
...
...
@@ -264,9 +264,6 @@ typename V_ATT::DATA_TYPE vertexNeighborhoodCentroid(typename PFP::MAP& map, Ver
{
typename
V_ATT
::
DATA_TYPE
center
(
0.0
);
unsigned
int
count
=
0
;
// Traversor3VVaE<typename PFP::MAP> t(map, d) ;
// for(Dart it = t.begin(); it != t.end(); it = t.next())
// foreachAdjacent3MT(VERTEX,EDGE,d,it,typename PFP::MAP,map,thread)
foreach_adjacent3
<
EDGE
>
(
map
,
v
,
[
&
](
Vertex
it
)
{
center
+=
attributs
[
it
];
...
...
@@ -280,9 +277,6 @@ typename V_ATT::DATA_TYPE vertexNeighborhoodCentroid(typename PFP::MAP& map, Ver
template
<
typename
PFP
,
typename
V_ATT
,
typename
W_ATT
>
void
computeCentroidVolumes
(
typename
PFP
::
MAP
&
map
,
const
V_ATT
&
position
,
W_ATT
&
vol_centroid
,
unsigned
int
thread
)
{
// TraversorW<typename PFP::MAP> t(map, thread) ;
// for(Dart d = t.begin(); d != t.end(); d = t.next())
// foreachCellMT(VOLUME,d,typename PFP::MAP,map ,thread)
foreach_cell
<
VOLUME
>
(
map
,
[
&
]
(
Vol
v
)
{
vol_centroid
[
v
]
=
Surface
::
Geometry
::
volumeCentroid
<
PFP
,
V_ATT
>
(
map
,
v
,
position
,
thread
)
;
...
...
@@ -293,9 +287,6 @@ void computeCentroidVolumes(typename PFP::MAP& map, const V_ATT& position, W_ATT
template
<
typename
PFP
,
typename
V_ATT
,
typename
W_ATT
>
void
computeCentroidELWVolumes
(
typename
PFP
::
MAP
&
map
,
const
V_ATT
&
position
,
W_ATT
&
vol_centroid
,
unsigned
int
thread
)
{
// TraversorW<typename PFP::MAP> t(map,thread) ;
// for(Dart d = t.begin(); d != t.end(); d = t.next())
// foreachCellMT(VOLUME,d,typename PFP::MAP,map ,thread)
foreach_cell
<
VOLUME
>
(
map
,
[
&
]
(
Vol
v
)
{
vol_centroid
[
v
]
=
Surface
::
Geometry
::
volumeCentroidELW
<
PFP
,
V_ATT
>
(
map
,
v
,
position
,
thread
)
;
...
...
@@ -306,9 +297,6 @@ void computeCentroidELWVolumes(typename PFP::MAP& map, const V_ATT& position, W_
template
<
typename
PFP
,
typename
V_ATT
>
void
computeNeighborhoodCentroidVertices
(
typename
PFP
::
MAP
&
map
,
const
V_ATT
&
position
,
V_ATT
&
vertex_centroid
,
unsigned
int
thread
)
{
// TraversorV<typename PFP::MAP> t(map, thread) ;
// for(Dart d = t.begin(); d != t.end(); d = t.next())
// foreachCellMT(VERTEX,d,typename PFP::MAP,map ,thread)
foreach_cell
<
VERTEX
>
(
map
,
[
&
]
(
Vertex
v
)
{
vertex_centroid
[
v
]
=
Volume
::
Geometry
::
vertexNeighborhoodCentroid
<
PFP
,
V_ATT
>
(
map
,
v
,
position
)
;
...
...
@@ -349,7 +337,6 @@ class FunctorComputeCentroidELWVolumes: public FunctorMapThreaded<typename PFP::
{
const
V_ATT
&
m_position
;
W_ATT
&
m_vol_centroid
;
// VolumeAttribute<typename PFP::VEC3>& m_vol_centroid;
public:
FunctorComputeCentroidELWVolumes
<
PFP
,
V_ATT
,
W_ATT
>
(
typename
PFP
::
MAP
&
map
,
const
V_ATT
&
position
,
W_ATT
&
vol_centroid
)
:
...
...
include/Topology/generic/traversor/traversorCell.h
View file @
8f89cbb4
...
...
@@ -114,14 +114,6 @@ public:
/*
* Executes function f on each ORBIT
*/
//template <unsigned int ORBIT, typename MAP, typename FUNC>
//inline void foreach_cell(const MAP& map, FUNC f, bool forceDartMarker = false, unsigned int thread = 0)
//{
// TraversorCell<MAP, ORBIT> trav(map, forceDartMarker, thread);
// for (Cell<ORBIT> c = trav.begin(), e = trav.end(); c.dart != e.dart; c = trav.next())
// f(c);
//}
template
<
unsigned
int
ORBIT
,
typename
MAP
,
typename
FUNC
>
inline
void
foreach_cell
(
const
MAP
&
map
,
FUNC
f
,
TraversalOptim
opt
=
AUTO
,
unsigned
int
thread
=
0
)
{
...
...
@@ -163,15 +155,6 @@ inline void foreach_cell(const MAP& map, FUNC f, TraversalOptim opt = AUTO, unsi
/*
* Executes function f on each ORBIT until f returns false
*/
//template <unsigned int ORBIT, typename MAP, typename FUNC>
//inline void foreach_cell_until(const MAP& map, FUNC f, bool forceDartMarker = false, unsigned int thread = 0)
//{
// TraversorCell<MAP, ORBIT> trav(map, forceDartMarker, thread);
// for (Cell<ORBIT> c = trav.begin(), e = trav.end(); c.dart != e.dart; c = trav.next())
// if (!f(c))
// break;
//}
template
<
unsigned
int
ORBIT
,
typename
MAP
,
typename
FUNC
>
inline
void
foreach_cell_until
(
const
MAP
&
map
,
FUNC
f
,
TraversalOptim
opt
=
AUTO
,
unsigned
int
thread
=
0
)
{
...
...
@@ -213,7 +196,11 @@ inline void foreach_cell_until(const MAP& map, FUNC f, TraversalOptim opt = AUTO
}
}
/*
* Executes function f on each ORBIT, then
* execute function g on each ORBIT
* Optimization on marking (even pass marking, odd pass unmarking)
*/
template
<
unsigned
int
ORBIT
,
typename
MAP
,
typename
FUNC
,
typename
FUNC2
>
inline
void
foreach_cell_EvenOddd
(
const
MAP
&
map
,
FUNC
f
,
FUNC2
g
,
unsigned
int
nbpasses
=
1
,
TraversalOptim
opt
=
AUTO
,
unsigned
int
thread
=
0
)
{
...
...
@@ -280,9 +267,7 @@ inline void foreach_cell_EvenOddd(const MAP& map, FUNC f, FUNC2 g, unsigned int
}
}
break
;
}
}
...
...
@@ -290,10 +275,10 @@ inline void foreach_cell_EvenOddd(const MAP& map, FUNC f, FUNC2 g, unsigned int
namespace
Parallel
{
template
<
unsigned
int
ORBIT
,
typename
MAP
,
typename
FUNC
>
void
foreach_cell
(
MAP
&
map
,
FUNC
func
,
unsigned
int
nbth
=
0
,
bool
needMarkers
=
true
);
void
foreach_cell
(
MAP
&
map
,
FUNC
func
,
unsigned
int
nbth
=
0
,
bool
needMarkers
=
true
,
TraversalOptim
opt
=
AUTO
);
template
<
unsigned
int
ORBIT
,
typename
MAP
,
typename
FUNC_E
,
typename
FUNC_O
>
void
foreach_cell_EO
(
MAP
&
map
,
FUNC_E
funcEven
,
FUNC_O
funcOdd
,
unsigned
int
nbth
=
0
,
bool
needMarkers
=
true
);
//
template <unsigned int ORBIT, typename MAP, typename FUNC_E, typename FUNC_O>
//
void foreach_cell_EO(MAP& map, FUNC_E funcEven, FUNC_O funcOdd,unsigned int nbth=0, bool needMarkers=true
, TraversalOptim opt = AUTO
);
}
...
...
include/Topology/generic/traversor/traversorCell.hpp
View file @
8f89cbb4
...
...
@@ -501,8 +501,8 @@ public:
};
template
<
unsigned
int
ORBIT
,
typename
MAP
,
typename
FUNC
>
void
foreach_cell
(
MAP
&
map
,
FUNC
func
,
unsigned
int
nbth
,
bool
needMarkers
)
template
<
TraversalOptim
OPT
,
unsigned
int
ORBIT
,
typename
MAP
,
typename
FUNC
>
void
foreach_cell
_tmpl
(
MAP
&
map
,
FUNC
func
,
unsigned
int
nbth
,
bool
needMarkers
)
{
if
(
nbth
==
0
)
nbth
=
boost
::
thread
::
hardware_concurrency
();
...
...
@@ -514,7 +514,7 @@ void foreach_cell(MAP& map, FUNC func, unsigned int nbth, bool needMarkers)
// TraversorCell<MAP, ORBIT> trav(map,false,th_orig);
unsigned
int
nb
=
0
;
TraversorCell
<
MAP
,
ORBIT
>
trav
(
map
);
TraversorCell
<
MAP
,
ORBIT
,
OPT
>
trav
(
map
);
Cell
<
ORBIT
>
cell
=
trav
.
begin
();
Cell
<
ORBIT
>
c_end
=
trav
.
end
();
while
((
cell
.
dart
!=
c_end
.
dart
)
&&
(
nb
<
nbth
*
SIZE_BUFFER_THREAD
)
)
...
...
@@ -584,7 +584,30 @@ void foreach_cell(MAP& map, FUNC func, unsigned int nbth, bool needMarkers)
delete
[]
tempo
;
}
template
<
unsigned
int
ORBIT
,
typename
MAP
,
typename
FUNC
>
void
foreach_cell
(
MAP
&
map
,
FUNC
func
,
unsigned
int
nbth
,
bool
needMarkers
,
TraversalOptim
opt
)
{
switch
(
opt
)
{
case
FORCE_DART_MARKING
:
foreach_cell_tmpl
<
FORCE_DART_MARKING
,
ORBIT
,
MAP
,
FUNC
>
(
map
,
func
,
nbth
,
needMarkers
);
break
;
case
FORCE_CELL_MARKING
:
foreach_cell_tmpl
<
FORCE_CELL_MARKING
,
ORBIT
,
MAP
,
FUNC
>
(
map
,
func
,
nbth
,
needMarkers
);
break
;
case
FORCE_QUICK_TRAVERSAL
:
foreach_cell_tmpl
<
FORCE_QUICK_TRAVERSAL
,
ORBIT
,
MAP
,
FUNC
>
(
map
,
func
,
nbth
,
needMarkers
);
break
;
case
AUTO
:
default:
foreach_cell_tmpl
<
AUTO
,
ORBIT
,
MAP
,
FUNC
>
(
map
,
func
,
nbth
,
needMarkers
);
break
;
}
}
}
// namespace Parallel
}
// namespace CGoGN
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment