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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
KennethVanhoey
CGoGN
Commits
1568a9a5
Commit
1568a9a5
authored
Jul 25, 2014
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new c++11 syntax for Cell traversal
parent
a4f08955
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
113 additions
and
5 deletions
+113
-5
Apps/Tuto/Attributes/simple_attribs.cpp
Apps/Tuto/Attributes/simple_attribs.cpp
+12
-4
include/Geometry/vector_gen.h
include/Geometry/vector_gen.h
+6
-0
include/Geometry/vector_gen.hpp
include/Geometry/vector_gen.hpp
+13
-0
include/Topology/generic/traversor/traversorCell.h
include/Topology/generic/traversor/traversorCell.h
+82
-1
No files found.
Apps/Tuto/Attributes/simple_attribs.cpp
View file @
1568a9a5
...
...
@@ -129,10 +129,18 @@ void dumpAttribute(const ATTRIB& attr)
template
<
typename
T
>
void
VertexTyped
(
MAP
&
map
,
T
&
va
)
{
foreach_cell
<
VERTEX
>
(
map
,[
&
](
Vertex
v
)
// for all vertices
{
va
[
v
]
=
1.1
*
va
[
v
];
});
// foreach_cell<VERTEX>(map,[&](Vertex v) // for all vertices
// {
// va[v] = 1.1 * va[v];
// });
// other syntax for traversal
for
(
Vertex
v
:
allVertices
<
MAP
>
(
map
))
{
va
[
v
]
=
1.1
*
va
[
v
];
std
::
cout
<<
"V:"
<<
v
<<
" -> "
<<
va
[
v
]
<<
std
::
endl
;
}
}
// version that take a VertexAttribute, check type at runtime and call instancied template version
...
...
include/Geometry/vector_gen.h
View file @
1568a9a5
...
...
@@ -65,6 +65,12 @@ public:
template
<
typename
T2
>
Vector
(
const
Vector
<
DIM
,
T2
>&
v
)
;
/**
* @brief Vector constructor from list init. (c++11)
* @param args {x,y,z}
*/
Vector
(
typename
std
::
initializer_list
<
T
>
args
);
Vector
(
T
x
,
T
y
)
;
Vector
(
T
x
,
T
y
,
T
z
)
;
...
...
include/Geometry/vector_gen.hpp
View file @
1568a9a5
...
...
@@ -48,6 +48,19 @@ std::string Vector<DIM, T>::CGoGNnameOfType()
/* CONSTRUCTORS */
/**********************************************/
template
<
unsigned
int
DIM
,
typename
T
>
Vector
<
DIM
,
T
>::
Vector
(
typename
std
::
initializer_list
<
T
>
args
)
{
unsigned
int
i
=
0
;
// fill from initializer list
for
(
auto
iter
=
args
.
begin
();
(
iter
!=
args
.
end
())
&&
(
i
<
DIM
);
++
iter
,
++
i
)
m_data
[
i
]
=
*
iter
;
// finish with 0 if necessary
for
(
int
j
=
i
;
j
<
DIM
;
++
j
)
m_data
[
j
]
=
0
;
}
template
<
unsigned
int
DIM
,
typename
T
>
Vector
<
DIM
,
T
>::
Vector
()
{
...
...
include/Topology/generic/traversor/traversorCell.h
View file @
1568a9a5
...
...
@@ -144,7 +144,6 @@ void foreach_cell(MAP& map, FUNC func, TraversalOptim opt = AUTO, unsigned int n
template
<
typename
MAP
,
TraversalOptim
OPT
=
AUTO
>
class
TraversorV
:
public
TraversorCell
<
MAP
,
VERTEX
,
OPT
>
{
...
...
@@ -177,6 +176,88 @@ public:
{}
};
template
<
typename
MAP
,
unsigned
int
ORBIT
,
TraversalOptim
OPT
=
AUTO
>
class
allCells
:
public
TraversorCell
<
MAP
,
ORBIT
,
OPT
>
{
public:
allCells
(
const
MAP
&
map
,
bool
forceDartMarker
=
false
,
unsigned
int
thread
=
0
)
:
TraversorCell
<
MAP
,
ORBIT
,
OPT
>
(
map
,
forceDartMarker
,
thread
)
{}
class
iterator
{
Cell
<
ORBIT
>
m_index
;
TraversorCell
<
MAP
,
ORBIT
,
OPT
>*
m_ptr
;
public:
inline
iterator
(
allCells
<
MAP
,
ORBIT
,
OPT
>*
p
,
Cell
<
ORBIT
>
i
)
:
m_ptr
(
p
),
m_index
(
i
){}
inline
iterator
&
operator
++
()
{
m_index
=
m_ptr
->
next
();
return
*
this
;
}
inline
Cell
<
ORBIT
>&
operator
*
()
{
return
m_index
;
}
inline
bool
operator
!=
(
iterator
it
)
{
return
m_index
.
dart
!=
it
.
m_index
.
dart
;
}
};
inline
iterator
begin
()
{
return
iterator
(
this
,
TraversorCell
<
MAP
,
ORBIT
,
OPT
>::
begin
());
}
inline
iterator
end
()
{
return
iterator
(
this
,
TraversorCell
<
MAP
,
ORBIT
,
OPT
>::
end
());
}
};
template
<
typename
MAP
,
TraversalOptim
OPT
=
AUTO
>
class
allVertices
:
public
allCells
<
MAP
,
VERTEX
,
OPT
>
{
public:
allVertices
(
const
MAP
&
m
,
unsigned
int
thread
=
0
)
:
allCells
<
MAP
,
VERTEX
>
(
m
,
false
,
thread
)
{}
};
template
<
typename
MAP
,
TraversalOptim
OPT
=
AUTO
>
class
allEdges
:
public
allCells
<
MAP
,
EDGE
,
OPT
>
{
public:
allEdges
(
const
MAP
&
m
,
unsigned
int
thread
=
0
)
:
allCells
<
MAP
,
EDGE
>
(
m
,
false
,
thread
)
{}
};
template
<
typename
MAP
,
TraversalOptim
OPT
=
AUTO
>
class
allFaces
:
public
allCells
<
MAP
,
FACE
,
OPT
>
{
public:
allFaces
(
const
MAP
&
m
,
unsigned
int
thread
=
0
)
:
allCells
<
MAP
,
FACE
>
(
m
,
false
,
thread
)
{}
};
template
<
typename
MAP
,
TraversalOptim
OPT
=
AUTO
>
class
allVolumes
:
public
allCells
<
MAP
,
VOLUME
,
OPT
>
{
public:
allVolumes
(
const
MAP
&
m
,
unsigned
int
thread
=
0
)
:
allCells
<
MAP
,
VOLUME
>
(
m
,
false
,
thread
)
{}
};
}
// namespace CGoGN
...
...
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