Commit cfaebffc authored by Sylvain Thery's avatar Sylvain Thery

keep only NoTypeNameAttribute for fake attribute

parent 927fc518
......@@ -120,7 +120,7 @@ private:
bool valid ;
static std::string CGoGNnameOfType() { return "LengthEdgeInfo" ; }
} LengthEdgeInfo ;
typedef NoMathIOAttribute<LengthEdgeInfo> EdgeInfo ;
typedef NoTypeNameAttribute<LengthEdgeInfo> EdgeInfo ;
EdgeAttribute<EdgeInfo> edgeInfo ;
......@@ -183,7 +183,7 @@ private:
bool valid ;
static std::string CGoGNnameOfType() { return "QEMedgeInfo" ; }
} QEMedgeInfo ;
typedef NoMathIOAttribute<QEMedgeInfo> EdgeInfo ;
typedef NoTypeNameAttribute<QEMedgeInfo> EdgeInfo ;
EdgeAttribute<EdgeInfo> edgeInfo ;
VertexAttribute<Utils::Quadric<REAL> > quadric ;
......@@ -235,7 +235,7 @@ private:
bool valid ;
static std::string CGoGNnameOfType() { return "QEMedgeInfo" ; }
} QEMedgeInfo ;
typedef NoMathIOAttribute<QEMedgeInfo> EdgeInfo ;
typedef NoTypeNameAttribute<QEMedgeInfo> EdgeInfo ;
EdgeAttribute<EdgeInfo> edgeInfo ;
VertexAttribute<Utils::Quadric<REAL> > quadric ;
......@@ -288,7 +288,7 @@ private:
bool valid ;
static std::string CGoGNnameOfType() { return "NormalAreaEdgeInfo" ; }
} NormalAreaEdgeInfo ;
typedef NoMathIOAttribute<NormalAreaEdgeInfo> EdgeInfo ;
typedef NoTypeNameAttribute<NormalAreaEdgeInfo> EdgeInfo ;
EdgeAttribute<EdgeInfo> edgeInfo ;
EdgeAttribute<Geom::Matrix<3,3,REAL> > edgeMatrix ;
......@@ -342,7 +342,7 @@ private:
bool valid ;
static std::string CGoGNnameOfType() { return "CurvatureEdgeInfo" ; }
} CurvatureEdgeInfo ;
typedef NoMathIOAttribute<CurvatureEdgeInfo> EdgeInfo ;
typedef NoTypeNameAttribute<CurvatureEdgeInfo> EdgeInfo ;
Geom::BoundingBox<VEC3> bb ;
REAL radius ;
......@@ -442,7 +442,7 @@ private:
bool valid ;
static std::string CGoGNnameOfType() { return "CurvatureTensorEdgeInfo" ; }
} CurvatureTensorEdgeInfo ;
typedef NoMathIOAttribute<CurvatureTensorEdgeInfo> EdgeInfo ;
typedef NoTypeNameAttribute<CurvatureTensorEdgeInfo> EdgeInfo ;
EdgeAttribute<EdgeInfo> edgeInfo ;
EdgeAttribute<REAL> edgeangle ;
......@@ -500,7 +500,7 @@ private:
bool valid ;
static std::string CGoGNnameOfType() { return "MinDetailEdgeInfo" ; }
} MinDetailEdgeInfo ;
typedef NoMathIOAttribute<MinDetailEdgeInfo> EdgeInfo ;
typedef NoTypeNameAttribute<MinDetailEdgeInfo> EdgeInfo ;
EdgeAttribute<EdgeInfo> edgeInfo ;
......@@ -551,7 +551,7 @@ private:
bool valid ;
static std::string CGoGNnameOfType() { return "ColorNaiveEdgeInfo" ; }
} ColorNaiveedgeInfo ;
typedef NoMathIOAttribute<ColorNaiveedgeInfo> EdgeInfo ;
typedef NoTypeNameAttribute<ColorNaiveedgeInfo> EdgeInfo ;
EdgeAttribute<EdgeInfo> edgeInfo ;
VertexAttribute<Utils::Quadric<REAL> > m_quadric ;
......@@ -613,7 +613,7 @@ private:
bool valid ;
static std::string CGoGNnameOfType() { return "GeomColOptGradEdgeInfo" ; }
} ColorNaiveedgeInfo ;
typedef NoMathIOAttribute<ColorNaiveedgeInfo> EdgeInfo ;
typedef NoTypeNameAttribute<ColorNaiveedgeInfo> EdgeInfo ;
EdgeAttribute<EdgeInfo> edgeInfo ;
VertexAttribute<Utils::Quadric<REAL> > m_quadric ;
......@@ -695,7 +695,7 @@ private:
bool valid ;
static std::string CGoGNnameOfType() { return "QEMextColorEdgeInfo" ; }
} QEMextColorEdgeInfo ;
typedef NoMathIOAttribute<QEMextColorEdgeInfo> EdgeInfo ;
typedef NoTypeNameAttribute<QEMextColorEdgeInfo> EdgeInfo ;
EdgeAttribute<EdgeInfo> edgeInfo ;
VertexAttribute<Utils::QuadricNd<REAL,6> > m_quadric ;
......
......@@ -57,7 +57,7 @@ private:
bool valid ;
static std::string CGoGNnameOfType() { return "QEMhalfEdgeInfo" ; }
} QEMhalfEdgeInfo ;
typedef NoMathIOAttribute<QEMhalfEdgeInfo> HalfEdgeInfo ;
typedef NoTypeNameAttribute<QEMhalfEdgeInfo> HalfEdgeInfo ;
DartAttribute<HalfEdgeInfo> halfEdgeInfo ;
VertexAttribute<Utils::Quadric<REAL> > quadric ;
......@@ -113,7 +113,7 @@ private:
bool valid ;
static std::string CGoGNnameOfType() { return "QEMextColorHalfEdgeInfo" ; }
} QEMextColorHalfEdgeInfo ;
typedef NoMathIOAttribute<QEMextColorHalfEdgeInfo> HalfEdgeInfo ;
typedef NoTypeNameAttribute<QEMextColorHalfEdgeInfo> HalfEdgeInfo ;
DartAttribute<HalfEdgeInfo> halfEdgeInfo ;
VertexAttribute<Utils::QuadricNd<REAL,6> > m_quadric ;
......@@ -200,7 +200,7 @@ private:
bool valid ;
static std::string CGoGNnameOfType() { return "ColorExperimentalHalfEdgeInfo" ; }
} QEMextColorHalfEdgeInfo ;
typedef NoMathIOAttribute<QEMextColorHalfEdgeInfo> HalfEdgeInfo ;
typedef NoTypeNameAttribute<QEMextColorHalfEdgeInfo> HalfEdgeInfo ;
DartAttribute<HalfEdgeInfo> halfEdgeInfo ;
VertexAttribute<Utils::Quadric<REAL> > m_quadric ;
......
......@@ -298,7 +298,7 @@ private:
typedef typename std::multimap<float, CRIT*>::iterator CRIT_IT;
typedef NoMathIONameAttribute<CRIT_IT> CRIT_IT_ATT;
typedef NoTypeNameAttribute<CRIT_IT> CRIT_IT_ATT;
// attribut d'arête
AutoAttributeHandler<CRIT_IT_ATT> m_edgeEmb;
......
......@@ -101,7 +101,7 @@ private:
bool valid ;
static std::string CGoGNnameOfType() { return "LengthEdgeInfo" ; }
} LengthEdgeInfo ;
typedef NoMathIOAttribute<LengthEdgeInfo> EdgeInfo ;
typedef NoTypeNameAttribute<LengthEdgeInfo> EdgeInfo ;
EdgeAttribute<EdgeInfo> edgeInfo ;
......@@ -151,7 +151,7 @@ private:
bool valid ;
static std::string CGoGNnameOfType() { return "SG98edgeInfo" ; }
} SG98edgeInfo ;
typedef NoMathIOAttribute<SG98edgeInfo> EdgeInfo ;
typedef NoTypeNameAttribute<SG98edgeInfo> EdgeInfo ;
EdgeAttribute<EdgeInfo> edgeInfo ;
......
......@@ -26,7 +26,6 @@
#define __ALGO_GEOMETRY_CENTROID_H__
#include "Geometry/basic.h"
#include "Topology/generic/attribops.h"
namespace CGoGN
{
......
......@@ -47,7 +47,7 @@ enum
typedef struct { Dart d ; float w ; } e0point ;
typedef struct { e0point p1 ; e0point p2 ; unsigned char type ; } e0segment ;
typedef NoMathIONameAttribute<e0segment> ridgeSegment ;
typedef NoTypeNameAttribute<e0segment> ridgeSegment ;
template <typename PFP>
void featureEdgeDetection(
......
......@@ -34,7 +34,7 @@ protected :
Dart pathOrigin;
static std::string CGoGNnameOfType() { return "VoronoiVertexInfo" ; }
} VoronoiVertexInfo ;
typedef NoMathIOAttribute<VoronoiVertexInfo> VertexInfo ;
typedef NoTypeNameAttribute<VoronoiVertexInfo> VertexInfo ;
typename PFP::MAP& map;
const EdgeAttribute<REAL>& edgeCost; // weights on the graph edges
......
......@@ -192,7 +192,7 @@ bool importMRDAT(typename PFP::MAP& map, const std::string& filename, std::vecto
std::cout << " Create base level mesh.." << std::flush ;
VertexAutoAttribute< NoMathIONameAttribute< std::vector<Dart> > > vecDartsPerVertex(map, "incidents") ;
VertexAutoAttribute< NoTypeNameAttribute< std::vector<Dart> > > vecDartsPerVertex(map, "incidents") ;
DartMarkerNoUnmark m(map) ;
unsigned nbf = qt.roots.size() ;
......
......@@ -49,7 +49,7 @@ bool importMSH(typename PFP::MAP& map, const std::string& filename, std::vector<
AttributeContainer& container = map.template getAttributeContainer<VERTEX>() ;
unsigned int m_nbVertices = 0, m_nbVolumes = 0;
VertexAutoAttribute< NoMathIONameAttribute< std::vector<Dart> > > vecDartsPerVertex(map, "incidents");
VertexAutoAttribute< NoTypeNameAttribute< std::vector<Dart> > > vecDartsPerVertex(map, "incidents");
//open file
std::ifstream fp(filename.c_str(), std::ios::in);
......
......@@ -42,7 +42,7 @@ namespace Import
template <typename PFP>
bool importMesh(typename PFP::MAP& map, MeshTablesSurface<PFP>& mts)
{
VertexAutoAttribute< NoMathIONameAttribute< std::vector<Dart> > > vecDartsPerVertex(map, "incidents");
VertexAutoAttribute< NoTypeNameAttribute< std::vector<Dart> > > vecDartsPerVertex(map, "incidents");
unsigned nbf = mts.getNbFaces();
int index = 0;
......@@ -159,7 +159,7 @@ bool importMesh(typename PFP::MAP& map, const std::string& filename, std::vector
template <typename PFP>
bool importMeshSAsV(typename PFP::MAP& map, MeshTablesSurface<PFP>& mts)
{
VertexAutoAttribute< NoMathIONameAttribute< std::vector<Dart> > > vecDartsPerVertex(map, "incidents");
VertexAutoAttribute< NoTypeNameAttribute< std::vector<Dart> > > vecDartsPerVertex(map, "incidents");
unsigned nbf = mts.getNbFaces();
int index = 0;
......@@ -273,7 +273,7 @@ namespace Import
template <typename PFP>
bool importMeshSToV(typename PFP::MAP& map, Surface::Import::MeshTablesSurface<PFP>& mts, float dist)
{
VertexAutoAttribute< NoMathIONameAttribute< std::vector<Dart> > > vecDartsPerVertex(map, "incidents");
VertexAutoAttribute< NoTypeNameAttribute< std::vector<Dart> > > vecDartsPerVertex(map, "incidents");
unsigned nbf = mts.getNbFaces();
int index = 0;
// buffer for tempo faces (used to remove degenerated edges)
......@@ -379,7 +379,7 @@ bool importMeshSToV(typename PFP::MAP& map, Surface::Import::MeshTablesSurface<P
template <typename PFP>
bool importMeshSurfToVol(typename PFP::MAP& map, Surface::Import::MeshTablesSurface<PFP>& mts, float scale, unsigned int nbStage)
{
VertexAutoAttribute< NoMathIONameAttribute< std::vector<Dart> > > vecDartsPerVertex(map);
VertexAutoAttribute< NoTypeNameAttribute< std::vector<Dart> > > vecDartsPerVertex(map);
unsigned nbf = mts.getNbFaces();
int index = 0;
// buffer for tempo faces (used to remove degenerated edges)
......@@ -508,7 +508,7 @@ bool importMeshSurfToVol(typename PFP::MAP& map, Surface::Import::MeshTablesSurf
template <typename PFP>
bool importMesh(typename PFP::MAP& map, MeshTablesVolume<PFP>& mtv)
{
VertexAutoAttribute< NoMathIONameAttribute< std::vector<Dart> > > vecDartsPerVertex(map, "incidents");
VertexAutoAttribute< NoTypeNameAttribute< std::vector<Dart> > > vecDartsPerVertex(map, "incidents");
return false;
}
......
......@@ -76,7 +76,7 @@ bool importNAS(typename PFP::MAP& map, const std::string& filename, std::vector<
AttributeContainer& container = map.template getAttributeContainer<VERTEX>() ;
VertexAutoAttribute< NoMathIONameAttribute< std::vector<Dart> > > vecDartsPerVertex(map, "incidents");
VertexAutoAttribute< NoTypeNameAttribute< std::vector<Dart> > > vecDartsPerVertex(map, "incidents");
//open file
std::ifstream fp(filename.c_str(), std::ios::in);
......
......@@ -50,7 +50,7 @@ bool importNodeWithELERegions(typename PFP::MAP& map, const std::string& filenam
AttributeContainer& container = map.template getAttributeContainer<VERTEX>() ;
unsigned int m_nbVertices = 0, m_nbFaces = 0, m_nbEdges = 0, m_nbVolumes = 0;
VertexAutoAttribute< NoMathIONameAttribute< std::vector<Dart> > > vecDartsPerVertex(map, "incidents");
VertexAutoAttribute< NoTypeNameAttribute< std::vector<Dart> > > vecDartsPerVertex(map, "incidents");
//open file
std::ifstream fnode(filenameNode.c_str(), std::ios::in);
......
......@@ -49,7 +49,7 @@ bool importOFFWithELERegions(typename PFP::MAP& map, const std::string& filename
unsigned int m_nbVertices = 0, m_nbFaces = 0, m_nbEdges = 0, m_nbVolumes = 0;
VertexAutoAttribute< NoMathIONameAttribute< std::vector<Dart> > > vecDartsPerVertex(map, "incidents");
VertexAutoAttribute< NoTypeNameAttribute< std::vector<Dart> > > vecDartsPerVertex(map, "incidents");
// open files
std::ifstream foff(filenameOFF.c_str(), std::ios::in);
......
......@@ -673,9 +673,9 @@ bool OBJModel<PFP>::import( const std::string& filename, std::vector<std::string
localIndices.reserve(64*3);
FunctorInitEmb<typename PFP::MAP, VERTEX> fsetemb(m_map);
VertexAutoAttribute< NoMathIONameAttribute< std::vector<Dart> > > vecDartsPerVertex(m_map, "incidents");
VertexAutoAttribute< NoMathIONameAttribute< std::vector<unsigned int> > > vecNormIndPerVertex(m_map, "incidentsN");
VertexAutoAttribute< NoMathIONameAttribute< std::vector<unsigned int> > > vecTCIndPerVertex(m_map, "incidentsTC");
VertexAutoAttribute< NoTypeNameAttribute< std::vector<Dart> > > vecDartsPerVertex(m_map, "incidents");
VertexAutoAttribute< NoTypeNameAttribute< std::vector<unsigned int> > > vecNormIndPerVertex(m_map, "incidentsN");
VertexAutoAttribute< NoTypeNameAttribute< std::vector<unsigned int> > > vecTCIndPerVertex(m_map, "incidentsTC");
unsigned int currentGroup = 0;
......
......@@ -314,8 +314,8 @@ bool importSVG(typename PFP::MAP& map, const std::string& filename, VertexAttrib
CellMarker<EDGE> brokenMark(map);
EdgeAttribute<float> edgeWidth = map.template addAttribute<float, EDGE>("width");
EdgeAttribute<NoMathAttribute<Geom::Plane3D<typename PFP::REAL> > > edgePlanes = map.template addAttribute<NoMathAttribute<Geom::Plane3D<typename PFP::REAL> >, EDGE>("planes");
// EdgeAttribute<NoMathAttribute<Geom::Plane3D<typename PFP::REAL> > > edgePlanes = map.template addAttribute<NoMathAttribute<Geom::Plane3D<typename PFP::REAL> >, EDGE>("planes");
EdgeAttribute<NoTypeNameAttribute<Geom::Plane3D<typename PFP::REAL> > > edgePlanes = map.template addAttribute<NoTypeNameAttribute<Geom::Plane3D<typename PFP::REAL> >, EDGE>("planes");
/////////////////////////////////////////////////////////////////////////////////////////////
//create broken lines
DartMarker brokenL(map);
......
......@@ -49,7 +49,7 @@ bool importTet(typename PFP::MAP& map, const std::string& filename, std::vector<
AttributeContainer& container = map.template getAttributeContainer<VERTEX>() ;
unsigned int m_nbVertices = 0, m_nbVolumes = 0;
VertexAutoAttribute< NoMathIONameAttribute< std::vector<Dart> > > vecDartsPerVertex(map, "incidents");
VertexAutoAttribute< NoTypeNameAttribute< std::vector<Dart> > > vecDartsPerVertex(map, "incidents");
//open file
std::ifstream fp(filename.c_str(), std::ios::in);
......
......@@ -54,7 +54,7 @@ bool importTs(typename PFP::MAP& map, const std::string& filename, std::vector<s
AttributeContainer& container = map.template getAttributeContainer<VERTEX>() ;
unsigned int m_nbVertices = 0, m_nbVolumes = 0;
VertexAutoAttribute< NoMathIONameAttribute< std::vector<Dart> > > vecDartsPerVertex(map, "incidents");
VertexAutoAttribute< NoTypeNameAttribute< std::vector<Dart> > > vecDartsPerVertex(map, "incidents");
// open file
std::ifstream fp(filename.c_str(), std::ios::in);
......
......@@ -48,7 +48,7 @@ bool importVBGZ(typename PFP::MAP& map, const std::string& filename, std::vector
AttributeContainer& container = map.template getAttributeContainer<VERTEX>() ;
VertexAutoAttribute< NoMathIONameAttribute< std::vector<Dart> > > vecDartsPerVertex(map, "incidents");
VertexAutoAttribute< NoTypeNameAttribute< std::vector<Dart> > > vecDartsPerVertex(map, "incidents");
//open file
igzstream fs(filename.c_str(), std::ios::in|std::ios::binary);
......
......@@ -53,7 +53,7 @@ bool importVTU(typename PFP::MAP& map, const std::string& filename, std::vector<
AttributeContainer& container = map.template getAttributeContainer<VERTEX>() ;
VertexAutoAttribute< NoMathIONameAttribute< std::vector<Dart> > > vecDartsPerVertex(map, "incidents");
VertexAutoAttribute< NoTypeNameAttribute< std::vector<Dart> > > vecDartsPerVertex(map, "incidents");
xmlDocPtr doc = xmlReadFile(filename.c_str(), NULL, 0);
xmlNodePtr vtu_node = xmlDocGetRootElement(doc);
......
......@@ -58,7 +58,7 @@ protected:
// multiset typedef for simple writing
typedef std::multiset< VertexPoly,VertexPoly> VPMS;
typedef typename VPMS::iterator VMPSITER;
typedef NoMathIONameAttribute<VMPSITER> EarAttr ;
typedef NoTypeNameAttribute<VMPSITER> EarAttr ;
class VertexPoly
{
......
......@@ -436,7 +436,7 @@ protected:
bool valid ;
static std::string CGoGNnameOfType() { return "DijkstraVertexInfo" ; }
} DijkstraVertexInfo ;
typedef NoMathIOAttribute<DijkstraVertexInfo> VertexInfo ;
typedef NoTypeNameAttribute<DijkstraVertexInfo> VertexInfo ;
VertexAttribute<VertexInfo> vertexInfo ;
......@@ -483,7 +483,7 @@ protected:
bool valid ;
static std::string CGoGNnameOfType() { return "DijkstraVertexInfo" ; }
} DijkstraVertexInfo ;
typedef NoMathIOAttribute<DijkstraVertexInfo> VertexInfo ;
typedef NoTypeNameAttribute<DijkstraVertexInfo> VertexInfo ;
VertexAttribute<VertexInfo> vertexInfo ;
......
......@@ -404,112 +404,13 @@ public:
template <typename T>
void setData(unsigned int attrIndex, unsigned int eltIndex, const T& data);
/**************************************
* ARITHMETIC OPERATIONS *
**************************************/
/**
* Toggle an attribute to process
* @param index index of attribute
*/
void toggleProcess(unsigned int index);
/**
* Toggle an attribute to process
* @param index index of attribute
*/
void toggleNoProcess(unsigned int index);
/**
* copy process attributes of line j in line i
* @param i line to modify
* @param j line to copy to i
*/
void affect(unsigned int i, unsigned int j);
/**
* add process attributes of line j to line i
* @param i line to modify
* @param j line to add to i
*/
void add(unsigned int i, unsigned int j);
/**
* sub process attributes of line j from line i
* @param i line to modify
* @param j line to sub from i
*/
void sub(unsigned int i, unsigned int j);
/**
* multiy process attributes of line j by a scalar
* @param i line to multiply
* @param alpha scalar
*/
void mult(unsigned int i, double alpha);
/**
* multiy process attributes of line j by a scalar
* @param i line to multiply
* @param alpha scalar
*/
void div(unsigned int i, double alpha);
/**
* interpole process attributes A_res = alpha*A_i + (1-alpha)*A_j
* @param res result line
* @param i first line
* @param j second line
* @param alpha coefficient of interpolation
*/
void lerp(unsigned res, unsigned int i, unsigned int j, double alpha);
/**************************************
* SAVE & LOAD *
**************************************/
protected:
// /**
// * load xmlpart of container
// */
// bool loadXmlHB(xmlNodePtr node);
/**
* load xmlpart of container
*/
// bool loadXmlBWF(xmlNodePtr node);
/**
* load xmlpart of container
*/
// bool loadXmlAN(xmlNodePtr node, unsigned int nbb);
/**
* load xmlpart of container
*/
// bool loadXmlDL(xmlNodePtr node);
public:
/**
* save Xml file
* @param writer a xmlTextWriterPtr obj
* @param id the id to save
*/
// void saveXml(xmlTextWriterPtr writer, unsigned int id);
/**
* get id from xml node
* @param node the node of container node of xml tree
* @return the value of id of the node
*/
// static unsigned int getIdXmlNode(xmlNodePtr node);
/**
* load from xml node
* @param node the node of container node of xml tree
*/
// bool loadXml(xmlNodePtr node);
/**
* save binary file
* @param fs a file stream
......
......@@ -396,76 +396,4 @@ inline void AttributeContainer::setData(unsigned int attrIndex, unsigned int elt
atm->operator[](eltIndex) = data;
}
/**************************************
* ARITHMETIC OPERATIONS *
**************************************/
inline void AttributeContainer::toggleProcess(unsigned int index)
{
assert(index < m_tableAttribs.size() || !"toggleProcess: attribute index out of bounds");
assert(m_tableAttribs[index] != NULL || !"toggleProcess: attribute does not exist");
m_tableAttribs[index]->toggleProcess();
}
inline void AttributeContainer::toggleNoProcess(unsigned int index)
{
assert(index < m_tableAttribs.size() || !"toggleNoProcess: attribute index out of bounds");
assert(m_tableAttribs[index] != NULL || !"toggleNoProcess: attribute does not exist");
m_tableAttribs[index]->toggleNoProcess();
}
inline void AttributeContainer::affect(unsigned int i, unsigned int j)
{
for (std::vector<AttributeMultiVectorGen*>::iterator it = m_tableAttribs.begin(); it!= m_tableAttribs.end(); ++it)
{
if (*it != NULL)
(*it)->affect(i, j);
}
}
inline void AttributeContainer::add(unsigned int i, unsigned int j)
{
for (std::vector<AttributeMultiVectorGen*>::iterator it = m_tableAttribs.begin(); it!= m_tableAttribs.end(); ++it)
{
if ((*it) != NULL)
(*it)->add(i, j);
}
}
inline void AttributeContainer::sub(unsigned int i, unsigned int j)
{
for (std::vector<AttributeMultiVectorGen*>::iterator it = m_tableAttribs.begin(); it!= m_tableAttribs.end(); ++it)
{
if ((*it) != NULL)
(*it)->sub(i, j);
}
}
inline void AttributeContainer::mult(unsigned int i, double alpha)
{
for (std::vector<AttributeMultiVectorGen*>::iterator it = m_tableAttribs.begin(); it!= m_tableAttribs.end(); ++it)
{
if ((*it) != NULL)
(*it)->mult(i, alpha);
}
}
inline void AttributeContainer::div(unsigned int i, double alpha)
{
for (std::vector<AttributeMultiVectorGen*>::iterator it = m_tableAttribs.begin(); it!= m_tableAttribs.end(); ++it)
{
if ((*it) != NULL)
(*it)->div(i, alpha);
}
}
inline void AttributeContainer::lerp(unsigned res, unsigned int i, unsigned int j, double alpha)
{
for (std::vector<AttributeMultiVectorGen*>::iterator it = m_tableAttribs.begin(); it!= m_tableAttribs.end(); ++it)
{
if ((*it) != NULL)
(*it)->lerp(res, i, j, alpha);
}
}
} // namespace CGoGN
......@@ -159,54 +159,11 @@ public:
virtual void overwrite(unsigned int src_b, unsigned int src_id, unsigned int dst_b, unsigned int dst_id) = 0;
/**************************************
* ARITHMETIC OPERATIONS *
**************************************/
void toggleProcess();
void toggleNoProcess();
bool toProcess();
/**
* copy attribute j on i
*/
virtual void affect(unsigned int i, unsigned int j) = 0;
/**
* add attribute j to i
*/
virtual void add(unsigned int i, unsigned int j) = 0;
/**
* sub attribute j from i
*/
virtual void sub(unsigned int i, unsigned int j) = 0;
/**
* multiply attribute i by alpha
*/
virtual void mult(unsigned int i, double alpha) = 0;
/**
* divide attribute i by alpha
*/
virtual void div(unsigned int i, double alpha) = 0;
/**
* interpolate attribute i and j in res (with alpha coefficient)
*/
virtual void lerp(unsigned res, unsigned int i, unsigned int j, double alpha) = 0;
/**************************************
* SAVE & LOAD *
**************************************/
virtual std::string output(unsigned int i) = 0;
virtual void input(unsigned int i,const std::string& st) = 0;
virtual void saveBin(CGoGNostream& fs, unsigned int id) = 0;
static unsigned int loadBinInfos(CGoGNistream& fs, std::string& name, std::string& type);
......@@ -318,19 +275,6 @@ public:
* SAVE & LOAD *
**************************************/
/**
* export en string d'un element
* @param i index de l'element a sortie
*/
std::string output(unsigned int i);
/**
* import d'un element depuis une string
* @param i index de l'element a importer
* @param st string contenant l'element a importer
*/
void input(unsigned int i,const std::string& st);
/**
* Sauvegarde binaire
* @param fs filestream
......
......@@ -85,25 +85,6 @@ inline unsigned int AttributeMultiVectorGen::getBlockSize()
return _BLOCKSIZE_ ;
}
/**************************************
* ARITHMETIC OPERATIONS *
**************************************/
inline void AttributeMultiVectorGen::toggleProcess()
{
m_toProcess = true;
}
inline void AttributeMultiVectorGen::toggleNoProcess()
{
m_toProcess = false;
}
inline bool AttributeMultiVectorGen::toProcess()
{
return m_toProcess;
}
/***************************************************************************************************/
/***************************************************************************************************/
......@@ -321,82 +302,11 @@ void AttributeMultiVector<T>::overwrite(unsigned int src_b, unsigned int src_id,
m_tableData[dst_b][dst_id] = m_tableData[src_b][src_id];
}
/**************************************
* ARITHMETIC OPERATIONS *
**************************************/
template <typename T>
void AttributeMultiVector<T>::affect(unsigned int i, unsigned int j)
{
if (m_toProcess)
m_tableData[i/_BLOCKSIZE_][i%_BLOCKSIZE_] = m_tableData[j/_BLOCKSIZE_][j%_BLOCKSIZE_];
}
template <typename T>
void AttributeMultiVector<T>::add(unsigned int i, unsigned int j)
{
if (m_toProcess)
m_tableData[i/_BLOCKSIZE_][i%_BLOCKSIZE_] += m_tableData[j/_BLOCKSIZE_][j%_BLOCKSIZE_];
}
template <typename T>
void AttributeMultiVector<T>::sub(unsigned int i, unsigned int j)
{
if (m_toProcess)
m_tableData[i/_BLOCKSIZE_][i%_BLOCKSIZE_] -= m_tableData[j/_BLOCKSIZE_][j%_BLOCKSIZE_];
}
template <typename T>
void AttributeMultiVector<T>::mult(unsigned int i, double alpha)
{
if (m_toProcess)
m_tableData[i/_BLOCKSIZE_][i%_BLOCKSIZE_] *= alpha;
}
template <typename T>
void AttributeMultiVector<T>::div(unsigned int i, double alpha)
{
if (m_toProcess)
m_tableData[i/_BLOCKSIZE_][i%_BLOCKSIZE_] /= alpha;
}
template <typename T>
void AttributeMultiVector<T>::lerp(unsigned res, unsigned int i, unsigned int j, double alpha)
{
if (m_toProcess)
{
T v1 = m_tableData[i/_BLOCKSIZE_][i%_BLOCKSIZE_];
T v2 = m_tableData[j/_BLOCKSIZE_][j%_BLOCKSIZE_];
v1 *= alpha;
v2 *= 1.0 - alpha;
v1 +=