Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CGoGN
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Hurstel
CGoGN
Commits
56f2be8c
Commit
56f2be8c
authored
Jun 24, 2014
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
optimization of map compacting
parent
05b0276d
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
99 additions
and
68 deletions
+99
-68
include/Container/attributeContainer.h
include/Container/attributeContainer.h
+7
-0
include/Container/attributeContainer.hpp
include/Container/attributeContainer.hpp
+5
-0
include/Topology/generic/genericmap.h
include/Topology/generic/genericmap.h
+10
-1
include/Topology/generic/genericmap.hpp
include/Topology/generic/genericmap.hpp
+7
-0
include/Topology/generic/mapImpl/mapMulti.h
include/Topology/generic/mapImpl/mapMulti.h
+1
-1
include/Topology/generic/mapImpl/mapMulti.hpp
include/Topology/generic/mapImpl/mapMulti.hpp
+0
-42
src/Container/attributeContainer.cpp
src/Container/attributeContainer.cpp
+11
-0
src/Topology/generic/genericmap.cpp
src/Topology/generic/genericmap.cpp
+13
-24
src/Topology/generic/mapMulti.cpp
src/Topology/generic/mapMulti.cpp
+45
-0
No files found.
include/Container/attributeContainer.h
View file @
56f2be8c
...
...
@@ -337,6 +337,13 @@ public:
*/
void
compact
(
std
::
vector
<
unsigned
int
>&
mapOldNew
);
/**
* Test the fragmentation of container,
* in fact just size/max_size
* @return 1 if full filled - 0 is lots of holes
*/
inline
float
fragmentation
();
/**************************************
* LINES MANAGEMENT *
**************************************/
...
...
include/Container/attributeContainer.hpp
View file @
56f2be8c
...
...
@@ -227,6 +227,11 @@ inline bool AttributeContainer::used(unsigned int index) const
return
m_holesBlocks
[
index
/
_BLOCKSIZE_
]
->
used
(
index
%
_BLOCKSIZE_
)
!=
0
;
}
inline
float
AttributeContainer
::
fragmentation
()
{
return
float
(
m_size
)
/
float
(
m_maxSize
);
}
/**************************************
* CONTAINER TRAVERSAL *
**************************************/
...
...
include/Topology/generic/genericmap.h
View file @
56f2be8c
...
...
@@ -430,8 +430,17 @@ protected:
public:
/**
* compact the map
* @warning the quickTraversals needs to be updated
*/
void
compact
()
;
void
compact
(
bool
topoOnly
=
false
)
;
/**
* test if containers are fragmented
* ~1.0 no need to compact
* ~0.0 need to compact
*/
inline
float
fragmentation
(
unsigned
int
orbit
);
/**
* @brief dump all attributes of map in CSV format (; separated columns)
...
...
include/Topology/generic/genericmap.hpp
View file @
56f2be8c
...
...
@@ -322,4 +322,11 @@ inline AttributeMultiVector<Dart>* GenericMap::getRelation(const std::string& na
return
amv
;
}
inline
float
GenericMap
::
fragmentation
(
unsigned
int
orbit
)
{
if
(
isOrbitEmbedded
(
orbit
))
return
m_attribs
[
orbit
].
fragmentation
();
return
1.0
f
;
}
}
//namespace CGoGN
include/Topology/generic/mapImpl/mapMulti.h
View file @
56f2be8c
...
...
@@ -165,7 +165,7 @@ protected:
template
<
int
I
>
inline
void
permutationUnsew
(
Dart
d
);
inline
virtual
void
compactTopo
();
virtual
void
compactTopo
();
/****************************************
* MR CONTAINER MANAGEMENT *
...
...
include/Topology/generic/mapImpl/mapMulti.hpp
View file @
56f2be8c
...
...
@@ -297,48 +297,6 @@ inline void MapMulti::permutationUnsew(Dart d)
(
*
m_permutation_inv
[
I
])[
e_index
]
=
e
;
}
inline
void
MapMulti
::
compactTopo
()
{
std
::
vector
<
unsigned
int
>
oldnewMR
;
m_mrattribs
.
compact
(
oldnewMR
);
std
::
vector
<
unsigned
int
>
oldnew
;
m_attribs
[
DART
].
compact
(
oldnew
);
unsigned
int
nbl
=
m_mrDarts
.
size
();
for
(
unsigned
int
i
=
m_mrattribs
.
begin
();
i
!=
m_mrattribs
.
end
();
m_mrattribs
.
next
(
i
))
{
for
(
unsigned
int
level
=
0
;
level
<
nbl
;
++
level
)
{
unsigned
int
&
d
=
m_mrDarts
[
level
]
->
operator
[](
i
);
if
(
d
!=
oldnew
[
d
])
d
=
oldnew
[
d
];
}
}
for
(
unsigned
int
i
=
m_attribs
[
DART
].
begin
();
i
!=
m_attribs
[
DART
].
end
();
m_attribs
[
DART
].
next
(
i
))
{
for
(
unsigned
int
j
=
0
;
j
<
m_permutation
.
size
();
++
j
)
{
Dart
d
=
(
*
m_permutation
[
j
])[
i
];
if
(
d
.
index
!=
oldnewMR
[
d
.
index
])
(
*
m_permutation
[
j
])[
i
]
=
Dart
(
oldnewMR
[
d
.
index
]);
}
for
(
unsigned
int
j
=
0
;
j
<
m_permutation_inv
.
size
();
++
j
)
{
Dart
d
=
(
*
m_permutation_inv
[
j
])[
i
];
if
(
d
.
index
!=
oldnewMR
[
d
.
index
])
(
*
m_permutation_inv
[
j
])[
i
]
=
Dart
(
oldnewMR
[
d
.
index
]);
}
for
(
unsigned
int
j
=
0
;
j
<
m_involution
.
size
();
++
j
)
{
Dart
d
=
(
*
m_involution
[
j
])[
i
];
if
(
d
.
index
!=
oldnewMR
[
d
.
index
])
(
*
m_involution
[
j
])[
i
]
=
Dart
(
oldnewMR
[
d
.
index
]);
}
}
}
/****************************************
* MR CONTAINER MANAGEMENT *
****************************************/
...
...
src/Container/attributeContainer.cpp
View file @
56f2be8c
...
...
@@ -216,6 +216,17 @@ void AttributeContainer::compact(std::vector<unsigned int>& mapOldNew)
mapOldNew
.
clear
();
mapOldNew
.
resize
(
realEnd
(),
0xffffffff
);
//VERSION THAT PRESERVE ORDER OF ELEMENTS ?
// unsigned int down = 0;
// for (unsigned int occup = realBegin(); occup != realEnd(); next(occup))
// {
// mapOldNew[occup] = down;
// copyLine(down,occup);
// // copy ref counter
// setNbRefs(down,getNbRefs(occup));
// down++;
// }
// fill the holes with data & create the map Old->New
unsigned
int
up
=
realRBegin
();
unsigned
int
down
=
0
;
...
...
src/Topology/generic/genericmap.cpp
View file @
56f2be8c
...
...
@@ -424,44 +424,33 @@ void GenericMap::dumpAttributesAndMarkers()
// }
}
void
GenericMap
::
compact
()
void
GenericMap
::
compact
(
bool
topoOnly
)
{
// compact embedding attribs
std
::
vector
<
std
::
vector
<
unsigned
int
>*
>
oldnews
(
NB_ORBITS
,
NULL
);
compactTopo
();
if
(
topoOnly
)
return
;
std
::
vector
<
unsigned
int
>
oldnew
;
for
(
unsigned
int
orbit
=
0
;
orbit
<
NB_ORBITS
;
++
orbit
)
{
if
((
orbit
!=
DART
)
&&
(
isOrbitEmbedded
(
orbit
)))
{
oldnews
[
orbit
]
=
new
std
::
vector
<
unsigned
int
>
;
m_attribs
[
orbit
].
compact
(
*
(
oldnews
[
orbit
]));
}
}
// update embedding indices of topo
for
(
unsigned
int
i
=
m_attribs
[
DART
].
begin
();
i
!=
m_attribs
[
DART
].
end
();
m_attribs
[
DART
].
next
(
i
))
{
for
(
unsigned
int
orbit
=
0
;
orbit
<
NB_ORBITS
;
++
orbit
)
{
if
((
orbit
!=
DART
)
&&
(
isOrbitEmbedded
(
orbit
)))
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
s
[
orbit
]
->
operator
[](
idx
)
;
if
(
(
jdx
!=
0xffffffff
)
&&
(
jdx
!=
idx
)
)
unsigned
int
jdx
=
oldnew
[
idx
]
;
if
(
jdx
!=
0xffffffff
)
idx
=
jdx
;
}
}
}
// delete allocated vectors
for
(
unsigned
int
orbit
=
0
;
orbit
<
NB_ORBITS
;
++
orbit
)
if
(
oldnews
[
orbit
]
!=
NULL
)
delete
oldnews
[
orbit
];
// compact topo (depends on map implementation)
compactTopo
();
}
void
GenericMap
::
dumpCSV
()
const
{
for
(
unsigned
int
orbit
=
0
;
orbit
<
NB_ORBITS
;
++
orbit
)
...
...
src/Topology/generic/mapMulti.cpp
View file @
56f2be8c
...
...
@@ -416,4 +416,49 @@ void MapMulti::restore_topo_shortcuts()
}
}
// TODO A VERIFIER ET A TESTER
void
MapMulti
::
compactTopo
()
{
std
::
vector
<
unsigned
int
>
oldnewMR
;
m_mrattribs
.
compact
(
oldnewMR
);
unsigned
int
nbl
=
m_mrDarts
.
size
();
for
(
unsigned
int
i
=
m_mrattribs
.
begin
();
i
!=
m_mrattribs
.
end
();
m_mrattribs
.
next
(
i
))
{
for
(
unsigned
int
level
=
0
;
level
<
nbl
;
++
level
)
{
unsigned
int
&
d
=
m_mrDarts
[
level
]
->
operator
[](
i
);
if
(
oldnewMR
[
d
]
!=
AttributeContainer
::
UNKNOWN
)
d
=
oldnewMR
[
d
];
}
}
m_attribs
[
DART
].
compact
(
oldnewMR
);
for
(
unsigned
int
i
=
m_attribs
[
DART
].
begin
();
i
!=
m_attribs
[
DART
].
end
();
m_attribs
[
DART
].
next
(
i
))
{
for
(
unsigned
int
j
=
0
;
j
<
m_permutation
.
size
();
++
j
)
{
Dart
d
=
(
*
m_permutation
[
j
])[
i
];
if
(
oldnewMR
[
d
.
index
]
!=
AttributeContainer
::
UNKNOWN
)
(
*
m_permutation
[
j
])[
i
]
=
Dart
(
oldnewMR
[
d
.
index
]);
}
for
(
unsigned
int
j
=
0
;
j
<
m_permutation_inv
.
size
();
++
j
)
{
Dart
d
=
(
*
m_permutation_inv
[
j
])[
i
];
if
(
oldnewMR
[
d
.
index
]
!=
AttributeContainer
::
UNKNOWN
)
(
*
m_permutation_inv
[
j
])[
i
]
=
Dart
(
oldnewMR
[
d
.
index
]);
}
for
(
unsigned
int
j
=
0
;
j
<
m_involution
.
size
();
++
j
)
{
Dart
d
=
(
*
m_involution
[
j
])[
i
];
if
(
oldnewMR
[
d
.
index
]
!=
AttributeContainer
::
UNKNOWN
)
(
*
m_involution
[
j
])[
i
]
=
Dart
(
oldnewMR
[
d
.
index
]);
}
}
}
}
//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