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
31b2e5a8
Commit
31b2e5a8
authored
May 23, 2014
by
Pierre Kraemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add missing file..
parent
4670bae0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
133 additions
and
0 deletions
+133
-0
include/Algo/Topo/embedding.h
include/Algo/Topo/embedding.h
+133
-0
No files found.
include/Algo/Topo/embedding.h
0 → 100644
View file @
31b2e5a8
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#ifndef __ALGO_TOPO_EMBEDDING__
#define __ALGO_TOPO_EMBEDDING__
namespace
CGoGN
{
namespace
Algo
{
namespace
Topo
{
/**
* Set the index of the associated cell to all the darts of an orbit
* @param orbit orbit to embed
* @param d a dart of the topological vertex
* @param em index of attribute to store as embedding
*/
template
<
unsigned
int
ORBIT
,
typename
MAP
>
inline
void
setOrbitEmbedding
(
MAP
&
m
,
Cell
<
ORBIT
>
c
,
unsigned
int
em
)
{
assert
(
m
.
template
isOrbitEmbedded
<
ORBIT
>()
||
!
"Invalid parameter: orbit not embedded"
);
m
.
foreach_dart_of_orbit
(
c
,
[
&
]
(
Dart
d
)
{
m
.
template
setDartEmbedding
<
ORBIT
>(
d
,
em
);
});
}
/**
* Set the index of the associated cell to all the darts of an orbit
* !!! WARNING !!! use only on freshly inserted darts (no unref is done on old embedding)!!! WARNING !!!
*/
template
<
unsigned
int
ORBIT
,
typename
MAP
>
inline
void
initOrbitEmbedding
(
MAP
&
m
,
Cell
<
ORBIT
>
c
,
unsigned
int
em
)
{
assert
(
m
.
template
isOrbitEmbedded
<
ORBIT
>()
||
!
"Invalid parameter: orbit not embedded"
);
m
.
foreach_dart_of_orbit
(
c
,
[
&
]
(
Dart
d
)
{
m
.
template
initDartEmbedding
<
ORBIT
>(
d
,
em
);
});
}
/**
* Associate an new cell to all darts of an orbit
* @param orbit orbit to embed
* @param d a dart of the topological cell
* @return index of the attribute in table
*/
template
<
unsigned
int
ORBIT
,
typename
MAP
>
inline
unsigned
int
setOrbitEmbeddingOnNewCell
(
MAP
&
m
,
Cell
<
ORBIT
>
c
)
{
assert
(
m
.
template
isOrbitEmbedded
<
ORBIT
>()
||
!
"Invalid parameter: orbit not embedded"
);
unsigned
int
em
=
m
.
template
newCell
<
ORBIT
>();
setOrbitEmbedding
<
ORBIT
>
(
m
,
c
,
em
);
return
em
;
}
/**
* Associate an new cell to all darts of an orbit
* !!! WARNING !!! use only on freshly inserted darts (no unref is done on old embedding)!!! WARNING !!!
*/
template
<
unsigned
int
ORBIT
,
typename
MAP
>
inline
unsigned
int
initOrbitEmbeddingOnNewCell
(
MAP
&
m
,
Cell
<
ORBIT
>
d
)
{
assert
(
m
.
template
isOrbitEmbedded
<
ORBIT
>()
||
!
"Invalid parameter: orbit not embedded"
);
unsigned
int
em
=
m
.
template
newCell
<
ORBIT
>();
initOrbitEmbedding
<
ORBIT
>
(
m
,
d
,
em
);
return
em
;
}
/**
* Copy the cell associated to a dart over an other dart
* @param orbit attribute orbit to use
* @param d the dart to overwrite (dest)
* @param e the dart to copy (src)
*/
template
<
unsigned
int
ORBIT
,
typename
MAP
>
inline
void
copyCellAttributes
(
MAP
&
m
,
Cell
<
ORBIT
>
d
,
Cell
<
ORBIT
>
e
)
{
assert
(
m
.
template
isOrbitEmbedded
<
ORBIT
>()
||
!
"Invalid parameter: orbit not embedded"
);
unsigned
int
dE
=
m
.
getEmbedding
(
d
)
;
unsigned
int
eE
=
m
.
getEmbedding
(
e
)
;
if
(
eE
!=
EMBNULL
)
// if the source is NULL, nothing to copy
{
if
(
dE
==
EMBNULL
)
// if the dest is NULL, create a new cell
dE
=
setOrbitEmbeddingOnNewCell
(
m
,
d
)
;
AttributeContainer
&
cont
=
m
.
template
getAttributeContainer
<
ORBIT
>();
cont
.
copyLine
(
dE
,
eE
)
;
// copy the data
}
}
template
<
unsigned
int
DIM
,
unsigned
int
ORBIT
,
typename
MAP
>
void
boundaryMarkOrbit
(
MAP
&
m
,
Cell
<
ORBIT
>
c
)
{
m
.
foreach_dart_of_orbit
(
c
,
[
&
]
(
Dart
d
)
{
m
.
template
boundaryMark
<
DIM
>(
d
);
});
}
template
<
unsigned
int
DIM
,
unsigned
int
ORBIT
,
typename
MAP
>
void
boundaryUnmarkOrbit
(
MAP
&
m
,
Cell
<
ORBIT
>
c
)
{
m
.
foreach_dart_of_orbit
(
c
,
[
&
]
(
Dart
d
)
{
m
.
template
boundaryUnmark
<
DIM
>(
d
);
});
}
}
// namespace Topo
}
// namespace Algo
}
// namespace CGoGN
#endif
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