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
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
David Cazier
CGoGN
Commits
753c8238
Commit
753c8238
authored
May 09, 2014
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parallel::foreach_cell usage
parent
8f89cbb4
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
482 additions
and
571 deletions
+482
-571
Apps/Examples/viewer.cpp
Apps/Examples/viewer.cpp
+49
-39
include/Algo/Geometry/area.hpp
include/Algo/Geometry/area.hpp
+29
-53
include/Algo/Geometry/centroid.hpp
include/Algo/Geometry/centroid.hpp
+26
-114
include/Algo/Geometry/curvature.hpp
include/Algo/Geometry/curvature.hpp
+9
-91
include/Algo/Geometry/normal.hpp
include/Algo/Geometry/normal.hpp
+36
-78
include/Algo/Geometry/volume.hpp
include/Algo/Geometry/volume.hpp
+15
-36
include/Topology/generic/traversor/traversorCell.h
include/Topology/generic/traversor/traversorCell.h
+15
-155
include/Topology/generic/traversor/traversorCell.hpp
include/Topology/generic/traversor/traversorCell.hpp
+303
-5
No files found.
Apps/Examples/viewer.cpp
View file @
753c8238
...
@@ -272,31 +272,31 @@ void Viewer::cb_keyPress(int keycode)
...
@@ -272,31 +272,31 @@ void Viewer::cb_keyPress(int keycode)
if
(
!
pos2
.
isValid
())
if
(
!
pos2
.
isValid
())
pos2
=
myMap
.
addAttribute
<
VEC3
,
VERTEX
>
(
"pos2"
)
;
pos2
=
myMap
.
addAttribute
<
VEC3
,
VERTEX
>
(
"pos2"
)
;
foreach_cell_EvenOddd
<
VERTEX
>
(
myMap
,
[
&
]
(
Vertex
d
)
//
foreach_cell_EvenOddd<VERTEX>(myMap, [&] (Vertex d)
{
//
{
pos2
[
d
]
=
VEC3
(
0
,
0
,
0
);
//
pos2[d] = VEC3(0,0,0);
int
nb
=
0
;
//
int nb=0;
foreach_adjacent2
<
FACE
>
(
myMap
,
d
,[
&
](
Vertex
e
)
//
foreach_adjacent2<FACE>(myMap,d,[&](Vertex e)
{
//
{
pos2
[
d
]
+=
position
[
e
];
//
pos2[d] += position[e];
nb
++
;
//
nb++;
});
//
});
pos2
[
d
]
/=
nb
;
//
pos2[d]/=nb;
},
//
},
[
&
]
(
Vertex
d
)
//
[&] (Vertex d)
{
//
{
position
[
d
]
=
VEC3
(
0
,
0
,
0
);
//
position[d] = VEC3(0,0,0);
int
nb
=
0
;
//
int nb=0;
foreach_adjacent2
<
FACE
>
(
myMap
,
d
,[
&
](
Vertex
e
)
//
foreach_adjacent2<FACE>(myMap,d,[&](Vertex e)
{
//
{
position
[
d
]
+=
pos2
[
e
];
//
position[d] += pos2[e];
nb
++
;
//
nb++;
});
//
});
position
[
d
]
/=
nb
;
//
position[d]/=nb;
},
//
},
3
);
//
3);
std
::
cout
<<
"Even/Odd "
<<
ch
.
elapsed
()
<<
" ms "
<<
std
::
endl
;
//
std::cout << "Even/Odd "<< ch.elapsed()<< " ms "<< std::endl;
Algo
::
Surface
::
Geometry
::
computeNormalVertices
<
PFP
>
(
myMap
,
position
,
normal
)
;
Algo
::
Surface
::
Geometry
::
computeNormalVertices
<
PFP
>
(
myMap
,
position
,
normal
)
;
m_positionVBO
->
updateData
(
position
)
;
m_positionVBO
->
updateData
(
position
)
;
m_normalVBO
->
updateData
(
normal
)
;
m_normalVBO
->
updateData
(
normal
)
;
...
@@ -460,22 +460,32 @@ void Viewer::cb_keyPress(int keycode)
...
@@ -460,22 +460,32 @@ void Viewer::cb_keyPress(int keycode)
Utils
::
Chrono
ch
;
Utils
::
Chrono
ch
;
ch
.
start
();
ch
.
start
();
TraversorCell
<
MAP
,
VERTEX
>
trav
(
myMap
,
true
);
for
(
unsigned
int
i
=
0
;
i
<
4
;
++
i
)
TraversorCellEven
<
MAP
,
VERTEX
>
tr1
(
trav
)
;
Algo
::
Surface
::
Geometry
::
Parallel
::
computeNormalVertices
<
PFP
>
(
myMap
,
position
,
normal
)
;
TraversorCellOdd
<
MAP
,
VERTEX
>
tr2
(
trav
)
;
std
::
cout
<<
"Algo::Surface::Geometry::Parallel::computeNormalVertices "
<<
ch
.
elapsed
()
<<
" ms "
<<
std
::
endl
;
for
(
unsigned
int
i
=
0
;
i
<
5
;
++
i
)
ch
.
start
();
{
for
(
unsigned
int
i
=
0
;
i
<
4
;
++
i
)
for
(
Cell
<
VERTEX
>
v
=
tr1
.
begin
(),
e
=
tr1
.
end
();
v
.
dart
!=
e
.
dart
;
v
=
tr1
.
next
())
Parallel
::
foreach_cell
<
VERTEX
>
(
myMap
,[
&
](
Vertex
v
,
unsigned
int
th
)
{
normal
[
v
][
0
]
=
0.0
f
;
}
for
(
Cell
<
VERTEX
>
v
=
tr2
.
begin
(),
e
=
tr2
.
end
();
v
.
dart
!=
e
.
dart
;
v
=
tr2
.
next
())
{
{
normal
[
v
][
0
]
=
0.0
f
;
normal
[
v
]
=
Algo
::
Surface
::
Geometry
::
vertexNormal
<
PFP
>
(
myMap
,
v
,
position
);
}
},
4
,
false
,
FORCE_CELL_MARKING
);
}
std
::
cout
<<
"Timing 5 traversors even/odd "
<<
ch
.
elapsed
()
<<
" ms "
<<
std
::
endl
;
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
;
break
;
...
...
include/Algo/Geometry/area.hpp
View file @
753c8238
...
@@ -201,73 +201,49 @@ void computeVoronoiAreaVertices(typename PFP::MAP& map, const VertexAttribute<ty
...
@@ -201,73 +201,49 @@ void computeVoronoiAreaVertices(typename PFP::MAP& map, const VertexAttribute<ty
namespace
Parallel
namespace
Parallel
{
{
template
<
typename
PFP
>
class
FunctorConvexFaceArea
:
public
FunctorMapThreaded
<
typename
PFP
::
MAP
>
{
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
)
{
m_area
[
d
]
=
convexFaceArea
<
PFP
>
(
this
->
m_map
,
d
,
m_position
)
;
}
};
template
<
typename
PFP
>
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
)
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
);
// if (map.isOrbitEmbedded<FACE>())
Algo
::
Parallel
::
foreach_cell
<
typename
PFP
::
MAP
,
FACE
>
(
map
,
funct
,
nbth
,
false
);
// {
// 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);
// }
// TODO A REMPLACER QUAND PLGTS CHANGES
CGoGN
::
Parallel
::
foreach_cell
<
FACE
>
(
map
,[
&
](
Face
f
,
unsigned
int
thr
)
{
area
[
f
]
=
convexFaceArea
<
PFP
>
(
map
,
f
,
position
)
;
},
nbth
,
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
>
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
,
unsigned
int
nbth
)
{
{
FunctorConvexFaceArea
<
PFP
>
funct
(
map
,
position
,
area
);
CGoGN
::
Parallel
::
foreach_cell
<
VERTEX
>
(
map
,[
&
](
Vertex
v
,
unsigned
int
thr
)
Algo
::
Parallel
::
foreach_cell
<
typename
PFP
::
MAP
,
VERTEX
>
(
map
,
funct
,
nbth
,
false
);
}
template
<
typename
PFP
>
class
FunctorVertexVoronoiArea
:
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:
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
)
{
{
m_area
[
d
]
=
vertexVoronoiArea
<
PFP
>
(
this
->
m_map
,
d
,
m_
position
)
;
area
[
v
]
=
vertexOneRingArea
<
PFP
>
(
map
,
v
,
position
)
;
}
}
,
nbth
,
false
,
FORCE_CELL_MARKING
);
}
;
}
template
<
typename
PFP
>
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
,
unsigned
int
nbth
)
{
{
FunctorConvexFaceArea
<
PFP
>
funct
(
map
,
position
,
area
);
CGoGN
::
Parallel
::
foreach_cell
<
VERTEX
>
(
map
,[
&
](
Vertex
v
,
unsigned
int
thr
)
Algo
::
Parallel
::
foreach_cell
<
typename
PFP
::
MAP
,
VERTEX
>
(
map
,
funct
,
nbth
,
false
);
{
area
[
v
]
=
vertexVoronoiArea
<
PFP
>
(
map
,
v
,
position
)
;
},
nbth
,
false
,
FORCE_CELL_MARKING
);
}
}
}
// namespace Parallel
}
// namespace Parallel
...
...
include/Algo/Geometry/centroid.hpp
View file @
753c8238
...
@@ -169,71 +169,25 @@ void computeNeighborhoodCentroidVertices(typename PFP::MAP& map, const V_ATT& po
...
@@ -169,71 +169,25 @@ void computeNeighborhoodCentroidVertices(typename PFP::MAP& map, const V_ATT& po
namespace
Parallel
namespace
Parallel
{
{
template
<
typename
PFP
,
typename
V_ATT
,
typename
F_ATT
>
class
FunctorComputeCentroidFaces
:
public
FunctorMapThreaded
<
typename
PFP
::
MAP
>
{
const
V_ATT
&
m_position
;
F_ATT
&
m_fcentroid
;
public:
FunctorComputeCentroidFaces
<
PFP
,
V_ATT
,
F_ATT
>
(
typename
PFP
::
MAP
&
map
,
const
V_ATT
&
position
,
F_ATT
&
fcentroid
)
:
FunctorMapThreaded
<
typename
PFP
::
MAP
>
(
map
),
m_position
(
position
),
m_fcentroid
(
fcentroid
)
{
}
void
run
(
Dart
d
,
unsigned
int
/*threadID*/
)
{
m_fcentroid
[
d
]
=
faceCentroid
<
PFP
>
(
this
->
m_map
,
d
,
m_position
)
;
}
};
template
<
typename
PFP
,
typename
V_ATT
,
typename
F_ATT
>
class
FunctorComputeCentroidELWFaces
:
public
FunctorMapThreaded
<
typename
PFP
::
MAP
>
{
const
V_ATT
&
m_position
;
F_ATT
&
m_fcentroid
;
public:
FunctorComputeCentroidELWFaces
<
PFP
,
V_ATT
,
F_ATT
>
(
typename
PFP
::
MAP
&
map
,
const
V_ATT
&
position
,
F_ATT
&
fcentroid
)
:
FunctorMapThreaded
<
typename
PFP
::
MAP
>
(
map
),
m_position
(
position
),
m_fcentroid
(
fcentroid
)
{
}
void
run
(
Dart
d
,
unsigned
int
threadID
)
{
m_fcentroid
[
d
]
=
faceCentroidELW
<
PFP
>
(
this
->
m_map
,
d
,
m_position
)
;
}
};
template
<
typename
PFP
,
typename
V_ATT
>
class
FunctorComputeNeighborhoodCentroidVertices
:
public
FunctorMapThreaded
<
typename
PFP
::
MAP
>
{
const
V_ATT
&
m_position
;
V_ATT
&
m_vcentroid
;
public:
FunctorComputeNeighborhoodCentroidVertices
<
PFP
,
V_ATT
>
(
typename
PFP
::
MAP
&
map
,
const
V_ATT
&
position
,
V_ATT
&
vcentroid
)
:
FunctorMapThreaded
<
typename
PFP
::
MAP
>
(
map
),
m_position
(
position
),
m_vcentroid
(
vcentroid
)
{
}
void
run
(
Dart
d
,
unsigned
int
/*threadID*/
)
{
m_vcentroid
[
d
]
=
vertexNeighborhoodCentroid
<
PFP
>
(
this
->
m_map
,
d
,
m_position
)
;
}
};
template
<
typename
PFP
,
typename
V_ATT
,
typename
F_ATT
>
template
<
typename
PFP
,
typename
V_ATT
,
typename
F_ATT
>
void
computeCentroidFaces
(
typename
PFP
::
MAP
&
map
,
const
V_ATT
&
position
,
F_ATT
&
face_centroid
,
void
computeCentroidFaces
(
typename
PFP
::
MAP
&
map
,
const
V_ATT
&
position
,
F_ATT
&
face_centroid
,
unsigned
int
nbth
,
unsigned
int
current_thread
)
unsigned
int
nbth
)
{
{
FunctorComputeCentroidFaces
<
PFP
,
V_ATT
,
F_ATT
>
funct
(
map
,
position
,
face_centroid
);
CGoGN
::
Parallel
::
foreach_cell
<
FACE
>
(
map
,[
&
](
Face
f
,
unsigned
int
thr
)
Algo
::
Parallel
::
foreach_cell
<
typename
PFP
::
MAP
,
FACE
>
(
map
,
funct
,
nbth
,
false
,
current_thread
);
{
face_centroid
[
f
]
=
faceCentroid
<
PFP
>
(
map
,
f
,
position
)
;
},
nbth
,
false
,
AUTO
);
}
}
template
<
typename
PFP
,
typename
V_ATT
,
typename
F_ATT
>
template
<
typename
PFP
,
typename
V_ATT
,
typename
F_ATT
>
void
computeCentroidELWFaces
(
typename
PFP
::
MAP
&
map
,
const
V_ATT
&
position
,
F_ATT
&
face_centroid
,
void
computeCentroidELWFaces
(
typename
PFP
::
MAP
&
map
,
const
V_ATT
&
position
,
F_ATT
&
face_centroid
,
unsigned
int
nbth
,
unsigned
int
current_thread
)
unsigned
int
nbth
,
unsigned
int
current_thread
)
{
{
FunctorComputeCentroidELWFaces
<
PFP
,
V_ATT
,
F_ATT
>
funct
(
map
,
position
,
face_centroid
);
CGoGN
::
Parallel
::
foreach_cell
<
FACE
>
(
map
,[
&
](
Face
f
,
unsigned
int
thr
)
Algo
::
Parallel
::
foreach_cell
<
typename
PFP
::
MAP
,
FACE
>
(
map
,
funct
,
nbth
,
false
,
current_thread
);
{
face_centroid
[
f
]
=
faceCentroidELW
<
PFP
>
(
map
,
f
,
position
)
;
},
nbth
,
false
,
AUTO
);
}
}
template
<
typename
PFP
,
typename
V_ATT
>
template
<
typename
PFP
,
typename
V_ATT
>
...
@@ -241,8 +195,10 @@ void computeNeighborhoodCentroidVertices(typename PFP::MAP& map,
...
@@ -241,8 +195,10 @@ void computeNeighborhoodCentroidVertices(typename PFP::MAP& map,
const
V_ATT
&
position
,
V_ATT
&
vertex_centroid
,
const
V_ATT
&
position
,
V_ATT
&
vertex_centroid
,
unsigned
int
nbth
,
unsigned
int
current_thread
)
unsigned
int
nbth
,
unsigned
int
current_thread
)
{
{
FunctorComputeNeighborhoodCentroidVertices
<
PFP
,
V_ATT
>
funct
(
map
,
position
,
vertex_centroid
);
CGoGN
::
Parallel
::
foreach_cell
<
VERTEX
>
(
map
,[
&
](
Vertex
v
,
unsigned
int
thr
)
Algo
::
Parallel
::
foreach_cell
<
typename
PFP
::
MAP
,
VERTEX
>
(
map
,
funct
,
nbth
,
false
);
{
vertex_centroid
[
v
]
=
vertexNeighborhoodCentroid
<
PFP
>
(
map
,
v
,
position
)
;
},
nbth
,
false
,
FORCE_CELL_MARKING
);
}
}
}
// namespace Parallel
}
// namespace Parallel
...
@@ -308,79 +264,35 @@ void computeNeighborhoodCentroidVertices(typename PFP::MAP& map, const V_ATT& po
...
@@ -308,79 +264,35 @@ void computeNeighborhoodCentroidVertices(typename PFP::MAP& map, const V_ATT& po
namespace
Parallel
namespace
Parallel
{
{
template
<
typename
PFP
,
typename
V_ATT
,
typename
W_ATT
>
class
FunctorComputeCentroidVolumes
:
public
FunctorMapThreaded
<
typename
PFP
::
MAP
>
{
const
V_ATT
&
m_position
;
W_ATT
&
m_vol_centroid
;
public:
FunctorComputeCentroidVolumes
<
PFP
,
V_ATT
,
W_ATT
>
(
typename
PFP
::
MAP
&
map
,
const
V_ATT
&
position
,
W_ATT
&
vol_centroid
)
:
FunctorMapThreaded
<
typename
PFP
::
MAP
>
(
map
),
m_position
(
position
),
m_vol_centroid
(
vol_centroid
)
{
}
void
run
(
Dart
d
,
unsigned
int
threadID
)
{
m_vol_centroid
[
d
]
=
Surface
::
Geometry
::
volumeCentroid
<
PFP
,
V_ATT
,
W_ATT
>
(
this
->
m_map
,
d
,
m_position
,
threadID
)
;
}
};
template
<
typename
PFP
,
typename
V_ATT
,
typename
W_ATT
>
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
)
void
computeCentroidVolumes
(
typename
PFP
::
MAP
&
map
,
const
V_ATT
&
position
,
W_ATT
&
vol_centroid
,
unsigned
int
nbth
)
{
{
FunctorComputeCentroidVolumes
<
PFP
,
V_ATT
,
W_ATT
>
funct
(
map
,
position
,
vol_centroid
);
CGoGN
::
Parallel
::
foreach_cell
<
VOLUME
>
(
map
,[
&
](
Vol
v
,
unsigned
int
thr
)
Algo
::
Parallel
::
foreach_cell
<
typename
PFP
::
MAP
,
VOLUME
>
(
map
,
funct
,
nbth
,
true
);
}
template
<
typename
PFP
,
typename
V_ATT
,
typename
W_ATT
>
class
FunctorComputeCentroidELWVolumes
:
public
FunctorMapThreaded
<
typename
PFP
::
MAP
>
{
const
V_ATT
&
m_position
;
W_ATT
&
m_vol_centroid
;
public:
FunctorComputeCentroidELWVolumes
<
PFP
,
V_ATT
,
W_ATT
>
(
typename
PFP
::
MAP
&
map
,
const
V_ATT
&
position
,
W_ATT
&
vol_centroid
)
:
FunctorMapThreaded
<
typename
PFP
::
MAP
>
(
map
),
m_position
(
position
),
m_vol_centroid
(
vol_centroid
)
{
}
void
run
(
Dart
d
,
unsigned
int
threadID
)
{
{
m_vol_centroid
[
d
]
=
Surface
::
Geometry
::
volumeCentroidELW
<
PFP
,
V_ATT
>
(
this
->
m_map
,
d
,
m_position
,
threadID
)
;
vol_centroid
[
v
]
=
Surface
::
Geometry
::
volumeCentroid
<
PFP
,
V_ATT
,
W_ATT
>
(
map
,
v
,
position
,
thr
)
;
}
}
,
nbth
,
true
,
AUTO
);
}
;
}
template
<
typename
PFP
,
typename
V_ATT
,
typename
W_ATT
>
template
<
typename
PFP
,
typename
V_ATT
,
typename
W_ATT
>
void
computeCentroidELWVolumes
(
typename
PFP
::
MAP
&
map
,
void
computeCentroidELWVolumes
(
typename
PFP
::
MAP
&
map
,
const
V_ATT
&
position
,
W_ATT
&
vol_centroid
,
const
V_ATT
&
position
,
W_ATT
&
vol_centroid
,
unsigned
int
nbth
)
unsigned
int
nbth
)
{
{
FunctorComputeCentroidELWVolumes
<
PFP
,
V_ATT
,
W_ATT
>
funct
(
map
,
position
,
vol_centroid
);
CGoGN
::
Parallel
::
foreach_cell
<
VOLUME
>
(
map
,[
&
](
Vol
v
,
unsigned
int
thr
)
Algo
::
Parallel
::
foreach_cell
<
typename
PFP
::
MAP
,
VOLUME
>
(
map
,
funct
,
nbth
,
true
);
{
vol_centroid
[
v
]
=
Surface
::
Geometry
::
volumeCentroidELW
<
PFP
,
V_ATT
>
(
map
,
v
,
position
,
thr
)
;
},
nbth
,
true
,
AUTO
);
}
}
template
<
typename
PFP
,
typename
V_ATT
>
class
FunctorComputeNeighborhoodCentroidVertices
:
public
FunctorMapThreaded
<
typename
PFP
::
MAP
>
{
const
V_ATT
&
m_position
;
V_ATT
&
m_vcentroid
;
public:
FunctorComputeNeighborhoodCentroidVertices
<
PFP
,
V_ATT
>
(
typename
PFP
::
MAP
&
map
,
const
V_ATT
&
position
,
V_ATT
&
vcentroid
)
:
FunctorMapThreaded
<
typename
PFP
::
MAP
>
(
map
),
m_position
(
position
),
m_vcentroid
(
vcentroid
)
{
}
void
run
(
Dart
d
,
unsigned
int
/*threadID*/
)
{
m_vcentroid
[
d
]
=
vertexNeighborhoodCentroid
<
PFP
,
V_ATT
>
(
this
->
m_map
,
d
,
m_position
)
;
}
};
template
<
typename
PFP
,
typename
V_ATT
>
template
<
typename
PFP
,
typename
V_ATT
>
void
computeNeighborhoodCentroidVertices
(
typename
PFP
::
MAP
&
map
,
const
V_ATT
&
position
,
V_ATT
&
vertex_centroid
,
void
computeNeighborhoodCentroidVertices
(
typename
PFP
::
MAP
&
map
,
const
V_ATT
&
position
,
V_ATT
&
vertex_centroid
,
unsigned
int
nbth
)
unsigned
int
nbth
)
{
{
FunctorComputeNeighborhoodCentroidVertices
<
PFP
,
V_ATT
>
funct
(
map
,
position
,
vertex_centroid
);
CGoGN
::
Parallel
::
foreach_cell
<
VERTEX
>
(
map
,[
&
](
Vertex
v
,
unsigned
int
thr
)
Algo
::
Parallel
::
foreach_cell
<
typename
PFP
::
MAP
,
VERTEX
>
(
map
,
funct
,
nbth
,
false
);
{
vertex_centroid
[
v
]
=
Volume
::
Geometry
::
vertexNeighborhoodCentroid
<
PFP
,
V_ATT
>
(
map
,
v
,
position
,
thr
)
;
},
nbth
,
true
,
FORCE_CELL_MARKING
);
}
}
}
// namespace Parallel
}
// namespace Parallel
...
...
include/Algo/Geometry/curvature.hpp
View file @
753c8238
...
@@ -602,54 +602,6 @@ void normalCycles_ProjectTensor(Geom::Matrix<3,3,typename PFP::REAL>& tensor, co
...
@@ -602,54 +602,6 @@ void normalCycles_ProjectTensor(Geom::Matrix<3,3,typename PFP::REAL>& tensor, co
namespace
Parallel
namespace
Parallel
{
{
template
<
typename
PFP
>
class
FunctorComputeCurvatureVertices_NormalCycles
:
public
FunctorMapThreaded
<
typename
PFP
::
MAP
>
{
typedef
typename
PFP
::
MAP
MAP
;
typedef
typename
PFP
::
MAP
::
IMPL
MAP_IMPL
;
typedef
typename
PFP
::
VEC3
VEC3
;
typedef
typename
PFP
::
REAL
REAL
;
REAL
m_radius
;
const
VertexAttribute
<
VEC3
,
MAP_IMPL
>&
m_position
;
const
VertexAttribute
<
VEC3
,
MAP_IMPL
>&
m_normal
;
const
EdgeAttribute
<
REAL
,
MAP_IMPL
>&
m_edgeangle
;
VertexAttribute
<
REAL
,
MAP_IMPL
>&
m_kmax
;
VertexAttribute
<
REAL
,
MAP_IMPL
>&
m_kmin
;
VertexAttribute
<
VEC3
,
MAP_IMPL
>&
m_Kmax
;
VertexAttribute
<
VEC3
,
MAP_IMPL
>&
m_Kmin
;
VertexAttribute
<
VEC3
,
MAP_IMPL
>&
m_Knormal
;
public:
FunctorComputeCurvatureVertices_NormalCycles
(
MAP
&
map
,
REAL
radius
,
const
VertexAttribute
<
VEC3
,
MAP_IMPL
>&
position
,
const
VertexAttribute
<
VEC3
,
MAP_IMPL
>&
normal
,
const
EdgeAttribute
<
REAL
,
MAP_IMPL
>&
edgeangle
,
VertexAttribute
<
REAL
,
MAP_IMPL
>&
kmax
,
VertexAttribute
<
REAL
,
MAP_IMPL
>&
kmin
,
VertexAttribute
<
VEC3
,
MAP_IMPL
>&
Kmax
,
VertexAttribute
<
VEC3
,
MAP_IMPL
>&
Kmin
,
VertexAttribute
<
VEC3
,
MAP_IMPL
>&
Knormal
)
:
FunctorMapThreaded
<
MAP
>
(
map
),
m_radius
(
radius
),
m_position
(
position
),
m_normal
(
normal
),
m_edgeangle
(
edgeangle
),
m_kmax
(
kmax
),
m_kmin
(
kmin
),
m_Kmax
(
Kmax
),
m_Kmin
(
Kmin
),
m_Knormal
(
Knormal
)
{
}
void
run
(
Dart
d
,
unsigned
int
threadID
)
{
computeCurvatureVertex_NormalCycles
<
PFP
>
(
this
->
m_map
,
d
,
m_radius
,
m_position
,
m_normal
,
m_edgeangle
,
m_kmax
,
m_kmin
,
m_Kmax
,
m_Kmin
,
m_Knormal
,
threadID
)
;
}
};
template
<
typename
PFP
>
template
<
typename
PFP
>
void
computeCurvatureVertices_NormalCycles
(
void
computeCurvatureVertices_NormalCycles
(
typename
PFP
::
MAP
&
map
,
typename
PFP
::
MAP
&
map
,
...
@@ -681,50 +633,13 @@ void computeCurvatureVertices_NormalCycles(
...
@@ -681,50 +633,13 @@ void computeCurvatureVertices_NormalCycles(
map
.
template
initAllOrbitsEmbedding
<
FACE
>();
map
.
template
initAllOrbitsEmbedding
<
FACE
>();
}
}
FunctorComputeCurvatureVertices_NormalCycles
<
PFP
>
funct
(
map
,
radius
,
position
,
normal
,
edgeangle
,
kmax
,
kmin
,
Kmax
,
Kmin
,
Knormal
);
Parallel
::
foreach_cell
<
VERTEX
>
(
map
,[
&
](
Vertex
v
,
unsigned
int
threadID
)
Algo
::
Parallel
::
foreach_cell
<
typename
PFP
::
MAP
,
VERTEX
>
(
map
,
funct
,
nbth
,
true
);
{
computeCurvatureVertex_NormalCycles
<
PFP
>
(
map
,
v
,
radius
,
position
,
normal
,
edgeangle
,
kmax
,
kmin
,
Kmax
,
Kmin
,
Knormal
,
threadID
)
;
},
nbth
,
true
,
FORCE_CELL_MARKING
);
}
}
template
<
typename
PFP
>
class
FunctorComputeCurvatureVertices_QuadraticFitting
:
public
FunctorMapThreaded
<
typename
PFP
::
MAP
>
{
typedef
typename
PFP
::
MAP
MAP
;
typedef
typename
PFP
::
MAP
::
IMPL
MAP_IMPL
;
typedef
typename
PFP
::
VEC3
VEC3
;
typedef
typename
PFP
::
REAL
REAL
;
const
VertexAttribute
<
VEC3
,
MAP_IMPL
>&
m_position
;
const
VertexAttribute
<
VEC3
,
MAP_IMPL
>&
m_normal
;
VertexAttribute
<
REAL
,
MAP_IMPL
>&
m_kmax
;
VertexAttribute
<
REAL
,
MAP_IMPL
>&
m_kmin
;
VertexAttribute
<
VEC3
,
MAP_IMPL
>&
m_Kmax
;
VertexAttribute
<
VEC3
,
MAP_IMPL
>&
m_Kmin
;
public:
FunctorComputeCurvatureVertices_QuadraticFitting
(
MAP
&
map
,
const
VertexAttribute
<
VEC3
,
MAP_IMPL
>&
position
,
const
VertexAttribute
<
VEC3
,
MAP_IMPL
>&
normal
,
VertexAttribute
<
REAL
,
MAP_IMPL
>&
kmax
,
VertexAttribute
<
REAL
,
MAP_IMPL
>&
kmin
,
VertexAttribute
<
VEC3
,
MAP_IMPL
>&
Kmax
,
VertexAttribute
<
VEC3
,
MAP_IMPL
>&
Kmin
)
:
FunctorMapThreaded
<
MAP
>
(
map
),
m_position
(
position
),
m_normal
(
normal
),
m_kmax
(
kmax
),
m_kmin
(
kmin
),
m_Kmax
(
Kmax
),
m_Kmin
(
Kmin
)
{
}
void
run
(
Dart
d
,
unsigned
int
threadID
)
{
computeCurvatureVertex_QuadraticFitting
<
PFP
>
(
this
->
m_map
,
d
,
m_position
,
m_normal
,
m_kmax
,
m_kmin
,
m_Kmax
,
m_Kmin
)
;
}
};
template
<
typename
PFP
>
template
<
typename
PFP
>
void
computeCurvatureVertices_QuadraticFitting
(
void
computeCurvatureVertices_QuadraticFitting
(
typename
PFP
::
MAP
&
map
,
typename
PFP
::
MAP
&
map
,
...
@@ -736,8 +651,11 @@ void computeCurvatureVertices_QuadraticFitting(
...
@@ -736,8 +651,11 @@ void computeCurvatureVertices_QuadraticFitting(
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
::
IMPL
>&
Kmin
,
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
::
IMPL
>&
Kmin
,
unsigned
int
nbth
)
unsigned
int
nbth
)
{
{
FunctorComputeCurvatureVertices_QuadraticFitting
<
PFP
>
funct
(
map
,
position
,
normal
,
kmax
,
kmin
,
Kmax
,
Kmin
);
Parallel
::
foreach_cell
<
VERTEX
>
(
map
,[
&
](
Vertex
v
,
unsigned
int
threadID
)
Algo
::
Parallel
::
foreach_cell
<
typename
PFP
::
MAP
,
VERTEX
>
(
map
,
funct
,
nbth
,
true
);
{
computeCurvatureVertex_QuadraticFitting
<
PFP
>
(
map
,
v
,
position
,
normal
,
kmax
,
kmin
,
Kmax
,
Kmin
,
threadID
)
;
},
nbth
,
true
,
FORCE_CELL_MARKING
);
}
}
}
// namespace Parallel
}
// namespace Parallel
...
...
include/Algo/Geometry/normal.hpp