00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef TSV_META_COMPARE_H
00012 #define TSV_META_COMPARE_H
00013
00015
00016
00017
00019
00020 template<class T1, class T2, unsigned D>
00021 struct TSV_MetaCompareArrays
00022 {
00023 inline static bool
00024 apply(const T1* lhs, const T2* rhs) {
00025 for (int i = 0; i < D; i++)
00026 if (lhs[i] != rhs[i])
00027 return false;
00028 return true;
00029 }
00030 };
00031
00032
00034
00035
00036
00038
00039 template<class T1, class T2> struct TSV_MetaCompare {};
00040
00042
00043
00044
00046
00047 template<class T1, class T2, unsigned D>
00048 struct TSV_MetaCompare< Vektor<T1,D> , Vektor<T2,D> >
00049 {
00050 inline static bool
00051 apply(const Vektor<T1,D>& lhs, const Vektor<T2,D>& rhs) {
00052 return TSV_MetaCompareArrays<T1,T2,D>::apply(&lhs[0],&rhs[0]);
00053 }
00054 };
00055
00057
00058
00059
00061
00062 template<class T1, class T2, unsigned D>
00063 struct TSV_MetaCompare< Tenzor<T1,D> , Tenzor<T2,D> >
00064 {
00065 inline static bool
00066 apply(const Tenzor<T1,D>& lhs, const Tenzor<T2,D>& rhs) {
00067 return TSV_MetaCompareArrays<T1,T2,D*D>::apply(&lhs[0],&rhs[0]);
00068 }
00069 };
00070
00072
00073
00074
00076
00077 template<class T1, class T2, unsigned D>
00078 struct TSV_MetaCompare< SymTenzor<T1,D> , SymTenzor<T2,D> >
00079 {
00080 inline static bool
00081 apply(const SymTenzor<T1,D>& lhs, const SymTenzor<T2,D>& rhs) {
00082 return TSV_MetaCompareArrays<T1,T2,D*(D+1)/2>::apply(&lhs[0],&rhs[0]);
00083 }
00084 };
00085
00087
00088
00089
00091
00092 template<class T1, class T2, unsigned D>
00093 struct TSV_MetaCompare< AntiSymTenzor<T1,D> , AntiSymTenzor<T2,D> >
00094 {
00095 inline static bool
00096 apply(const AntiSymTenzor<T1,D>& lhs, const AntiSymTenzor<T2,D>& rhs) {
00097 return TSV_MetaCompareArrays<T1,T2,D*(D-1)/2>::apply(&lhs[0],&rhs[0]);
00098 }
00099 };
00100
00102
00103 #endif // TSV_META_COMPARE_H
00104
00105
00106
00107
00108
00109
00110