00001 #ifndef PhysicsTools_Utilities_Simplify_begin_h 00002 #define PhysicsTools_Utilities_Simplify_begin_h 00003 #undef PhysicsTools_Utilities_Simplify_end_h 00004 #define TYP0 00005 00006 #define TYPT1 typename A 00007 #define TYPT2 typename A, typename B 00008 #define TYPT3 typename A, typename B, typename C 00009 #define TYPT4 typename A, typename B, typename C, typename D 00010 00011 #define TYPN1 int n 00012 #define TYPN2 int n, int m 00013 #define TYPN3 int n, int m, int k 00014 #define TYPN4 int n, int m, int k, int l 00015 00016 #define TYPN1T1 int n, typename A 00017 #define TYPN1T2 int n, typename A, typename B 00018 #define TYPN2T1 int n, int m, typename A 00019 #define TYPN2T2 int n, int m, typename A, typename B 00020 #define TYPN3T1 int n, int m, int k, typename A 00021 00022 #define TYPX typename X 00023 00024 #define TYPXT1 typename X, typename A 00025 #define TYPXT2 typename X, typename A, typename B 00026 00027 #define TYPXN1 typename X, int n 00028 #define TYPXN2 typename X, int n, int m 00029 00030 #define TYPXN1T1 typename X, int n, typename A 00031 #define TYPXN2T1 typename X, int n, int m, typename A 00032 00033 #define TEMPL(X) template< TYP##X > 00034 00035 #define NUM(N) Numerical< N > 00036 #define FRACT(N, M) typename Fraction< N, M >::type 00037 #define SUM_S(A, B) SumStruct<A, B> 00038 #define MINUS_S(A) MinusStruct<A> 00039 #define PROD_S(A, B) ProductStruct<A, B> 00040 #define RATIO_S(A, B) RatioStruct<A, B> 00041 #define POWER_S(A, B) PowerStruct<A, B> 00042 #define FRACT_S(N, M) FractionStruct<N, M> 00043 #define SQRT_S(A) SqrtStruct<A> 00044 #define EXP_S(A) ExpStruct<A> 00045 #define LOG_S(A) LogStruct<A> 00046 #define SIN_S(A) SinStruct<A> 00047 #define COS_S(A) CosStruct<A> 00048 #define TAN_S(A) TanStruct<A> 00049 #define ABS_S(A) AbsStruct<A> 00050 #define SGN_S(A) SgnStruct<A> 00051 00052 #define SUM(A, B) typename Sum< A, B >::type 00053 #define DIFF(A, B) typename Difference< A, B >::type 00054 #define MINUS(A) typename Minus< A >::type 00055 #define PROD(A, B) typename Product< A, B >::type 00056 #define RATIO(A, B) typename Ratio< A, B >::type 00057 #define POWER(A, B) typename Power< A, B >::type 00058 #define SQUARE(A) typename Square< A >::type 00059 #define SQRT(A) typename Sqrt< A >::type 00060 #define EXP(A) typename Exp< A >::type 00061 #define LOG(A) typename Log< A >::type 00062 #define SIN(A) typename Sin< A >::type 00063 #define COS(A) typename Cos< A >::type 00064 #define SIN2(A) typename Sin2< A >::type 00065 #define COS2(A) typename Cos2< A >::type 00066 #define TAN(A) typename Tan< A >::type 00067 #define ABS(A) typename Abs< A >::type 00068 #define SGN(A) typename Sgn< A >::type 00069 00070 #define COMBINE(A, B, RES) \ 00071 inline static type combine (const A& _1, const B& _2) { \ 00072 return RES; \ 00073 } \ 00074 struct __useless_ignoreme 00075 00076 #define MINUS_RULE(TMPL, T, RES, COMB) \ 00077 template<TMPL> \ 00078 struct Minus<T> { \ 00079 typedef RES type; \ 00080 inline static type operate(const T& _) { return COMB; } \ 00081 } 00082 00083 #define SUM_RULE(TMPL, T1, T2, RES, COMB) \ 00084 template<TMPL> \ 00085 struct Sum<T1, T2> { \ 00086 typedef RES type; \ 00087 inline static type combine(const T1& _1, const T2 & _2) { return COMB; } \ 00088 } 00089 00090 #define DIFF_RULE(TMPL, T1, T2, RES, COMB) \ 00091 template<TMPL> \ 00092 struct Difference<T1, T2> { \ 00093 typedef RES type; \ 00094 inline static type combine(const T1& _1, const T2 & _2) { return COMB; } \ 00095 } 00096 00097 #define PROD_RULE(TMPL, T1, T2, RES, COMB) \ 00098 template<TMPL> \ 00099 struct Product<T1, T2> { \ 00100 typedef RES type; \ 00101 inline static type combine(const T1& _1, const T2 & _2) { return COMB; } \ 00102 } 00103 00104 #define RATIO_RULE(TMPL, T1, T2, RES, COMB) \ 00105 template<TMPL> \ 00106 struct Ratio<T1, T2> { \ 00107 typedef RES type; \ 00108 inline static type combine(const T1& _1, const T2 & _2) { return COMB; } \ 00109 } 00110 00111 #define POWER_RULE(TMPL, T1, T2, RES, COMB) \ 00112 template<TMPL> \ 00113 struct Power<T1, T2> { \ 00114 typedef RES type; \ 00115 inline static type combine(const T1& _1, const T2 & _2) { return COMB; } \ 00116 } 00117 00118 #define EXP_RULE(TMPL, T, RES, COMB) \ 00119 template< TMPL >\ 00120 struct Exp< T > { \ 00121 typedef RES type; \ 00122 inline static type compose(const T& _) { return COMB; } \ 00123 } 00124 00125 #define LOG_RULE(TMPL, T, RES, COMB) \ 00126 template< TMPL > \ 00127 struct Log< T > { \ 00128 typedef RES type; \ 00129 inline static type compose(const T& _) { return COMB; } \ 00130 } 00131 00132 #define SIN_RULE(TMPL, T, RES, COMB) \ 00133 template< TMPL > \ 00134 struct Sin< T > { \ 00135 typedef RES type; \ 00136 inline static type compose(const T& _) { return COMB; } \ 00137 } 00138 00139 #define COS_RULE(TMPL, T, RES, COMB) \ 00140 template< TMPL > \ 00141 struct Cos< T > { \ 00142 typedef RES type; \ 00143 inline static type compose(const T& _) { return COMB; } \ 00144 } 00145 00146 #define TAN_RULE(TMPL, T, RES, COMB) \ 00147 template< TMPL > \ 00148 struct Tan< T > { \ 00149 typedef RES type; \ 00150 inline static type compose(const T& _) { return COMB; } \ 00151 } 00152 00153 #define GET(A, RES) \ 00154 inline static type get(const A& _) { return RES; } \ 00155 \ 00156 struct __useless_ignoreme 00157 00158 #define DERIV(X, A) typename Derivative<X, A>::type 00159 #define PRIMIT(X, A) typename Primitive<A, X>::type 00160 00161 #define DERIV_RULE(TMPL, T, RES, COMB) \ 00162 template<TMPL> \ 00163 struct Derivative<X, T> \ 00164 { \ 00165 typedef RES type; \ 00166 inline static type get(const T& _) { return COMB; } \ 00167 } 00168 00169 #define PRIMIT_RULE(TMPL, T, RES, COMB) \ 00170 template<TMPL> \ 00171 struct Primitive<T, X> \ 00172 { \ 00173 typedef RES type; \ 00174 inline static type get(const T& _) { return COMB; } \ 00175 } 00176 00177 #endif