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
7a132517
Commit
7a132517
authored
Apr 24, 2014
by
Pierre Kraemer
Browse files
first lambdas..
parent
a5ee3a10
Changes
5
Hide whitespace changes
Inline
Side-by-side
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_i
ndex
;
return
this
->
dartI
ndex
(
d
)
;
return
(
*
this
->
m_embeddings
[
ORBIT
])[
d_i
ndex
]
;
return
(
*
this
->
m_embeddings
[
ORBIT
])[
this
->
dartI
ndex
(
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
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