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
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
David Cazier
CGoGN
Commits
fdfbd068
Commit
fdfbd068
authored
Jun 27, 2014
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
introducing MapManipulators
parent
da89af54
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
140 additions
and
41 deletions
+140
-41
include/Algo/Multiresolution/Map2MR/map2MR_DualRegular.h
include/Algo/Multiresolution/Map2MR/map2MR_DualRegular.h
+3
-1
include/Algo/Multiresolution/Map2MR/map2MR_DualRegular.hpp
include/Algo/Multiresolution/Map2MR/map2MR_DualRegular.hpp
+12
-1
include/Topology/generic/genericmap.h
include/Topology/generic/genericmap.h
+57
-35
include/Topology/generic/mapImpl/mapMulti.h
include/Topology/generic/mapImpl/mapMulti.h
+2
-0
src/Container/attributeContainer.cpp
src/Container/attributeContainer.cpp
+1
-2
src/Topology/generic/genericmap.cpp
src/Topology/generic/genericmap.cpp
+32
-0
src/Topology/generic/mapMulti.cpp
src/Topology/generic/mapMulti.cpp
+33
-2
No files found.
include/Algo/Multiresolution/Map2MR/map2MR_DualRegular.h
View file @
fdfbd068
...
...
@@ -50,7 +50,7 @@ namespace Regular
{
template
<
typename
PFP
>
class
Map2MR
class
Map2MR
:
public
MapManipulator
{
public:
typedef
typename
PFP
::
MAP
MAP
;
...
...
@@ -65,6 +65,8 @@ protected:
public:
Map2MR
(
MAP
&
map
);
virtual
MapManipulator
*
create
(
GenericMap
*
gm
);
~
Map2MR
();
//if true : tri and quad else quad
...
...
include/Algo/Multiresolution/Map2MR/map2MR_DualRegular.hpp
View file @
fdfbd068
...
...
@@ -44,10 +44,10 @@ namespace Regular
template
<
typename
PFP
>
Map2MR
<
PFP
>::
Map2MR
(
typename
PFP
::
MAP
&
map
)
:
MapManipulator
(
"DualRegular2"
,
&
map
),
m_map
(
map
),
shareVertexEmbeddings
(
false
)
{
}
template
<
typename
PFP
>
...
...
@@ -63,6 +63,17 @@ Map2MR<PFP>::~Map2MR()
m_map
.
removeLevelFront
();
}
template
<
typename
PFP
>
MapManipulator
*
Map2MR
<
PFP
>::
create
(
GenericMap
*
gm
)
{
typename
PFP
::
MAP
*
map
=
dynamic_cast
<
typename
PFP
::
MAP
*>
(
gm
);
if
(
map
!=
NULL
)
return
(
new
Map2MR
<
PFP
>
(
*
map
));
else
return
NULL
;
}
template
<
typename
PFP
>
void
Map2MR
<
PFP
>::
addNewLevel
(
bool
embedNewVertices
)
{
...
...
include/Topology/generic/genericmap.h
View file @
fdfbd068
...
...
@@ -73,6 +73,7 @@ inline int getSystemNumberOfCores(bool hyperthreading=false)
class
AttributeHandlerGen
;
class
DartMarkerGen
;
class
CellMarkerGen
;
class
MapManipulator
;
class
GenericMap
{
...
...
@@ -98,11 +99,11 @@ protected:
static
std
::
map
<
std
::
string
,
RegisteredBaseAttribute
*>*
m_attributes_registry_map
;
static
int
m_nbInstances
;
// buffer for less memory allocation
//
/
buffer for less memory allocation
static
std
::
vector
<
std
::
vector
<
Dart
>*
>*
s_vdartsBuffers
;
static
std
::
vector
<
std
::
vector
<
unsigned
int
>*
>*
s_vintsBuffers
;
// table of instancied maps for Dart/CellMarker release
//
/
table of instancied maps for Dart/CellMarker release
static
std
::
vector
<
GenericMap
*>*
s_instances
;
...
...
@@ -177,6 +178,34 @@ public:
virtual
void
clear
(
bool
removeAttrib
)
;
/****************************************
* MANIPULATOR MANAGEMENT *
****************************************/
protected:
/// manipulator pointer to Manipulator object that currently work on map
MapManipulator
*
m_manipulator
;
public:
/**
* @brief ask for associating manipulator to the map
* @param ptr Manipulator ptr
* @return ok or not
*/
bool
askManipulate
(
MapManipulator
*
ptr
);
/**
* @brief release the map from manipulator
* @param ptr manipulator asking for release
* @return ok or not
*/
bool
releaseManipulate
(
MapManipulator
*
ptr
);
/**
* @brief get the manipulator
* @return manipulator ptr
*/
MapManipulator
*
getManipulator
();
/****************************************
* DARTS MANAGEMENT *
****************************************/
...
...
@@ -461,7 +490,7 @@ public:
/**
* @brief dump all attributes of map in CSV format (; separated columns)
*/
void
dumpCSV
()
const
;
v
irtual
v
oid
dumpCSV
()
const
;
public:
/**
...
...
@@ -472,39 +501,32 @@ public:
}
;
/**
* @brief The MapManipulator class
*/
class
MapManipulator
{
protected:
std
::
string
m_name
;
public:
MapManipulator
(
const
std
::
string
&
name
,
GenericMap
*
gm
)
:
m_name
(
name
)
{
gm
->
askManipulate
(
this
);
}
~
MapManipulator
()
:
m_name
(
name
)
{
gm
->
releaseManipulate
(
this
);
}
const
std
::
string
&
name
()
{
return
m_name
;}
virtual
MapManipulator
*
create
(
GenericMap
*
gm
);
};
//
//template <typename MAP>
//bool foreach_dart_of_orbit_in_parent(MAP* ptrMap, unsigned int orbit, Dart d, FunctorType& f, unsigned int thread = 0)
//{
// switch(orbit)
// {
// case DART: return f(d);
// case VERTEX: return ptrMap->MAP::ParentMap::foreach_dart_of_vertex(d, f, thread) ;
// case EDGE: return ptrMap->MAP::ParentMap::foreach_dart_of_edge(d, f, thread) ;
// case ORIENTED_FACE: return ptrMap->MAP::ParentMap::foreach_dart_of_oriented_face(d, f, thread) ;
// case FACE: return ptrMap->MAP::ParentMap::foreach_dart_of_face(d, f, thread) ;
// case VOLUME: return ptrMap->MAP::ParentMap::foreach_dart_of_volume(d, f, thread) ;
// default: assert(!"Cells of this dimension are not handled") ;
// }
// return false ;
//}
//
//template <typename MAP>
//bool foreach_dart_of_orbit_in_parent2(MAP* ptrMap, unsigned int orbit, Dart d, FunctorType& f, unsigned int thread = 0)
//{
// switch(orbit)
// {
// case DART: return f(d);
// case VERTEX: return ptrMap->MAP::ParentMap::ParentMap::foreach_dart_of_vertex(d, f,thread) ;
// case EDGE: return ptrMap->MAP::ParentMap::ParentMap::foreach_dart_of_edge(d, f, thread) ;
// case ORIENTED_FACE: return ptrMap->MAP::ParentMap::ParentMap::foreach_dart_of_oriented_face(d, f, thread) ;
// case FACE: return ptrMap->MAP::ParentMap::ParentMap::foreach_dart_of_face(d, f, thread) ;
// case VOLUME: return ptrMap->MAP::ParentMap::ParentMap::foreach_dart_of_volume(d, f, thread) ;
// default: assert(!"Cells of this dimension are not handled") ;
// }
// return false ;
//}
}
//namespace CGoGN
...
...
include/Topology/generic/mapImpl/mapMulti.h
View file @
fdfbd068
...
...
@@ -306,6 +306,8 @@ public:
bool
copyFromOtherType
(
const
MapMono
&
map
);
void
restore_topo_shortcuts
();
virtual
void
dumpCSV
()
const
;
}
;
}
//namespace CGoGN
...
...
src/Container/attributeContainer.cpp
View file @
fdfbd068
...
...
@@ -844,8 +844,6 @@ void AttributeContainer::copyFrom(const AttributeContainer& cont)
void
AttributeContainer
::
dumpCSV
()
const
{
CGoGNout
<<
"Container of "
<<
orbitName
(
this
->
getOrbit
())
<<
CGoGNendl
;
CGoGNout
<<
"Name ; ;"
;
for
(
unsigned
int
i
=
0
;
i
<
m_tableAttribs
.
size
();
++
i
)
{
...
...
@@ -887,6 +885,7 @@ void AttributeContainer::dumpCSV() const
}
CGoGNout
<<
CGoGNendl
;
}
CGoGNout
<<
CGoGNendl
;
}
void
AttributeContainer
::
dumpByLines
()
const
...
...
src/Topology/generic/genericmap.cpp
View file @
fdfbd068
...
...
@@ -55,6 +55,7 @@ std::vector<GenericMap*>* GenericMap::s_instances=NULL;
GenericMap
::
GenericMap
()
:
m_manipulator
(
NULL
),
m_nextMarkerId
(
0
)
{
if
(
m_attributes_registry_map
==
NULL
)
...
...
@@ -166,6 +167,36 @@ GenericMap::~GenericMap()
s_instances
->
pop_back
();
}
bool
GenericMap
::
askManipulate
(
MapManipulator
*
ptr
)
{
if
(
m_manipulator
==
NULL
)
{
CGoGNerr
<<
"Map already manipulated by other manipulator"
<<
CGoGNendl
;
return
false
;
}
m_manipulator
=
ptr
;
return
true
;
}
MapManipulator
*
GenericMap
::
getManipulator
()
{
return
m_manipulator
;
}
bool
GenericMap
::
releaseManipulate
(
MapManipulator
*
ptr
)
{
if
(
m_manipulator
!=
ptr
)
{
CGoGNerr
<<
"Wrong manipulator want to release the map"
<<
CGoGNendl
;
return
false
;
}
m_manipulator
=
NULL
;
return
true
;
}
void
GenericMap
::
init
(
bool
addBoundaryMarkers
)
{
for
(
unsigned
int
i
=
0
;
i
<
NB_ORBITS
;
++
i
)
...
...
@@ -499,6 +530,7 @@ void GenericMap::dumpCSV() const
{
for
(
unsigned
int
orbit
=
0
;
orbit
<
NB_ORBITS
;
++
orbit
)
{
CGoGNout
<<
"Container of "
<<
orbitName
(
orbit
)
<<
CGoGNendl
;
m_attribs
[
orbit
].
dumpCSV
();
}
CGoGNout
<<
CGoGNendl
;
...
...
src/Topology/generic/mapMulti.cpp
View file @
fdfbd068
...
...
@@ -230,17 +230,25 @@ bool MapMulti::saveMapBin(const std::string& filename) const
for
(
unsigned
int
i
=
0
;
i
<
NB_ORBITS
;
++
i
)
m_attribs
[
i
].
saveBin
(
fs
,
i
);
// save mr_attrtibs
m_mrattribs
.
saveBin
(
fs
,
00
);
// save current level
fs
.
write
(
reinterpret_cast
<
const
char
*>
(
&
m_mrCurrentLevel
),
sizeof
(
unsigned
int
));
// save table of nb darts per level
unsigned
int
nb
=
m_mrNbDarts
.
size
();
fs
.
write
(
reinterpret_cast
<
const
char
*>
(
&
nb
),
sizeof
(
unsigned
int
));
fs
.
write
(
reinterpret_cast
<
const
char
*>
(
&
(
m_mrNbDarts
[
0
])),
nb
*
sizeof
(
unsigned
int
));
// nb = m_mrLevelStack.size();
// fs.write(reinterpret_cast<const char*>(&nb), sizeof(unsigned int));
// fs.write(reinterpret_cast<const char*>(&(m_mrLevelStack[0])), nb *sizeof(unsigned int));
return
true
;
}
bool
MapMulti
::
loadMapBin
(
const
std
::
string
&
filename
)
{
CGoGNistream
fs
(
filename
.
c_str
(),
std
::
ios
::
in
|
std
::
ios
::
binary
);
...
...
@@ -250,7 +258,18 @@ bool MapMulti::loadMapBin(const std::string& filename)
return
false
;
}
GenericMap
::
clear
(
true
);
// clear the map but do not insert boundary markers dart attribute
GenericMap
::
init
(
false
);
// init MR data without adding the attributes
m_mrattribs
.
clear
(
true
)
;
m_mrattribs
.
setRegistry
(
m_attributes_registry_map
)
;
m_mrDarts
.
clear
()
;
m_mrDarts
.
reserve
(
16
)
;
m_mrNbDarts
.
clear
();
m_mrNbDarts
.
reserve
(
16
);
m_mrLevelStack
.
clear
()
;
m_mrLevelStack
.
reserve
(
16
)
;
// read info
char
*
buff
=
new
char
[
256
];
...
...
@@ -298,10 +317,12 @@ bool MapMulti::loadMapBin(const std::string& filename)
m_attribs
[
id
].
loadBin
(
fs
);
}
AttributeContainer
::
loadBinId
(
fs
);
// not used but need to read
to skip
AttributeContainer
::
loadBinId
(
fs
);
// not used but need to read
for skipping data file
m_mrattribs
.
loadBin
(
fs
);
// read current level
fs
.
read
(
reinterpret_cast
<
char
*>
(
&
m_mrCurrentLevel
),
sizeof
(
unsigned
int
));
// read table of nb darts per level
unsigned
int
nb
;
fs
.
read
(
reinterpret_cast
<
char
*>
(
&
nb
),
sizeof
(
unsigned
int
));
m_mrNbDarts
.
resize
(
nb
);
...
...
@@ -508,4 +529,14 @@ void MapMulti::compactTopo()
}
void
MapMulti
::
dumpCSV
()
const
{
CGoGNout
<<
"Container of MR_DART"
<<
CGoGNendl
;
m_mrattribs
.
dumpCSV
();
CGoGNout
<<
CGoGNendl
;
GenericMap
::
dumpCSV
();
}
}
//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