134#include "type_parite.h"
184 explicit Tbl(
int size0) ;
195 Tbl(
int size1,
int size0) ;
209 Tbl(
int size2,
int size1,
int size0) ;
219 explicit Tbl(FILE* ) ;
282 assert (
etat == ETATQCQ) ;
285 assert( i <
dim.
dim[0] ) ;
291 assert (
etat == ETATQCQ) ;
294 assert( i <
dim.
dim[0] ) ;
299 assert(
etat != ETATNONDEF) ;
302 assert( i <
dim.
dim[0] ) ;
303 if (
etat == ETATZERO) {
311 double&
set(
int j,
int i) {
312 assert (
etat == ETATQCQ) ;
314 assert( (i>=0) && (i<
dim.
dim[0]) ) ;
315 assert( (j>=0) && (j<
dim.
dim[1]) ) ;
321 assert(
etat != ETATNONDEF) ;
323 assert( (i>=0) && (i<
dim.
dim[0]) ) ;
324 assert( (j>=0) && (j<
dim.
dim[1]) ) ;
325 if (
etat == ETATZERO) {
329 else return t[
dim.
dim[0] * j + i] ;
333 double&
set(
int k,
int j,
int i) {
334 assert (
etat == ETATQCQ) ;
336 assert( (i>=0) && (i<
dim.
dim[0]) ) ;
337 assert( (j>=0) && (j<
dim.
dim[1]) ) ;
338 assert( (k>=0) && (k<
dim.
dim[2]) ) ;
344 assert(
etat != ETATNONDEF) ;
346 assert( (i>=0) && (i<
dim.
dim[0]) ) ;
347 assert( (j>=0) && (j<
dim.
dim[1]) ) ;
348 assert( (k>=0) && (k<
dim.
dim[2]) ) ;
349 if (
etat == ETATZERO) {
360 for (
int i=0 ; i<n ; i++)
361 assert( (place(i)>=0) && (place(i)<
dim.
dim[0]) ) ;
363 for (
int d=n-1 ; d>=0 ; d--) {
372 assert(
etat != ETATNONDEF) ;
375 for (
int i=0 ; i<n ; i++)
376 assert( (place(i)>=0) && (place(i)<
dim.
dim[0]) ) ;
377 if (
etat == ETATZERO) {
383 for (
int d=n-1 ; d>=0 ; d--) {
404 assert( (i>=0) && (i<
dim.
ndim) ) ;
411 void sauve(FILE* )
const ;
420 double threshold = 1.e-7)
const ;
438ostream& operator<<(ostream& ,
const Tbl& ) ;
469Tbl
sin(
const Tbl& ) ;
470Tbl
cos(
const Tbl& ) ;
471Tbl
tan(
const Tbl& ) ;
472Tbl
asin(
const Tbl& ) ;
473Tbl
acos(
const Tbl& ) ;
474Tbl
atan(
const Tbl& ) ;
475Tbl
exp(
const Tbl& ) ;
477Tbl
log(
const Tbl& ) ;
478Tbl
log10(
const Tbl& ) ;
479Tbl
sqrt(
const Tbl& ) ;
481Tbl
pow(
const Tbl& ,
int ) ;
482Tbl
pow(
const Tbl& ,
double ) ;
483Tbl
abs(
const Tbl& ) ;
484double max(
const Tbl& ) ;
485double min(
const Tbl& ) ;
488double norme(
const Tbl& ) ;
495double diffrel(
const Tbl& a,
const Tbl& b) ;
502double diffrelmax(
const Tbl& a,
const Tbl& b) ;
Storage of array dimensions.
int taille
Total size of the array Tbl::t.
int * dim
Array of dimensions (size: ndim).
int ndim
Number of dimensions of the Tbl: can be 1, 2 or 3.
3D grid class in one domain.
Basic integer array class.
int get_dim(int i) const
Gives the i th dimension (ie {tt dim.dim[i] )
Dim_tbl dim
Number of dimensions, size,...
void operator=(const Tbl &)
Assignment to another Tbl.
int get_ndim() const
Gives the number of dimensions (ie dim.ndim)
void operator*=(const Tbl &)
Multiplication of this by a Tbl.
double operator()(int j, int i) const
Read-only of a particular element (index (j,i)) (2D case)
int get_etat() const
Gives the logical state.
int etat
logical state (ETATNONDEF, ETATQCQ or ETATZERO).
void operator/=(const Tbl &)
Division of this by a Tbl.
void affiche_seuil(ostream &ostr, int precision=4, double threshold=1.e-7) const
Prints only the values greater than a given threshold.
void sauve(FILE *) const
Save in a file.
void annule_hard()
Sets the Tbl to zero in a hard way.
void set_etat_zero()
Sets the logical state to ETATZERO (zero).
void del_t()
Logical destructor: dellocates the memory occupied by the array t and sets the logical state to ETATN...
double operator()(int k, int j, int i) const
Read-only of a particular element (index (k,j,i)) (3D case)
double operator()(int i) const
Read-only of a particular element (index i) (1D case)
double & set(const Itbl place)
Read/write of a particular element (multi-dimensional case)
friend ostream & operator<<(ostream &, const Tbl &)
Display
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
void operator-=(const Tbl &)
Subtraction of a Tbl to this.
double & set(int i)
Read/write of a particular element (index i) (1D case)
void set_etat_nondef()
Sets the logical state to ETATNONDEF (undefined).
void affecte(int i, double val)
Affectation of a particular element (index i) (1D case)
int get_taille() const
Gives the total size (ie dim.taille)
double * t
The array of double.
double operator()(const Itbl place) const
Read-only of a particular element (index (k,j,i)) (multi-dimensional case)
double & set(int k, int j, int i)
Read/write of a particular element (index (k,j,i)) (3D case)
double & set(int j, int i)
Read/write of a particular element (index (j,i)) (2D case)
void operator+=(const Tbl &)
Addition of a Tbl to this.
int get_dim(int i) const
Gives the i-th dimension (ie dim.dim[i])
Base_val operator*(const Base_val &, const Base_val &)
This operator is used when calling multiplication or division of Valeur .
Cmp operator-(const Cmp &)
- Cmp
Cmp atan(const Cmp &)
Arctangent.
Cmp sqrt(const Cmp &)
Square root.
Cmp log10(const Cmp &)
Basis 10 logarithm.
Cmp operator/(const Cmp &, const Cmp &)
Cmp / Cmp.
Cmp exp(const Cmp &)
Exponential.
Cmp sin(const Cmp &)
Sine.
Tbl diffrel(const Cmp &a, const Cmp &b)
Relative difference between two Cmp (norme version).
Tbl norme(const Cmp &)
Sums of the absolute values of all the values of the Cmp in each domain.
Cmp acos(const Cmp &)
Arccosine.
Cmp asin(const Cmp &)
Arcsine.
Cmp racine_cubique(const Cmp &)
Cube root.
Tbl min(const Cmp &)
Minimum values of a Cmp in each domain.
Tbl max(const Cmp &)
Maximum values of a Cmp in each domain.
Cmp pow(const Cmp &, int)
Power .
Cmp cos(const Cmp &)
Cosine.
Cmp abs(const Cmp &)
Absolute value.
Tbl diffrelmax(const Cmp &a, const Cmp &b)
Relative difference between two Cmp (max version).
Cmp operator+(const Cmp &)
Cmp tan(const Cmp &)
Tangent.
Cmp log(const Cmp &)
Neperian logarithm.
Mtbl Heaviside(const Mtbl &)
Heaviside function.