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
KennethVanhoey
CGoGN
Commits
3619c00b
Commit
3619c00b
authored
Feb 22, 2011
by
Pierre Kraemer
Browse files
correction de bugs pour les Containers
parent
443b9e63
Changes
9
Hide whitespace changes
Inline
Side-by-side
include/Algo/ImplicitHierarchicalMesh/ihm.h
View file @
3619c00b
...
...
@@ -211,7 +211,7 @@ public:
AttributeHandler_IHM
()
:
AttributeHandler
<
T
>
()
{}
AttributeHandler_IHM
(
GenericMap
*
m
,
unsigned
int
orbit
,
unsigned
int
index
)
:
AttributeHandler
<
T
>
(
m
,
orbit
,
index
)
AttributeHandler_IHM
(
GenericMap
*
m
,
AttributeMultiVector
<
T
>*
amv
)
:
AttributeHandler
<
T
>
(
m
,
amv
)
{}
AttributeMultiVector
<
T
>*
getDataVector
()
const
...
...
include/Algo/ImplicitHierarchicalMesh/ihm.hpp
View file @
3619c00b
...
...
@@ -47,21 +47,20 @@ AttributeHandler_IHM<T> ImplicitHierarchicalMap::addAttribute(unsigned int orbit
if
(
addNextLevelCell
)
{
AttributeContainer
&
cellCont
=
m_attribs
[
orbit
]
;
unsigned
int
index
=
cellCont
.
addAttribute
<
unsigned
int
>
(
"nextLevelCell"
)
;
AttributeMultiVector
<
unsigned
int
>&
amv
=
cellCont
.
getDataVector
<
unsigned
int
>
(
index
)
;
m_nextLevelCell
[
orbit
]
=
&
amv
;
AttributeMultiVector
<
unsigned
int
>*
amv
=
cellCont
.
addAttribute
<
unsigned
int
>
(
"nextLevelCell"
)
;
m_nextLevelCell
[
orbit
]
=
amv
;
for
(
unsigned
int
i
=
cellCont
.
begin
();
i
<
cellCont
.
end
();
cellCont
.
next
(
i
))
amv
[
i
]
=
EMBNULL
;
amv
->
operator
[](
i
)
=
EMBNULL
;
}
return
AttributeHandler_IHM
<
T
>
(
this
,
h
.
get
Orbit
(),
h
.
getIndex
())
;
return
AttributeHandler_IHM
<
T
>
(
this
,
h
.
get
DataVector
())
;
}
template
<
typename
T
>
AttributeHandler_IHM
<
T
>
ImplicitHierarchicalMap
::
getAttribute
(
unsigned
int
orbit
,
const
std
::
string
&
nameAttr
)
{
AttributeHandler
<
T
>
h
=
Map2
::
getAttribute
<
T
>
(
orbit
,
nameAttr
)
;
return
AttributeHandler_IHM
<
T
>
(
this
,
h
.
get
Orbit
(),
h
.
getIndex
())
;
return
AttributeHandler_IHM
<
T
>
(
this
,
h
.
get
DataVector
())
;
}
/***************************************************
...
...
include/Container/attributeContainer.h
View file @
3619c00b
...
...
@@ -347,18 +347,18 @@ public:
* @param attrIndex index of the attribute
*/
template
<
typename
T
>
AttributeMultiVector
<
T
>
&
getDataVector
(
unsigned
int
attrIndex
);
AttributeMultiVector
<
T
>
*
getDataVector
(
unsigned
int
attrIndex
);
AttributeMultiVectorGen
&
getVirtualDataVector
(
unsigned
int
attrIndex
);
AttributeMultiVectorGen
*
getVirtualDataVector
(
unsigned
int
attrIndex
);
/**
* get an AttributeMultiVector
* @param attribName name of the attribute
*/
template
<
typename
T
>
AttributeMultiVector
<
T
>
&
getDataVector
(
const
std
::
string
&
attribName
);
AttributeMultiVector
<
T
>
*
getDataVector
(
const
std
::
string
&
attribName
);
AttributeMultiVectorGen
&
getVirtualDataVector
(
const
std
::
string
&
attribName
);
AttributeMultiVectorGen
*
getVirtualDataVector
(
const
std
::
string
&
attribName
);
/**
* get a given element of a given attribute
...
...
include/Container/attributeContainer.hpp
View file @
3619c00b
...
...
@@ -262,38 +262,38 @@ inline bool AttributeContainer::swapAttributes(unsigned int index1, unsigned int
**************************************/
template
<
typename
T
>
AttributeMultiVector
<
T
>
&
AttributeContainer
::
getDataVector
(
unsigned
int
attrIndex
)
AttributeMultiVector
<
T
>
*
AttributeContainer
::
getDataVector
(
unsigned
int
attrIndex
)
{
assert
(
attrIndex
<
m_tableAttribs
.
size
()
||
!
"getDataVector: attribute index out of bounds"
);
assert
(
m_tableAttribs
[
attrIndex
]
!=
NULL
||
!
"getDataVector: attribute does not exist"
);
AttributeMultiVector
<
T
>*
atm
=
dynamic_cast
<
AttributeMultiVector
<
T
>*>
(
m_tableAttribs
[
attrIndex
]);
assert
((
atm
!=
NULL
)
||
!
"getDataVector: wrong type"
);
return
*
atm
;
return
atm
;
}
inline
AttributeMultiVectorGen
&
AttributeContainer
::
getVirtualDataVector
(
unsigned
int
attrIndex
)
inline
AttributeMultiVectorGen
*
AttributeContainer
::
getVirtualDataVector
(
unsigned
int
attrIndex
)
{
return
*
(
m_tableAttribs
[
attrIndex
]
)
;
return
m_tableAttribs
[
attrIndex
];
}
template
<
typename
T
>
AttributeMultiVector
<
T
>
&
AttributeContainer
::
getDataVector
(
const
std
::
string
&
attribName
)
AttributeMultiVector
<
T
>
*
AttributeContainer
::
getDataVector
(
const
std
::
string
&
attribName
)
{
unsigned
int
index
=
getAttributeIndex
(
attribName
)
;
assert
(
index
!=
UNKNOWN
)
;
if
(
index
==
UNKNOWN
)
return
NULL
;
AttributeMultiVector
<
T
>*
atm
=
dynamic_cast
<
AttributeMultiVector
<
T
>*>
(
m_tableAttribs
[
index
]);
assert
((
atm
!=
NULL
)
||
!
"getDataVector: wrong type"
);
return
*
atm
;
return
atm
;
}
inline
AttributeMultiVectorGen
&
AttributeContainer
::
getVirtualDataVector
(
const
std
::
string
&
attribName
)
inline
AttributeMultiVectorGen
*
AttributeContainer
::
getVirtualDataVector
(
const
std
::
string
&
attribName
)
{
unsigned
int
index
=
getAttributeIndex
(
attribName
)
;
assert
(
index
!=
UNKNOWN
)
;
return
*
(
m_tableAttribs
[
index
]
)
;
return
m_tableAttribs
[
index
];
}
template
<
typename
T
>
...
...
include/Topology/generic/attribmap.hpp
View file @
3619c00b
...
...
@@ -30,8 +30,7 @@ inline AttributeHandler<T> AttribMap::addAttribute(unsigned int orbit, const std
{
if
(
!
isOrbitEmbedded
(
orbit
))
addEmbedding
(
orbit
)
;
AttributeContainer
&
cellCont
=
m_attribs
[
orbit
]
;
AttributeMultiVector
<
T
>*
amv
=
cellCont
.
addAttribute
<
T
>
(
nameAttr
)
;
AttributeMultiVector
<
T
>*
amv
=
m_attribs
[
orbit
].
addAttribute
<
T
>
(
nameAttr
)
;
return
AttributeHandler
<
T
>
(
this
,
amv
)
;
}
...
...
@@ -46,8 +45,8 @@ template <typename T>
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
)
;
return
AttributeHandler
<
T
>
(
this
,
&
amv
)
;
AttributeMultiVector
<
T
>
*
amv
=
m_attribs
[
orbit
].
getDataVector
<
T
>
(
nameAttr
)
;
return
AttributeHandler
<
T
>
(
this
,
amv
)
;
}
template
<
typename
T
>
...
...
include/Topology/generic/attributeHandler.hpp
View file @
3619c00b
...
...
@@ -27,10 +27,8 @@ namespace CGoGN
template
<
typename
T
>
AttributeHandler
<
T
>::
AttributeHandler
(
GenericMap
*
m
,
AttributeMultiVector
<
T
>*
amv
)
:
m_map
(
m
)
{
m_attrib
=
amv
;
}
m_map
(
m
),
m_attrib
(
amv
)
{}
template
<
typename
T
>
AttributeHandler
<
T
>::
AttributeHandler
(
const
AttributeHandler
<
T
>&
ta
)
:
...
...
@@ -81,9 +79,9 @@ const std::string& AttributeHandler<T>::name() const
template
<
typename
T
>
bool
AttributeHandler
<
T
>::
isValid
()
const
{
return
(
m_
attrib
->
getIndex
()
!=
AttributeContainer
::
UNKNOWN
&&
m_
map
!=
NULL
&&
m_attrib
!=
NULL
)
;
return
(
m_
map
!=
NULL
&&
m_
attrib
!=
NULL
&&
m_attrib
->
getIndex
()
!=
AttributeContainer
::
UNKNOWN
)
;
}
template
<
typename
T
>
...
...
include/Topology/generic/genericmap.h
View file @
3619c00b
...
...
@@ -230,22 +230,6 @@ public:
*/
AttributeContainer
&
getAttributeContainer
(
unsigned
int
orbit
);
/**
* get a multi vector of attribute (direct access with [i])
* @param orbit orbit of attribute
* @param index index of attribute
*/
template
<
typename
T
>
AttributeMultiVector
<
T
>&
getAttributeVector
(
unsigned
int
orbit
,
unsigned
int
index
);
/**
* get a virtual multi vector of attribute
* No access to data, useful for access to address (VBO)
* @param orbit orbit of attribute
* @param index index of attribute
*/
AttributeMultiVectorGen
&
getAttributeVectorGen
(
unsigned
int
orbit
,
unsigned
int
index
);
/**
* get a multi vector of marker attribute (direct access with [i])
* @param orbit code
...
...
include/Topology/generic/genericmap.hpp
View file @
3619c00b
...
...
@@ -221,19 +221,6 @@ inline AttributeContainer& GenericMap::getAttributeContainer(unsigned int orbit)
return
m_attribs
[
orbit
]
;
}
template
<
typename
T
>
inline
AttributeMultiVector
<
T
>&
GenericMap
::
getAttributeVector
(
unsigned
int
orbit
,
unsigned
int
index
)
{
assert
(
index
!=
AttributeContainer
::
UNKNOWN
)
;
return
m_attribs
[
orbit
].
getDataVector
<
T
>
(
index
)
;
}
inline
AttributeMultiVectorGen
&
GenericMap
::
getAttributeVectorGen
(
unsigned
int
orbit
,
unsigned
int
index
)
{
assert
(
index
!=
AttributeContainer
::
UNKNOWN
)
;
return
m_attribs
[
orbit
].
getVirtualDataVector
(
index
)
;
}
inline
AttributeMultiVector
<
Mark
>*
GenericMap
::
getMarkerVector
(
unsigned
int
orbit
)
{
return
m_markerTables
[
orbit
]
;
...
...
src/Topology/generic/genericmap.cpp
View file @
3619c00b
...
...
@@ -169,9 +169,9 @@ void GenericMap::update_m_emb_afterLoad()
{
unsigned
int
orb
=
listeNames
[
i
][
4
]
-
'0'
;
// easy atoi computation for one char;
AttributeMultiVector
<
unsigned
int
>
&
amv
=
cont
.
getDataVector
<
unsigned
int
>
(
i
);
m_embeddings
[
orb
]
=
&
amv
;
std
::
cout
<<
"Ajoute m_emb["
<<
orb
<<
"]
:"
<<
i
<<
std
::
endl
;
AttributeMultiVector
<
unsigned
int
>
*
amv
=
cont
.
getDataVector
<
unsigned
int
>
(
i
);
m_embeddings
[
orb
]
=
amv
;
std
::
cout
<<
"Ajoute m_emb["
<<
orb
<<
"]
: "
<<
i
<<
std
::
endl
;
}
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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