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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Thomas Pitiot
CGoGN
Commits
c146daa8
Commit
c146daa8
authored
Jun 17, 2014
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Map3::moveFrom
parent
785f2c31
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
171 additions
and
15 deletions
+171
-15
Apps/Examples/volumeExplorer.cpp
Apps/Examples/volumeExplorer.cpp
+10
-2
Apps/Tests/CMakeLists.txt
Apps/Tests/CMakeLists.txt
+4
-0
include/Container/attributeMultiVector.h
include/Container/attributeMultiVector.h
+0
-5
include/Container/attributeMultiVector.hpp
include/Container/attributeMultiVector.hpp
+2
-3
include/Topology/generic/genericmap.h
include/Topology/generic/genericmap.h
+19
-1
include/Topology/generic/mapImpl/mapMono.h
include/Topology/generic/mapImpl/mapMono.h
+1
-0
include/Topology/generic/mapImpl/mapMono.hpp
include/Topology/generic/mapImpl/mapMono.hpp
+5
-0
include/Topology/map/map3.h
include/Topology/map/map3.h
+7
-0
include/Topology/map/map3.hpp
include/Topology/map/map3.hpp
+13
-0
src/Container/attributeContainer.cpp
src/Container/attributeContainer.cpp
+26
-4
src/Topology/generic/genericmap.cpp
src/Topology/generic/genericmap.cpp
+81
-0
src/Topology/generic/mapMono.cpp
src/Topology/generic/mapMono.cpp
+3
-0
No files found.
Apps/Examples/volumeExplorer.cpp
View file @
c146daa8
...
...
@@ -402,6 +402,14 @@ int main(int argc, char **argv)
else
{
*/
if
(
extension
==
std
::
string
(
".map"
))
{
myMap
.
loadMapBin
(
filename
);
position
=
myMap
.
getAttribute
<
VEC3
,
VERTEX
,
MAP
>
(
"position"
)
;
}
else
{
if
(
!
Algo
::
Volume
::
Import
::
importMesh
<
PFP
>
(
myMap
,
filename
,
attrNames
))
{
std
::
cerr
<<
"could not import "
<<
filename
<<
std
::
endl
;
...
...
@@ -409,9 +417,9 @@ int main(int argc, char **argv)
}
else
position
=
myMap
.
getAttribute
<
VEC3
,
VERTEX
,
MAP
>
(
attrNames
[
0
])
;
//
}
}
color
=
myMap
.
addAttribute
<
VEC3
,
VOLUME
,
MAP
>
(
"color"
);
color
=
myMap
.
addAttribute
<
VEC3
,
VOLUME
,
MAP
>
(
"color
Vol
"
);
TraversorCell
<
MAP
,
VOLUME
>
tra
(
myMap
);
float
maxV
=
0.0
f
;
...
...
Apps/Tests/CMakeLists.txt
View file @
c146daa8
...
...
@@ -42,3 +42,7 @@ target_link_libraries( loadSave
add_executable
(
copyfrom ./copyfrom.cpp
)
target_link_libraries
(
copyfrom
${
CGoGN_LIBS_D
}
${
CGoGN_EXT_LIBS
}
)
add_executable
(
movefrom ./movefrom.cpp
)
target_link_libraries
(
movefrom
${
CGoGN_LIBS_D
}
${
CGoGN_EXT_LIBS
}
)
include/Container/attributeMultiVector.h
View file @
c146daa8
...
...
@@ -61,11 +61,6 @@ protected:
*/
unsigned
int
m_index
;
/**
* Process or not the attribute in arithmetic operations
*/
bool
m_toProcess
;
public:
AttributeMultiVectorGen
(
const
std
::
string
&
strName
,
const
std
::
string
&
strType
);
...
...
include/Container/attributeMultiVector.hpp
View file @
c146daa8
...
...
@@ -26,11 +26,10 @@ namespace CGoGN
{
inline
AttributeMultiVectorGen
::
AttributeMultiVectorGen
(
const
std
::
string
&
strName
,
const
std
::
string
&
strType
)
:
m_attrName
(
strName
),
m_typeName
(
strType
)
,
m_toProcess
(
true
)
m_attrName
(
strName
),
m_typeName
(
strType
)
{}
inline
AttributeMultiVectorGen
::
AttributeMultiVectorGen
()
:
m_toProcess
(
true
)
inline
AttributeMultiVectorGen
::
AttributeMultiVectorGen
()
{}
inline
AttributeMultiVectorGen
::~
AttributeMultiVectorGen
()
...
...
include/Topology/generic/genericmap.h
View file @
c146daa8
...
...
@@ -133,7 +133,7 @@ protected:
/**
* Store links to created AttributeHandlers
*/
std
::
multimap
<
AttributeMultiVectorGen
*
,
AttributeHandlerGen
*>
attributeHandlers
;
// TODO think of MT (AttributeHandler creation & release are not thread safe!)
std
::
multimap
<
AttributeMultiVectorGen
*
,
AttributeHandlerGen
*>
attributeHandlers
;
std
::
mutex
attributeHandlersMutex
;
public:
...
...
@@ -300,6 +300,17 @@ public:
template
<
unsigned
int
ORBIT
>
void
releaseMarkVector
(
AttributeMultiVector
<
MarkerBool
>*
amv
,
unsigned
int
thread
=
0
);
protected:
/**
* @brief scan attributes for MarkerBool, clean them and store as free in thread 0
*/
void
garbageMarkVectors
();
/**
* @brief scan attributes for MarkerBool and remove them
*/
void
removeMarkVectors
();
public:
/**
* return a pointer to the Dart attribute vector that store the embedding of the given orbit
...
...
@@ -426,6 +437,13 @@ public:
* @brief dump all attributes of map in CSV format (; separated columns)
*/
void
dumpCSV
()
const
;
public:
/**
* @brief move data (container && shortcuts from a map to this map
* @param mapf map from which data are moved);
*/
void
moveData
(
GenericMap
&
mapf
);
}
;
...
...
include/Topology/generic/mapImpl/mapMono.h
View file @
c146daa8
...
...
@@ -73,6 +73,7 @@ public:
protected:
inline
void
addInvolution
();
inline
void
addPermutation
();
inline
void
removeLastInvolutionPtr
();
// for moveFrom
inline
AttributeMultiVector
<
Dart
>*
getInvolutionAttribute
(
unsigned
int
i
);
inline
AttributeMultiVector
<
Dart
>*
getPermutationAttribute
(
unsigned
int
i
);
...
...
include/Topology/generic/mapImpl/mapMono.hpp
View file @
c146daa8
...
...
@@ -90,6 +90,11 @@ inline void MapMono::addInvolution()
m_involution
.
push_back
(
addRelation
(
sstm
.
str
()));
}
inline
void
MapMono
::
removeLastInvolutionPtr
()
{
m_involution
.
pop_back
();
}
inline
void
MapMono
::
addPermutation
()
{
std
::
stringstream
sstm
;
...
...
include/Topology/map/map3.h
View file @
c146daa8
...
...
@@ -519,6 +519,13 @@ public:
void
computeDualTest
();
//@}
/**
* @brief move all data from a map2 in a map3
* @param mapf the input map2 (which will be empty after)
*/
void
moveFrom
(
Map2
<
MAP_IMPL
>&
mapf
);
};
}
// namespace CGoGN
...
...
include/Topology/map/map3.hpp
View file @
c146daa8
...
...
@@ -1803,7 +1803,20 @@ void Map3<MAP_IMPL>::computeDualTest()
// //deleteVolume(d);
// }
// }
}
template <typename MAP_IMPL>
void Map3<MAP_IMPL>::moveFrom(Map2<MAP_IMPL>& mapf)
{
GenericMap::moveData(mapf);
MAP_IMPL::removeLastInvolutionPtr();
MAP_IMPL::addInvolution() ;
MAP_IMPL::restore_topo_shortcuts() ;
GenericMap::garbageMarkVectors();
closeMap();
}
} // namespace CGoGN
src/Container/attributeContainer.cpp
View file @
c146daa8
...
...
@@ -661,7 +661,22 @@ void AttributeContainer::removeLine(unsigned int index)
void
AttributeContainer
::
saveBin
(
CGoGNostream
&
fs
,
unsigned
int
id
)
const
{
// en ascii id et taille les tailles
std
::
vector
<
AttributeMultiVectorGen
*>
bufferamv
;
bufferamv
.
reserve
(
m_tableAttribs
.
size
());
for
(
std
::
vector
<
AttributeMultiVectorGen
*>::
const_iterator
it
=
m_tableAttribs
.
begin
();
it
!=
m_tableAttribs
.
end
();
++
it
)
{
if
(
*
it
!=
NULL
)
{
const
std
::
string
&
attName
=
(
*
it
)
->
getName
();
std
::
string
markName
=
attName
.
substr
(
0
,
7
);
if
(
markName
!=
"marker_"
)
bufferamv
.
push_back
(
*
it
);
}
}
// en ascii id et les tailles
std
::
vector
<
unsigned
int
>
bufferui
;
bufferui
.
reserve
(
10
);
...
...
@@ -670,20 +685,27 @@ void AttributeContainer::saveBin(CGoGNostream& fs, unsigned int id) const
bufferui
.
push_back
(
_BLOCKSIZE_
);
bufferui
.
push_back
(
m_holesBlocks
.
size
());
bufferui
.
push_back
(
m_tableBlocksWithFree
.
size
());
bufferui
.
push_back
(
m_nbAttributes
);
// bufferui.push_back(m_nbAttributes);
bufferui
.
push_back
(
bufferamv
.
size
());
bufferui
.
push_back
(
m_size
);
bufferui
.
push_back
(
m_maxSize
);
bufferui
.
push_back
(
m_orbit
);
bufferui
.
push_back
(
m_nbUnknown
);
fs
.
write
(
reinterpret_cast
<
const
char
*>
(
&
bufferui
[
0
]),
bufferui
.
size
()
*
sizeof
(
unsigned
int
));
unsigned
int
i
=
0
;
for
(
std
::
vector
<
AttributeMultiVectorGen
*>::
const_iterator
it
=
m_tableAttribs
.
begin
();
it
!=
m_tableAttribs
.
end
();
++
it
)
for
(
std
::
vector
<
AttributeMultiVectorGen
*>::
const_iterator
it
=
bufferamv
.
begin
();
it
!=
bufferamv
.
end
();
++
it
)
{
if
(
*
it
!=
NULL
)
(
*
it
)
->
saveBin
(
fs
,
i
++
);
{
const
std
::
string
&
attName
=
(
*
it
)
->
getName
();
std
::
string
markName
=
attName
.
substr
(
0
,
7
);
if
(
markName
!=
"marker_"
)
(
*
it
)
->
saveBin
(
fs
,
i
++
);
}
else
{
CGoGNerr
<<
"PB saving, NULL ptr in m_tableAttribs"
<<
CGoGNendl
;
...
...
src/Topology/generic/genericmap.cpp
View file @
c146daa8
...
...
@@ -471,4 +471,85 @@ void GenericMap::dumpCSV() const
CGoGNout
<<
CGoGNendl
;
}
void
GenericMap
::
moveData
(
GenericMap
&
mapf
)
{
GenericMap
::
init
(
false
);
for
(
unsigned
int
i
=
0
;
i
<
NB_ORBITS
;
++
i
)
{
this
->
m_attribs
[
i
].
swap
(
mapf
.
m_attribs
[
i
]);
this
->
m_embeddings
[
i
]
=
mapf
.
m_embeddings
[
i
];
this
->
m_quickTraversal
[
i
]
=
mapf
.
m_quickTraversal
[
i
];
mapf
.
m_embeddings
[
i
]
=
NULL
;
mapf
.
m_quickTraversal
[
i
]
=
NULL
;
for
(
unsigned
int
j
=
0
;
j
<
NB_ORBITS
;
++
j
)
{
this
->
m_quickLocalIncidentTraversal
[
i
][
j
]
=
mapf
.
m_quickLocalIncidentTraversal
[
i
][
j
];
this
->
m_quickLocalAdjacentTraversal
[
i
][
j
]
=
mapf
.
m_quickLocalAdjacentTraversal
[
i
][
j
];
mapf
.
m_quickLocalIncidentTraversal
[
i
][
j
]
=
NULL
;
mapf
.
m_quickLocalAdjacentTraversal
[
i
][
j
]
=
NULL
;
}
for
(
unsigned
int
j
=
0
;
j
<
NB_THREAD
;
++
j
)
this
->
m_markVectors_free
[
i
][
j
].
swap
(
mapf
.
m_markVectors_free
[
i
][
j
]);
}
this
->
m_boundaryMarkers
[
0
]
=
mapf
.
m_boundaryMarkers
[
0
];
this
->
m_boundaryMarkers
[
1
]
=
mapf
.
m_boundaryMarkers
[
1
];
this
->
m_nextMarkerId
=
mapf
.
m_nextMarkerId
;
for
(
auto
it
=
mapf
.
attributeHandlers
.
begin
();
it
!=
mapf
.
attributeHandlers
.
end
();
++
it
)
(
*
it
).
second
->
setInvalid
()
;
mapf
.
attributeHandlers
.
clear
()
;
}
void
GenericMap
::
garbageMarkVectors
()
{
unsigned
int
maxId
=
0
;
for
(
unsigned
int
orbit
=
0
;
orbit
<
NB_ORBITS
;
++
orbit
)
{
std
::
vector
<
std
::
string
>
attNames
;
m_attribs
[
orbit
].
getAttributesNames
(
attNames
);
for
(
auto
sit
=
attNames
.
begin
();
sit
!=
attNames
.
end
();
++
sit
)
{
if
(
sit
->
substr
(
0
,
7
)
==
"marker_"
)
{
std
::
string
num
=
sit
->
substr
(
sit
->
length
()
-
3
,
3
);
unsigned
int
id
=
100
*
(
num
[
0
]
-
'0'
)
+
10
*
(
num
[
1
]
-
'0'
)
+
(
num
[
2
]
-
'0'
);
if
(
id
>
maxId
)
maxId
=
id
;
AttributeMultiVector
<
MarkerBool
>*
amv
=
m_attribs
[
orbit
].
getDataVector
<
MarkerBool
>
(
*
sit
);
amv
->
allFalse
();
m_markVectors_free
[
orbit
][
0
].
push_back
(
amv
);
}
}
}
m_nextMarkerId
=
maxId
+
1
;
}
void
GenericMap
::
removeMarkVectors
()
{
for
(
unsigned
int
orbit
=
0
;
orbit
<
NB_ORBITS
;
++
orbit
)
{
std
::
vector
<
std
::
string
>
attNames
;
m_attribs
[
orbit
].
getAttributesNames
(
attNames
);
for
(
auto
sit
=
attNames
.
begin
();
sit
!=
attNames
.
end
();
++
sit
)
{
if
(
sit
->
substr
(
0
,
7
)
==
"marker_"
)
{
m_attribs
[
orbit
].
removeAttribute
<
MarkerBool
>
(
*
sit
);
}
}
}
m_nextMarkerId
=
0
;
}
}
// namespace CGoGN
src/Topology/generic/mapMono.cpp
View file @
c146daa8
...
...
@@ -128,6 +128,7 @@ bool MapMono::loadMapBin(const std::string& filename)
bool
MapMono
::
copyFrom
(
const
GenericMap
&
map
)
{
if
(
mapTypeName
()
!=
map
.
mapTypeName
())
{
CGoGNerr
<<
"try to copy from incompatible type map"
<<
CGoGNendl
;
...
...
@@ -143,6 +144,8 @@ bool MapMono::copyFrom(const GenericMap& map)
for
(
unsigned
int
i
=
0
;
i
<
NB_ORBITS
;
++
i
)
m_attribs
[
i
].
copyFrom
(
mapM
.
m_attribs
[
i
]);
GenericMap
::
garbageMarkVectors
();
// restore shortcuts
GenericMap
::
restore_shortcuts
();
restore_topo_shortcuts
();
...
...
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