134 #include "type_parite.h" 184 explicit Tbl(
int size0) ;
195 Tbl(
int size1,
int size0) ;
209 Tbl(
int size2,
int size1,
int size0) ;
218 explicit Tbl(FILE* ) ;
282 assert (etat == ETATQCQ) ;
283 assert( dim.
ndim == 1 ) ;
285 assert( i < dim.
dim[0] ) ;
291 assert (etat == ETATQCQ) ;
292 assert( dim.
ndim == 1 ) ;
294 assert( i < dim.
dim[0] ) ;
299 assert(etat != ETATNONDEF) ;
300 assert( dim.
ndim == 1 ) ;
302 assert( i < dim.
dim[0] ) ;
303 if (etat == ETATZERO) {
311 double&
set(
int j,
int i) {
312 assert (etat == ETATQCQ) ;
313 assert( dim.
ndim == 2 ) ;
314 assert( (i>=0) && (i<dim.
dim[0]) ) ;
315 assert( (j>=0) && (j<dim.
dim[1]) ) ;
316 return t[dim.
dim[0] * j + i] ;
321 assert(etat != ETATNONDEF) ;
322 assert( dim.
ndim == 2 ) ;
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) ;
335 assert( dim.
ndim == 3 ) ;
336 assert( (i>=0) && (i<dim.
dim[0]) ) ;
337 assert( (j>=0) && (j<dim.
dim[1]) ) ;
338 assert( (k>=0) && (k<dim.
dim[2]) ) ;
339 return t[dim.
dim[1]*dim.
dim[0]*k + dim.
dim[0]*j + i] ;
344 assert(etat != ETATNONDEF) ;
345 assert( dim.
ndim == 3 ) ;
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) {
353 else return t[dim.
dim[1]*dim.
dim[0]*k + dim.
dim[0]*j + i] ;
357 double&
set(
const Itbl place) {
358 int n = place.get_dim(0) ;
359 assert (n == dim.
ndim) ;
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) ;
374 assert (n == dim.
ndim) ;
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 ;
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)