Commit 7a4f43d9 authored by Sylvain Thery's avatar Sylvain Thery

set getOrbit of attribute handlers static

parent 71e149b3
...@@ -142,7 +142,7 @@ public: ...@@ -142,7 +142,7 @@ public:
/** /**
* get attribute orbit * get attribute orbit
*/ */
unsigned int getOrbit() const ; static unsigned int getOrbit() ;
/** /**
* get attribute index * get attribute index
......
...@@ -139,7 +139,7 @@ inline AttributeMultiVector<T>* AttributeHandler<T, ORBIT>::getDataVector() cons ...@@ -139,7 +139,7 @@ inline AttributeMultiVector<T>* AttributeHandler<T, ORBIT>::getDataVector() cons
} }
template <typename T, unsigned int ORBIT> template <typename T, unsigned int ORBIT>
inline unsigned int AttributeHandler<T, ORBIT>::getOrbit() const inline unsigned int AttributeHandler<T, ORBIT>::getOrbit()
{ {
return ORBIT ; return ORBIT ;
} }
......
...@@ -116,9 +116,49 @@ public: ...@@ -116,9 +116,49 @@ public:
{ {
return RefCompo3Type<T1,T2,T3>(m_h1[d],m_h2[d],m_h3[d]); 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[](Dart 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[](Dart 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> template <typename T1, typename T2, typename T3>
class Face3Attributes class Face3Attributes
{ {
...@@ -151,6 +191,8 @@ public: ...@@ -151,6 +191,8 @@ public:
{ {
return RefCompo3Type<T1,T2,T3>(m_h1[d],m_h2[d],m_h3[d]); return RefCompo3Type<T1,T2,T3>(m_h1[d],m_h2[d],m_h3[d]);
} }
static unsigned int getOrbit() { return FACE; }
}; };
template <typename T1, typename T2, typename T3> template <typename T1, typename T2, typename T3>
...@@ -185,6 +227,9 @@ public: ...@@ -185,6 +227,9 @@ public:
{ {
return RefCompo3Type<T1,T2,T3>(m_h1[d],m_h2[d],m_h3[d]); return RefCompo3Type<T1,T2,T3>(m_h1[d],m_h2[d],m_h3[d]);
} }
static unsigned int getOrbit() { return VOLUME; }
}; };
......
...@@ -119,9 +119,50 @@ public: ...@@ -119,9 +119,50 @@ public:
{ {
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[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:
typedef Compo4Type<T1,T2,T3,T4> DATA_TYPE;
typedef RefCompo4Type<T1,T2,T3,T4> REF_DATA_TYPE;
Edge4Attributes(EdgeAttribute<T1>& h1, EdgeAttribute<T2>& h2, EdgeAttribute<T3>& h3, EdgeAttribute<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[](Dart 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[](Dart 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> template <typename T1, typename T2, typename T3, typename T4>
class Face4Attributes class Face4Attributes
{ {
...@@ -155,6 +196,8 @@ public: ...@@ -155,6 +196,8 @@ public:
{ {
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[d],m_h2[d],m_h3[d],m_h4[d]);
} }
static unsigned int getOrbit() { return FACE; }
}; };
template <typename T1, typename T2, typename T3, typename T4> template <typename T1, typename T2, typename T3, typename T4>
...@@ -190,6 +233,8 @@ public: ...@@ -190,6 +233,8 @@ public:
{ {
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[d],m_h2[d],m_h3[d],m_h4[d]);
} }
static unsigned int getOrbit() { return VOLUME; }
}; };
......
...@@ -41,6 +41,9 @@ struct Compo2Type ...@@ -41,6 +41,9 @@ struct Compo2Type
Compo2Type(){} Compo2Type(){}
Compo2Type(double z ): m_v1(z), m_v2(z) {} Compo2Type(double z ): m_v1(z), m_v2(z) {}
Compo2Type(const Compo2Type<double,double>& ct ): m_v1(ct.m_v1), m_v2(ct.m_v1) {}
Compo2Type(const RefCompo2Type<T1,T2>& v); Compo2Type(const RefCompo2Type<T1,T2>& v);
Compo2Type<T1,T2>& operator =(const Compo2Type<T1,T2>& comp); Compo2Type<T1,T2>& operator =(const Compo2Type<T1,T2>& comp);
...@@ -78,6 +81,20 @@ struct RefCompo2Type ...@@ -78,6 +81,20 @@ struct RefCompo2Type
RefCompo2Type<T1,T2>& operator/=(double d); RefCompo2Type<T1,T2>& operator/=(double d);
}; };
template <typename T1, typename T2>
Compo2Type<double, double> length( const Compo2Type<T1,T2>& v)
{
Compo2Type<double, double> l;
l.m_v1 = sqrt(v.m_v1*v.m_v1);
l.m_v2 = sqrt(v.m_v2*v.m_v2);
return l;
}
template <typename T>
double length(const T& v)
{
return v.norm();
}
template <typename T1, typename T2> template <typename T1, typename T2>
...@@ -111,9 +128,49 @@ public: ...@@ -111,9 +128,49 @@ public:
{ {
return RefCompo2Type<T1,T2>(m_h1[d],m_h2[d]); return RefCompo2Type<T1,T2>(m_h1[d],m_h2[d]);
} }
static unsigned int getOrbit() { return VERTEX; }
};
template <typename T1, typename T2>
class Edge2Attributes
{
EdgeAttribute<T1>& m_h1;
EdgeAttribute<T2>& m_h2;
public:
typedef Compo2Type<T1,T2> DATA_TYPE;
typedef RefCompo2Type<T1,T2> REF_DATA_TYPE;
Edge2Attributes(EdgeAttribute<T1>& h1, EdgeAttribute<T2>& h2):
m_h1(h1), m_h2(h2) {}
RefCompo2Type<T1,T2> operator[](unsigned int a)
{
return RefCompo2Type<T1,T2>(m_h1[a],m_h2[a]);
}
RefCompo2Type<T1,T2> operator[](Dart d)
{
return RefCompo2Type<T1,T2>(m_h1[d],m_h2[d]);
}
const RefCompo2Type<T1,T2> operator[](unsigned int a) const
{
return RefCompo2Type<T1,T2>(m_h1[a],m_h2[a]);
}
const RefCompo2Type<T1,T2> operator[](Dart d) const
{
return RefCompo2Type<T1,T2>(m_h1[d],m_h2[d]);
}
static unsigned int getOrbit() { return EDGE; }
}; };
template <typename T1, typename T2> template <typename T1, typename T2>
class Face2Attributes class Face2Attributes
{ {
...@@ -146,6 +203,7 @@ public: ...@@ -146,6 +203,7 @@ public:
return RefCompo2Type<T1,T2>(m_h1[d],m_h2[d]); return RefCompo2Type<T1,T2>(m_h1[d],m_h2[d]);
} }
static unsigned int getOrbit() { return FACE; }
}; };
template <typename T1, typename T2> template <typename T1, typename T2>
...@@ -179,6 +237,9 @@ public: ...@@ -179,6 +237,9 @@ public:
{ {
return RefCompo2Type<T1,T2>(m_h1[d],m_h2[d]); return RefCompo2Type<T1,T2>(m_h1[d],m_h2[d]);
} }
static unsigned int getOrbit() { return VOLUME; }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment