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 #ifndef __MTBL_H_
00030 #define __MTBL_H_
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097 #include "tbl.h"
00098 #include "grilles.h"
00099
00100 class Coord ;
00101
00114 class Mtbl {
00115
00116
00117
00118 private:
00120 const Mg3d* mg ;
00122 int nzone ;
00124 int etat ;
00125
00126 public:
00128 Tbl** t;
00129
00130
00131
00132
00133 public:
00135 explicit Mtbl(const Mg3d& mgrid) ;
00137 explicit Mtbl(const Mg3d* p_mgrid) ;
00139 Mtbl(const Mg3d&, FILE* ) ;
00141 Mtbl(const Coord& c) ;
00143 Mtbl(const Mtbl& a) ;
00145 ~Mtbl() ;
00146
00147
00148
00149 public:
00151 void operator=(const Mtbl& ) ;
00153 void operator=(double ) ;
00155 void operator=(int ) ;
00156
00157
00158
00159 private:
00163 void del_t() ;
00164
00165 public:
00166
00171 void set_etat_nondef() ;
00172
00177 void set_etat_zero() ;
00178
00185 void set_etat_qcq() ;
00186
00195 void annule_hard() ;
00196
00207 void annule(int l_min, int l_max) ;
00208
00209
00210
00211
00212 public:
00217 Tbl& set(int l) {
00218 assert(l < nzone) ;
00219 assert(etat == ETATQCQ) ;
00220 return *(t[l]) ;
00221 };
00222
00223
00228 const Tbl& operator()(int l) const {
00229 assert(l < nzone) ;
00230 assert(etat == ETATQCQ) ;
00231 return *(t[l]) ;
00232 };
00233
00241 double& set(int l, int k, int j, int i) {
00242 assert(l < nzone) ;
00243 assert(etat == ETATQCQ) ;
00244 return (t[l])->set(k, j, i) ;
00245 };
00246
00247
00255 double operator()(int l, int k, int j, int i) const {
00256 assert(etat != ETATNONDEF) ;
00257 assert(l < nzone) ;
00258 if (etat == ETATZERO) {
00259 double zero = 0. ;
00260 return zero ;
00261 }
00262 else return (*t[l])(k, j, i) ;
00263 };
00264
00265
00266
00267
00268 public:
00270 const Mg3d* get_mg() const { return mg ; };
00271
00273 int get_etat() const { return etat ; };
00274
00276 int get_nzone() const { return nzone ; } ;
00277
00278
00279
00280 public:
00282 void sauve(FILE *) const ;
00283
00290 void affiche_seuil(ostream& ostr, int precision = 4,
00291 double threshold = 1.e-7) const ;
00293 friend ostream& operator<<(ostream& , const Mtbl & ) ;
00294
00295
00296
00297 public:
00299 void operator+=(const Mtbl & ) ;
00301 void operator+=(double ) ;
00303 void operator-=(const Mtbl & ) ;
00305 void operator-=(double ) ;
00307 void operator*=(const Mtbl & ) ;
00309 void operator*=(double ) ;
00311 void operator/=(const Mtbl & ) ;
00313 void operator/=(double ) ;
00314
00315 } ;
00316 ostream& operator<<(ostream& , const Mtbl & ) ;
00317
00324
00325 Mtbl operator+(const Mtbl& ) ;
00327 Mtbl operator-(const Mtbl& ) ;
00329 Mtbl operator+(const Mtbl&, const Mtbl& ) ;
00331 Mtbl operator+(const Mtbl&, double ) ;
00333 Mtbl operator+(double , const Mtbl& ) ;
00335 Mtbl operator+(const Mtbl&, int ) ;
00337 Mtbl operator+(int, const Mtbl& ) ;
00339 Mtbl operator-(const Mtbl&, const Mtbl& ) ;
00341 Mtbl operator-(const Mtbl&, double ) ;
00343 Mtbl operator-(double, const Mtbl& ) ;
00345 Mtbl operator-(const Mtbl&, int ) ;
00347 Mtbl operator-(int, const Mtbl& ) ;
00349 Mtbl operator*(const Mtbl&, const Mtbl& ) ;
00351 Mtbl operator*(const Mtbl&, double ) ;
00353 Mtbl operator*(double, const Mtbl& ) ;
00355 Mtbl operator*(const Mtbl&, int ) ;
00357 Mtbl operator*(int, const Mtbl& ) ;
00359 Mtbl operator/(const Mtbl&, const Mtbl& ) ;
00361 Mtbl operator/(const Mtbl&, double ) ;
00363 Mtbl operator/(double, const Mtbl& ) ;
00365 Mtbl operator/(const Mtbl&, int ) ;
00367 Mtbl operator/(int, const Mtbl& ) ;
00368
00370 Mtbl sin(const Mtbl& ) ;
00372 Mtbl cos(const Mtbl& ) ;
00374 Mtbl tan(const Mtbl& ) ;
00376 Mtbl asin(const Mtbl& ) ;
00378 Mtbl acos(const Mtbl& ) ;
00380 Mtbl atan(const Mtbl& ) ;
00382 Mtbl exp(const Mtbl& ) ;
00384 Mtbl Heaviside(const Mtbl& ) ;
00386 Mtbl log(const Mtbl& ) ;
00388 Mtbl log(const Mtbl& ) ;
00390 Mtbl log10(const Mtbl& ) ;
00392 Mtbl sqrt(const Mtbl& ) ;
00394 Mtbl racine_cubique (const Mtbl&) ;
00396 Mtbl pow(const Mtbl& , int ) ;
00398 Mtbl pow(const Mtbl& , double ) ;
00400 Mtbl abs(const Mtbl& ) ;
00401
00406 double totalmax(const Mtbl& ) ;
00407
00412 double totalmin(const Mtbl& ) ;
00413
00419 Tbl max(const Mtbl& ) ;
00420
00426 Tbl min(const Mtbl& ) ;
00427
00433 Tbl norme(const Mtbl& ) ;
00434
00443 Tbl diffrel(const Mtbl& a, const Mtbl& b) ;
00444
00453 Tbl diffrelmax(const Mtbl& a, const Mtbl& b) ;
00454
00458 #endif