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
KennethVanhoey
CGoGN
Commits
439c9150
Commit
439c9150
authored
Jun 25, 2014
by
Sylvain Thery
Browse files
more compacting functions
parent
d66a6841
Changes
3
Hide whitespace changes
Inline
Side-by-side
include/Container/holeblockref.h
View file @
439c9150
...
...
@@ -189,6 +189,8 @@ public:
void
saveBin
(
CGoGNostream
&
fs
);
bool
loadBin
(
CGoGNistream
&
fs
);
unsigned
int
*
getTableFree
(
unsigned
int
&
nb
)
{
nb
=
m_nbfree
;
return
m_tableFree
;}
};
}
// namespace CGoGN
...
...
include/Topology/generic/genericmap.h
View file @
439c9150
...
...
@@ -431,14 +431,30 @@ public:
/**
* compact the map
* @warning the quickTraversals needs to be updated
* @param topoOnly compact only the topo ?
*/
void
compact
(
bool
topoOnly
=
false
)
;
/**
* compact a container (and update embedding attribute of topo)
* @param orbit orbit of container to compact
* @param frag minimum fragmentation value for compacting (default value 1.0 mean always compact)s
*/
void
compactOrbitContainer
(
unsigned
int
orbit
,
float
frag
=
1.0
);
/**
* @brief compact if containers are fragmented.
* @warning the quickTraversals needs to be updated
* @param frag if fragmentation (filling) of containers inferior to frag then compact
* @param topoOnly compact only the topo ?
*/
void
compactIfNeeded
(
float
frag
,
bool
topoOnly
=
false
)
;
/**
* test if containers are fragmented
* ~1.0 no need to compact
* ~0.0 need to compact
* ~1.0
(full filled)
no need to compact
* ~0.0
(lots of holes)
need to compact
*/
inline
float
fragmentation
(
unsigned
int
orbit
);
...
...
src/Topology/generic/genericmap.cpp
View file @
439c9150
...
...
@@ -450,6 +450,50 @@ void GenericMap::compact(bool topoOnly)
}
}
void
GenericMap
::
compactOrbitContainer
(
unsigned
int
orbit
,
float
frag
)
{
std
::
vector
<
unsigned
int
>
oldnew
;
if
(
isOrbitEmbedded
(
orbit
)
&&
(
fragmentation
(
orbit
)
<
frag
))
{
m_attribs
[
orbit
].
compact
(
oldnew
);
for
(
unsigned
int
i
=
m_attribs
[
DART
].
begin
();
i
!=
m_attribs
[
DART
].
end
();
m_attribs
[
DART
].
next
(
i
))
{
unsigned
int
&
idx
=
m_embeddings
[
orbit
]
->
operator
[](
i
);
unsigned
int
jdx
=
oldnew
[
idx
];
if
(
jdx
!=
0xffffffff
)
idx
=
jdx
;
}
}
}
void
GenericMap
::
compactIfNeeded
(
float
frag
,
bool
topoOnly
)
{
if
(
fragmentation
(
DART
)
<
frag
)
compactTopo
();
if
(
topoOnly
)
return
;
std
::
vector
<
unsigned
int
>
oldnew
;
for
(
unsigned
int
orbit
=
0
;
orbit
<
NB_ORBITS
;
++
orbit
)
{
if
((
orbit
!=
DART
)
&&
(
isOrbitEmbedded
(
orbit
))
&&
(
fragmentation
(
orbit
)
<
frag
))
{
m_attribs
[
orbit
].
compact
(
oldnew
);
for
(
unsigned
int
i
=
m_attribs
[
DART
].
begin
();
i
!=
m_attribs
[
DART
].
end
();
m_attribs
[
DART
].
next
(
i
))
{
unsigned
int
&
idx
=
m_embeddings
[
orbit
]
->
operator
[](
i
);
unsigned
int
jdx
=
oldnew
[
idx
];
if
(
jdx
!=
0xffffffff
)
idx
=
jdx
;
}
}
}
}
void
GenericMap
::
dumpCSV
()
const
{
...
...
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