Commit 54d09f40 authored by Pierre Kraemer's avatar Pierre Kraemer

Suite essais compute dual

Mise a jour stockage des AttributeMultiVector dans les
AttributeContainer
parent cc7691b9
...@@ -534,6 +534,58 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y) ...@@ -534,6 +534,58 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y)
break ; break ;
} }
case 'd':
{
GLint t1 = glutGet(GLUT_ELAPSED_TIME);
myMap.removeAttribute<PFP::VEC3>(normal) ;
myMap.removeAttribute<PFP::VEC3>(laplacian) ;
AttributeHandler<PFP::VEC3> newPosition = myMap.addAttribute<PFP::VEC3>(FACE_ORBIT, "position") ;
Algo::Geometry::computeCentroidFaces<PFP>(myMap, position, newPosition) ;
std::vector<std::string> attrNames ;
for(unsigned int i = 0; i < NB_ORBITS; ++i)
{
AttributeContainer& cont = myMap.getAttributeContainer(i) ;
std::cout << "container " << i << " (" << cont.getNbAttributes() << ") :" << std::endl ;
cont.getAttributesNames(attrNames) ;
for(unsigned int j = 0; j < attrNames.size(); ++j)
std::cout << " -> " << attrNames[j] << std::endl ;
}
std::cout << std::endl ;
Algo::Modelisation::computeDual<PFP>(myMap) ;
for(unsigned int i = 0; i < NB_ORBITS; ++i)
{
AttributeContainer& cont = myMap.getAttributeContainer(i) ;
std::cout << "container " << i << " (" << cont.getNbAttributes() << ") :" << std::endl ;
cont.getAttributesNames(attrNames) ;
for(unsigned int j = 0; j < attrNames.size(); ++j)
std::cout << " -> " << attrNames[j] << std::endl ;
}
position = myMap.getAttribute<PFP::VEC3>(VERTEX_ORBIT, "position") ;
normal = myMap.addAttribute<PFP::VEC3>(VERTEX_ORBIT, "normal") ;
laplacian = myMap.addAttribute<PFP::VEC3>(VERTEX_ORBIT, "laplacian") ;
GLint t2 = glutGet(GLUT_ELAPSED_TIME);
GLfloat seconds = (t2 - t1) / 1000.0f;
std::cout << "dual computation: "<< seconds << "sec" << std::endl;
t1 = glutGet(GLUT_ELAPSED_TIME);
updateVBOprimitives(Algo::Render::VBO::TRIANGLES | Algo::Render::VBO::LINES | Algo::Render::VBO::POINTS) ;
updateVBOdata(Algo::Render::VBO::POSITIONS | Algo::Render::VBO::NORMALS) ;
topo_render->updateData<PFP>(myMap, position, 0.9f, 0.9f) ;
t2 = glutGet(GLUT_ELAPSED_TIME);
seconds = (t2 - t1) / 1000.0f;
std::cout << "display update: "<< seconds << "sec" << std::endl;
glutPostRedisplay() ;
break ;
}
case '3': case '3':
{ {
CellMarker markVisit(myMap, VERTEX_CELL) ; CellMarker markVisit(myMap, VERTEX_CELL) ;
......
...@@ -40,7 +40,7 @@ bool importMesh(typename PFP::MAP& map, MeshTablesSurface<PFP>& mts) ...@@ -40,7 +40,7 @@ bool importMesh(typename PFP::MAP& map, MeshTablesSurface<PFP>& mts)
{ {
typedef typename PFP::VEC3 VEC3 ; typedef typename PFP::VEC3 VEC3 ;
AutoAttributeHandler< NoMathIONameAttribute< std::vector<Dart> > > vecDartsPerVertex(map, VERTEX_ORBIT, "incidents"); AutoAttributeHandler< NoMathIONameAttribute< std::vector<Dart> > > vecDartsPerVertex(map, VERTEX_ORBIT, "incidents");
unsigned nbf = mts.getNbFaces(); unsigned nbf = mts.getNbFaces();
int index = 0; int index = 0;
...@@ -106,7 +106,6 @@ bool importMesh(typename PFP::MAP& map, MeshTablesSurface<PFP>& mts) ...@@ -106,7 +106,6 @@ bool importMesh(typename PFP::MAP& map, MeshTablesSurface<PFP>& mts)
if (good_dart != Dart::nil()) if (good_dart != Dart::nil())
{ {
Dart aze = map.phi2(good_dart) ;
if (good_dart == map.phi2(good_dart)) if (good_dart == map.phi2(good_dart))
{ {
map.sewFaces(d, good_dart); map.sewFaces(d, good_dart);
......
...@@ -95,7 +95,7 @@ void LoopSubdivision(typename PFP::MAP& map, typename PFP::TVEC3& position, cons ...@@ -95,7 +95,7 @@ void LoopSubdivision(typename PFP::MAP& map, typename PFP::TVEC3& position, cons
* Dual mesh computation * Dual mesh computation
*/ */
template <typename PFP> template <typename PFP>
void computeDual(typename PFP::MAP& map, typename PFP::TVEC3& position, const FunctorSelect& selected = SelectorTrue()) ; void computeDual(typename PFP::MAP& map, const FunctorSelect& selected = SelectorTrue()) ;
/** /**
* Sqrt(3) subdivision scheme * Sqrt(3) subdivision scheme
......
...@@ -435,32 +435,33 @@ void LoopSubdivision(typename PFP::MAP& map, typename PFP::TVEC3& position, cons ...@@ -435,32 +435,33 @@ void LoopSubdivision(typename PFP::MAP& map, typename PFP::TVEC3& position, cons
} }
template <typename PFP> template <typename PFP>
void computeDual(typename PFP::MAP& map, typename PFP::TVEC3& position, const FunctorSelect& selected) void computeDual(typename PFP::MAP& map, const FunctorSelect& selected)
{ {
typedef typename PFP::MAP MAP ;
typedef typename PFP::VEC3 VEC3 ;
typedef typename PFP::REAL REAL ;
AttributeHandler<Dart> phi1 = map.template getAttribute<Dart>(DART_ORBIT, "phi1") ; AttributeHandler<Dart> phi1 = map.template getAttribute<Dart>(DART_ORBIT, "phi1") ;
AttributeHandler<Dart> phi_1 = map.template getAttribute<Dart>(DART_ORBIT, "phi_1") ; AttributeHandler<Dart> phi_1 = map.template getAttribute<Dart>(DART_ORBIT, "phi_1") ;
AttributeHandler<Dart> new_phi1 = map.template addAttribute<Dart>(DART_ORBIT, "new_phi1") ; AttributeHandler<Dart> new_phi1 = map.template addAttribute<Dart>(DART_ORBIT, "new_phi1") ;
AttributeHandler<Dart> new_phi_1 = map.template addAttribute<Dart>(DART_ORBIT, "new_phi_1") ;
for(Dart d = map.begin(); d != map.end(); map.next(d)) for(Dart d = map.begin(); d != map.end(); map.next(d))
{ {
Dart dd = map.alpha1(d) ; Dart dd = map.alpha1(d) ;
new_phi1[d] = dd ; new_phi1[d] = dd ;
phi_1[dd] = d ; new_phi_1[dd] = d ;
} }
map.template swapAttributes<Dart>(phi1, new_phi1) ; map.template swapAttributes<Dart>(phi1, new_phi1) ;
map.template swapAttributes<Dart>(phi_1, new_phi_1) ;
map.template removeAttribute<Dart>(new_phi1) ; map.template removeAttribute<Dart>(new_phi1) ;
map.template removeAttribute<Dart>(new_phi_1) ;
map.swapEmbeddingContainers(VERTEX_ORBIT, FACE_ORBIT) ;
} }
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, position, selected); // computeDual<PFP>(map, selected);
trianguleFaces<PFP>(map, position, selected); trianguleFaces<PFP>(map, position, selected);
} }
......
...@@ -49,7 +49,6 @@ namespace VBO ...@@ -49,7 +49,6 @@ namespace VBO
class topo_VBORender class topo_VBORender
{ {
protected: protected:
/** /**
* vbo buffers * vbo buffers
* 0: vertices darts * 0: vertices darts
...@@ -78,7 +77,6 @@ protected: ...@@ -78,7 +77,6 @@ protected:
*/ */
float m_topo_relation_width; float m_topo_relation_width;
/** /**
* attribut d'index dans le VBO * attribut d'index dans le VBO
*/ */
...@@ -157,11 +155,9 @@ public: ...@@ -157,11 +155,9 @@ public:
* @param b blue ! * @param b blue !
*/ */
void overdrawDart(Dart d, float width, float r, float g, float b); void overdrawDart(Dart d, float width, float r, float g, float b);
}; };
class topo_VBORenderMapD:public topo_VBORender class topo_VBORenderMapD : public topo_VBORender
{ {
public: public:
/** /**
...@@ -176,7 +172,7 @@ public: ...@@ -176,7 +172,7 @@ public:
void updateData(typename PFP::MAP& map, const typename PFP::TVEC3& positions, float ke, float kf, const FunctorSelect& good = SelectorTrue()); void updateData(typename PFP::MAP& map, const typename PFP::TVEC3& positions, float ke, float kf, const FunctorSelect& good = SelectorTrue());
}; };
class topo_VBORenderGMap: public topo_VBORender class topo_VBORenderGMap : public topo_VBORender
{ {
public: public:
/** /**
......
...@@ -78,7 +78,7 @@ void topo_VBORenderMapD::updateData(typename PFP::MAP& map, const typename PFP:: ...@@ -78,7 +78,7 @@ void topo_VBORenderMapD::updateData(typename PFP::MAP& map, const typename PFP::
glBufferDataARB(GL_ARRAY_BUFFER, 2*m_nbDarts*sizeof(VEC3), 0, GL_STREAM_DRAW); glBufferDataARB(GL_ARRAY_BUFFER, 2*m_nbDarts*sizeof(VEC3), 0, GL_STREAM_DRAW);
GLvoid* PositionDartsBuffer = glMapBufferARB(GL_ARRAY_BUFFER, GL_READ_WRITE); GLvoid* PositionDartsBuffer = glMapBufferARB(GL_ARRAY_BUFFER, GL_READ_WRITE);
VEC3* positionDartBuf = reinterpret_cast<VEC3*>(PositionDartsBuffer); VEC3* positionDartBuf = reinterpret_cast<VEC3*>(PositionDartsBuffer);
unsigned int posDBI=0; unsigned int posDBI = 0;
DartMarker mf(map); DartMarker mf(map);
for(std::vector<Dart>::iterator id = vecDarts.begin(); id!= vecDarts.end(); id++) for(std::vector<Dart>::iterator id = vecDarts.begin(); id!= vecDarts.end(); id++)
...@@ -176,12 +176,8 @@ void topo_VBORenderMapD::updateData(typename PFP::MAP& map, const typename PFP:: ...@@ -176,12 +176,8 @@ void topo_VBORenderMapD::updateData(typename PFP::MAP& map, const typename PFP::
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER, m_VBOBuffers[2]); glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER, m_VBOBuffers[2]);
glUnmapBufferARB(GL_ELEMENT_ARRAY_BUFFER); glUnmapBufferARB(GL_ELEMENT_ARRAY_BUFFER);
} }
template<typename PFP> template<typename PFP>
void topo_VBORenderGMap::updateData(typename PFP::MAP& map, const typename PFP::TVEC3& positions, float ke, float kf, const FunctorSelect& good) void topo_VBORenderGMap::updateData(typename PFP::MAP& map, const typename PFP::TVEC3& positions, float ke, float kf, const FunctorSelect& good)
{ {
......
...@@ -71,6 +71,8 @@ protected: ...@@ -71,6 +71,8 @@ protected:
*/ */
std::vector<AttributeMultiVectorGen*> m_tableAttribs; std::vector<AttributeMultiVectorGen*> m_tableAttribs;
std::vector<unsigned int> m_freeIndices;
/** /**
* map de correspondance string / indice pour les attributs * map de correspondance string / indice pour les attributs
*/ */
...@@ -246,7 +248,7 @@ public: ...@@ -246,7 +248,7 @@ public:
* @param strings (OUT) tableau des noms d'attributs * @param strings (OUT) tableau des noms d'attributs
* @return le nombre d'attributs * @return le nombre d'attributs
*/ */
unsigned int getAttributesStrings(std::vector<std::string>& strings); unsigned int getAttributesNames(std::vector<std::string>& names);
/** /**
* get the name of an attribute, given its index in the container * get the name of an attribute, given its index in the container
...@@ -394,11 +396,6 @@ public: ...@@ -394,11 +396,6 @@ public:
*/ */
unsigned int memoryTotalSize() ; unsigned int memoryTotalSize() ;
/**
* Nombre d'attributs
*/
unsigned int nbAttributes();
/** /**
* Nombre de reference d'une ligne * Nombre de reference d'une ligne
*/ */
......
/*******************************************************************************
//#include <typeinfo> * CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
//#include <stdio.h> * version 0.1 *
//#include <string.h> * Copyright (C) 2009, IGG Team, LSIIT, University of Strasbourg *
//#include <libxml/encoding.h> * *
//#include <libxml/xmlwriter.h> * This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
#include<iostream> * Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: https://iggservis.u-strasbg.fr/CGoGN/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#include <iostream>
#include <cassert> #include <cassert>
#include "Container/registered.h" #include "Container/registered.h"
#include "Utils/nameTypes.h" #include "Utils/nameTypes.h"
...@@ -27,16 +44,24 @@ unsigned int AttributeContainer::addAttribute(const std::string& attribName) ...@@ -27,16 +44,24 @@ unsigned int AttributeContainer::addAttribute(const std::string& attribName)
{ {
MapNameId::iterator it = m_attribNameMap.find(attribName); MapNameId::iterator it = m_attribNameMap.find(attribName);
if (it != m_attribNameMap.end()) if (it != m_attribNameMap.end())
{
return UNKNOWN; return UNKNOWN;
}
} }
// new attribut // new attribut
AttributeMultiVector<T>* ptr = new AttributeMultiVector<T>(attribName, nametype); AttributeMultiVector<T>* amv = new AttributeMultiVector<T>(attribName, nametype);
unsigned int idxAttrib = m_tableAttribs.size();
// add it to table of attribut_manager unsigned int idxAttrib ;
m_tableAttribs.push_back(ptr); if(!m_freeIndices.empty())
{
idxAttrib = m_freeIndices.back() ;
m_freeIndices.pop_back() ;
m_tableAttribs[idxAttrib] = amv ;
}
else
{
idxAttrib = m_tableAttribs.size();
m_tableAttribs.push_back(amv);
}
// add it in the map // add it in the map
if (attribName == "") // if no name, generate a fake name if (attribName == "") // if no name, generate a fake name
...@@ -44,6 +69,7 @@ unsigned int AttributeContainer::addAttribute(const std::string& attribName) ...@@ -44,6 +69,7 @@ unsigned int AttributeContainer::addAttribute(const std::string& attribName)
std::stringstream ss; std::stringstream ss;
ss << "unknown" << m_nbUnknown++; ss << "unknown" << m_nbUnknown++;
m_attribNameMap.insert(std::pair<std::string, unsigned int>(ss.str(), idxAttrib)); m_attribNameMap.insert(std::pair<std::string, unsigned int>(ss.str(), idxAttrib));
amv->setName(ss.str());
} }
else else
m_attribNameMap.insert(std::pair<std::string, unsigned int>(attribName, idxAttrib)); m_attribNameMap.insert(std::pair<std::string, unsigned int>(attribName, idxAttrib));
...@@ -53,7 +79,7 @@ unsigned int AttributeContainer::addAttribute(const std::string& attribName) ...@@ -53,7 +79,7 @@ unsigned int AttributeContainer::addAttribute(const std::string& attribName)
// resize the new attribute container to have same size than others // resize the new attribute container to have same size than others
int nbb = m_holesBlocks.size(); int nbb = m_holesBlocks.size();
ptr->setNbBlocks(nbb); amv->setNbBlocks(nbb);
m_nbAttributes++; m_nbAttributes++;
...@@ -68,24 +94,30 @@ unsigned int AttributeContainer::addAttribute(const std::string& attribName, con ...@@ -68,24 +94,30 @@ unsigned int AttributeContainer::addAttribute(const std::string& attribName, con
{ {
MapNameId::iterator it = m_attribNameMap.find(attribName); MapNameId::iterator it = m_attribNameMap.find(attribName);
if (it != m_attribNameMap.end()) if (it != m_attribNameMap.end())
{
return UNKNOWN; return UNKNOWN;
}
} }
// new attribut // new attribut
AttributeMultiVector<T>* ptr = new AttributeMultiVector<T>(attribName, nametype); AttributeMultiVector<T>* amv = new AttributeMultiVector<T>(attribName, nametype);
// add it to table of attribut_manager // add it to table of attribut_manager
m_tableAttribs[idxAttrib] = ptr; m_tableAttribs[idxAttrib] = amv;
// add it in the map // add it in the map
m_attribNameMap.insert(std::pair<std::string, unsigned int>(attribName, idxAttrib)); if (attribName == "") // if no name, generate a fake name
{
std::stringstream ss;
ss << "unknown" << m_nbUnknown++;
m_attribNameMap.insert(std::pair<std::string, unsigned int>(ss.str(), idxAttrib));
amv->setName(ss.str());
}
else
m_attribNameMap.insert(std::pair<std::string, unsigned int>(attribName, idxAttrib));
// maj taille d'une ligne // maj taille d'une ligne
m_lineCost += sizeof(T); m_lineCost += sizeof(T);
// resize the new attribute container to have same size than others // resize the new attribute container to have same size than others
int nbb = m_holesBlocks.size(); int nbb = m_holesBlocks.size();
ptr->setNbBlocks(nbb); amv->setNbBlocks(nbb);
m_nbAttributes++; m_nbAttributes++;
...@@ -94,7 +126,7 @@ unsigned int AttributeContainer::addAttribute(const std::string& attribName, con ...@@ -94,7 +126,7 @@ unsigned int AttributeContainer::addAttribute(const std::string& attribName, con
inline unsigned int AttributeContainer::getNbAttributes() inline unsigned int AttributeContainer::getNbAttributes()
{ {
return m_tableAttribs.size(); return m_nbAttributes;
} }
/////////////////////////// ///////////////////////////
...@@ -104,12 +136,12 @@ inline unsigned int AttributeContainer::getNbAttributes() ...@@ -104,12 +136,12 @@ inline unsigned int AttributeContainer::getNbAttributes()
template <typename T> template <typename T>
T& AttributeContainer::getData(unsigned int codeAttrib, unsigned int eltIdx) T& AttributeContainer::getData(unsigned int codeAttrib, unsigned int eltIdx)
{ {
assert(eltIdx < m_maxSize && "Attribut non existant (indice trop grand)"); assert(eltIdx < m_maxSize || !"Attribut non existant (indice trop grand)");
assert(m_holesBlocks[eltIdx/_BLOCKSIZE_]->used(eltIdx%_BLOCKSIZE_)&&"Attribut non existant"); assert(m_holesBlocks[eltIdx/_BLOCKSIZE_]->used(eltIdx%_BLOCKSIZE_) || !"Attribut non existant");
assert((m_tableAttribs[codeAttrib]!=NULL)&&"Attribut detruit"); assert((m_tableAttribs[codeAttrib] != NULL) || !"Attribut detruit");
AttributeMultiVector<T>* atm = dynamic_cast< AttributeMultiVector<T>* >(m_tableAttribs[codeAttrib]); AttributeMultiVector<T>* atm = dynamic_cast< AttributeMultiVector<T>* >(m_tableAttribs[codeAttrib]);
assert((atm!=NULL)&& "type attribut non concordant"); assert((atm != NULL) || !"type attribut non concordant");
return atm->operator[](eltIdx); return atm->operator[](eltIdx);
} }
...@@ -117,12 +149,12 @@ T& AttributeContainer::getData(unsigned int codeAttrib, unsigned int eltIdx) ...@@ -117,12 +149,12 @@ T& AttributeContainer::getData(unsigned int codeAttrib, unsigned int eltIdx)
template <typename T> template <typename T>
const T& AttributeContainer::getData(unsigned int codeAttrib, unsigned int eltIdx) const const T& AttributeContainer::getData(unsigned int codeAttrib, unsigned int eltIdx) const
{ {
assert(eltIdx < m_maxSize && "Attribut non existant (indice trop grand)"); assert(eltIdx < m_maxSize || !"Attribut non existant (indice trop grand)");
assert(m_holesBlocks[eltIdx/_BLOCKSIZE_]->used(eltIdx%_BLOCKSIZE_)&&"Attribut non existant"); assert(m_holesBlocks[eltIdx/_BLOCKSIZE_]->used(eltIdx%_BLOCKSIZE_) || !"Attribut non existant");
assert((m_tableAttribs[codeAttrib]!=NULL)&&"Attribut detruit"); assert((m_tableAttribs[codeAttrib] != NULL) || !"Attribut detruit");
AttributeMultiVector<T>* atm = dynamic_cast< AttributeMultiVector<T>* >(m_tableAttribs[codeAttrib]); AttributeMultiVector<T>* atm = dynamic_cast< AttributeMultiVector<T>* >(m_tableAttribs[codeAttrib]);
assert((atm!=NULL)&& "type attribut non concordant"); assert((atm != NULL) || !"type attribut non concordant");
return atm->operator[](eltIdx); return atm->operator[](eltIdx);
} }
...@@ -130,13 +162,12 @@ const T& AttributeContainer::getData(unsigned int codeAttrib, unsigned int eltId ...@@ -130,13 +162,12 @@ const T& AttributeContainer::getData(unsigned int codeAttrib, unsigned int eltId
template <typename T> template <typename T>
void AttributeContainer::setData(unsigned int codeAttrib, unsigned int eltIdx, const T& data) void AttributeContainer::setData(unsigned int codeAttrib, unsigned int eltIdx, const T& data)
{ {
assert(eltIdx < m_maxSize || !"Attribut non existant (indice trop grand)");
assert(eltIdx < m_maxSize && "Attribut non existant (indice trop grand)"); assert(m_holesBlocks[eltIdx/_BLOCKSIZE_]->used(eltIdx%_BLOCKSIZE_) || !"Attribut non existant");
assert(m_holesBlocks[eltIdx/_BLOCKSIZE_]->used(eltIdx%_BLOCKSIZE_)&&"Attribut non existant"); assert((m_tableAttribs[codeAttrib] != NULL) || !"Attribut detruit");
assert((m_tableAttribs[codeAttrib]!=NULL)&&"Attribut detruit");
AttributeMultiVector<T>* atm = dynamic_cast< AttributeMultiVector<T>* >(m_tableAttribs[codeAttrib]); AttributeMultiVector<T>* atm = dynamic_cast< AttributeMultiVector<T>* >(m_tableAttribs[codeAttrib]);
assert((atm!=NULL)&& "type attribut non concordant"); assert((atm != NULL) || !"type attribut non concordant");
atm->operator[](eltIdx) = data; atm->operator[](eltIdx) = data;
} }
...@@ -152,11 +183,11 @@ void AttributeContainer::setData(unsigned int codeAttrib, unsigned int eltIdx, ...@@ -152,11 +183,11 @@ void AttributeContainer::setData(unsigned int codeAttrib, unsigned int eltIdx,
template<typename T> template<typename T>
AttributeMultiVector<T>& AttributeContainer::getDataVector(unsigned int codeAttrib) AttributeMultiVector<T>& AttributeContainer::getDataVector(unsigned int codeAttrib)
{ {
assert((codeAttrib < m_tableAttribs.size()) && "Attribut inexistant"); assert((codeAttrib < m_tableAttribs.size()) || !"Attribut inexistant");
assert((m_tableAttribs[codeAttrib] != NULL) && "Attribut detruit"); assert((m_tableAttribs[codeAttrib] != NULL) || !"Attribut detruit");
AttributeMultiVector<T>* atm = dynamic_cast< AttributeMultiVector<T>* >(m_tableAttribs[codeAttrib]); AttributeMultiVector<T>* atm = dynamic_cast< AttributeMultiVector<T>* >(m_tableAttribs[codeAttrib]);
assert((atm!=NULL)&& "type attribut non concordant"); assert((atm != NULL) || !"type attribut non concordant");
return *atm; return *atm;
} }
...@@ -169,11 +200,11 @@ bool AttributeContainer::getAttributesVector(const std::string& attribName, Attr ...@@ -169,11 +200,11 @@ bool AttributeContainer::getAttributesVector(const std::string& attribName, Attr
int codeAttrib = it->second; int codeAttrib = it->second;
if (m_tableAttribs[codeAttrib]==NULL) if (m_tableAttribs[codeAttrib] == NULL)
return false; return false;
AttributeMultiVector<T>* atm = dynamic_cast< AttributeMultiVector<T>* >(m_tableAttribs[codeAttrib]); AttributeMultiVector<T>* atm = dynamic_cast< AttributeMultiVector<T>* >(m_tableAttribs[codeAttrib]);
if (atm==NULL) if (atm == NULL)
return false; return false;
*ptr = atm; *ptr = atm;
...@@ -188,7 +219,7 @@ template <typename T> ...@@ -188,7 +219,7 @@ template <typename T>
unsigned int AttributeContainer::getAddresses(unsigned int attr, std::vector<T*>& vect_adr) unsigned int AttributeContainer::getAddresses(unsigned int attr, std::vector<T*>& vect_adr)
{ {
AttributeMultiVector<T>* atm = dynamic_cast< AttributeMultiVector<T>* >(m_tableAttribs[attr]); AttributeMultiVector<T>* atm = dynamic_cast< AttributeMultiVector<T>* >(m_tableAttribs[attr]);
assert((atm!=NULL)&& "type attribut non concordant"); assert((atm != NULL) || !"type attribut non concordant");
return atm->getStartAddresses(vect_adr); return atm->getStartAddresses(vect_adr);
} }
......
...@@ -99,9 +99,13 @@ public: ...@@ -99,9 +99,13 @@ public:
/** /**
* get name of the type of attribute * get name of the type of attribute
*/ */
const std::string& getTypeName() { return m_typeName;} const std::string& getTypeName() { return m_typeName; }
const std::string& getName() { return m_attName;} void setTypeName(const std::string& n) { m_typeName = n ; }
const std::string& getName() { return m_attName; }
void setName(const std::string& n) { m_attName = n ; }
virtual void saveBin(CGoGNostream& fs, unsigned int id)=0; virtual void saveBin(CGoGNostream& fs, unsigned int id)=0;
...@@ -115,8 +119,6 @@ public: ...@@ -115,8 +119,6 @@ public:
virtual void input(unsigned int i,const std::string& st)=0; virtual void input(unsigned int i,const std::string& st)=0;