Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
CGoGN
CGoGN
Commits
4f71806d
Commit
4f71806d
authored
Jul 08, 2014
by
Sylvain Thery
Browse files
attribute handler type checking
parent
193a7dae
Changes
7
Hide whitespace changes
Inline
Side-by-side
Apps/Tuto/Attributes/multi_attribs.cpp
View file @
4f71806d
...
...
@@ -77,7 +77,10 @@ typename ATT::DATA_TYPE smooth(MAP& map, Vertex v, const ATT& attributs)
template
<
typename
MAP
,
typename
ATT
>
void
applySmooth
(
MAP
&
map
,
const
ATT
&
att_in
,
ATT
&
att_out
)
{
foreach_cell
<
VERTEX
>
(
map
,[
&
](
Vertex
v
)
// for all edge e of map do
// check at compile if ATT is an AttributeHandler on orbit VERTEX
CHECK_ATTRIBUTEHANDER_ORBIT_TYPE
(
ATT
,
VERTEX
);
foreach_cell
<
VERTEX
>
(
map
,[
&
](
Vertex
v
)
// for all vertex v of map do
{
att_out
[
v
]
=
smooth
(
map
,
v
,
att_in
);
});
...
...
Apps/Tuto/Attributes/simple_attribs.cpp
View file @
4f71806d
...
...
@@ -112,6 +112,8 @@ void computeNewPositions(MAP& map, VertexAttribute<VEC3, MAP>& pos)
template
<
typename
ATTRIB
>
void
dumpAttribute
(
const
ATTRIB
&
attr
)
{
CHECK_ATTRIBUTEHANDER__TYPE
(
ATTRIB
);
std
::
cout
<<
"Attribute "
<<
attr
.
name
()
<<
" of orbit "
<<
orbitName
(
attr
.
getOrbit
())
<<
" of type "
<<
attr
.
typeName
()
<<
std
::
endl
;
// NEVER USE 0 AND ++ IN FOR LOOP ON ATTRIBUTE !
...
...
include/Topology/generic/attributeHandler.h
View file @
4f71806d
...
...
@@ -33,6 +33,14 @@
#include
"Container/fakeAttribute.h"
#include
"Topology/generic/cells.h"
/// Macro that check if ATTRIBUTEHANDLER type is an AttributeHandler of orbit ORBITVALUE
#define CHECK_ATTRIBUTEHANDER_ORBIT_TYPE(ATTRIBUTEHANDLER, ORBITVALUE) \
static_assert(std::is_base_of<AttributeHandlerGen,ATTRIBUTEHANDLER>::value, "Error not AttributeHandler");\
static_assert(ATTRIBUTEHANDLER::ORBIT==ORBITVALUE,"Error wrong orbit of AttributeHandler");
#define CHECK_ATTRIBUTEHANDER__TYPE(ATTRIBUTEHANDLER) \
static_assert(std::is_base_of<AttributeHandlerGen,ATTRIBUTEHANDLER>::value, "Error not AttributeHandler");
namespace
CGoGN
{
...
...
@@ -78,7 +86,7 @@ protected:
* - [ dart ]
* - begin / end / next to manage indexing
*/
template
<
typename
T
,
unsigned
int
ORB
IT
,
typename
MAP
>
template
<
typename
T
,
unsigned
int
ORB
,
typename
MAP
>
class
AttributeHandler
:
public
AttributeHandlerGen
{
protected:
...
...
@@ -92,6 +100,7 @@ protected:
public:
typedef
T
DATA_TYPE
;
static
const
unsigned
int
ORBIT
=
ORB
;
/**
* Default constructor
...
...
@@ -110,7 +119,7 @@ public:
* Copy constructor
* @param ta the table attribute
*/
AttributeHandler
(
const
AttributeHandler
<
T
,
ORB
IT
,
MAP
>&
ta
)
;
AttributeHandler
(
const
AttributeHandler
<
T
,
ORB
,
MAP
>&
ta
)
;
/**
* Transmute Constructor
...
...
@@ -124,14 +133,14 @@ public:
* affectation operator
* @param ta the table attribute to affect to this
*/
AttributeHandler
<
T
,
ORB
IT
,
MAP
>&
operator
=
(
const
AttributeHandler
<
T
,
ORB
IT
,
MAP
>&
ta
)
;
AttributeHandler
<
T
,
ORB
,
MAP
>&
operator
=
(
const
AttributeHandler
<
T
,
ORB
,
MAP
>&
ta
)
;
/**
* transmuted affectation operator
* @param ta the table attribute to affect to this
*/
template
<
unsigned
int
ORBIT2
>
AttributeHandler
<
T
,
ORB
IT
,
MAP
>&
operator
=
(
const
AttributeHandler
<
T
,
ORBIT2
,
MAP
>&
ta
)
;
AttributeHandler
<
T
,
ORB
,
MAP
>&
operator
=
(
const
AttributeHandler
<
T
,
ORBIT2
,
MAP
>&
ta
)
;
/**
* Destructor (empty & virtual)
...
...
@@ -190,12 +199,12 @@ public:
/**
* [] operator with cell parameter
*/
T
&
operator
[](
Cell
<
ORB
IT
>
c
)
;
T
&
operator
[](
Cell
<
ORB
>
c
)
;
/**
* const [] operator with cell parameter
*/
const
T
&
operator
[](
Cell
<
ORB
IT
>
c
)
const
;
const
T
&
operator
[](
Cell
<
ORB
>
c
)
const
;
/**
* at operator (same as [] but with index parameter)
...
...
@@ -241,75 +250,39 @@ public:
void
next
(
unsigned
int
&
iter
)
const
;
}
;
/**
* shortcut
class
for Dart Attribute (Handler)
*
c++11
shortcut for Dart Attribute (Handler)
*/
template
<
typename
T
,
typename
MAP
>
class
DartAttribute
:
public
AttributeHandler
<
T
,
DART
,
MAP
>
{
public:
DartAttribute
()
:
AttributeHandler
<
T
,
DART
,
MAP
>
()
{}
DartAttribute
(
const
AttributeHandler
<
T
,
DART
,
MAP
>&
ah
)
:
AttributeHandler
<
T
,
DART
,
MAP
>
(
ah
)
{}
DartAttribute
(
MAP
*
m
,
AttributeMultiVector
<
T
>*
amv
)
:
AttributeHandler
<
T
,
DART
,
MAP
>
(
m
,
amv
)
{}
DartAttribute
<
T
,
MAP
>&
operator
=
(
const
AttributeHandler
<
T
,
DART
,
MAP
>&
ah
)
{
this
->
AttributeHandler
<
T
,
DART
,
MAP
>::
operator
=
(
ah
);
return
*
this
;
}
};
using
DartAttribute
=
AttributeHandler
<
T
,
DART
,
MAP
>
;
/**
* shortcut
class
for Vertex Attribute (Handler)
*
c++11
shortcut for Vertex Attribute (Handler)
*/
template
<
typename
T
,
typename
MAP
>
class
VertexAttribute
:
public
AttributeHandler
<
T
,
VERTEX
,
MAP
>
{
public:
VertexAttribute
()
:
AttributeHandler
<
T
,
VERTEX
,
MAP
>
()
{}
VertexAttribute
(
const
AttributeHandler
<
T
,
VERTEX
,
MAP
>&
ah
)
:
AttributeHandler
<
T
,
VERTEX
,
MAP
>
(
ah
)
{}
VertexAttribute
(
MAP
*
m
,
AttributeMultiVector
<
T
>*
amv
)
:
AttributeHandler
<
T
,
VERTEX
,
MAP
>
(
m
,
amv
)
{}
VertexAttribute
<
T
,
MAP
>&
operator
=
(
const
AttributeHandler
<
T
,
VERTEX
,
MAP
>&
ah
)
{
this
->
AttributeHandler
<
T
,
VERTEX
,
MAP
>::
operator
=
(
ah
);
return
*
this
;
}
VertexAttribute
<
T
,
MAP
>&
operator
=
(
const
AttributeHandler
<
T
,
EDGE
,
MAP
>&
ah
)
{
this
->
AttributeHandler
<
T
,
VERTEX
,
MAP
>::
operator
=
(
ah
);
return
*
this
;
}
VertexAttribute
<
T
,
MAP
>&
operator
=
(
const
AttributeHandler
<
T
,
FACE
,
MAP
>&
ah
)
{
this
->
AttributeHandler
<
T
,
VERTEX
,
MAP
>::
operator
=
(
ah
);
return
*
this
;
}
VertexAttribute
<
T
,
MAP
>&
operator
=
(
const
AttributeHandler
<
T
,
VOLUME
,
MAP
>&
ah
)
{
this
->
AttributeHandler
<
T
,
VERTEX
,
MAP
>::
operator
=
(
ah
);
return
*
this
;
}
};
using
VertexAttribute
=
AttributeHandler
<
T
,
VERTEX
,
MAP
>
;
/**
* shortcut
class
for Edge Attribute (Handler)
*
c++11
shortcut for Edge Attribute (Handler)
*/
template
<
typename
T
,
typename
MAP
>
class
EdgeAttribute
:
public
AttributeHandler
<
T
,
EDGE
,
MAP
>
{
public:
EdgeAttribute
()
:
AttributeHandler
<
T
,
EDGE
,
MAP
>
()
{}
EdgeAttribute
(
const
AttributeHandler
<
T
,
EDGE
,
MAP
>&
ah
)
:
AttributeHandler
<
T
,
EDGE
,
MAP
>
(
ah
)
{}
EdgeAttribute
(
MAP
*
m
,
AttributeMultiVector
<
T
>*
amv
)
:
AttributeHandler
<
T
,
EDGE
,
MAP
>
(
m
,
amv
)
{}
EdgeAttribute
<
T
,
MAP
>&
operator
=
(
const
AttributeHandler
<
T
,
EDGE
,
MAP
>&
ah
)
{
this
->
AttributeHandler
<
T
,
EDGE
,
MAP
>::
operator
=
(
ah
);
return
*
this
;
}
};
using
EdgeAttribute
=
AttributeHandler
<
T
,
EDGE
,
MAP
>
;
/**
* shortcut
class
for Face Attribute (Handler)
*
c++11
shortcut for Face Attribute (Handler)
*/
template
<
typename
T
,
typename
MAP
>
class
FaceAttribute
:
public
AttributeHandler
<
T
,
FACE
,
MAP
>
{
public:
FaceAttribute
()
:
AttributeHandler
<
T
,
FACE
,
MAP
>
()
{}
FaceAttribute
(
const
AttributeHandler
<
T
,
FACE
,
MAP
>&
ah
)
:
AttributeHandler
<
T
,
FACE
,
MAP
>
(
ah
)
{}
FaceAttribute
(
MAP
*
m
,
AttributeMultiVector
<
T
>*
amv
)
:
AttributeHandler
<
T
,
FACE
,
MAP
>
(
m
,
amv
)
{}
FaceAttribute
<
T
,
MAP
>&
operator
=
(
const
AttributeHandler
<
T
,
FACE
,
MAP
>&
ah
)
{
this
->
AttributeHandler
<
T
,
FACE
,
MAP
>::
operator
=
(
ah
);
return
*
this
;
}
FaceAttribute
<
T
,
MAP
>&
operator
=
(
const
AttributeHandler
<
T
,
VERTEX
,
MAP
>&
ah
)
{
this
->
AttributeHandler
<
T
,
FACE
,
MAP
>::
operator
=
(
ah
);
return
*
this
;
}
};
using
FaceAttribute
=
AttributeHandler
<
T
,
FACE
,
MAP
>
;
/**
* shortcut
class
for Volume Attribute (Handler)
*
c++11
shortcut for Volume Attribute (Handler)
*/
template
<
typename
T
,
typename
MAP
>
class
VolumeAttribute
:
public
AttributeHandler
<
T
,
VOLUME
,
MAP
>
{
public:
VolumeAttribute
()
:
AttributeHandler
<
T
,
VOLUME
,
MAP
>
()
{}
VolumeAttribute
(
const
AttributeHandler
<
T
,
VOLUME
,
MAP
>&
ah
)
:
AttributeHandler
<
T
,
VOLUME
,
MAP
>
(
ah
)
{}
VolumeAttribute
(
MAP
*
m
,
AttributeMultiVector
<
T
>*
amv
)
:
AttributeHandler
<
T
,
VOLUME
,
MAP
>
(
m
,
amv
)
{}
VolumeAttribute
<
T
,
MAP
>&
operator
=
(
const
AttributeHandler
<
T
,
VOLUME
,
MAP
>&
ah
)
{
this
->
AttributeHandler
<
T
,
VOLUME
,
MAP
>::
operator
=
(
ah
);
return
*
this
;
}
VolumeAttribute
<
T
,
MAP
>&
operator
=
(
const
AttributeHandler
<
T
,
VERTEX
,
MAP
>&
ah
)
{
this
->
AttributeHandler
<
T
,
VOLUME
,
MAP
>::
operator
=
(
ah
);
return
*
this
;
}
};
using
VolumeAttribute
=
AttributeHandler
<
T
,
VOLUME
,
MAP
>
;
// turn_to<b>(A*</b> obj) changes class of the object
...
...
include/Topology/generic/attributeHandler.hpp
View file @
4f71806d
...
...
@@ -29,15 +29,15 @@
namespace
CGoGN
{
template
<
typename
T
,
unsigned
int
ORB
IT
,
typename
MAP
>
inline
void
AttributeHandler
<
T
,
ORB
IT
,
MAP
>::
registerInMap
()
template
<
typename
T
,
unsigned
int
ORB
,
typename
MAP
>
inline
void
AttributeHandler
<
T
,
ORB
,
MAP
>::
registerInMap
()
{
std
::
lock_guard
<
std
::
mutex
>
lockAH
(
m_map
->
attributeHandlersMutex
);
m_map
->
attributeHandlers
.
insert
(
std
::
pair
<
AttributeMultiVectorGen
*
,
AttributeHandlerGen
*>
(
m_attrib
,
this
))
;
}
template
<
typename
T
,
unsigned
int
ORB
IT
,
typename
MAP
>
inline
void
AttributeHandler
<
T
,
ORB
IT
,
MAP
>::
unregisterFromMap
()
template
<
typename
T
,
unsigned
int
ORB
,
typename
MAP
>
inline
void
AttributeHandler
<
T
,
ORB
,
MAP
>::
unregisterFromMap
()
{
typedef
std
::
multimap
<
AttributeMultiVectorGen
*
,
AttributeHandlerGen
*>::
iterator
IT
;
...
...
@@ -56,22 +56,22 @@ inline void AttributeHandler<T, ORBIT, MAP>::unregisterFromMap()
// =================================================================
template
<
typename
T
,
unsigned
int
ORB
IT
,
typename
MAP
>
AttributeHandler
<
T
,
ORB
IT
,
MAP
>::
AttributeHandler
()
:
template
<
typename
T
,
unsigned
int
ORB
,
typename
MAP
>
AttributeHandler
<
T
,
ORB
,
MAP
>::
AttributeHandler
()
:
AttributeHandlerGen
(
false
),
m_map
(
NULL
),
m_attrib
(
NULL
)
{}
template
<
typename
T
,
unsigned
int
ORB
IT
,
typename
MAP
>
AttributeHandler
<
T
,
ORB
IT
,
MAP
>::
AttributeHandler
(
MAP
*
m
,
AttributeMultiVector
<
T
>*
amv
)
:
template
<
typename
T
,
unsigned
int
ORB
,
typename
MAP
>
AttributeHandler
<
T
,
ORB
,
MAP
>::
AttributeHandler
(
MAP
*
m
,
AttributeMultiVector
<
T
>*
amv
)
:
AttributeHandlerGen
(
false
),
m_map
(
m
),
m_attrib
(
amv
)
{
if
(
m
!=
NULL
&&
amv
!=
NULL
&&
amv
->
getIndex
()
!=
AttributeContainer
::
UNKNOWN
)
{
assert
(
ORB
IT
==
amv
->
getOrbit
()
||
!
"AttributeHandler: orbit incompatibility"
)
;
assert
(
ORB
==
amv
->
getOrbit
()
||
!
"AttributeHandler: orbit incompatibility"
)
;
valid
=
true
;
registerInMap
()
;
}
...
...
@@ -79,8 +79,8 @@ AttributeHandler<T, ORBIT, MAP>::AttributeHandler(MAP* m, AttributeMultiVector<T
valid
=
false
;
}
template
<
typename
T
,
unsigned
int
ORB
IT
,
typename
MAP
>
AttributeHandler
<
T
,
ORB
IT
,
MAP
>::
AttributeHandler
(
const
AttributeHandler
<
T
,
ORB
IT
,
MAP
>&
ta
)
:
template
<
typename
T
,
unsigned
int
ORB
,
typename
MAP
>
AttributeHandler
<
T
,
ORB
,
MAP
>::
AttributeHandler
(
const
AttributeHandler
<
T
,
ORB
,
MAP
>&
ta
)
:
AttributeHandlerGen
(
ta
.
valid
),
m_map
(
ta
.
m_map
),
m_attrib
(
ta
.
m_attrib
)
...
...
@@ -89,9 +89,9 @@ AttributeHandler<T, ORBIT, MAP>::AttributeHandler(const AttributeHandler<T, ORBI
registerInMap
()
;
}
template
<
typename
T
,
unsigned
int
ORB
IT
,
typename
MAP
>
template
<
typename
T
,
unsigned
int
ORB
,
typename
MAP
>
template
<
unsigned
int
ORBIT2
>
AttributeHandler
<
T
,
ORB
IT
,
MAP
>::
AttributeHandler
(
const
AttributeHandler
<
T
,
ORBIT2
,
MAP
>&
h
)
:
AttributeHandler
<
T
,
ORB
,
MAP
>::
AttributeHandler
(
const
AttributeHandler
<
T
,
ORBIT2
,
MAP
>&
h
)
:
AttributeHandlerGen
(
h
.
valid
),
m_map
(
h
.
m_map
),
m_attrib
(
h
.
m_attrib
)
...
...
@@ -105,8 +105,8 @@ AttributeHandler<T, ORBIT, MAP>::AttributeHandler(const AttributeHandler<T, ORBI
valid
=
false
;
}
template
<
typename
T
,
unsigned
int
ORB
IT
,
typename
MAP
>
inline
AttributeHandler
<
T
,
ORB
IT
,
MAP
>&
AttributeHandler
<
T
,
ORB
IT
,
MAP
>::
operator
=
(
const
AttributeHandler
<
T
,
ORB
IT
,
MAP
>&
ta
)
template
<
typename
T
,
unsigned
int
ORB
,
typename
MAP
>
inline
AttributeHandler
<
T
,
ORB
,
MAP
>&
AttributeHandler
<
T
,
ORB
,
MAP
>::
operator
=
(
const
AttributeHandler
<
T
,
ORB
,
MAP
>&
ta
)
{
if
(
valid
)
unregisterFromMap
()
;
...
...
@@ -118,9 +118,9 @@ inline AttributeHandler<T, ORBIT, MAP>& AttributeHandler<T, ORBIT, MAP>::operato
return
*
this
;
}
template
<
typename
T
,
unsigned
int
ORB
IT
,
typename
MAP
>
template
<
typename
T
,
unsigned
int
ORB
,
typename
MAP
>
template
<
unsigned
int
ORBIT2
>
inline
AttributeHandler
<
T
,
ORB
IT
,
MAP
>&
AttributeHandler
<
T
,
ORB
IT
,
MAP
>::
operator
=
(
const
AttributeHandler
<
T
,
ORBIT2
,
MAP
>&
ta
)
inline
AttributeHandler
<
T
,
ORB
,
MAP
>&
AttributeHandler
<
T
,
ORB
,
MAP
>::
operator
=
(
const
AttributeHandler
<
T
,
ORBIT2
,
MAP
>&
ta
)
{
if
(
valid
)
unregisterFromMap
()
;
...
...
@@ -132,64 +132,64 @@ inline AttributeHandler<T, ORBIT, MAP>& AttributeHandler<T, ORBIT, MAP>::operato
return
*
this
;
}
template
<
typename
T
,
unsigned
int
ORB
IT
,
typename
MAP
>
AttributeHandler
<
T
,
ORB
IT
,
MAP
>::~
AttributeHandler
()
template
<
typename
T
,
unsigned
int
ORB
,
typename
MAP
>
AttributeHandler
<
T
,
ORB
,
MAP
>::~
AttributeHandler
()
{
if
(
valid
)
unregisterFromMap
()
;
}
template
<
typename
T
,
unsigned
int
ORB
IT
,
typename
MAP
>
inline
AttributeMultiVector
<
T
>*
AttributeHandler
<
T
,
ORB
IT
,
MAP
>::
getDataVector
()
const
template
<
typename
T
,
unsigned
int
ORB
,
typename
MAP
>
inline
AttributeMultiVector
<
T
>*
AttributeHandler
<
T
,
ORB
,
MAP
>::
getDataVector
()
const
{
return
m_attrib
;
}
template
<
typename
T
,
unsigned
int
ORB
IT
,
typename
MAP
>
inline
AttributeMultiVectorGen
*
AttributeHandler
<
T
,
ORB
IT
,
MAP
>::
getDataVectorGen
()
const
template
<
typename
T
,
unsigned
int
ORB
,
typename
MAP
>
inline
AttributeMultiVectorGen
*
AttributeHandler
<
T
,
ORB
,
MAP
>::
getDataVectorGen
()
const
{
return
m_attrib
;
}
template
<
typename
T
,
unsigned
int
ORB
IT
,
typename
MAP
>
inline
int
AttributeHandler
<
T
,
ORB
IT
,
MAP
>::
getSizeOfType
()
const
template
<
typename
T
,
unsigned
int
ORB
,
typename
MAP
>
inline
int
AttributeHandler
<
T
,
ORB
,
MAP
>::
getSizeOfType
()
const
{
return
sizeof
(
T
)
;
}
template
<
typename
T
,
unsigned
int
ORB
IT
,
typename
MAP
>
inline
unsigned
int
AttributeHandler
<
T
,
ORB
IT
,
MAP
>::
getOrbit
()
const
template
<
typename
T
,
unsigned
int
ORB
,
typename
MAP
>
inline
unsigned
int
AttributeHandler
<
T
,
ORB
,
MAP
>::
getOrbit
()
const
{
return
ORB
IT
;
return
ORB
;
}
template
<
typename
T
,
unsigned
int
ORB
IT
,
typename
MAP
>
inline
unsigned
int
AttributeHandler
<
T
,
ORB
IT
,
MAP
>::
getIndex
()
const
template
<
typename
T
,
unsigned
int
ORB
,
typename
MAP
>
inline
unsigned
int
AttributeHandler
<
T
,
ORB
,
MAP
>::
getIndex
()
const
{
return
m_attrib
->
getIndex
()
;
}
template
<
typename
T
,
unsigned
int
ORB
IT
,
typename
MAP
>
inline
const
std
::
string
&
AttributeHandler
<
T
,
ORB
IT
,
MAP
>::
name
()
const
template
<
typename
T
,
unsigned
int
ORB
,
typename
MAP
>
inline
const
std
::
string
&
AttributeHandler
<
T
,
ORB
,
MAP
>::
name
()
const
{
return
m_attrib
->
getName
()
;
}
template
<
typename
T
,
unsigned
int
ORB
IT
,
typename
MAP
>
inline
const
std
::
string
&
AttributeHandler
<
T
,
ORB
IT
,
MAP
>::
typeName
()
const
template
<
typename
T
,
unsigned
int
ORB
,
typename
MAP
>
inline
const
std
::
string
&
AttributeHandler
<
T
,
ORB
,
MAP
>::
typeName
()
const
{
return
m_attrib
->
getTypeName
();
}
template
<
typename
T
,
unsigned
int
ORB
IT
,
typename
MAP
>
inline
unsigned
int
AttributeHandler
<
T
,
ORB
IT
,
MAP
>::
nbElements
()
const
template
<
typename
T
,
unsigned
int
ORB
,
typename
MAP
>
inline
unsigned
int
AttributeHandler
<
T
,
ORB
,
MAP
>::
nbElements
()
const
{
return
m_map
->
template
getAttributeContainer
<
ORB
IT
>().
size
()
;
return
m_map
->
template
getAttributeContainer
<
ORB
>().
size
()
;
}
template
<
typename
T
,
unsigned
int
ORB
IT
,
typename
MAP
>
inline
T
&
AttributeHandler
<
T
,
ORB
IT
,
MAP
>::
operator
[](
Cell
<
ORB
IT
>
c
)
template
<
typename
T
,
unsigned
int
ORB
,
typename
MAP
>
inline
T
&
AttributeHandler
<
T
,
ORB
,
MAP
>::
operator
[](
Cell
<
ORB
>
c
)
{
assert
(
valid
||
!
"Invalid AttributeHandler"
)
;
unsigned
int
a
=
m_map
->
getEmbedding
(
c
)
;
...
...
@@ -200,71 +200,71 @@ inline T& AttributeHandler<T, ORBIT, MAP>::operator[](Cell<ORBIT> c)
return
m_attrib
->
operator
[](
a
)
;
}
template
<
typename
T
,
unsigned
int
ORB
IT
,
typename
MAP
>
inline
const
T
&
AttributeHandler
<
T
,
ORB
IT
,
MAP
>::
operator
[](
Cell
<
ORB
IT
>
c
)
const
template
<
typename
T
,
unsigned
int
ORB
,
typename
MAP
>
inline
const
T
&
AttributeHandler
<
T
,
ORB
,
MAP
>::
operator
[](
Cell
<
ORB
>
c
)
const
{
assert
(
valid
||
!
"Invalid AttributeHandler"
)
;
unsigned
int
a
=
m_map
->
getEmbedding
(
c
)
;
return
m_attrib
->
operator
[](
a
)
;
}
template
<
typename
T
,
unsigned
int
ORB
IT
,
typename
MAP
>
inline
T
&
AttributeHandler
<
T
,
ORB
IT
,
MAP
>::
operator
[](
unsigned
int
a
)
template
<
typename
T
,
unsigned
int
ORB
,
typename
MAP
>
inline
T
&
AttributeHandler
<
T
,
ORB
,
MAP
>::
operator
[](
unsigned
int
a
)
{
assert
(
valid
||
!
"Invalid AttributeHandler"
)
;
return
m_attrib
->
operator
[](
a
)
;
}
template
<
typename
T
,
unsigned
int
ORB
IT
,
typename
MAP
>
inline
const
T
&
AttributeHandler
<
T
,
ORB
IT
,
MAP
>::
operator
[](
unsigned
int
a
)
const
template
<
typename
T
,
unsigned
int
ORB
,
typename
MAP
>
inline
const
T
&
AttributeHandler
<
T
,
ORB
,
MAP
>::
operator
[](
unsigned
int
a
)
const
{
assert
(
valid
||
!
"Invalid AttributeHandler"
)
;
return
m_attrib
->
operator
[](
a
)
;
}
template
<
typename
T
,
unsigned
int
ORB
IT
,
typename
MAP
>
inline
unsigned
int
AttributeHandler
<
T
,
ORB
IT
,
MAP
>::
insert
(
const
T
&
elt
)
template
<
typename
T
,
unsigned
int
ORB
,
typename
MAP
>
inline
unsigned
int
AttributeHandler
<
T
,
ORB
,
MAP
>::
insert
(
const
T
&
elt
)
{
assert
(
valid
||
!
"Invalid AttributeHandler"
)
;
unsigned
int
idx
=
m_map
->
template
getAttributeContainer
<
ORB
IT
>().
insertLine
()
;
unsigned
int
idx
=
m_map
->
template
getAttributeContainer
<
ORB
>().
insertLine
()
;
m_attrib
->
operator
[](
idx
)
=
elt
;
return
idx
;
}
template
<
typename
T
,
unsigned
int
ORB
IT
,
typename
MAP
>
inline
unsigned
int
AttributeHandler
<
T
,
ORB
IT
,
MAP
>::
newElt
()
template
<
typename
T
,
unsigned
int
ORB
,
typename
MAP
>
inline
unsigned
int
AttributeHandler
<
T
,
ORB
,
MAP
>::
newElt
()
{
assert
(
valid
||
!
"Invalid AttributeHandler"
)
;
unsigned
int
idx
=
m_map
->
template
getAttributeContainer
<
ORB
IT
>().
insertLine
()
;
unsigned
int
idx
=
m_map
->
template
getAttributeContainer
<
ORB
>().
insertLine
()
;
return
idx
;
}
template
<
typename
T
,
unsigned
int
ORB
IT
,
typename
MAP
>
inline
void
AttributeHandler
<
T
,
ORB
IT
,
MAP
>::
setAllValues
(
const
T
&
v
)
template
<
typename
T
,
unsigned
int
ORB
,
typename
MAP
>
inline
void
AttributeHandler
<
T
,
ORB
,
MAP
>::
setAllValues
(
const
T
&
v
)
{
for
(
unsigned
int
i
=
begin
();
i
!=
end
();
next
(
i
))
m_attrib
->
operator
[](
i
)
=
v
;
}
template
<
typename
T
,
unsigned
int
ORB
IT
,
typename
MAP
>
inline
unsigned
int
AttributeHandler
<
T
,
ORB
IT
,
MAP
>::
begin
()
const
template
<
typename
T
,
unsigned
int
ORB
,
typename
MAP
>
inline
unsigned
int
AttributeHandler
<
T
,
ORB
,
MAP
>::
begin
()
const
{
assert
(
valid
||
!
"Invalid AttributeHandler"
)
;
return
m_map
->
template
getAttributeContainer
<
ORB
IT
>().
begin
()
;
return
m_map
->
template
getAttributeContainer
<
ORB
>().
begin
()
;
}
template
<
typename
T
,
unsigned
int
ORB
IT
,
typename
MAP
>
inline
unsigned
int
AttributeHandler
<
T
,
ORB
IT
,
MAP
>::
end
()
const
template
<
typename
T
,
unsigned
int
ORB
,
typename
MAP
>
inline
unsigned
int
AttributeHandler
<
T
,
ORB
,
MAP
>::
end
()
const
{
assert
(
valid
||
!
"Invalid AttributeHandler"
)
;
return
m_map
->
template
getAttributeContainer
<
ORB
IT
>().
end
()
;
return
m_map
->
template
getAttributeContainer
<
ORB
>().
end
()
;
}
template
<
typename
T
,
unsigned
int
ORB
IT
,
typename
MAP
>
inline
void
AttributeHandler
<
T
,
ORB
IT
,
MAP
>::
next
(
unsigned
int
&
iter
)
const
template
<
typename
T
,
unsigned
int
ORB
,
typename
MAP
>
inline
void
AttributeHandler
<
T
,
ORB
,
MAP
>::
next
(
unsigned
int
&
iter
)
const
{
assert
(
valid
||
!
"Invalid AttributeHandler"
)
;
m_map
->
template
getAttributeContainer
<
ORB
IT
>().
next
(
iter
)
;
m_map
->
template
getAttributeContainer
<
ORB
>().
next
(
iter
)
;
}
...
...
include/Topology/generic/multi3Attribs.h
View file @
4f71806d
...
...
@@ -86,102 +86,39 @@ struct RefCompo3Type
template
<
typename
T1
,
typename
T2
,
typename
T3
>
class
Vertex3Attributes
{
VertexAttribute
<
T1
>&
m_h1
;
VertexAttribute
<
T2
>&
m_h2
;
VertexAttribute
<
T3
>&
m_h3
;
public:
typedef
Compo3Type
<
T1
,
T2
,
T3
>
DATA_TYPE
;
typedef
RefCompo3Type
<
T1
,
T2
,
T3
>
REF_DATA_TYPE
;
Vertex3Attributes
(
VertexAttribute
<
T1
>&
h1
,
VertexAttribute
<
T2
>&
h2
,
VertexAttribute
<
T3
>&
h3
)
:
m_h1
(
h1
),
m_h2
(
h2
),
m_h3
(
h3
)
{}
RefCompo3Type
<
T1
,
T2
,
T3
>
operator
[](
unsigned
int
a
)
{
return
RefCompo3Type
<
T1
,
T2
,
T3
>
(
m_h1
[
a
],
m_h2
[
a
],
m_h3
[
a
]);
}
RefCompo3Type
<
T1
,
T2
,
T3
>
operator
[](
Vertex
d
)
{
return
RefCompo3Type
<
T1
,
T2
,
T3
>
(
m_h1
[
d
],
m_h2
[
d
],
m_h3
[
d
]);
}
const
RefCompo3Type
<
T1
,
T2
,
T3
>
operator
[](
unsigned
int
a
)
const
{
return
RefCompo3Type
<
T1
,
T2
,
T3
>
(
m_h1
[
a
],
m_h2
[
a
],
m_h3
[
a
]);
}
const
RefCompo3Type
<
T1
,
T2
,
T3
>
operator
[](
Vertex
d
)
const
{
return
RefCompo3Type
<
T1
,
T2
,
T3
>
(
m_h1
[
d
],
m_h2
[
d
],
m_h3
[
d
]);
}
static
unsigned
int
getOrbit
()
{
return
VERTEX
;
}
};
template
<
typename
T1
,
typename
T2
,
typename
T3
>
class
Edge3Attributes
template
<
typename
T1
,
typename
T2
,
typename
T3
,
unsigned
int
ORB
,
typename
MAP
>
class
Cell3Attributes
:
public
AttributeHandlerGen
{
EdgeAttribute
<
T1
>&
m_h1
;
EdgeAttribute
<
T2
>&
m_h2
;
EdgeAttribute
<
T3
>&
m_h3
;
public:
typedef
Compo3Type
<
T1
,
T2
,
T3
>
DATA_TYPE
;
typedef
RefCompo3Type
<
T1
,
T2
,
T3
>
REF_DATA_TYPE
;
Edge3Attributes
(
EdgeAttribute
<
T1
>&
h1
,
EdgeAttribute
<
T2
>&
h2
,
EdgeAttribute
<
T3
>&
h3
)
:
m_h1
(
h1
),
m_h2
(
h2
),
m_h3
(
h3
)
{}
RefCompo3Type
<
T1
,
T2
,
T3
>
operator
[](
unsigned
int
a
)
{
return
RefCompo3Type
<
T1
,
T2
,
T3
>
(
m_h1
[
a
],
m_h2
[
a
],
m_h3
[
a
]);
}
RefCompo3Type
<
T1
,
T2
,
T3
>
operator
[](
Edge
d
)
{
return
RefCompo3Type
<
T1
,
T2
,
T3
>
(
m_h1
[
d
],
m_h2
[
d
],
m_h3
[
d
]);
}
const
RefCompo3Type
<
T1
,
T2
,
T3
>
operator
[](
unsigned
int
a
)
const
{
return
RefCompo3Type
<
T1
,
T2
,
T3
>
(
m_h1
[
a
],
m_h2
[
a
],
m_h3
[
a
]);
}
const
RefCompo3Type
<
T1
,
T2
,
T3
>
operator
[](
Edge
d
)
const
{
return
RefCompo3Type
<
T1
,
T2
,
T3
>
(
m_h1
[
d
],
m_h2
[
d
],
m_h3
[
d
]);
}
static
unsigned
int
getOrbit
()
{
return
EDGE
;
}
};
template
<
typename
T1
,
typename
T2
,
typename
T3
>
class
Face3Attributes
{
FaceAttribute
<
T1
>&
m_h1
;
FaceAttribute
<
T2
>&
m_h2
;
FaceAttribute
<
T3
>&
m_h3
;
AttributeHandler
<
T1
,
ORB
,
MAP
>&
m_h1
;
AttributeHandler
<
T2
,
ORB
,
MAP
>&
m_h2
;
AttributeHandler
<
T3
,
ORB
,
MAP
>&
m_h3
;
public:
typedef
Compo3Type
<
T1
,
T2
,
T3
>
DATA_TYPE
;
typedef
RefCompo3Type
<
T1
,
T2
,
T3
>
REF_DATA_TYPE
;
Face3Attributes
(
FaceAttribute
<
T1
>&
h1
,
FaceAttribute
<
T2
>&
h2
,
FaceAttribute
<
T3
>&
h3
)
:
Cell3Attributes
(
AttributeHandler
<
T1
,
ORB
,
MAP
>&
h1
,
AttributeHandler
<
T2
,
ORB
,
MAP
>&
h2
,
AttributeHandler
<
T3
,
ORB
,
MAP
>&
h3
)
:
AttributeHandlerGen
(
true
),
m_h1
(
h1
),
m_h2
(
h2
),
m_h3
(
h3
)
{}
static
const
unsigned
int
ORBIT
=
ORB
;
virtual
int
getSizeOfType
()
const
{
return
m_h1
.
getSizeOfType
()
+
m_h2
.
getSizeOfType
()
+
m_h3
.
getSizeOfType
();
}
virtual
unsigned
int
getOrbit
()
const
{
return
ORB
;}
virtual
const
std
::
string
&
name
()
const
{
return
m_h1
.
name
();
}
virtual
const
std
::
string
&
typeName
()
const
{
return
m_h1
.
typeName
();}
virtual
AttributeMultiVectorGen
*
getDataVectorGen
()
const
{
return
NULL
;}
RefCompo3Type
<
T1
,
T2
,
T3
>
operator
[](
unsigned
int
a
)
{
return
RefCompo3Type
<
T1
,
T2
,
T3
>
(
m_h1
[
a
],
m_h2
[
a
],
m_h3
[
a
]);
}
RefCompo3Type
<
T1
,
T2
,
T3
>
operator
[](
Face
d
)
RefCompo3Type
<
T1
,
T2
,
T3
>
operator
[](
Cell
<
ORB
>
c
)
{
return
RefCompo3Type
<
T1
,
T2
,
T3
>
(
m_h1
[
d
],
m_h2
[
d
],
m_h3
[
d
]);
return
RefCompo3Type
<
T1
,
T2
,
T3
>
(
m_h1
[
c
],
m_h2
[
c
],
m_h3
[
c
]);