Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CGoGN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Thomas Pitiot
CGoGN
Commits
edb26f50
Commit
edb26f50
authored
May 12, 2014
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'optimizedTraversors' into develop
parents
70470eec
0c249b1a
Changes
22
Show whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
1098 additions
and
712 deletions
+1098
-712
Apps/Examples/viewer.cpp
Apps/Examples/viewer.cpp
+160
-47
Apps/Examples/volumeExplorer.cpp
Apps/Examples/volumeExplorer.cpp
+0
-3
Apps/Tuto/Traversals/traverse_cells.cpp
Apps/Tuto/Traversals/traverse_cells.cpp
+11
-6
include/Algo/Geometry/area.h
include/Algo/Geometry/area.h
+15
-0
include/Algo/Geometry/area.hpp
include/Algo/Geometry/area.hpp
+62
-64
include/Algo/Geometry/centroid.h
include/Algo/Geometry/centroid.h
+6
-15
include/Algo/Geometry/centroid.hpp
include/Algo/Geometry/centroid.hpp
+69
-146
include/Algo/Geometry/curvature.h
include/Algo/Geometry/curvature.h
+15
-4
include/Algo/Geometry/curvature.hpp
include/Algo/Geometry/curvature.hpp
+88
-97
include/Algo/Geometry/normal.h
include/Algo/Geometry/normal.h
+11
-9
include/Algo/Geometry/normal.hpp
include/Algo/Geometry/normal.hpp
+57
-81
include/Algo/Geometry/volume.h
include/Algo/Geometry/volume.h
+1
-1
include/Algo/Geometry/volume.hpp
include/Algo/Geometry/volume.hpp
+19
-38
include/Algo/Render/GL2/mapRender.hpp
include/Algo/Render/GL2/mapRender.hpp
+5
-5
include/Algo/Render/GL2/topo3Render.hpp
include/Algo/Render/GL2/topo3Render.hpp
+1
-1
include/Algo/Topo/basic.h
include/Algo/Topo/basic.h
+2
-2
include/Topology/generic/attributeHandler.h
include/Topology/generic/attributeHandler.h
+1
-1
include/Topology/generic/attributeHandler.hpp
include/Topology/generic/attributeHandler.hpp
+3
-4
include/Topology/generic/genericmap.h
include/Topology/generic/genericmap.h
+26
-0
include/Topology/generic/traversor/traversorCell.h
include/Topology/generic/traversor/traversorCell.h
+41
-56
include/Topology/generic/traversor/traversorCell.hpp
include/Topology/generic/traversor/traversorCell.hpp
+499
-132
src/Topology/generic/genericmap.cpp
src/Topology/generic/genericmap.cpp
+6
-0
No files found.
Apps/Examples/viewer.cpp
View file @
edb26f50
...
...
@@ -272,31 +272,31 @@ void Viewer::cb_keyPress(int keycode)
if
(
!
pos2
.
isValid
())
pos2
=
myMap
.
addAttribute
<
VEC3
,
VERTEX
>
(
"pos2"
)
;
foreach_cell_EvenOddd
<
VERTEX
>
(
myMap
,
[
&
]
(
Vertex
d
)
{
pos2
[
d
]
=
VEC3
(
0
,
0
,
0
);
int
nb
=
0
;
foreach_adjacent2
<
FACE
>
(
myMap
,
d
,[
&
](
Vertex
e
)
{
pos2
[
d
]
+=
position
[
e
];
nb
++
;
});
pos2
[
d
]
/=
nb
;
},
[
&
]
(
Vertex
d
)
{
position
[
d
]
=
VEC3
(
0
,
0
,
0
);
int
nb
=
0
;
foreach_adjacent2
<
FACE
>
(
myMap
,
d
,[
&
](
Vertex
e
)
{
position
[
d
]
+=
pos2
[
e
];
nb
++
;
});
position
[
d
]
/=
nb
;
},
3
);
std
::
cout
<<
"Even/Odd "
<<
ch
.
elapsed
()
<<
" ms "
<<
std
::
endl
;
//
foreach_cell_EvenOddd<VERTEX>(myMap, [&] (Vertex d)
//
{
//
pos2[d] = VEC3(0,0,0);
//
int nb=0;
//
foreach_adjacent2<FACE>(myMap,d,[&](Vertex e)
//
{
//
pos2[d] += position[e];
//
nb++;
//
});
//
pos2[d]/=nb;
//
},
//
[&] (Vertex d)
//
{
//
position[d] = VEC3(0,0,0);
//
int nb=0;
//
foreach_adjacent2<FACE>(myMap,d,[&](Vertex e)
//
{
//
position[d] += pos2[e];
//
nb++;
//
});
//
position[d]/=nb;
//
},
//
3);
//
std::cout << "Even/Odd "<< ch.elapsed()<< " ms "<< std::endl;
Algo
::
Surface
::
Geometry
::
computeNormalVertices
<
PFP
>
(
myMap
,
position
,
normal
)
;
m_positionVBO
->
updateData
(
position
)
;
m_normalVBO
->
updateData
(
normal
)
;
...
...
@@ -371,45 +371,158 @@ void Viewer::cb_keyPress(int keycode)
case
'A'
:
{
myMap
.
disableQuickTraversal
<
VERTEX
>
()
;
#define NBLOOP 5
Utils
::
Chrono
ch
;
ch
.
start
();
TraversorCell
<
MAP
,
VERTEX
>
trav
(
myMap
,
true
);
for
(
unsigned
int
i
=
0
;
i
<
10
;
++
i
)
{
TraversorCell
<
MAP
,
VERTEX
,
FORCE_CELL_MARKING
>
trav
(
myMap
,
true
);
for
(
unsigned
int
i
=
0
;
i
<
NBLOOP
;
++
i
)
{
for
(
Cell
<
VERTEX
>
v
=
trav
.
begin
(),
e
=
trav
.
end
();
v
.
dart
!=
e
.
dart
;
v
=
trav
.
next
())
{
// normal[v] = Algo::Surface::Geometry::vertexNormal<PFP>(myMap, v, position) ;
normal
[
v
][
0
]
=
0.0
f
;
}
}
std
::
cout
<<
"Timing 10 traversors
"
<<
ch
.
elapsed
()
<<
" ms "
<<
std
::
endl
;
std
::
cout
<<
"FORCE_CELL_MARKING
"
<<
ch
.
elapsed
()
<<
" ms "
<<
std
::
endl
;
}
break
;
case
'Z'
:
{
Utils
::
Chrono
ch
;
ch
.
start
();
{
TraversorCell
<
MAP
,
VERTEX
>
trav
(
myMap
);
for
(
unsigned
int
i
=
0
;
i
<
NBLOOP
;
++
i
)
{
for
(
Cell
<
VERTEX
>
v
=
trav
.
begin
(),
e
=
trav
.
end
();
v
.
dart
!=
e
.
dart
;
v
=
trav
.
next
())
{
normal
[
v
][
0
]
=
0.0
f
;
}
}
std
::
cout
<<
"auto "
<<
ch
.
elapsed
()
<<
" ms "
<<
std
::
endl
;
}
ch
.
start
();
{
TraversorCell
<
MAP
,
VERTEX
>
trav
(
myMap
,
true
);
TraversorCellEven
<
MAP
,
VERTEX
>
tr1
(
trav
);
TraversorCellOdd
<
MAP
,
VERTEX
>
tr2
(
trav
);
for
(
unsigned
int
i
=
0
;
i
<
NBLOOP
;
++
i
)
{
for
(
Cell
<
VERTEX
>
v
=
trav
.
begin
(),
e
=
trav
.
end
();
v
.
dart
!=
e
.
dart
;
v
=
trav
.
next
())
{
normal
[
v
][
0
]
=
0.0
f
;
}
}
std
::
cout
<<
"auto forcedart "
<<
ch
.
elapsed
()
<<
" ms "
<<
std
::
endl
;
}
for
(
unsigned
int
i
=
0
;
i
<
5
;
++
i
)
ch
.
start
();
{
TraversorCell
<
MAP
,
VERTEX
,
FORCE_DART_MARKING
>
trav
(
myMap
,
true
);
for
(
unsigned
int
i
=
0
;
i
<
NBLOOP
;
++
i
)
{
for
(
Cell
<
VERTEX
>
v
=
tr1
.
begin
(),
e
=
tr1
.
end
();
v
.
dart
!=
e
.
dart
;
v
=
tr1
.
next
())
for
(
Cell
<
VERTEX
>
v
=
trav
.
begin
(),
e
=
trav
.
end
();
v
.
dart
!=
e
.
dart
;
v
=
trav
.
next
())
{
// normal[v] = Algo::Surface::Geometry::vertexNormal<PFP>(myMap, v, position) ;
normal
[
v
][
0
]
=
0.0
f
;
}
for
(
Cell
<
VERTEX
>
v
=
tr2
.
begin
(),
e
=
tr2
.
end
();
v
.
dart
!=
e
.
dart
;
v
=
tr2
.
next
())
}
std
::
cout
<<
"FORCE_DART_MARKING "
<<
ch
.
elapsed
()
<<
" ms "
<<
std
::
endl
;
}
myMap
.
enableQuickTraversal
<
VERTEX
>
()
;
ch
.
start
();
{
TraversorCell
<
MAP
,
VERTEX
>
trav
(
myMap
);
for
(
unsigned
int
i
=
0
;
i
<
NBLOOP
;
++
i
)
{
for
(
Cell
<
VERTEX
>
v
=
trav
.
begin
(),
e
=
trav
.
end
();
v
.
dart
!=
e
.
dart
;
v
=
trav
.
next
())
{
normal
[
v
][
0
]
=
0.0
f
;
}
}
std
::
cout
<<
"auto (quick) "
<<
ch
.
elapsed
()
<<
" ms "
<<
std
::
endl
;
}
ch
.
start
();
{
TraversorCell
<
MAP
,
VERTEX
,
FORCE_QUICK_TRAVERSAL
>
trav
(
myMap
);
for
(
unsigned
int
i
=
0
;
i
<
NBLOOP
;
++
i
)
{
for
(
Cell
<
VERTEX
>
v
=
trav
.
begin
(),
e
=
trav
.
end
();
v
.
dart
!=
e
.
dart
;
v
=
trav
.
next
())
{
// normal[v] = Algo::Surface::Geometry::vertexNormal<PFP>(myMap, v, position) ;
normal
[
v
][
0
]
=
0.0
f
;
}
}
std
::
cout
<<
"Timing 5 traversors even/odd "
<<
ch
.
elapsed
()
<<
" ms "
<<
std
::
endl
;
std
::
cout
<<
"FORCE_QUICK_TRAVERSAL "
<<
ch
.
elapsed
()
<<
" ms "
<<
std
::
endl
;
}
}
break
;
case
'Z'
:
{
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)
// {
// normal[v] = Algo::Surface::Geometry::vertexNormal<PFP>(myMap,v,position);
// },
// [&](Vertex v, unsigned int th)
// {
// normal[v] = Algo::Surface::Geometry::vertexNormal<PFP>(myMap,v,position);
// },2,4,false,FORCE_CELL_MARKING);
// std::cout << "Parallel::foreach_cell_EO "<< ch.elapsed()<< " ms "<< std::endl;
}
break
;
...
...
Apps/Examples/volumeExplorer.cpp
View file @
edb26f50
...
...
@@ -498,8 +498,6 @@ int main(int argc, char **argv)
Utils
::
Chrono
ch
;
Vertex
v
(
myMap
.
begin
());
VEC3
p
=
Algo
::
Volume
::
Geometry
::
vertexNeighborhoodCentroid
<
PFP
>
(
myMap
,
v
,
position
);
...
...
@@ -529,7 +527,6 @@ int main(int argc, char **argv)
vol
+=
Algo
::
Geometry
::
totalVolume
<
PFP
>
(
myMap
,
position
);
std
::
cout
<<
ch
.
elapsed
()
<<
" ms val="
<<
vol
<<
std
::
endl
;
// et on attend la fin.
return
app
.
exec
();
}
Apps/Tuto/Traversals/traverse_cells.cpp
View file @
edb26f50
...
...
@@ -114,7 +114,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) !!!!
},
4
,
false
);
// 4:4 thread, false for no need for markers in threaded code.
},
false
);
// 4:4 thread, false for no need for markers in threaded code.
std
::
cout
<<
"After // processing"
<<
std
::
endl
;
...
...
@@ -127,17 +127,22 @@ int main()
// Example with // accumulation
// computing the sum of area faces
// force number of threads to 4 (0 for traverse, 1,2,3 for computation)
CGoGN
::
Parallel
::
NumberOfThreads
=
4
;
// init nbthread values with 0
float
surf
[
4
]
=
{
0.0
f
,
0.0
f
,
0.0
f
,
0.0
f
};
float
surf
[
3
]
=
{
0.0
f
,
0.0
f
,
0.0
f
};
// traverse face in //
Parallel
::
foreach_cell
<
FACE
>
(
myMap
,[
&
](
Face
f
,
unsigned
int
thr
)
{
// for each face add surface to accumulator (-1 because counter between 1-
4
not 0-3)
// 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
);
},
4
,
false
);
},
false
);
std
::
cout
<<
surf
[
0
]
<<
"/"
<<
surf
[
1
]
<<
"/"
<<
surf
[
2
]
<<
"/"
<<
s
urf
[
3
]
<<
"/"
<<
s
td
::
endl
;
std
::
cout
<<
"Total="
<<
surf
[
0
]
+
surf
[
1
]
+
surf
[
2
]
+
surf
[
3
]
<<
std
::
endl
;
std
::
cout
<<
surf
[
0
]
<<
"/"
<<
surf
[
1
]
<<
"/"
<<
surf
[
2
]
<<
"/"
<<
std
::
endl
;
std
::
cout
<<
"Total="
<<
surf
[
0
]
+
surf
[
1
]
+
surf
[
2
]
<<
std
::
endl
;
TraversorV
<
MAP
>
tv0
(
myMap
);
...
...
include/Algo/Geometry/area.h
View file @
edb26f50
...
...
@@ -86,6 +86,21 @@ void computeBarycentricAreaVertices(typename PFP::MAP& map, const VertexAttribut
template
<
typename
PFP
>
void
computeVoronoiAreaVertices
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
::
IMPL
>&
position
,
VertexAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
::
IMPL
>&
vertex_area
,
unsigned
int
thread
=
0
)
;
namespace
Parallel
{
template
<
typename
PFP
>
void
computeAreaFaces
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
::
IMPL
>&
position
,
FaceAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
::
IMPL
>&
area
);
template
<
typename
PFP
>
void
computeOneRingAreaVertices
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
::
IMPL
>&
position
,
VertexAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
::
IMPL
>&
area
);
template
<
typename
PFP
>
void
computeBarycentricAreaVertices
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
::
IMPL
>&
position
,
VertexAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
::
IMPL
>&
vertex_area
);
template
<
typename
PFP
>
void
computeVoronoiAreaVertices
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
>&
position
,
VertexAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
>&
area
);
}
// namespace Parallel
}
// namespace Geometry
}
// namespace Surface
...
...
include/Algo/Geometry/area.hpp
View file @
edb26f50
...
...
@@ -76,8 +76,6 @@ typename PFP::REAL totalArea(typename PFP::MAP& map, const VertexAttribute<typen
{
typename
PFP
::
REAL
area
(
0
)
;
// TraversorF<typename PFP::MAP> t(map) ;
foreach_cell
<
FACE
>
(
map
,
[
&
]
(
Face
f
)
{
area
+=
convexFaceArea
<
PFP
>
(
map
,
f
,
position
);
...
...
@@ -91,7 +89,6 @@ template <typename PFP>
typename
PFP
::
REAL
vertexOneRingArea
(
typename
PFP
::
MAP
&
map
,
Vertex
v
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
::
IMPL
>&
position
)
{
typename
PFP
::
REAL
area
(
0
)
;
// Traversor2VF<typename PFP::MAP> t(map, d) ;
foreach_incident2
<
FACE
>
(
map
,
v
,
[
&
]
(
Face
f
)
{
...
...
@@ -104,7 +101,6 @@ template <typename PFP>
typename
PFP
::
REAL
vertexBarycentricArea
(
typename
PFP
::
MAP
&
map
,
Vertex
v
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
::
IMPL
>&
position
)
{
typename
PFP
::
REAL
area
(
0
)
;
// Traversor2VF<typename PFP::MAP> t(map, v) ;
foreach_incident2
<
FACE
>
(
map
,
v
,
[
&
]
(
Face
f
)
{
...
...
@@ -117,7 +113,6 @@ template <typename PFP>
typename
PFP
::
REAL
vertexVoronoiArea
(
typename
PFP
::
MAP
&
map
,
Vertex
v
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
::
IMPL
>&
position
)
{
typename
PFP
::
REAL
area
(
0
)
;
// Traversor2VF<typename PFP::MAP> t(map, v) ;
foreach_incident2
<
FACE
>
(
map
,
v
,
[
&
]
(
Face
it
)
{
const
typename
PFP
::
VEC3
&
p1
=
position
[
it
]
;
...
...
@@ -144,21 +139,30 @@ typename PFP::REAL vertexVoronoiArea(typename PFP::MAP& map, Vertex v, const Ver
template
<
typename
PFP
>
void
computeAreaFaces
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
::
IMPL
>&
position
,
FaceAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
::
IMPL
>&
face_area
,
unsigned
int
thread
)
{
// TraversorF<typename PFP::MAP> t(map) ;
// for(Dart d = t.begin(); d != t.end(); d = t.next())
// face_area[d] = convexFaceArea<PFP>(map, d, position) ;
if
((
CGoGN
::
Parallel
::
NumberOfThreads
>
1
)
&&
(
thread
==
0
))
{
Parallel
::
computeAreaFaces
<
PFP
>
(
map
,
position
,
face_area
);
return
;
}
foreach_cell
<
FACE
>
(
map
,
[
&
]
(
Face
f
)
{
face_area
[
f
]
=
convexFaceArea
<
PFP
>
(
map
,
f
,
position
)
;
}
,
false
,
thread
);
,
AUTO
,
thread
);
}
template
<
typename
PFP
>
void
computeOneRingAreaVertices
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
::
IMPL
>&
position
,
VertexAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
::
IMPL
>&
vertex_area
,
unsigned
int
thread
)
{
if
((
CGoGN
::
Parallel
::
NumberOfThreads
>
1
)
&&
(
thread
==
0
))
{
Parallel
::
computeOneRingAreaVertices
<
PFP
>
(
map
,
position
,
vertex_area
);
return
;
}
FaceAutoAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
::
IMPL
>
areas
(
map
);
computeAreaFaces
<
PFP
>
(
map
,
position
,
areas
);
...
...
@@ -170,30 +174,40 @@ void computeOneRingAreaVertices(typename PFP::MAP& map, const VertexAttribute<ty
vertex_area
[
v
]
+=
areas
[
f
];
});
}
,
false
,
thread
);
,
FORCE_CELL_MARKING
,
thread
);
}
template
<
typename
PFP
>
void
computeBarycentricAreaVertices
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
::
IMPL
>&
position
,
VertexAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
::
IMPL
>&
vertex_area
,
unsigned
int
thread
)
{
// TraversorV<typename PFP::MAP> t(map) ;
if
((
CGoGN
::
Parallel
::
NumberOfThreads
>
1
)
&&
(
thread
==
0
))
{
Parallel
::
computeBarycentricAreaVertices
<
PFP
>
(
map
,
position
,
vertex_area
);
return
;
}
foreach_cell
<
VERTEX
>
(
map
,
[
&
]
(
Vertex
v
)
{
vertex_area
[
v
]
=
vertexBarycentricArea
<
PFP
>
(
map
,
v
,
position
)
;
}
,
false
,
thread
);
,
FORCE_CELL_MARKING
,
thread
);
}
template
<
typename
PFP
>
void
computeVoronoiAreaVertices
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
::
IMPL
>&
position
,
VertexAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
::
IMPL
>&
vertex_area
,
unsigned
int
thread
)
{
// TraversorV<typename PFP::MAP> t(map) ;
if
((
CGoGN
::
Parallel
::
NumberOfThreads
>
1
)
&&
(
thread
==
0
))
{
Parallel
::
computeVoronoiAreaVertices
<
PFP
>
(
map
,
position
,
vertex_area
);
return
;
}
foreach_cell
<
VERTEX
>
(
map
,
[
&
]
(
Vertex
v
)
{
vertex_area
[
v
]
=
vertexVoronoiArea
<
PFP
>
(
map
,
v
,
position
)
;
}
,
false
,
thread
);
,
FORCE_CELL_MARKING
,
thread
);
}
...
...
@@ -202,72 +216,56 @@ namespace Parallel
{
template
<
typename
PFP
>
class
FunctorConvexFaceArea
:
public
FunctorMapThreaded
<
typename
PFP
::
MAP
>
void
computeAreaFaces
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
::
IMPL
>&
position
,
FaceAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
::
IMPL
>&
area
)
{
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
::
IMPL
>&
m_position
;
FaceAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
::
IMPL
>&
m_area
;
public:
FunctorConvexFaceArea
<
PFP
>
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
::
IMPL
>&
position
,
FaceAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
::
IMPL
>&
area
)
:
FunctorMapThreaded
<
typename
PFP
::
MAP
>
(
map
),
m_position
(
position
),
m_area
(
area
)
{
}
void
run
(
Dart
d
,
unsigned
int
threadID
)
// if (map.isOrbitEmbedded<FACE>())
// {
// Parallel::foreach_cell<FACE>(map,[&](Face f, unsigned int thr)
// {
// area[f] = convexFaceArea<PFP>(map, f, position) ;
// },nbth,false,FORCE_CELL_MARKING);
// }
// else
// {
// Parallel::foreach_cell<FACE>(map,[&](Face f, unsigned int thr)
// {
// area[f] = convexFaceArea<PFP>(map, f, position) ;
// },nbth,false,AUTO);
// }
CGoGN
::
Parallel
::
foreach_cell
<
FACE
>
(
map
,[
&
](
Face
f
,
unsigned
int
thr
)
{
m_area
[
d
]
=
convexFaceArea
<
PFP
>
(
this
->
m_map
,
d
,
m_position
)
;
}
};
template
<
typename
PFP
>
void
computeAreaFaces
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
::
IMPL
>&
position
,
FaceAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
::
IMPL
>&
area
,
unsigned
int
nbth
)
{
FunctorConvexFaceArea
<
PFP
>
funct
(
map
,
position
,
area
);
Algo
::
Parallel
::
foreach_cell
<
typename
PFP
::
MAP
,
FACE
>
(
map
,
funct
,
nbth
,
false
);
area
[
f
]
=
convexFaceArea
<
PFP
>
(
map
,
f
,
position
)
;
},
false
,
AUTO
);
}
template
<
typename
PFP
>
class
FunctorVertexOneRingArea
:
public
FunctorMapThreaded
<
typename
PFP
::
MAP
>
{
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
::
IMPL
>&
m_position
;
VertexAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
::
IMPL
>&
m_area
;
public:
FunctorVertexOneRingArea
<
PFP
>
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
::
IMPL
>&
position
,
VertexAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
::
IMPL
>&
area
)
:
FunctorMapThreaded
<
typename
PFP
::
MAP
>
(
map
),
m_position
(
position
),
m_area
(
area
)
{
}
void
run
(
Dart
d
,
unsigned
int
threadID
)
{
m_area
[
d
]
=
vertexOneRingArea
<
PFP
>
(
this
->
m_map
,
d
,
m_position
)
;
}
};
template
<
typename
PFP
>
void
computeOneRingAreaVertices
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
::
IMPL
>&
position
,
VertexAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
::
IMPL
>&
area
,
unsigned
int
nbth
)
void
computeOneRingAreaVertices
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
::
IMPL
>&
position
,
VertexAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
::
IMPL
>&
area
)
{
FunctorConvexFaceArea
<
PFP
>
funct
(
map
,
position
,
area
);
Algo
::
Parallel
::
foreach_cell
<
typename
PFP
::
MAP
,
VERTEX
>
(
map
,
funct
,
nbth
,
false
);
CGoGN
::
Parallel
::
foreach_cell
<
VERTEX
>
(
map
,[
&
](
Vertex
v
,
unsigned
int
thr
)
{
area
[
v
]
=
vertexOneRingArea
<
PFP
>
(
map
,
v
,
position
)
;
},
false
,
FORCE_CELL_MARKING
);
}
template
<
typename
PFP
>
class
FunctorVertexVoronoiArea
:
public
FunctorMapThreaded
<
typename
PFP
::
MAP
>
void
computeBarycentricAreaVertices
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
::
IMPL
>&
position
,
VertexAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
::
IMPL
>&
vertex_area
)
{
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
::
IMPL
>&
m_position
;
VertexAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
::
IMPL
>&
m_area
;
public:
FunctorVertexVoronoiArea
<
PFP
>
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
::
IMPL
>&
position
,
VertexAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
::
IMPL
>&
area
)
:
FunctorMapThreaded
<
typename
PFP
::
MAP
>
(
map
),
m_position
(
position
),
m_area
(
area
)
{
}
void
run
(
Dart
d
,
unsigned
int
threadID
)
CGoGN
::
Parallel
::
foreach_cell
<
VERTEX
>
(
map
,
[
&
]
(
Vertex
v
,
unsigned
int
thr
)
{
m_area
[
d
]
=
vertexVoronoiArea
<
PFP
>
(
this
->
m_map
,
d
,
m_
position
)
;
vertex_area
[
v
]
=
vertexBarycentricArea
<
PFP
>
(
map
,
v
,
position
)
;
}
};
,
false
,
FORCE_CELL_MARKING
);
}
template
<
typename
PFP
>
void
computeVoronoiAreaVertices
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
>&
position
,
VertexAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
>&
area
,
unsigned
int
nbth
)
void
computeVoronoiAreaVertices
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
>&
position
,
VertexAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
>&
area
)
{
FunctorConvexFaceArea
<
PFP
>
funct
(
map
,
position
,
area
);
Algo
::
Parallel
::
foreach_cell
<
typename
PFP
::
MAP
,
VERTEX
>
(
map
,
funct
,
nbth
,
false
);
CGoGN
::
Parallel
::
foreach_cell
<
VERTEX
>
(
map
,[
&
](
Vertex
v
,
unsigned
int
thr
)
{
area
[
v
]
=
vertexVoronoiArea
<
PFP
>
(
map
,
v
,
position
)
;
},
false
,
FORCE_CELL_MARKING
);
}
}
// namespace Parallel
...
...
include/Algo/Geometry/centroid.h
View file @
edb26f50
...
...
@@ -140,36 +140,30 @@ namespace Parallel
* @param map the map
* @param position position vertex attribute
* @param face_centroid centroid face attribute
* @param nbth the number of threads
*/
template
<
typename
PFP
,
typename
V_ATT
,
typename
F_ATT
>
void
computeCentroidFaces
(
typename
PFP
::
MAP
&
map
,
const
V_ATT
&
position
,
F_ATT
&
face_centroid
,
unsigned
int
nbth
=
0
)
;
const
V_ATT
&
position
,
F_ATT
&
face_centroid
)
;
/**
* Compute centroid of all faces (Edge Length Weighted)
* @param map the map
* @param position position vertex attribute
* @param face_centroid centroid face attribute
* @param nbth the number of threads
*/
template
<
typename
PFP
,
typename
V_ATT
,
typename
F_ATT
>
void
computeCentroidELWFaces
(
typename
PFP
::
MAP
&
map
,
const
V_ATT
&
position
,
F_ATT
&
face_centroid
,
unsigned
int
nbth
=
0
)
;
const
V_ATT
&
position
,
F_ATT
&
face_centroid
)
;
/**
* Compute neighborhood centroid of all vertices (in parallel)
* @param map the map
* @param position position vertex attribute
* @param vertex_centroid centroid vertex attribute
* @param nbth the number of threads
*/
template
<
typename
PFP
,
typename
V_ATT
>
void
computeNeighborhoodCentroidVertices
(
typename
PFP
::
MAP
&
map
,
const
V_ATT
&
position
,
V_ATT
&
vertex_centroid
,
unsigned
int
nbth
=
0
)
;
const
V_ATT
&
position
,
V_ATT
&
vertex_centroid
)
;
}
// namespace Parallel
...
...
@@ -224,20 +218,17 @@ namespace Parallel
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
nbth
=
0
)
;
const
V_ATT
&
position
,
W_ATT
&
vol_centroid
)
;
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
nbth
=
0
)
;
const
V_ATT
&
position
,
W_ATT
&
vol_centroid
)
;
template
<
typename
PFP
,
typename
V_ATT
>
void
computeNeighborhoodCentroidVertices
(
typename
PFP
::
MAP
&
map
,
const
V_ATT
&
position
,
V_ATT
&
vertex_centroid
,
unsigned
int
nbth
=
0
)
;
const
V_ATT
&
position
,
V_ATT
&
vertex_centroid
)
;
}
// namespace Parallel
...
...
include/Algo/Geometry/centroid.hpp
View file @
edb26f50
...
...
@@ -46,7 +46,6 @@ typename V_ATT::DATA_TYPE volumeCentroid(typename PFP::MAP& map, Vol d, const V_
{
typename
V_ATT
::
DATA_TYPE
center
(
0.0
);
unsigned
int
count
=
0
;
// Traversor3WV<typename PFP::MAP> tra(map,d,false,thread);