00001
00002
00031 #if !defined(__geom_content_h__)
00032 #define __geom_content_h__
00033
00034
00035 #if defined(DEBUG_geom) && !defined(DEBUG_content)
00036 #define DEBUG_content
00037 #endif
00038
00039 #ifdef DEBUG_content
00040 #ifndef DEBUG_FixedArray
00041 #define DEBUG_FixedArray
00042 #endif
00043 #endif
00044
00045 #include "../defs.h"
00046
00047 #include "Point.h"
00048
00049 #include "../../ads/tensor/SquareMatrix.h"
00050
00051 BEGIN_NAMESPACE_GEOM
00052
00053
00054
00056
00057
00058
00060
00064 template<int N, typename T>
00065 T
00066 computeDistance(const ads::FixedArray<N,T>& x, const ads::FixedArray<N,T>& y);
00067
00068
00070 template<int N, typename T>
00071 T
00072 computeDistance(const ads::FixedArray<2, ads::FixedArray<N,T> >& x);
00073
00074
00075
00077
00081 template<int N, typename T>
00082 T
00083 computeContent(const ads::FixedArray<N,T>& x, const ads::FixedArray<N,T>& y);
00084
00085
00087 template<int N, typename T>
00088 T
00089 computeContent(const ads::FixedArray<2, ads::FixedArray<N,T> >& x);
00090
00091
00092
00094 template<int N, typename T>
00095 void
00096 computeGradientOfDistance(const ads::FixedArray<N,T>& x,
00097 const ads::FixedArray<N,T>& y,
00098 ads::FixedArray<N,T>* gradient);
00099
00100
00102 template<int N, typename T>
00103 void
00104 computeGradientOfDistance(const ads::FixedArray<2, ads::FixedArray<N,T> >& x,
00105 ads::FixedArray<N,T>* gradient);
00106
00107
00108
00110 template<int N, typename T>
00111 void
00112 computeGradientOfContent(const ads::FixedArray<N,T>& x,
00113 const ads::FixedArray<N,T>& y,
00114 ads::FixedArray<N,T>* gradient);
00115
00116
00118 template<int N, typename T>
00119 void
00120 computeGradientOfContent(const ads::FixedArray<2, ads::FixedArray<N,T> >& x,
00121 ads::FixedArray<N,T>* gradient);
00122
00123
00124
00125
00127
00128
00129
00131
00134 template<typename T>
00135 T
00136 computeArea(const ads::FixedArray<2,T>& a, const ads::FixedArray<2,T>& b,
00137 const ads::FixedArray<2,T>& c);
00138
00139
00141
00144 template<typename T>
00145 T
00146 computeArea(const ads::FixedArray<3, ads::FixedArray<2,T> >& p);
00147
00148
00150
00153 template<typename T>
00154 T
00155 computeArea(const ads::FixedArray<3,T>& a, const ads::FixedArray<3,T>& b,
00156 const ads::FixedArray<3,T>& c);
00157
00158
00160
00163 template<typename T>
00164 T
00165 computeArea(const ads::FixedArray<3, ads::FixedArray<3,T> >& p);
00166
00167
00168
00170
00174 template<int N, typename T>
00175 T
00176 computeContent(const ads::FixedArray<N,T>& a, const ads::FixedArray<N,T>& b,
00177 const ads::FixedArray<N,T>& c);
00178
00179
00181 template<int N, typename T>
00182 T
00183 computeContent(const ads::FixedArray<3, ads::FixedArray<N,T> >& p);
00184
00185
00186
00188 template<typename T>
00189 void
00190 computeGradientOfArea(const ads::FixedArray<2,T>& a,
00191 const ads::FixedArray<2,T>& b,
00192 const ads::FixedArray<2,T>& c,
00193 ads::FixedArray<2,T>* gradient);
00194
00195
00197 template<typename T>
00198 void
00199 computeGradientOfArea(const ads::FixedArray<3,T>& a,
00200 const ads::FixedArray<3,T>& b,
00201 const ads::FixedArray<3,T>& c,
00202 ads::FixedArray<3,T>* gradient);
00203
00204
00206 template<int N, typename T>
00207 void
00208 computeGradientOfArea(const ads::FixedArray<3, ads::FixedArray<N,T> >& p,
00209 ads::FixedArray<N,T>* gradient);
00210
00211
00213
00216 template<int N, typename T>
00217 inline
00218 void
00219 computeGradientOfContent(const ads::FixedArray<N,T>& a,
00220 const ads::FixedArray<N,T>& b,
00221 const ads::FixedArray<N,T>& c,
00222 ads::FixedArray<N,T>* gradient) {
00223 computeGradientOfArea(a, b, c, gradient);
00224 }
00225
00226
00228
00231 template<int N, typename T>
00232 inline
00233 void
00234 computeGradientOfContent(const ads::FixedArray<3, ads::FixedArray<N,T> >& p,
00235 ads::FixedArray<N,T>* gradient) {
00236 computeGradientOfArea(p, gradient);
00237 }
00238
00239
00240
00241
00243
00244
00245
00247
00251 template<int N, typename T>
00252 T
00253 computeVolume(const ads::FixedArray<N,T>& a, const ads::FixedArray<N,T>& b,
00254 const ads::FixedArray<N,T>& c, const ads::FixedArray<N,T>& d);
00255
00256
00258 template<int N, typename T>
00259 T
00260 computeVolume(const ads::FixedArray<4, ads::FixedArray<N,T> >& p);
00261
00262
00263
00265
00271 template<int N, typename T>
00272 inline
00273 T
00274 computeContent(const ads::FixedArray<N,T>& a, const ads::FixedArray<N,T>& b,
00275 const ads::FixedArray<N,T>& c, const ads::FixedArray<N,T>& d) {
00276 return computeVolume(a, b, c, d);
00277 }
00278
00279
00281
00287 template<int N, typename T>
00288 inline
00289 T
00290 computeContent(const ads::FixedArray<4, ads::FixedArray<N,T> >& p) {
00291 return computeVolume(p);
00292 }
00293
00294
00295
00297 template<typename T>
00298 void
00299 computeGradientOfVolume(const ads::FixedArray<3,T>& a,
00300 const ads::FixedArray<3,T>& b,
00301 const ads::FixedArray<3,T>& c,
00302 const ads::FixedArray<3,T>& d,
00303 ads::FixedArray<3,T>* gradient);
00304
00305
00307 template<int N, typename T>
00308 inline
00309 void
00310 computeGradientOfVolume(const ads::FixedArray<4, ads::FixedArray<N,T> >& p,
00311 ads::FixedArray<N,T>* gradient) {
00312 computeGradientOfVolume(p[0], p[1], p[2], p[3], gradient);
00313 }
00314
00315
00316
00318
00321 template<int N, typename T>
00322 inline
00323 void
00324 computeGradientOfContent(const ads::FixedArray<N,T>& a,
00325 const ads::FixedArray<N,T>& b,
00326 const ads::FixedArray<N,T>& c,
00327 const ads::FixedArray<N,T>& d,
00328 ads::FixedArray<N,T>* gradient) {
00329 computeGradientOfVolume(a, b, c, d, gradient);
00330 }
00331
00332
00334
00337 template<int N, typename T>
00338 inline
00339 void
00340 computeGradientOfContent(const ads::FixedArray<4, ads::FixedArray<N,T> >& p,
00341 ads::FixedArray<N,T>* gradient) {
00342 computeGradientOfVolume(p, gradient);
00343 }
00344
00345
00346
00347
00348 END_NAMESPACE_GEOM
00349
00350 #define __geom_content_ipp__
00351 #include "content.ipp"
00352 #undef __geom_content_ipp__
00353
00354 #endif