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
7a132517
Commit
7a132517
authored
Apr 24, 2014
by
Pierre Kraemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
first lambdas..
parent
a5ee3a10
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
41 deletions
+35
-41
Apps/Examples/viewer.cpp
Apps/Examples/viewer.cpp
+2
-0
CMakeLists.txt
CMakeLists.txt
+1
-1
include/Algo/Topo/basic.h
include/Algo/Topo/basic.h
+6
-23
include/Topology/generic/mapCommon.hpp
include/Topology/generic/mapCommon.hpp
+2
-4
include/Topology/generic/traversor/traversorCell.h
include/Topology/generic/traversor/traversorCell.h
+24
-13
No files found.
Apps/Examples/viewer.cpp
View file @
7a132517
...
...
@@ -247,6 +247,8 @@ void Viewer::importMesh(std::string& filename)
setParamObject
(
bb
.
maxSize
(),
bb
.
center
().
data
())
;
updateGLMatrices
()
;
std
::
cout
<<
"#vertices -> "
<<
Algo
::
Topo
::
getNbOrbits
<
VERTEX
>
(
myMap
)
<<
std
::
endl
;
}
void
Viewer
::
exportMesh
(
std
::
string
&
filename
,
bool
askExportMode
)
...
...
CMakeLists.txt
View file @
7a132517
...
...
@@ -150,7 +150,7 @@ IF(WIN32)
set
(
CMAKE_CONFIGURATION_TYPES
"
${
CMAKE_CONFIGURATION_TYPES
}
"
CACHE STRING
"Only Release or Debug"
FORCE
)
# set(CMAKE_CONFIGURATION_TYPES "Release Debug" CACHE STRING "Only Release or Debug" FORCE)
ELSE
(
WIN32
)
SET
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-Wall -Wextra -fPIC"
)
SET
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-Wall -Wextra -fPIC
-std=c++11
"
)
SET
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
-Wall -Woverride-init -fPIC"
)
# remove the 60000+ "no unused local typedefs" warnings with GCC4.8+
if
(
CMAKE_COMPILER_IS_GNUCXX
)
...
...
include/Algo/Topo/basic.h
View file @
7a132517
...
...
@@ -37,27 +37,11 @@ namespace Algo
namespace
Topo
{
template
<
unsigned
int
ORBIT
,
typename
MAP
>
bool
foreach_orbit
(
const
MAP
&
map
,
FunctorType
&
fonct
,
unsigned
int
thread
=
0
)
{
TraversorCell
<
MAP
,
ORBIT
>
trav
(
map
,
true
,
thread
);
bool
found
=
false
;
for
(
Dart
d
=
trav
.
begin
();
!
found
&&
d
!=
trav
.
end
();
d
=
trav
.
next
())
{
if
((
fonct
)(
d
))
found
=
true
;
}
return
found
;
}
template
<
unsigned
int
ORBIT
,
typename
MAP
>
unsigned
int
getNbOrbits
(
const
MAP
&
map
)
{
unsigned
int
cpt
=
0
;
TraversorCell
<
MAP
,
ORBIT
>
trav
(
map
,
true
);
for
(
Dart
d
=
trav
.
begin
();
d
!=
trav
.
end
();
d
=
trav
.
next
())
++
cpt
;
foreach_cell
<
ORBIT
>
(
map
,
[
&
]
(
Dart
)
{
++
cpt
;
},
true
);
return
cpt
;
}
...
...
@@ -91,12 +75,11 @@ void initAllOrbitsEmbedding(MAP& map, bool realloc = false)
if
(
!
map
.
template
isOrbitEmbedded
<
ORBIT
>())
map
.
template
addEmbedding
<
ORBIT
>()
;
TraversorCell
<
MAP
,
ORBIT
>
trav
(
map
,
true
);
for
(
Dart
d
=
trav
.
begin
();
d
!=
trav
.
end
();
d
=
trav
.
next
())
foreach_cell
<
ORBIT
>
(
map
,
[
&
]
(
Dart
d
)
{
if
(
realloc
||
map
.
template
getEmbedding
<
ORBIT
>(
d
)
==
EMBNULL
)
map
.
template
setOrbitEmbeddingOnNewCell
<
ORBIT
>(
d
)
;
}
}
);
}
/**
...
...
@@ -125,8 +108,7 @@ void bijectiveOrbitEmbedding(MAP& map)
AttributeHandler
<
int
,
ORBIT
,
typename
MAP
::
IMPL
>
counter
=
map
.
template
addAttribute
<
int
,
ORBIT
>(
"tmpCounter"
)
;
counter
.
setAllValues
(
int
(
0
))
;
TraversorCell
<
MAP
,
ORBIT
>
trav
(
map
,
true
);
for
(
Dart
d
=
trav
.
begin
();
d
!=
trav
.
end
();
d
=
trav
.
next
())
foreach_cell
<
ORBIT
>
(
map
,
[
&
]
(
Dart
d
)
{
unsigned
int
emb
=
map
.
template
getEmbedding
<
ORBIT
>(
d
)
;
if
(
emb
!=
EMBNULL
)
...
...
@@ -138,7 +120,8 @@ void bijectiveOrbitEmbedding(MAP& map)
}
counter
[
d
]
++
;
}
}
},
true
);
map
.
removeAttribute
(
counter
)
;
}
...
...
include/Topology/generic/mapCommon.hpp
View file @
7a132517
...
...
@@ -66,12 +66,10 @@ inline unsigned int MapCommon<MAP_IMPL>::getEmbedding(Dart d) const
{
assert
(
this
->
template
isOrbitEmbedded
<
ORBIT
>()
||
!
"Invalid parameter: orbit not embedded"
);
unsigned
int
d_index
=
this
->
dartIndex
(
d
);
if
(
ORBIT
==
DART
)
return
d_index
;
return
this
->
dartIndex
(
d
)
;
return
(
*
this
->
m_embeddings
[
ORBIT
])[
d_index
]
;
return
(
*
this
->
m_embeddings
[
ORBIT
])[
this
->
dartIndex
(
d
)
]
;
}
template
<
typename
MAP_IMPL
>
...
...
include/Topology/generic/traversor/traversorCell.h
View file @
7a132517
...
...
@@ -30,22 +30,11 @@
#include "Topology/generic/cellmarker.h"
#include "Topology/generic/traversor/traversorGen.h"
#include <functional>
namespace
CGoGN
{
/// Macro for simple syntax traversal (can be nested)
/// parameters:
/// - cell type
/// - name of iterator variable (automatically declared)
/// - map type
/// - map used
///
/// Ex: FOR_ALL_CELLS(VERTEX, di, myMap) { ... }
///
#define FOR_ALL_CELLS(ORBIT, NAME_ITER, MAP_TYPE, MAP_PARAM) TraversorCell<MAP_TYPE, (ORBIT)> NAME_ITER_TraversalMacroLocalLoop(MAP_PARAM); \
for (Dart NAME_ITER = NAME_ITER_TraversalMacroLocalLoop.begin(); NAME_ITER != NAME_ITER_TraversalMacroLocalLoop.end(); NAME_ITER = NAME_ITER_TraversalMacroLocalLoop.next())
template
<
typename
MAP
,
unsigned
int
ORBIT
>
class
TraversorCell
//: public Traversor<MAP>
{
...
...
@@ -75,10 +64,32 @@ public:
inline
Dart
next
()
;
inline
void
skip
(
Dart
d
);
inline
void
apply
(
std
::
function
<
bool
(
Dart
)
>
f
)
{
for
(
Dart
d
=
begin
();
d
!=
end
();
d
=
next
())
if
(
f
(
d
))
return
;
}
inline
void
apply
(
std
::
function
<
void
(
Dart
)
>
f
)
{
for
(
Dart
d
=
begin
();
d
!=
end
();
d
=
next
())
f
(
d
);
}
}
;
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
);
trav
.
apply
(
f
);
}
template
<
typename
MAP
>
class
TraversorV
:
public
TraversorCell
<
MAP
,
VERTEX
>
{
...
...
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