Commit 4f71806d authored by Sylvain Thery's avatar Sylvain Thery

attribute handler type checking

parent 193a7dae
...@@ -77,7 +77,10 @@ typename ATT::DATA_TYPE smooth(MAP& map, Vertex v, const ATT& attributs) ...@@ -77,7 +77,10 @@ typename ATT::DATA_TYPE smooth(MAP& map, Vertex v, const ATT& attributs)
template <typename MAP, typename ATT> template <typename MAP, typename ATT>
void applySmooth(MAP& map, const ATT& att_in, ATT& att_out) 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); att_out[v] = smooth(map,v,att_in);
}); });
......
...@@ -112,6 +112,8 @@ void computeNewPositions(MAP& map, VertexAttribute<VEC3, MAP>& pos) ...@@ -112,6 +112,8 @@ void computeNewPositions(MAP& map, VertexAttribute<VEC3, MAP>& pos)
template<typename ATTRIB> template<typename ATTRIB>
void dumpAttribute(const ATTRIB& attr) 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; 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 ! // NEVER USE 0 AND ++ IN FOR LOOP ON ATTRIBUTE !
......
...@@ -33,6 +33,14 @@ ...@@ -33,6 +33,14 @@
#include "Container/fakeAttribute.h" #include "Container/fakeAttribute.h"
#include "Topology/generic/cells.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 namespace CGoGN
{ {
...@@ -78,7 +86,7 @@ protected: ...@@ -78,7 +86,7 @@ protected:
* - [ dart ] * - [ dart ]
* - begin / end / next to manage indexing * - begin / end / next to manage indexing
*/ */
template <typename T, unsigned int ORBIT, typename MAP> template <typename T, unsigned int ORB, typename MAP>
class AttributeHandler : public AttributeHandlerGen class AttributeHandler : public AttributeHandlerGen
{ {
protected: protected:
...@@ -92,6 +100,7 @@ protected: ...@@ -92,6 +100,7 @@ protected:
public: public:
typedef T DATA_TYPE ; typedef T DATA_TYPE ;
static const unsigned int ORBIT = ORB;
/** /**
* Default constructor * Default constructor
...@@ -110,7 +119,7 @@ public: ...@@ -110,7 +119,7 @@ public:
* Copy constructor * Copy constructor
* @param ta the table attribute * @param ta the table attribute
*/ */
AttributeHandler(const AttributeHandler<T, ORBIT, MAP>& ta) ; AttributeHandler(const AttributeHandler<T, ORB, MAP>& ta) ;
/** /**
* Transmute Constructor * Transmute Constructor
...@@ -124,14 +133,14 @@ public: ...@@ -124,14 +133,14 @@ public:
* affectation operator * affectation operator
* @param ta the table attribute to affect to this * @param ta the table attribute to affect to this
*/ */
AttributeHandler<T, ORBIT, MAP>& operator=(const AttributeHandler<T, ORBIT, MAP>& ta) ; AttributeHandler<T, ORB, MAP>& operator=(const AttributeHandler<T, ORB, MAP>& ta) ;
/** /**
* transmuted affectation operator * transmuted affectation operator
* @param ta the table attribute to affect to this * @param ta the table attribute to affect to this
*/ */
template <unsigned int ORBIT2> template <unsigned int ORBIT2>
AttributeHandler<T, ORBIT, MAP>& operator=(const AttributeHandler<T, ORBIT2, MAP>& ta) ; AttributeHandler<T, ORB, MAP>& operator=(const AttributeHandler<T, ORBIT2, MAP>& ta) ;
/** /**
* Destructor (empty & virtual) * Destructor (empty & virtual)
...@@ -190,12 +199,12 @@ public: ...@@ -190,12 +199,12 @@ public:
/** /**
* [] operator with cell parameter * [] operator with cell parameter
*/ */
T& operator[](Cell<ORBIT> c) ; T& operator[](Cell<ORB> c) ;
/** /**
* const [] operator with cell parameter * const [] operator with cell parameter
*/ */
const T& operator[](Cell<ORBIT> c) const ; const T& operator[](Cell<ORB> c) const ;
/** /**
* at operator (same as [] but with index parameter) * at operator (same as [] but with index parameter)
...@@ -241,75 +250,39 @@ public: ...@@ -241,75 +250,39 @@ public:
void next(unsigned int& iter) const; void next(unsigned int& iter) const;
} ; } ;
/** /**
* shortcut class for Dart Attribute (Handler) * c++11 shortcut for Dart Attribute (Handler)
*/ */
template <typename T, typename MAP> template <typename T, typename MAP>
class DartAttribute : public AttributeHandler<T, DART, MAP> using DartAttribute = 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; }
};
/** /**
* shortcut class for Vertex Attribute (Handler) * c++11 shortcut for Vertex Attribute (Handler)
*/ */
template <typename T, typename MAP> template <typename T, typename MAP>
class VertexAttribute : public AttributeHandler<T, VERTEX, MAP> using VertexAttribute = 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; }
};
/** /**
* shortcut class for Edge Attribute (Handler) * c++11 shortcut for Edge Attribute (Handler)
*/ */
template <typename T, typename MAP> template <typename T, typename MAP>
class EdgeAttribute : public AttributeHandler<T, EDGE, MAP> using EdgeAttribute = 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; }
};
/** /**
* shortcut class for Face Attribute (Handler) * c++11 shortcut for Face Attribute (Handler)
*/ */
template <typename T, typename MAP> template <typename T, typename MAP>
class FaceAttribute : public AttributeHandler<T, FACE, MAP> using FaceAttribute = 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; }
};
/** /**
* shortcut class for Volume Attribute (Handler) * c++11 shortcut for Volume Attribute (Handler)
*/ */
template <typename T, typename MAP> template <typename T, typename MAP>
class VolumeAttribute : public AttributeHandler<T, VOLUME, MAP> using VolumeAttribute = 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; }
};
// turn_to<b>(A*</b> obj) changes class of the object // turn_to<b>(A*</b> obj) changes class of the object
......
...@@ -86,102 +86,39 @@ struct RefCompo3Type ...@@ -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 template <typename T1, typename T2, typename T3, unsigned int ORB, typename MAP>
{ class Cell3Attributes: public AttributeHandlerGen
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
{ {
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 AttributeHandler<T1, ORB, MAP>& m_h1;
{ AttributeHandler<T2, ORB, MAP>& m_h2;
return RefCompo3Type<T1,T2,T3>(m_h1[d],m_h2[d],m_h3[d]); AttributeHandler<T3, ORB, MAP>& m_h3;
}
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;
public: public:
typedef Compo3Type<T1,T2,T3> DATA_TYPE; typedef Compo3Type<T1,T2,T3> DATA_TYPE;
typedef RefCompo3Type<T1,T2,T3> REF_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) {} 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) RefCompo3Type<T1,T2,T3> operator[](unsigned int a)
{ {
return RefCompo3Type<T1,T2,T3>(m_h1[a],m_h2[a],m_h3[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]);
} }
const RefCompo3Type<T1,T2,T3> operator[](unsigned int a) const const RefCompo3Type<T1,T2,T3> operator[](unsigned int a) const
...@@ -189,51 +126,24 @@ public: ...@@ -189,51 +126,24 @@ public:
return RefCompo3Type<T1,T2,T3>(m_h1[a],m_h2[a],m_h3[a]); return RefCompo3Type<T1,T2,T3>(m_h1[a],m_h2[a],m_h3[a]);
} }
const RefCompo3Type<T1,T2,T3> operator[](Face d) const const RefCompo3Type<T1,T2,T3> operator[](Cell<ORB> c) const
{ {
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]);
} }
static unsigned int getOrbit() { return FACE; }
}; };
template <typename T1, typename T2, typename T3> template <typename T1, typename T2, typename T3, typename MAP>
class Volume3Attributes using Vertex3Attributes = Cell3Attributes<T1, T2, T3, VERTEX, MAP>;
{
VolumeAttribute<T1>& m_h1;
VolumeAttribute<T2>& m_h2;
VolumeAttribute<T3>& m_h3;
public:
typedef Compo3Type<T1,T2,T3> DATA_TYPE;
typedef RefCompo3Type<T1,T2,T3> REF_DATA_TYPE;
Volume3Attributes(VolumeAttribute<T1>& h1, VolumeAttribute<T2>& h2, VolumeAttribute<T2>& h3): template <typename T1, typename T2, typename T3, typename MAP>
m_h1(h1), m_h2(h2), m_h3(h3) {} using Edge3Attributes = Cell3Attributes<T1, T2, T3, EDGE, MAP>;
RefCompo3Type<T1,T2,T3> operator[](unsigned int a) template <typename T1, typename T2, typename T3, typename MAP>
{ using Face3Attributes = Cell3Attributes<T1, T2, T3, FACE, MAP>;
return RefCompo3Type<T1,T2,T3>(m_h1[a],m_h2[a],m_h3[a]);
}
RefCompo3Type<T1,T2,T3> operator[](Vol 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[](Vol d) const
{
return RefCompo3Type<T1,T2,T3>(m_h1[d],m_h2[d],m_h3[d]);
}
static unsigned int getOrbit() { return VOLUME; }
};
template <typename T1, typename T2, typename T3, typename MAP>
using Volume3Attributes = Cell3Attributes<T1, T2, T3, VOLUME, MAP>;
/// implementation /// implementation
......
...@@ -88,105 +88,43 @@ struct RefCompo4Type ...@@ -88,105 +88,43 @@ struct RefCompo4Type
template <typename T1, typename T2, typename T3, typename T4> //template <typename T1, typename T2, typename T3, typename T4>
class Vertex4Attributes //class Vertex4Attributes
template <typename T1, typename T2, typename T3, typename T4, unsigned int ORB, typename MAP>
class Cell4Attributes: public AttributeHandlerGen
{ {
VertexAttribute<T1>& m_h1; AttributeHandler<T1, ORB, MAP>& m_h1;
VertexAttribute<T2>& m_h2; AttributeHandler<T2, ORB, MAP>& m_h2;
VertexAttribute<T3>& m_h3; AttributeHandler<T3, ORB, MAP>& m_h3;
VertexAttribute<T4>& m_h4; AttributeHandler<T4, ORB, MAP>& m_h4;
public:
typedef Compo4Type<T1,T2,T3,T4> DATA_TYPE;
typedef RefCompo4Type<T1,T2,T3,T4> REF_DATA_TYPE;
Vertex4Attributes(VertexAttribute<T1>& h1, VertexAttribute<T2>& h2, VertexAttribute<T3>& h3, VertexAttribute<T4>& h4):
m_h1(h1), m_h2(h2), m_h3(h3), m_h4(h4) {}
RefCompo4Type<T1,T2,T3,T4> operator[](unsigned int a)
{
return RefCompo4Type<T1,T2,T3,T4>(m_h1[a],m_h2[a],m_h3[a],m_h4[a]);
}
RefCompo4Type<T1,T2,T3,T4> operator[](Vertex d)
{
return RefCompo4Type<T1,T2,T3,T4>(m_h1[d],m_h2[d],m_h3[d],m_h4[d]);
}
const RefCompo4Type<T1,T2,T3,T4> operator[](unsigned int a) const
{
return RefCompo4Type<T1,T2,T3,T4>(m_h1[a],m_h2[a],m_h3[a],m_h4[a]);
}
const RefCompo4Type<T1,T2,T3,T4> operator[](Vertex d) const
{
return RefCompo4Type<T1,T2,T3,T4>(m_h1[d],m_h2[d],m_h3[d],m_h4[d]);
}
static unsigned int getOrbit() { return VERTEX; }
};
template <typename T1, typename T2, typename T3, typename T4>
class Edge4Attributes
{
EdgeAttribute<T1>& m_h1;
EdgeAttribute<T2>& m_h2;
EdgeAttribute<T3>& m_h3;
EdgeAttribute<T4>& m_h4;
public: public:
typedef Compo4Type<T1,T2,T3,T4> DATA_TYPE; typedef Compo4Type<T1,T2,T3,T4> DATA_TYPE;
typedef RefCompo4Type<T1,T2,T3,T4> REF_DATA_TYPE; typedef RefCompo4Type<T1,T2,T3,T4> REF_DATA_TYPE;
Edge4Attributes(EdgeAttribute<T1>& h1, EdgeAttribute<T2>& h2, EdgeAttribute<T3>& h3, EdgeAttribute<T4>& h4): Cell4Attributes(AttributeHandler<T1, ORB, MAP>& h1,
AttributeHandler<T2, ORB, MAP>& h2,
AttributeHandler<T3, ORB, MAP>& h3,
AttributeHandler<T4, ORB, MAP>& h4) :
AttributeHandlerGen(true),
m_h1(h1), m_h2(h2), m_h3(h3), m_h4(h4) {} m_h1(h1), m_h2(h2), m_h3(h3), m_h4(h4) {}
RefCompo4Type<T1,T2,T3,T4> operator[](unsigned int a) static const unsigned int ORBIT = ORB;
{ virtual int getSizeOfType() const {return m_h1.getSizeOfType()+m_h2.getSizeOfType()+m_h3.getSizeOfType()+m_h4.getSizeOfType(); }
return RefCompo4Type<T1,T2,T3,T4>(m_h1[a],m_h2[a],m_h3[a],m_h4[a]); 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();}
RefCompo4Type<T1,T2,T3,T4> operator[](Edge d) virtual AttributeMultiVectorGen* getDataVectorGen() const { return NULL;}
{
return RefCompo4Type<T1,T2,T3,T4>(m_h1[d],m_h2[d],m_h3[d],m_h4[d]);
}
const RefCompo4Type<T1,T2,T3,T4> operator[](unsigned int a) const
{
return RefCompo4Type<T1,T2,T3,T4>(m_h1[a],m_h2[a],m_h3[a],m_h4[a]);
}
const RefCompo4Type<T1,T2,T3,T4> operator[](Edge d) const
{
return RefCompo4Type<T1,T2,T3,T4>(m_h1[d],m_h2[d],m_h3[d],m_h4[d]);
}
static unsigned int getOrbit() { return EDGE; }
};
template <typename T1, typename T2, typename T3, typename T4>
class Face4Attributes
{
FaceAttribute<T1>& m_h1;
FaceAttribute<T2>& m_h2;
FaceAttribute<T3>& m_h3;
FaceAttribute<T4>& m_h4;
public:
typedef Compo4Type<T1,T2,T3,T4> DATA_TYPE;
typedef RefCompo4Type<T1,T2,T3,T4> REF_DATA_TYPE;
Face4Attributes(FaceAttribute<T1>& h1, FaceAttribute<T2>& h2, FaceAttribute<T3>& h3, FaceAttribute<T4>& h4):
m_h1(h1), m_h2(h2), m_h3(h3), m_h4(h4) {}
RefCompo4Type<T1,T2,T3,T4> operator[](unsigned int a) RefCompo4Type<T1,T2,T3,T4> operator[](unsigned int a)
{ {
return RefCompo4Type<T1,T2,T3,T4>(m_h1[a],m_h2[a],m_h3[a],m_h4[a]); return RefCompo4Type<T1,T2,T3,T4>(m_h1[a],m_h2[a],m_h3[a],m_h4[a]);
} }
RefCompo4Type<T1,T2,T3,T4> operator[](Face d) RefCompo4Type<T1,T2,T3,T4> operator[](Cell<ORB> c)
{ {
return RefCompo4Type<T1,T2,T3,T4>(m_h1[d],m_h2[d],m_h3[d],m_h4[d]); return RefCompo4Type<T1,T2,T3,T4>(m_h1[c],m_h2[c],m_h3[c],m_h4[c]);
} }
const RefCompo4Type<T1,T2,T3,T4> operator[](unsigned int a) const const RefCompo4Type<T1,T2,T3,T4> operator[](unsigned int a) const
...@@ -194,51 +132,24 @@ public: ...@@ -194,51 +132,24 @@ public:
return RefCompo4Type<T1,T2,T3,T4>(m_h1[a],m_h2[a],m_h3[a],m_h4[a]); return RefCompo4Type<T1,T2,T3,T4>(m_h1[a],m_h2[a],m_h3[a],m_h4[a]);
} }
const RefCompo4Type<T1,T2,T3,T4> operator[](Face d) const const RefCompo4Type<T1,T2