Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
David Cazier
CGoGN
Commits
4cd0c557
Commit
4cd0c557
authored
Feb 28, 2011
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of cgogn:~cgogn/CGoGN
parents
3aacf0b2
6346fca0
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
126 additions
and
151 deletions
+126
-151
Apps/Examples/miniTest.cpp
Apps/Examples/miniTest.cpp
+11
-10
include/Algo/ImplicitHierarchicalMesh/ihm.hpp
include/Algo/ImplicitHierarchicalMesh/ihm.hpp
+2
-2
include/Algo/Modelisation/subdivision.h
include/Algo/Modelisation/subdivision.h
+6
-0
include/Algo/Modelisation/subdivision.hpp
include/Algo/Modelisation/subdivision.hpp
+21
-1
include/Container/attributeContainer.hpp
include/Container/attributeContainer.hpp
+4
-2
include/Topology/generic/attribmap.hpp
include/Topology/generic/attribmap.hpp
+0
-3
include/Topology/generic/attributeHandler.h
include/Topology/generic/attributeHandler.h
+5
-9
include/Topology/generic/attributeHandler.hpp
include/Topology/generic/attributeHandler.hpp
+8
-3
include/Topology/generic/genericmap.h
include/Topology/generic/genericmap.h
+11
-13
include/Topology/generic/genericmap.hpp
include/Topology/generic/genericmap.hpp
+1
-3
include/Topology/map/map2.h
include/Topology/map/map2.h
+0
-7
src/Container/attributeContainer.cpp
src/Container/attributeContainer.cpp
+1
-2
src/Topology/generic/attribmap.cpp
src/Topology/generic/attribmap.cpp
+3
-1
src/Topology/generic/genericmap.cpp
src/Topology/generic/genericmap.cpp
+53
-55
src/Topology/map/map2.cpp
src/Topology/map/map2.cpp
+0
-40
No files found.
Apps/Examples/miniTest.cpp
View file @
4cd0c557
...
@@ -536,11 +536,10 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y)
...
@@ -536,11 +536,10 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y)
case
'd'
:
case
'd'
:
{
{
myMap
.
removeAttribute
<
PFP
::
VEC3
>
(
normal
)
;
AttributeHandler
<
PFP
::
VEC3
>
positionF
=
myMap
.
getAttribute
<
PFP
::
VEC3
>
(
FACE_ORBIT
,
"position"
)
;
myMap
.
removeAttribute
<
PFP
::
VEC3
>
(
laplacian
)
;
if
(
!
positionF
.
isValid
())
positionF
=
myMap
.
addAttribute
<
PFP
::
VEC3
>
(
FACE_ORBIT
,
"position"
)
;
AttributeHandler
<
PFP
::
VEC3
>
newPosition
=
myMap
.
addAttribute
<
PFP
::
VEC3
>
(
FACE_ORBIT
,
"position"
)
;
Algo
::
Geometry
::
computeCentroidFaces
<
PFP
>
(
myMap
,
position
,
positionF
)
;
Algo
::
Geometry
::
computeCentroidFaces
<
PFP
>
(
myMap
,
position
,
newPosition
)
;
GLint
t1
=
glutGet
(
GLUT_ELAPSED_TIME
);
GLint
t1
=
glutGet
(
GLUT_ELAPSED_TIME
);
...
@@ -550,12 +549,14 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y)
...
@@ -550,12 +549,14 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y)
GLfloat
seconds
=
(
t2
-
t1
)
/
1000.0
f
;
GLfloat
seconds
=
(
t2
-
t1
)
/
1000.0
f
;
std
::
cout
<<
"dual computation: "
<<
seconds
<<
"sec"
<<
std
::
endl
;
std
::
cout
<<
"dual computation: "
<<
seconds
<<
"sec"
<<
std
::
endl
;
newPosition
=
myMap
.
getAttribute
<
PFP
::
VEC3
>
(
FACE_ORBIT
,
"position"
)
;
myMap
.
removeAttribute
<
PFP
::
VEC3
>
(
newPosition
)
;
position
=
myMap
.
getAttribute
<
PFP
::
VEC3
>
(
VERTEX_ORBIT
,
"position"
)
;
position
=
myMap
.
getAttribute
<
PFP
::
VEC3
>
(
VERTEX_ORBIT
,
"position"
)
;
normal
=
myMap
.
addAttribute
<
PFP
::
VEC3
>
(
VERTEX_ORBIT
,
"normal"
)
;
laplacian
=
myMap
.
addAttribute
<
PFP
::
VEC3
>
(
VERTEX_ORBIT
,
"laplacian"
)
;
normal
=
myMap
.
getAttribute
<
PFP
::
VEC3
>
(
VERTEX_ORBIT
,
"normal"
)
;
if
(
!
normal
.
isValid
())
normal
=
myMap
.
addAttribute
<
PFP
::
VEC3
>
(
VERTEX_ORBIT
,
"normal"
)
;
laplacian
=
myMap
.
getAttribute
<
PFP
::
VEC3
>
(
VERTEX_ORBIT
,
"laplacian"
)
;
if
(
!
laplacian
.
isValid
())
laplacian
=
myMap
.
addAttribute
<
PFP
::
VEC3
>
(
VERTEX_ORBIT
,
"laplacian"
)
;
t1
=
glutGet
(
GLUT_ELAPSED_TIME
);
t1
=
glutGet
(
GLUT_ELAPSED_TIME
);
updateVBOprimitives
(
Algo
::
Render
::
VBO
::
TRIANGLES
|
Algo
::
Render
::
VBO
::
LINES
|
Algo
::
Render
::
VBO
::
POINTS
)
;
updateVBOprimitives
(
Algo
::
Render
::
VBO
::
TRIANGLES
|
Algo
::
Render
::
VBO
::
LINES
|
Algo
::
Render
::
VBO
::
POINTS
)
;
...
...
include/Algo/ImplicitHierarchicalMesh/ihm.hpp
View file @
4cd0c557
...
@@ -343,7 +343,7 @@ T& AttributeHandler_IHM<T>::operator[](Dart d)
...
@@ -343,7 +343,7 @@ T& AttributeHandler_IHM<T>::operator[](Dart d)
assert
(
m
->
m_dartLevel
[
d
]
<=
m
->
m_curLevel
||
!
"Access to a dart introduced after current level"
)
;
assert
(
m
->
m_dartLevel
[
d
]
<=
m
->
m_curLevel
||
!
"Access to a dart introduced after current level"
)
;
assert
(
m
->
vertexInsertionLevel
(
d
)
<=
m
->
m_curLevel
||
!
"Access to the embedding of a vertex inserted after current level"
)
;
assert
(
m
->
vertexInsertionLevel
(
d
)
<=
m
->
m_curLevel
||
!
"Access to the embedding of a vertex inserted after current level"
)
;
unsigned
int
orbit
=
this
->
m_o
rbit
;
unsigned
int
orbit
=
this
->
getO
rbit
()
;
unsigned
int
nbSteps
=
m
->
m_curLevel
-
m
->
vertexInsertionLevel
(
d
)
;
unsigned
int
nbSteps
=
m
->
m_curLevel
-
m
->
vertexInsertionLevel
(
d
)
;
unsigned
int
index
=
m
->
getEmbedding
(
d
,
orbit
)
;
unsigned
int
index
=
m
->
getEmbedding
(
d
,
orbit
)
;
...
@@ -380,7 +380,7 @@ const T& AttributeHandler_IHM<T>::operator[](Dart d) const
...
@@ -380,7 +380,7 @@ const T& AttributeHandler_IHM<T>::operator[](Dart d) const
assert
(
m
->
m_dartLevel
[
d
]
<=
m
->
m_curLevel
||
!
"Access to a dart introduced after current level"
)
;
assert
(
m
->
m_dartLevel
[
d
]
<=
m
->
m_curLevel
||
!
"Access to a dart introduced after current level"
)
;
assert
(
m
->
vertexInsertionLevel
(
d
)
<=
m
->
m_curLevel
||
!
"Access to the embedding of a vertex inserted after current level"
)
;
assert
(
m
->
vertexInsertionLevel
(
d
)
<=
m
->
m_curLevel
||
!
"Access to the embedding of a vertex inserted after current level"
)
;
unsigned
int
orbit
=
this
->
m_o
rbit
;
unsigned
int
orbit
=
this
->
getO
rbit
()
;
unsigned
int
nbSteps
=
m
->
m_curLevel
-
m
->
vertexInsertionLevel
(
d
)
;
unsigned
int
nbSteps
=
m
->
m_curLevel
-
m
->
vertexInsertionLevel
(
d
)
;
unsigned
int
index
=
m
->
getEmbedding
(
d
,
orbit
)
;
unsigned
int
index
=
m
->
getEmbedding
(
d
,
orbit
)
;
...
...
include/Algo/Modelisation/subdivision.h
View file @
4cd0c557
...
@@ -91,6 +91,12 @@ void LoopSubdivision(typename PFP::MAP& map, EMBV& attributs, const FunctorSelec
...
@@ -91,6 +91,12 @@ void LoopSubdivision(typename PFP::MAP& map, EMBV& attributs, const FunctorSelec
template
<
typename
PFP
>
template
<
typename
PFP
>
void
LoopSubdivision
(
typename
PFP
::
MAP
&
map
,
typename
PFP
::
TVEC3
&
position
,
const
FunctorSelect
&
selected
=
SelectorTrue
())
;
void
LoopSubdivision
(
typename
PFP
::
MAP
&
map
,
typename
PFP
::
TVEC3
&
position
,
const
FunctorSelect
&
selected
=
SelectorTrue
())
;
/**
* Reverse the orientation of the map
*/
template
<
typename
PFP
>
void
reverseOrientation
(
typename
PFP
::
MAP
&
map
)
;
/**
/**
* Dual mesh computation
* Dual mesh computation
*/
*/
...
...
include/Algo/Modelisation/subdivision.hpp
View file @
4cd0c557
...
@@ -434,6 +434,24 @@ void LoopSubdivision(typename PFP::MAP& map, typename PFP::TVEC3& position, cons
...
@@ -434,6 +434,24 @@ void LoopSubdivision(typename PFP::MAP& map, typename PFP::TVEC3& position, cons
LoopSubdivision
<
PFP
,
typename
PFP
::
TVEC3
,
typename
PFP
::
VEC3
>
(
map
,
position
,
selected
)
;
LoopSubdivision
<
PFP
,
typename
PFP
::
TVEC3
,
typename
PFP
::
VEC3
>
(
map
,
position
,
selected
)
;
}
}
template
<
typename
PFP
>
void
reverseOrientation
(
typename
PFP
::
MAP
&
map
)
{
AttributeHandler
<
unsigned
int
>
emb0
(
&
map
,
map
.
getEmbeddingAttributeVector
(
VERTEX_ORBIT
))
;
if
(
emb0
.
isValid
())
{
AttributeHandler
<
unsigned
int
>
new_emb0
=
map
.
template
addAttribute
<
unsigned
int
>(
DART_ORBIT
,
"new_EMB_0"
)
;
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
new_emb0
[
d
]
=
emb0
[
map
.
phi1
(
d
)]
;
map
.
template
swapAttributes
<
unsigned
int
>(
emb0
,
new_emb0
)
;
map
.
template
removeAttribute
<
unsigned
int
>(
new_emb0
)
;
}
AttributeHandler
<
Dart
>
phi1
=
map
.
template
getAttribute
<
Dart
>(
DART_ORBIT
,
"phi1"
)
;
AttributeHandler
<
Dart
>
phi_1
=
map
.
template
getAttribute
<
Dart
>(
DART_ORBIT
,
"phi_1"
)
;
map
.
template
swapAttributes
<
Dart
>(
phi1
,
phi_1
)
;
}
template
<
typename
PFP
>
template
<
typename
PFP
>
void
computeDual
(
typename
PFP
::
MAP
&
map
,
const
FunctorSelect
&
selected
)
void
computeDual
(
typename
PFP
::
MAP
&
map
,
const
FunctorSelect
&
selected
)
{
{
...
@@ -456,12 +474,14 @@ void computeDual(typename PFP::MAP& map, const FunctorSelect& selected)
...
@@ -456,12 +474,14 @@ void computeDual(typename PFP::MAP& map, const FunctorSelect& selected)
map
.
template
removeAttribute
<
Dart
>(
new_phi_1
)
;
map
.
template
removeAttribute
<
Dart
>(
new_phi_1
)
;
map
.
swapEmbeddingContainers
(
VERTEX_ORBIT
,
FACE_ORBIT
)
;
map
.
swapEmbeddingContainers
(
VERTEX_ORBIT
,
FACE_ORBIT
)
;
reverseOrientation
<
PFP
>
(
map
)
;
}
}
template
<
typename
PFP
>
template
<
typename
PFP
>
void
Sqrt3Subdivision
(
typename
PFP
::
MAP
&
map
,
typename
PFP
::
TVEC3
&
position
,
const
FunctorSelect
&
selected
)
void
Sqrt3Subdivision
(
typename
PFP
::
MAP
&
map
,
typename
PFP
::
TVEC3
&
position
,
const
FunctorSelect
&
selected
)
{
{
//
computeDual<PFP>(map, selected);
computeDual
<
PFP
>
(
map
,
selected
);
trianguleFaces
<
PFP
>
(
map
,
position
,
selected
);
trianguleFaces
<
PFP
>
(
map
,
position
,
selected
);
}
}
...
...
include/Container/attributeContainer.hpp
View file @
4cd0c557
...
@@ -292,8 +292,10 @@ AttributeMultiVector<T>* AttributeContainer::getDataVector(const std::string& at
...
@@ -292,8 +292,10 @@ AttributeMultiVector<T>* AttributeContainer::getDataVector(const std::string& at
inline
AttributeMultiVectorGen
*
AttributeContainer
::
getVirtualDataVector
(
const
std
::
string
&
attribName
)
inline
AttributeMultiVectorGen
*
AttributeContainer
::
getVirtualDataVector
(
const
std
::
string
&
attribName
)
{
{
unsigned
int
index
=
getAttributeIndex
(
attribName
)
;
unsigned
int
index
=
getAttributeIndex
(
attribName
)
;
assert
(
index
!=
UNKNOWN
)
;
if
(
index
==
UNKNOWN
)
return
m_tableAttribs
[
index
];
return
NULL
;
else
return
m_tableAttribs
[
index
];
}
}
template
<
typename
T
>
template
<
typename
T
>
...
...
include/Topology/generic/attribmap.hpp
View file @
4cd0c557
...
@@ -44,7 +44,6 @@ inline bool AttribMap::removeAttribute(AttributeHandler<T>& attr)
...
@@ -44,7 +44,6 @@ inline bool AttribMap::removeAttribute(AttributeHandler<T>& attr)
template
<
typename
T
>
template
<
typename
T
>
inline
AttributeHandler
<
T
>
AttribMap
::
getAttribute
(
unsigned
int
orbit
,
const
std
::
string
&
nameAttr
)
inline
AttributeHandler
<
T
>
AttribMap
::
getAttribute
(
unsigned
int
orbit
,
const
std
::
string
&
nameAttr
)
{
{
assert
(
isOrbitEmbedded
(
orbit
)
||
!
"Invalid parameter: orbit not embedded"
);
AttributeMultiVector
<
T
>*
amv
=
m_attribs
[
orbit
].
getDataVector
<
T
>
(
nameAttr
)
;
AttributeMultiVector
<
T
>*
amv
=
m_attribs
[
orbit
].
getDataVector
<
T
>
(
nameAttr
)
;
return
AttributeHandler
<
T
>
(
this
,
amv
)
;
return
AttributeHandler
<
T
>
(
this
,
amv
)
;
}
}
...
@@ -77,7 +76,6 @@ inline bool AttribMap::copyAttribute(AttributeHandler<T>& dst, AttributeHandler<
...
@@ -77,7 +76,6 @@ inline bool AttribMap::copyAttribute(AttributeHandler<T>& dst, AttributeHandler<
inline
unsigned
int
AttribMap
::
getNbCells
(
unsigned
int
orbit
)
inline
unsigned
int
AttribMap
::
getNbCells
(
unsigned
int
orbit
)
{
{
assert
(
isOrbitEmbedded
(
orbit
)
||
!
"Invalid parameter: orbit not embedded"
);
return
this
->
m_attribs
[
orbit
].
size
()
;
return
this
->
m_attribs
[
orbit
].
size
()
;
}
}
...
@@ -88,7 +86,6 @@ inline unsigned int AttribMap::getNbCells(unsigned int orbit)
...
@@ -88,7 +86,6 @@ inline unsigned int AttribMap::getNbCells(unsigned int orbit)
inline
AttributeMultiVector
<
Dart
>*
AttribMap
::
addRelation
(
const
std
::
string
&
name
)
inline
AttributeMultiVector
<
Dart
>*
AttribMap
::
addRelation
(
const
std
::
string
&
name
)
{
{
AttributeContainer
&
cont
=
m_attribs
[
DART_ORBIT
]
;
AttributeContainer
&
cont
=
m_attribs
[
DART_ORBIT
]
;
AttributeMultiVector
<
Dart
>*
amv
=
cont
.
addAttribute
<
Dart
>
(
name
)
;
AttributeMultiVector
<
Dart
>*
amv
=
cont
.
addAttribute
<
Dart
>
(
name
)
;
// set new relation to fix point for all the darts of the map
// set new relation to fix point for all the darts of the map
...
...
include/Topology/generic/attributeHandler.h
View file @
4cd0c557
...
@@ -43,8 +43,6 @@ namespace CGoGN
...
@@ -43,8 +43,6 @@ namespace CGoGN
template
<
typename
T
>
template
<
typename
T
>
class
AttributeHandler
class
AttributeHandler
{
{
friend
class
AttribMap
;
protected:
protected:
// we need the map to use dart as index
// we need the map to use dart as index
GenericMap
*
m_map
;
GenericMap
*
m_map
;
...
@@ -52,19 +50,17 @@ protected:
...
@@ -52,19 +50,17 @@ protected:
// access to the data
// access to the data
AttributeMultiVector
<
T
>*
m_attrib
;
AttributeMultiVector
<
T
>*
m_attrib
;
protected:
public:
typedef
T
DATA_TYPE
;
/**
/**
* Constructor
* Constructor
* @param m the map which belong attribute
* @param m the map which belong attribute
* @param orbit orbit of attribute
* @param amv a pointer to the AttributeMultiVector
* @param orbit index of attribute
*/
*/
AttributeHandler
(
GenericMap
*
m
,
AttributeMultiVector
<
T
>*
amv
)
;
AttributeHandler
(
GenericMap
*
m
,
AttributeMultiVector
<
T
>*
amv
)
;
public:
AttributeHandler
()
;
typedef
T
DATA_TYPE
;
AttributeHandler
()
:
m_map
(
NULL
),
m_attrib
(
NULL
)
{}
/**
/**
* Copy constructor
* Copy constructor
...
...
include/Topology/generic/attributeHandler.hpp
View file @
4cd0c557
...
@@ -30,6 +30,11 @@ AttributeHandler<T>::AttributeHandler(GenericMap* m, AttributeMultiVector<T>* am
...
@@ -30,6 +30,11 @@ AttributeHandler<T>::AttributeHandler(GenericMap* m, AttributeMultiVector<T>* am
m_map
(
m
),
m_attrib
(
amv
)
m_map
(
m
),
m_attrib
(
amv
)
{}
{}
template
<
typename
T
>
AttributeHandler
<
T
>::
AttributeHandler
()
:
m_map
(
NULL
),
m_attrib
(
NULL
)
{}
template
<
typename
T
>
template
<
typename
T
>
AttributeHandler
<
T
>::
AttributeHandler
(
const
AttributeHandler
<
T
>&
ta
)
:
AttributeHandler
<
T
>::
AttributeHandler
(
const
AttributeHandler
<
T
>&
ta
)
:
m_map
(
ta
.
m_map
),
m_attrib
(
ta
.
m_attrib
)
m_map
(
ta
.
m_map
),
m_attrib
(
ta
.
m_attrib
)
...
@@ -79,9 +84,9 @@ const std::string& AttributeHandler<T>::name() const
...
@@ -79,9 +84,9 @@ const std::string& AttributeHandler<T>::name() const
template
<
typename
T
>
template
<
typename
T
>
bool
AttributeHandler
<
T
>::
isValid
()
const
bool
AttributeHandler
<
T
>::
isValid
()
const
{
{
return
(
m_map
!
=
NULL
&&
return
!
(
m_map
=
=
NULL
||
m_attrib
!
=
NULL
&&
m_attrib
=
=
NULL
||
m_attrib
->
getIndex
()
!
=
AttributeContainer
::
UNKNOWN
)
;
m_attrib
->
getIndex
()
=
=
AttributeContainer
::
UNKNOWN
)
;
}
}
template
<
typename
T
>
template
<
typename
T
>
...
...
include/Topology/generic/genericmap.h
View file @
4cd0c557
...
@@ -84,7 +84,7 @@ protected:
...
@@ -84,7 +84,7 @@ protected:
*/
*/
AttributeContainer
m_attribs
[
NB_ORBITS
]
;
AttributeContainer
m_attribs
[
NB_ORBITS
]
;
static
std
::
map
<
std
::
string
,
RegisteredBaseAttribute
*
>*
m_attributes_registry_map
;
static
std
::
map
<
std
::
string
,
RegisteredBaseAttribute
*>*
m_attributes_registry_map
;
/**
/**
* Direct access to the Dart attributes that store the orbits embeddings
* Direct access to the Dart attributes that store the orbits embeddings
...
@@ -272,17 +272,16 @@ protected:
...
@@ -272,17 +272,16 @@ protected:
* @param orbit the orbit of cell to use (xxx_ORBIT)
* @param orbit the orbit of cell to use (xxx_ORBIT)
* @return the marker to use
* @return the marker to use
*/
*/
Marker
getNewMarker
(
unsigned
int
cell
=
DART_ORBIT
,
unsigned
int
thread
=
0
);
Marker
getNewMarker
(
unsigned
int
cell
=
DART_ORBIT
,
unsigned
int
thread
=
0
);
/**
/**
* release a marker of cell.
* release a marker of cell.
* @param m the marker to release
* @param m the marker to release
*/
*/
void
releaseMarker
(
Marker
m
,
unsigned
int
thread
=
0
);
void
releaseMarker
(
Marker
m
,
unsigned
int
thread
=
0
);
/****************************************
/****************************************
* THREAD MANAGEMENT *
*
THREAD MANAGEMENT
*
****************************************/
****************************************/
public:
public:
/**
/**
...
@@ -304,7 +303,6 @@ public:
...
@@ -304,7 +303,6 @@ public:
*/
*/
void
removeThreadMarker
(
unsigned
int
nb
);
void
removeThreadMarker
(
unsigned
int
nb
);
/****************************************
/****************************************
* SAVE & LOAD *
* SAVE & LOAD *
****************************************/
****************************************/
...
@@ -384,13 +382,13 @@ public:
...
@@ -384,13 +382,13 @@ public:
* @param d a dart of the orbit
* @param d a dart of the orbit
* @param f a functor obj
* @param f a functor obj
*/
*/
bool
foreach_dart_of_orbit
(
unsigned
int
orbit
,
Dart
d
,
FunctorType
&
f
,
unsigned
int
thread
=
0
);
bool
foreach_dart_of_orbit
(
unsigned
int
orbit
,
Dart
d
,
FunctorType
&
f
,
unsigned
int
thread
=
0
);
virtual
bool
foreach_dart_of_vertex
(
Dart
d
,
FunctorType
&
f
,
unsigned
int
thread
=
0
)
=
0
;
virtual
bool
foreach_dart_of_vertex
(
Dart
d
,
FunctorType
&
f
,
unsigned
int
thread
=
0
)
=
0
;
virtual
bool
foreach_dart_of_edge
(
Dart
d
,
FunctorType
&
f
,
unsigned
int
thread
=
0
)
=
0
;
virtual
bool
foreach_dart_of_edge
(
Dart
d
,
FunctorType
&
f
,
unsigned
int
thread
=
0
)
=
0
;
virtual
bool
foreach_dart_of_face
(
Dart
d
,
FunctorType
&
f
,
unsigned
int
thread
=
0
)
=
0
;
virtual
bool
foreach_dart_of_face
(
Dart
d
,
FunctorType
&
f
,
unsigned
int
thread
=
0
)
=
0
;
virtual
bool
foreach_dart_of_volume
(
Dart
d
,
FunctorType
&
f
,
unsigned
int
thread
=
0
)
=
0
;
virtual
bool
foreach_dart_of_volume
(
Dart
d
,
FunctorType
&
f
,
unsigned
int
thread
=
0
)
=
0
;
virtual
bool
foreach_dart_of_cc
(
Dart
d
,
FunctorType
&
f
,
unsigned
int
thread
=
0
)
=
0
;
virtual
bool
foreach_dart_of_cc
(
Dart
d
,
FunctorType
&
f
,
unsigned
int
thread
=
0
)
=
0
;
/**
/**
* execute functor for each orbit
* execute functor for each orbit
...
@@ -398,7 +396,7 @@ public:
...
@@ -398,7 +396,7 @@ public:
* @param f the functor
* @param f the functor
* @param good the selector of darts
* @param good the selector of darts
*/
*/
bool
foreach_orbit
(
unsigned
int
orbit
,
FunctorType
&
f
,
const
FunctorSelect
&
good
=
SelectorTrue
(),
unsigned
int
thread
=
0
);
bool
foreach_orbit
(
unsigned
int
orbit
,
FunctorType
&
f
,
const
FunctorSelect
&
good
=
SelectorTrue
(),
unsigned
int
thread
=
0
);
//! Count the number of orbits of dimension dim in the map
//! Count the number of orbits of dimension dim in the map
/*! @param dim the dimension of the orbit
/*! @param dim the dimension of the orbit
...
...
include/Topology/generic/genericmap.hpp
View file @
4cd0c557
...
@@ -242,9 +242,7 @@ inline void GenericMap::swapEmbeddingContainers(unsigned int orbit1, unsigned in
...
@@ -242,9 +242,7 @@ inline void GenericMap::swapEmbeddingContainers(unsigned int orbit1, unsigned in
m_attribs
[
orbit1
].
setOrbit
(
orbit1
)
;
// to update the orbit information
m_attribs
[
orbit1
].
setOrbit
(
orbit1
)
;
// to update the orbit information
m_attribs
[
orbit2
].
setOrbit
(
orbit2
)
;
// in the contained AttributeMultiVectors
m_attribs
[
orbit2
].
setOrbit
(
orbit2
)
;
// in the contained AttributeMultiVectors
AttributeMultiVector
<
unsigned
int
>*
e
=
m_embeddings
[
orbit1
]
;
m_embeddings
[
orbit1
]
->
swap
(
m_embeddings
[
orbit2
])
;
m_embeddings
[
orbit1
]
=
m_embeddings
[
orbit2
]
;
m_embeddings
[
orbit2
]
=
e
;
for
(
unsigned
int
t
=
0
;
t
<
m_nbThreads
;
++
t
)
for
(
unsigned
int
t
=
0
;
t
<
m_nbThreads
;
++
t
)
{
{
...
...
include/Topology/map/map2.h
View file @
4cd0c557
...
@@ -235,13 +235,6 @@ public:
...
@@ -235,13 +235,6 @@ public:
* @param marker
* @param marker
*/
*/
void
closeMap
(
DartMarker
&
marker
);
void
closeMap
(
DartMarker
&
marker
);
// TODO a mettre en algo
/**
* Reverse orientation of map (reverse orientation of all faces)
* no dart created, each dart keeps its embedding, only changing phi1 and phi2
*/
void
reverseOrientation
();
//@}
//@}
/*! @name Topological Queries
/*! @name Topological Queries
...
...
src/Container/attributeContainer.cpp
View file @
4cd0c557
...
@@ -125,8 +125,7 @@ const std::string& AttributeContainer::getAttributeName(unsigned int index)
...
@@ -125,8 +125,7 @@ const std::string& AttributeContainer::getAttributeName(unsigned int index)
assert
(
index
<
m_tableAttribs
.
size
()
||
!
"getAttributeName: attribute index out of bounds"
);
assert
(
index
<
m_tableAttribs
.
size
()
||
!
"getAttributeName: attribute index out of bounds"
);
assert
(
m_tableAttribs
[
index
]
!=
NULL
||
!
"getAttributeName: attribute does not exist"
);
assert
(
m_tableAttribs
[
index
]
!=
NULL
||
!
"getAttributeName: attribute does not exist"
);
if
(
m_tableAttribs
[
index
]
!=
NULL
)
return
m_tableAttribs
[
index
]
->
getName
()
;
return
m_tableAttribs
[
index
]
->
getName
()
;
}
}
template
<
typename
T
>
template
<
typename
T
>
...
...
src/Topology/generic/attribmap.cpp
View file @
4cd0c557
...
@@ -56,7 +56,9 @@ void AttribMap::addEmbedding(unsigned int orbit)
...
@@ -56,7 +56,9 @@ void AttribMap::addEmbedding(unsigned int orbit)
AttributeContainer
&
cellCont
=
m_attribs
[
orbit
];
AttributeContainer
&
cellCont
=
m_attribs
[
orbit
];
for
(
unsigned
int
t
=
0
;
t
<
m_nbThreads
;
++
t
)
for
(
unsigned
int
t
=
0
;
t
<
m_nbThreads
;
++
t
)
{
{
AttributeMultiVector
<
Mark
>*
amvMark
=
cellCont
.
addAttribute
<
Mark
>
(
"Mark"
)
;
std
::
stringstream
ss
;
ss
<<
"Mark_"
<<
t
;
AttributeMultiVector
<
Mark
>*
amvMark
=
cellCont
.
addAttribute
<
Mark
>
(
ss
.
str
())
;
m_markerTables
[
orbit
][
t
]
=
amvMark
;
m_markerTables
[
orbit
][
t
]
=
amvMark
;
}
}
}
}
...
...
src/Topology/generic/genericmap.cpp
View file @
4cd0c557
...
@@ -33,8 +33,7 @@ namespace CGoGN
...
@@ -33,8 +33,7 @@ namespace CGoGN
std
::
map
<
std
::
string
,
RegisteredBaseAttribute
*>*
GenericMap
::
m_attributes_registry_map
=
NULL
;
std
::
map
<
std
::
string
,
RegisteredBaseAttribute
*>*
GenericMap
::
m_attributes_registry_map
=
NULL
;
GenericMap
::
GenericMap
()
GenericMap
::
GenericMap
()
:
m_nbThreads
(
1
)
:
m_nbThreads
(
1
)
{
{
if
(
m_attributes_registry_map
==
NULL
)
if
(
m_attributes_registry_map
==
NULL
)
m_attributes_registry_map
=
new
std
::
map
<
std
::
string
,
RegisteredBaseAttribute
*>
;
m_attributes_registry_map
=
new
std
::
map
<
std
::
string
,
RegisteredBaseAttribute
*>
;
...
@@ -114,7 +113,6 @@ void GenericMap::setDartEmbedding(unsigned int orbit, Dart d, unsigned int emb)
...
@@ -114,7 +113,6 @@ void GenericMap::setDartEmbedding(unsigned int orbit, Dart d, unsigned int emb)
(
*
m_embeddings
[
orbit
])[
d
.
index
]
=
emb
;
(
*
m_embeddings
[
orbit
])[
d
.
index
]
=
emb
;
}
}
/****************************************
/****************************************
* ATTRIBUTES MANAGEMENT *
* ATTRIBUTES MANAGEMENT *
****************************************/
****************************************/
...
@@ -150,6 +148,58 @@ bool GenericMap::registerAttribute(const std::string &nameType)
...
@@ -150,6 +148,58 @@ bool GenericMap::registerAttribute(const std::string &nameType)
return
true
;
return
true
;
}
}
/****************************************
* THREAD MANAGEMENT *
****************************************/
void
GenericMap
::
addThreadMarker
(
unsigned
int
nb
)
{
unsigned
int
th
;
for
(
unsigned
int
j
=
0
;
j
<
nb
;
++
j
)
{
th
=
m_nbThreads
;
m_nbThreads
++
;
for
(
unsigned
int
i
=
0
;
i
<
NB_ORBITS
;
++
i
)
{
if
(
isOrbitEmbedded
(
i
))
{
std
::
stringstream
ss
;
ss
<<
"Mark_"
<<
th
;
AttributeContainer
&
cellCont
=
m_attribs
[
i
]
;
AttributeMultiVector
<
Mark
>*
amvMark
=
cellCont
.
addAttribute
<
Mark
>
(
ss
.
str
())
;
m_markerTables
[
i
][
th
]
=
amvMark
;
}
}
}
}
unsigned
int
GenericMap
::
getNbThreadMarkers
()
{
return
m_nbThreads
;
}
void
GenericMap
::
removeThreadMarker
(
unsigned
int
nb
)
{
unsigned
int
th
=
0
;
while
((
m_nbThreads
>
1
)
&&
(
nb
>
0
))
{
th
=
--
m_nbThreads
;
--
nb
;
for
(
unsigned
int
i
=
0
;
i
<
NB_ORBITS
;
++
i
)
{
if
(
isOrbitEmbedded
(
i
))
{
std
::
stringstream
ss
;
ss
<<
"Mark_"
<<
th
;
AttributeContainer
&
cellCont
=
m_attribs
[
i
]
;
cellCont
.
removeAttribute
(
ss
.
str
())
;
m_markerTables
[
i
][
th
]
=
NULL
;
}
}
}
}
/****************************************
/****************************************
* SAVE & LOAD *
* SAVE & LOAD *
...
@@ -464,7 +514,6 @@ bool GenericMap::loadMapBin(const std::string& filename)
...
@@ -464,7 +514,6 @@ bool GenericMap::loadMapBin(const std::string& filename)
return
true
;
return
true
;
}
}
/****************************************
/****************************************
* DARTS TRAVERSALS *
* DARTS TRAVERSALS *
****************************************/
****************************************/
...
@@ -524,55 +573,4 @@ unsigned int GenericMap::getNbOrbits(unsigned int orbit, const FunctorSelect& go
...
@@ -524,55 +573,4 @@ unsigned int GenericMap::getNbOrbits(unsigned int orbit, const FunctorSelect& go
return
fcount
.
getNb
();
return
fcount
.
getNb
();
}
}
void
GenericMap
::
addThreadMarker
(
unsigned
int
nb
)
{
unsigned
int
th
;
for
(
unsigned
int
j
=
0
;
j
<
nb
;
++
j
)
{
th
=
m_nbThreads
;
m_nbThreads
++
;
for
(
unsigned
int
i
=
0
;
i
<
NB_ORBITS
;
++
i
)
{
if
(
isOrbitEmbedded
(
i
))
{
AttributeContainer
&
cellCont
=
m_attribs
[
i
]
;
std
::
stringstream
ss
;
ss
<<
"Mark_"
<<
th
;
AttributeMultiVector
<
Mark
>*
amvMark
=
cellCont
.
addAttribute
<
Mark
>
(
ss
.
str
())
;
m_markerTables
[
i
][
th
]
=
amvMark
;
}
}
}
}
unsigned
int
GenericMap
::
getNbThreadMarkers
()
{
return
m_nbThreads
;
}
void
GenericMap
::
removeThreadMarker
(
unsigned
int
nb
)
{
unsigned
int
th
=
0
;
while
((
m_nbThreads
>
1
)
&&
(
nb
>
0
))
{
th
=
--
m_nbThreads
;
--
nb
;
for
(
unsigned
int
i
=
0
;
i
<
NB_ORBITS
;
++
i
)