00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef products_H
00034 #define products_H
00035
00036 #include "pTraits.H"
00037
00038
00039
00040 namespace Foam
00041 {
00042
00043
00044
00045 template<class Cmpt, int rank>
00046 class typeOfRank
00047 {};
00048
00049
00050 template<class arg1, class arg2>
00051 class typeOfSum
00052 {
00053 public:
00054
00055 typedef arg1 type;
00056 };
00057
00058
00059 template<class arg1, class arg2>
00060 class outerProduct
00061 {
00062 public:
00063
00064 typedef typename typeOfRank
00065 <
00066 typename pTraits<arg1>::cmptType,
00067 int(pTraits<arg1>::rank) + int(pTraits<arg2>::rank)
00068 >::type type;
00069 };
00070
00071
00072 template<class arg1, class arg2>
00073 class crossProduct
00074 {
00075 public:
00076
00077 typedef typename typeOfRank
00078 <
00079 typename pTraits<arg2>::cmptType,
00080 int(pTraits<arg1>::rank) + int(pTraits<arg2>::rank) - 1
00081 >::type type;
00082 };
00083
00084
00085 template<class arg1, class arg2>
00086 class innerProduct
00087 {
00088 public:
00089
00090 typedef typename typeOfRank
00091 <
00092 typename pTraits<arg1>::cmptType,
00093 int(pTraits<arg1>::rank) + int(pTraits<arg2>::rank) - 2
00094 >::type type;
00095 };
00096
00097
00098 template<class arg1, class arg2>
00099 class scalarProduct
00100 {
00101 public:
00102
00103 typedef typename pTraits<arg1>::cmptType type;
00104 };
00105
00106
00107 template<class arg1, int arg2>
00108 class powProduct
00109 {
00110 public:
00111
00112 typedef typename typeOfRank
00113 <
00114 typename pTraits<arg1>::cmptType,
00115 arg2*int(pTraits<arg1>::rank)
00116 >::type type;
00117 };
00118
00119
00120
00121
00122 }
00123
00124
00125
00126 #endif
00127
00128