137 #include "type_parite.h" 187 explicit Tbl(
int size0) ;
198 Tbl(
int size1,
int size0) ;
212 Tbl(
int size2,
int size1,
int size0) ;
229 Tbl(
int size3,
int size2,
int size1,
int size0) ;
238 explicit Tbl(FILE* ) ;
302 assert (
etat == ETATQCQ) ;
305 assert( i <
dim.
dim[0] ) ;
311 assert (
etat == ETATQCQ) ;
314 assert( i <
dim.
dim[0] ) ;
319 assert(
etat != ETATNONDEF) ;
322 assert( i <
dim.
dim[0] ) ;
323 if (
etat == ETATZERO) {
331 double&
set(
int j,
int i) {
332 assert (
etat == ETATQCQ) ;
334 assert( (i>=0) && (i<
dim.
dim[0]) ) ;
335 assert( (j>=0) && (j<
dim.
dim[1]) ) ;
341 assert(
etat != ETATNONDEF) ;
343 assert( (i>=0) && (i<
dim.
dim[0]) ) ;
344 assert( (j>=0) && (j<
dim.
dim[1]) ) ;
345 if (
etat == ETATZERO) {
349 else return t[
dim.
dim[0] * j + i] ;
353 double&
set(
int k,
int j,
int i) {
354 assert (
etat == ETATQCQ) ;
356 assert( (i>=0) && (i<
dim.
dim[0]) ) ;
357 assert( (j>=0) && (j<
dim.
dim[1]) ) ;
358 assert( (k>=0) && (k<
dim.
dim[2]) ) ;
364 assert(
etat != ETATNONDEF) ;
366 assert( (i>=0) && (i<
dim.
dim[0]) ) ;
367 assert( (j>=0) && (j<
dim.
dim[1]) ) ;
368 assert( (k>=0) && (k<
dim.
dim[2]) ) ;
369 if (
etat == ETATZERO) {
377 double&
set(
const Itbl place) {
378 int n = place.get_dim(0) ;
380 for (
int i=0 ; i<n ; i++)
381 assert( (place(i)>=0) && (place(i)<
dim.
dim[0]) ) ;
383 for (
int d=n-1 ; d>=0 ; d--) {
392 assert(
etat != ETATNONDEF) ;
395 for (
int i=0 ; i<n ; i++)
396 assert( (place(i)>=0) && (place(i)<
dim.
dim[0]) ) ;
397 if (
etat == ETATZERO) {
403 for (
int d=n-1 ; d>=0 ; d--) {
424 assert( (i>=0) && (i<
dim.
ndim) ) ;
431 void sauve(FILE* )
const ;
440 double threshold = 1.e-7)
const ;
458 ostream& operator<<(ostream& ,
const Tbl& ) ;
489 Tbl
sin(
const Tbl& ) ;
490 Tbl
cos(
const Tbl& ) ;
491 Tbl
tan(
const Tbl& ) ;
492 Tbl
asin(
const Tbl& ) ;
493 Tbl
acos(
const Tbl& ) ;
494 Tbl
atan(
const Tbl& ) ;
495 Tbl
exp(
const Tbl& ) ;
497 Tbl
log(
const Tbl& ) ;
498 Tbl
log10(
const Tbl& ) ;
499 Tbl
sqrt(
const Tbl& ) ;
501 Tbl
pow(
const Tbl& ,
int ) ;
502 Tbl
pow(
const Tbl& ,
double ) ;
503 Tbl
abs(
const Tbl& ) ;
504 double max(
const Tbl& ) ;
505 double min(
const Tbl& ) ;
508 double norme(
const Tbl& ) ;
515 double diffrel(
const Tbl& a,
const Tbl& b) ;
522 double diffrelmax(
const Tbl& a,
const Tbl& b) ;
Cmp log(const Cmp &)
Neperian logarithm.
Cmp asin(const Cmp &)
Arcsine.
Cmp exp(const Cmp &)
Exponential.
Cmp sqrt(const Cmp &)
Square root.
void operator/=(const Tbl &)
Division of this by a Tbl.
void operator-=(const Tbl &)
Subtraction of a Tbl to this.
Cmp racine_cubique(const Cmp &)
Cube root.
Base_val operator*(const Base_val &, const Base_val &)
This operator is used when calling multiplication or division of Valeur .
int taille
Total size of the array Tbl::t.
Basic integer array class.
int get_etat() const
Gives the logical state.
Cmp operator/(const Cmp &, const Cmp &)
Cmp / Cmp.
Tbl min(const Cmp &)
Minimum values of a Cmp in each domain.
Cmp cos(const Cmp &)
Cosine.
Tbl diffrel(const Cmp &a, const Cmp &b)
Relative difference between two Cmp (norme version).
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Cmp tan(const Cmp &)
Tangent.
void operator+=(const Tbl &)
Addition of a Tbl to this.
friend ostream & operator<<(ostream &, const Tbl &)
Display.
int get_ndim() const
Gives the number of dimensions (ie dim.ndim)
Tbl norme(const Cmp &)
Sums of the absolute values of all the values of the Cmp in each domain.
Cmp atan(const Cmp &)
Arctangent.
Tbl(int size0)
1D constructor
double operator()(int j, int i) const
Read-only of a particular element (index (j,i)) (2D case)
Dim_tbl dim
Number of dimensions, size,...
double operator()(int i) const
Read-only of a particular element (index i) (1D case)
Cmp operator+(const Cmp &)
double * t
The array of double.
void set_etat_nondef()
Sets the logical state to ETATNONDEF (undefined).
Tbl max(const Cmp &)
Maximum values of a Cmp in each domain.
int get_dim(int i) const
Gives the i-th dimension (ie dim.dim[i])
Cmp pow(const Cmp &, int)
Power .
int etat
logical state (ETATNONDEF, ETATQCQ or ETATZERO).
void set_etat_zero()
Sets the logical state to ETATZERO (zero).
void affiche_seuil(ostream &ostr, int precision=4, double threshold=1.e-7) const
Prints only the values greater than a given threshold.
int ndim
Number of dimensions of the Tbl: can be 1, 2 or 3.
void operator*=(const Tbl &)
Multiplication of this by a Tbl.
Storage of array dimensions.
void del_t()
Logical destructor: dellocates the memory occupied by the array t and sets the logical state to ETATN...
Cmp log10(const Cmp &)
Basis 10 logarithm.
Cmp acos(const Cmp &)
Arccosine.
Cmp abs(const Cmp &)
Absolute value.
int get_taille() const
Gives the total size (ie dim.taille)
int get_dim(int i) const
Gives the i th dimension (ie {tt dim.dim[i] )
double operator()(int k, int j, int i) const
Read-only of a particular element (index (k,j,i)) (3D case)
void sauve(FILE *) const
Save in a file.
Cmp operator-(const Cmp &)
- Cmp
Cmp sin(const Cmp &)
Sine.
Mtbl Heaviside(const Mtbl &)
Heaviside function.
double operator()(const Itbl place) const
Read-only of a particular element (index (k,j,i)) (multi-dimensional case)
void annule_hard()
Sets the Tbl to zero in a hard way.
void operator=(const Tbl &)
Assignment to another Tbl.
3D grid class in one domain.
Tbl diffrelmax(const Cmp &a, const Cmp &b)
Relative difference between two Cmp (max version).
int * dim
Array of dimensions (size: ndim).
void affecte(int i, double val)
Affectation of a particular element (index i) (1D case)