Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Hurstel
CGoGN
Commits
95bec210
Commit
95bec210
authored
Aug 24, 2012
by
Thery Sylvain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug in tuto_mt (4 instead of nbthreads)
parent
5a8e28ba
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
9 deletions
+12
-9
Apps/Tuto/tuto_mt.cpp
Apps/Tuto/tuto_mt.cpp
+12
-9
No files found.
Apps/Tuto/tuto_mt.cpp
View file @
95bec210
...
...
@@ -40,6 +40,7 @@
#include "Algo/Parallel/parallel_foreach.h"
#include "Algo/Parallel/cgogn_thread.h"
#include "Utils/cgognStream.h"
#include "Utils/chrono.h"
using
namespace
CGoGN
;
...
...
@@ -108,7 +109,7 @@ void MyQT::cb_initGL()
m_lines
->
setScale
(
2.0
f
);
m_lines
->
setColor
(
Geom
::
Vec4f
(
0.0
f
,
1.0
f
,
0.2
f
,
0.0
f
));
std
::
c
out
<<
"Je calcule les normales en meme temps que les primitives"
<<
std
::
endl
;
CGoGN
out
<<
"Je calcule les normales en meme temps que les primitives"
<<
CGoGN
endl
;
boost
::
thread
thread1
(
ThreadNormals
<
PFP
>
(
myMap
,
position
,
normal
,
1
));
...
...
@@ -150,7 +151,7 @@ void MyQT::cb_keyPress(int code)
default:
break
;
}
std
::
c
out
<<
"time = "
<<
ch
.
elapsed
()
<<
std
::
endl
;
CGoGN
out
<<
"time = "
<<
ch
.
elapsed
()
<<
CGoGN
endl
;
updateGL
();
}
...
...
@@ -281,8 +282,8 @@ void MyQT::threadStorage()
functs
.
push_back
(
lef
);
}
Algo
::
Parallel
::
foreach_cell
<
PFP
::
MAP
,
EDGE
>
(
myMap
,
functs
,
4
);
CGoGNout
<<
"using "
<<
nbthreads
<<
" threads"
<<
CGoGNendl
;
Algo
::
Parallel
::
foreach_cell
<
PFP
::
MAP
,
EDGE
>
(
myMap
,
functs
,
nbthreads
);
//compute average length from each thread result and delete functors
double
average
=
0
;
...
...
@@ -296,7 +297,7 @@ void MyQT::threadStorage()
}
average
/=
all
;
std
::
c
out
<<
"AVERAGE LENGTH "
<<
average
<<
std
::
endl
;
CGoGN
out
<<
"AVERAGE LENGTH "
<<
average
<<
CGoGN
endl
;
}
...
...
@@ -320,10 +321,12 @@ int main(int argc, char **argv)
if
(
!
normal
.
isValid
())
normal
=
myMap
.
addAttribute
<
PFP
::
VEC3
,
VERTEX
>
(
"normal"
);
unsigned
int
nbt
=
64
;
if
(
argc
==
2
)
nbt
=
atoi
(
argv
[
1
]);
// create a sphere
Algo
::
Modelisation
::
Polyhedron
<
PFP
>
prim
(
myMap
,
position
);
// prim.cylinder_topo(2640,2640, true, true); // test for speed timing
prim
.
cylinder_topo
(
64
,
64
,
true
,
true
);
// topo of sphere is a closed cylinder
prim
.
cylinder_topo
(
nbt
,
nbt
,
true
,
true
);
prim
.
embedSphere
(
20.0
f
);
...
...
@@ -331,8 +334,8 @@ int main(int argc, char **argv)
Geom
::
BoundingBox
<
PFP
::
VEC3
>
bb
=
Algo
::
Geometry
::
computeBoundingBox
<
PFP
>
(
myMap
,
position
);
float
lWidthObj
=
std
::
max
<
PFP
::
REAL
>
(
std
::
max
<
PFP
::
REAL
>
(
bb
.
size
(
0
),
bb
.
size
(
1
)),
bb
.
size
(
2
));
Geom
::
Vec3f
lPosObj
=
(
bb
.
min
()
+
bb
.
max
())
/
PFP
::
REAL
(
2
);
std
::
c
out
<<
"lPosObj="
<<
lPosObj
<<
std
::
endl
;
std
::
c
out
<<
"lWidthObj="
<<
lWidthObj
<<
std
::
endl
;
CGoGN
out
<<
"lPosObj="
<<
lPosObj
<<
CGoGN
endl
;
CGoGN
out
<<
"lWidthObj="
<<
lWidthObj
<<
CGoGN
endl
;
sqt
.
setParamObject
(
lWidthObj
,
lPosObj
.
data
());
// myMap.enableQuickTraversal<EDGE>() ;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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