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
e2fc1ed9
Commit
e2fc1ed9
authored
Mar 14, 2012
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add copyFrom method in genericmap (testing in progress)
add some const
parent
11ba46af
Changes
21
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
117 additions
and
19 deletions
+117
-19
include/Container/attributeContainer.h
include/Container/attributeContainer.h
+7
-0
include/Container/attributeMultiVector.h
include/Container/attributeMultiVector.h
+4
-0
include/Container/attributeMultiVector.hpp
include/Container/attributeMultiVector.hpp
+9
-1
include/Container/holeblockref.h
include/Container/holeblockref.h
+9
-2
include/Topology/generic/genericmap.h
include/Topology/generic/genericmap.h
+6
-1
include/Topology/gmap/gmap0.h
include/Topology/gmap/gmap0.h
+1
-1
include/Topology/gmap/gmap0.hpp
include/Topology/gmap/gmap0.hpp
+1
-1
include/Topology/gmap/gmap1.h
include/Topology/gmap/gmap1.h
+1
-1
include/Topology/gmap/gmap1.hpp
include/Topology/gmap/gmap1.hpp
+1
-1
include/Topology/gmap/gmap2.h
include/Topology/gmap/gmap2.h
+1
-1
include/Topology/gmap/gmap2.hpp
include/Topology/gmap/gmap2.hpp
+1
-1
include/Topology/gmap/gmap3.h
include/Topology/gmap/gmap3.h
+1
-1
include/Topology/gmap/gmap3.hpp
include/Topology/gmap/gmap3.hpp
+1
-1
include/Topology/map/map1.h
include/Topology/map/map1.h
+1
-1
include/Topology/map/map1.hpp
include/Topology/map/map1.hpp
+1
-1
include/Topology/map/map2.h
include/Topology/map/map2.h
+1
-1
include/Topology/map/map2.hpp
include/Topology/map/map2.hpp
+1
-1
include/Topology/map/map3.h
include/Topology/map/map3.h
+1
-1
include/Topology/map/map3.hpp
include/Topology/map/map3.hpp
+1
-1
src/Container/attributeContainer.cpp
src/Container/attributeContainer.cpp
+53
-0
src/Container/holeblockref.cpp
src/Container/holeblockref.cpp
+15
-1
No files found.
include/Container/attributeContainer.h
View file @
e2fc1ed9
...
...
@@ -530,6 +530,13 @@ public:
* @param id ??
*/
bool
loadBin
(
CGoGNistream
&
fs
);
/**
* copy container
* TODO a version that compact on the fly ?
*/
void
copyFrom
(
const
AttributeContainer
&
cont
);
};
}
// namespace CGoGN
...
...
include/Container/attributeMultiVector.h
View file @
e2fc1ed9
...
...
@@ -126,6 +126,8 @@ public:
*/
virtual
void
setNbBlocks
(
unsigned
int
nbb
)
=
0
;
virtual
unsigned
int
getNbBlocks
()
const
=
0
;
virtual
void
addBlocksBefore
(
unsigned
int
nbb
)
=
0
;
virtual
bool
copy
(
const
AttributeMultiVectorGen
*
atmvg
)
=
0
;
...
...
@@ -244,6 +246,8 @@ public:
void
setNbBlocks
(
unsigned
int
nbb
);
unsigned
int
getNbBlocks
()
const
;
void
addBlocksBefore
(
unsigned
int
nbb
);
bool
copy
(
const
AttributeMultiVectorGen
*
atmvg
);
...
...
include/Container/attributeMultiVector.hpp
View file @
e2fc1ed9
...
...
@@ -132,7 +132,9 @@ AttributeMultiVector<T>::~AttributeMultiVector()
template
<
typename
T
>
inline
AttributeMultiVectorGen
*
AttributeMultiVector
<
T
>::
new_obj
()
{
return
new
AttributeMultiVector
<
T
>
;
AttributeMultiVectorGen
*
ptr
=
new
AttributeMultiVector
<
T
>
;
ptr
->
setTypeName
(
m_typeName
);
return
ptr
;
}
/**************************************
...
...
@@ -166,6 +168,12 @@ void AttributeMultiVector<T>::setNbBlocks(unsigned int nbb)
}
}
template
<
typename
T
>
unsigned
int
AttributeMultiVector
<
T
>::
getNbBlocks
()
const
{
return
m_tableData
.
size
();
}
template
<
typename
T
>
void
AttributeMultiVector
<
T
>::
addBlocksBefore
(
unsigned
int
nbb
)
{
...
...
include/Container/holeblockref.h
View file @
e2fc1ed9
...
...
@@ -27,6 +27,7 @@
#include <fstream>
#include <iostream>
#include <assert.h>
#include "Container/sizeblock.h"
...
...
@@ -49,7 +50,7 @@ protected:
unsigned
int
m_nbref
;
/**
* nb element in block
* nb element
s
in block
*/
unsigned
int
m_nb
;
...
...
@@ -59,6 +60,11 @@ public:
*/
HoleBlockRef
();
/**
* copy constructor
*/
HoleBlockRef
(
const
HoleBlockRef
&
hb
);
/**
* destructor
*/
...
...
@@ -149,6 +155,7 @@ public:
*/
inline
bool
unref
(
unsigned
int
i
)
{
// assert(m_refCount[i] > 1);
m_refCount
[
i
]
--
;
if
(
m_refCount
[
i
]
==
1
)
{
...
...
@@ -165,7 +172,7 @@ public:
/**
* number of references of element i
* @return the number of references
(0 = no elements
)
* @return the number of references
+1 (stored as n+1, 0 = not used, 1 used but not refs, ...
)
*/
inline
unsigned
int
nbRefs
(
unsigned
int
i
)
{
return
m_refCount
[
i
];
}
...
...
include/Topology/generic/genericmap.h
View file @
e2fc1ed9
...
...
@@ -150,7 +150,7 @@ public:
~
GenericMap
()
;
virtual
std
::
string
mapTypeName
()
=
0
;
virtual
std
::
string
mapTypeName
()
const
=
0
;
/**
* Clear the map
...
...
@@ -503,6 +503,11 @@ public:
*/
bool
loadMapBin
(
const
std
::
string
&
filename
)
;
/**
* copy from another map (of same type)
*/
bool
copyFrom
(
const
GenericMap
&
map
);
/**
* Dump attributes types and names per orbit
*/
...
...
include/Topology/gmap/gmap0.h
View file @
e2fc1ed9
...
...
@@ -46,7 +46,7 @@ protected:
public:
GMap0
();
virtual
std
::
string
mapTypeName
();
virtual
std
::
string
mapTypeName
()
const
;
virtual
unsigned
int
dimension
();
...
...
include/Topology/gmap/gmap0.hpp
View file @
e2fc1ed9
...
...
@@ -37,7 +37,7 @@ inline GMap0::GMap0() : AttribMap()
init
()
;
}
inline
std
::
string
GMap0
::
mapTypeName
()
inline
std
::
string
GMap0
::
mapTypeName
()
const
{
return
"GMap0"
;
}
...
...
include/Topology/gmap/gmap1.h
View file @
e2fc1ed9
...
...
@@ -45,7 +45,7 @@ public:
GMap1
();
virtual
std
::
string
mapTypeName
();
virtual
std
::
string
mapTypeName
()
const
;
virtual
unsigned
int
dimension
();
...
...
include/Topology/gmap/gmap1.hpp
View file @
e2fc1ed9
...
...
@@ -35,7 +35,7 @@ inline GMap1::GMap1() : GMap0()
init
()
;
}
inline
std
::
string
GMap1
::
mapTypeName
()
inline
std
::
string
GMap1
::
mapTypeName
()
const
{
return
"GMap1"
;
}
...
...
include/Topology/gmap/gmap2.h
View file @
e2fc1ed9
...
...
@@ -50,7 +50,7 @@ public:
GMap2
();
virtual
std
::
string
mapTypeName
();
virtual
std
::
string
mapTypeName
()
const
;
virtual
unsigned
int
dimension
();
...
...
include/Topology/gmap/gmap2.hpp
View file @
e2fc1ed9
...
...
@@ -35,7 +35,7 @@ inline GMap2::GMap2() : GMap1()
init
()
;
}
inline
std
::
string
GMap2
::
mapTypeName
()
inline
std
::
string
GMap2
::
mapTypeName
()
const
{
return
"GMap2"
;
}
...
...
include/Topology/gmap/gmap3.h
View file @
e2fc1ed9
...
...
@@ -55,7 +55,7 @@ public:
GMap3
();
virtual
std
::
string
mapTypeName
();
virtual
std
::
string
mapTypeName
()
const
;
virtual
unsigned
int
dimension
();
...
...
include/Topology/gmap/gmap3.hpp
View file @
e2fc1ed9
...
...
@@ -35,7 +35,7 @@ inline GMap3::GMap3() : GMap2()
init
()
;
}
inline
std
::
string
GMap3
::
mapTypeName
()
inline
std
::
string
GMap3
::
mapTypeName
()
const
{
return
"GMap3"
;
}
...
...
include/Topology/map/map1.h
View file @
e2fc1ed9
...
...
@@ -51,7 +51,7 @@ protected:
public:
Map1
();
virtual
std
::
string
mapTypeName
();
virtual
std
::
string
mapTypeName
()
const
;
virtual
unsigned
int
dimension
();
...
...
include/Topology/map/map1.hpp
View file @
e2fc1ed9
...
...
@@ -38,7 +38,7 @@ inline Map1::Map1() : AttribMap()
init
()
;
}
inline
std
::
string
Map1
::
mapTypeName
()
inline
std
::
string
Map1
::
mapTypeName
()
const
{
return
"Map1"
;
}
...
...
include/Topology/map/map2.h
View file @
e2fc1ed9
...
...
@@ -62,7 +62,7 @@ public:
Map2
();
virtual
std
::
string
mapTypeName
();
virtual
std
::
string
mapTypeName
()
const
;
virtual
unsigned
int
dimension
();
...
...
include/Topology/map/map2.hpp
View file @
e2fc1ed9
...
...
@@ -37,7 +37,7 @@ inline Map2::Map2() : Map1()
init
()
;
}
inline
std
::
string
Map2
::
mapTypeName
()
inline
std
::
string
Map2
::
mapTypeName
()
const
{
return
"Map2"
;
}
...
...
include/Topology/map/map3.h
View file @
e2fc1ed9
...
...
@@ -69,7 +69,7 @@ public:
Map3
();
virtual
std
::
string
mapTypeName
();
virtual
std
::
string
mapTypeName
()
const
;
virtual
unsigned
int
dimension
();
...
...
include/Topology/map/map3.hpp
View file @
e2fc1ed9
...
...
@@ -35,7 +35,7 @@ inline Map3::Map3() : Map2()
init
()
;
}
inline
std
::
string
Map3
::
mapTypeName
()
inline
std
::
string
Map3
::
mapTypeName
()
const
{
return
"Map3"
;
}
...
...
src/Container/attributeContainer.cpp
View file @
e2fc1ed9
...
...
@@ -690,4 +690,57 @@ bool AttributeContainer::loadBin(CGoGNistream& fs)
return
true
;
}
void
AttributeContainer
::
copyFrom
(
const
AttributeContainer
&
cont
)
{
// clear is done from the map
m_size
=
cont
.
m_size
;
m_maxSize
=
cont
.
m_maxSize
;
m_orbit
=
cont
.
m_orbit
;
m_nbUnknown
=
cont
.
m_nbUnknown
;
m_nbAttributes
=
cont
.
m_nbAttributes
;
m_lineCost
=
cont
.
m_lineCost
;
// blocks
unsigned
int
sz
=
cont
.
m_holesBlocks
.
size
();
m_holesBlocks
.
resize
(
sz
);
for
(
unsigned
int
i
=
0
;
i
<
sz
;
++
i
)
m_holesBlocks
[
i
]
=
new
HoleBlockRef
(
*
(
cont
.
m_holesBlocks
[
i
]));
// blocks with free
sz
=
cont
.
m_tableBlocksWithFree
.
size
();
m_tableBlocksWithFree
.
resize
(
sz
);
for
(
unsigned
int
i
=
0
;
i
<
sz
;
++
i
)
m_tableBlocksWithFree
[
i
]
=
cont
.
m_tableBlocksWithFree
[
i
];
// empty blocks
sz
=
cont
.
m_tableBlocksEmpty
.
size
();
m_tableBlocksEmpty
.
resize
(
sz
);
for
(
unsigned
int
i
=
0
;
i
<
sz
;
++
i
)
m_tableBlocksEmpty
[
i
]
=
cont
.
m_tableBlocksEmpty
[
i
];
//attributes (warning attribute can have different numbers than in original)
m_tableAttribs
.
reserve
(
m_nbAttributes
);
sz
=
cont
.
m_tableAttribs
.
size
();
for
(
unsigned
int
i
=
0
;
i
<
sz
;
++
i
)
{
if
(
cont
.
m_tableAttribs
[
i
]
!=
NULL
)
{
AttributeMultiVectorGen
*
ptr
=
cont
.
m_tableAttribs
[
i
]
->
new_obj
();
ptr
->
setName
(
cont
.
m_tableAttribs
[
i
]
->
getName
());
ptr
->
setOrbit
(
cont
.
m_tableAttribs
[
i
]
->
getIndex
());
ptr
->
setIndex
(
m_tableAttribs
.
size
());
ptr
->
setNbBlocks
(
cont
.
m_tableAttribs
[
i
]
->
getNbBlocks
());
ptr
->
copy
(
cont
.
m_tableAttribs
[
i
]);
if
(
cont
.
m_tableAttribs
[
i
]
->
toProcess
())
ptr
->
toggleProcess
();
else
ptr
->
toggleNoProcess
();
m_tableAttribs
.
push_back
(
ptr
);
}
}
}
}
src/Container/holeblockref.cpp
View file @
e2fc1ed9
...
...
@@ -43,10 +43,24 @@ namespace CGoGN
HoleBlockRef
::
HoleBlockRef
()
:
m_nbfree
(
0
),
m_nbref
(
0
),
m_nb
(
0
)
{
m_tableFree
=
new
unsigned
int
[
_BLOCKSIZE_
];
m_tableFree
=
new
unsigned
int
[
_BLOCKSIZE_
+
10
];
m_refCount
=
new
unsigned
int
[
_BLOCKSIZE_
];
}
HoleBlockRef
::
HoleBlockRef
(
const
HoleBlockRef
&
hb
)
{
m_nbfree
=
hb
.
m_nbfree
;
m_nbref
=
hb
.
m_nbref
;
m_nb
=
hb
.
m_nb
;
m_tableFree
=
new
unsigned
int
[
_BLOCKSIZE_
+
10
];
memcpy
(
m_tableFree
,
hb
.
m_tableFree
,
(
_BLOCKSIZE_
+
10
)
*
sizeof
(
unsigned
int
));
m_refCount
=
new
unsigned
int
[
_BLOCKSIZE_
];
memcpy
(
m_refCount
,
hb
.
m_refCount
,
_BLOCKSIZE_
*
sizeof
(
unsigned
int
));
}
HoleBlockRef
::~
HoleBlockRef
()
{
delete
[]
m_tableFree
;
...
...
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