93#include "type_parite.h"
148 explicit Itbl(
int size0) ;
163 Itbl(
int size1,
int size0) ;
181 Itbl(
int size2,
int size1,
int size0) ;
192 explicit Itbl(FILE* ) ;
248 assert (
etat == ETATQCQ) ;
249 assert(
dim.ndim == 1 ) ;
251 assert( i <
dim.dim[0] ) ;
257 assert(
etat != ETATNONDEF) ;
258 assert(
dim.ndim == 1 ) ;
260 assert( i <
dim.dim[0] ) ;
261 if (
etat == ETATZERO) {
270 assert (
etat == ETATQCQ) ;
271 assert(
dim.ndim == 2 ) ;
272 assert( (i>=0) && (i<
dim.dim[0]) ) ;
273 assert( (j>=0) && (j<
dim.dim[1]) ) ;
274 return t[
dim.dim[0] * j + i] ;
279 assert(
etat != ETATNONDEF) ;
280 assert(
dim.ndim == 2 ) ;
281 assert( (i>=0) && (i<
dim.dim[0]) ) ;
282 assert( (j>=0) && (j<
dim.dim[1]) ) ;
283 if (
etat == ETATZERO) {
287 else return t[
dim.dim[0] * j + i] ;
291 int&
set(
int k,
int j,
int i) {
292 assert (
etat == ETATQCQ) ;
293 assert(
dim.ndim == 3 ) ;
294 assert( (i>=0) && (i<
dim.dim[0]) ) ;
295 assert( (j>=0) && (j<
dim.dim[1]) ) ;
296 assert( (k>=0) && (k<
dim.dim[2]) ) ;
297 return t[
dim.dim[1]*
dim.dim[0]*k +
dim.dim[0]*j + i] ;
302 assert(
etat != ETATNONDEF) ;
303 assert(
dim.ndim == 3 ) ;
304 assert( (i>=0) && (i<
dim.dim[0]) ) ;
305 assert( (j>=0) && (j<
dim.dim[1]) ) ;
306 assert( (k>=0) && (k<
dim.dim[2]) ) ;
307 if (
etat == ETATZERO) {
311 else return t[
dim.dim[1]*
dim.dim[0]*k +
dim.dim[0]*j + i] ;
327 assert( (i>=0) && (i<
dim.ndim) ) ;
334 void sauve(FILE* )
const ;
350ostream& operator<<(ostream& ,
const Itbl& ) ;
361Itbl
operator+(
const Itbl&,
const Itbl&) ;
364Itbl
operator-(
const Itbl&,
const Itbl&) ;
367Itbl
operator*(
const Itbl&,
const Itbl&) ;
371Itbl
abs(
const Itbl& ) ;
372int max(
const Itbl& ) ;
373int min(
const Itbl& ) ;
376int norme(
const Itbl& ) ;
383double diffrel(
const Itbl& a,
const Itbl& b) ;
390double diffrelmax(
const Itbl& a,
const Itbl& b) ;
Storage of array dimensions.
Basic integer array class.
void operator-=(const Itbl &)
Subtraction of a Itbl to this.
Itbl(int size0)
1D constructor.
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
void del_t()
Logical destructor: dellocates the memory occupied by the array t and sets the logical state to ETATN...
void operator*=(const Itbl &)
Multiplication of this by a Itbl.
int etat
logical state (ETATNONDEF , ETATQCQ or ETATZERO ).
void set_etat_nondef()
Sets the logical state to ETATNONDEF (undefined).
int operator()(int i) const
Read-only of a particular element (index i ) (1D case).
Dim_tbl dim
Number of dimensions, size,...
int operator()(int k, int j, int i) const
Read-only of a particular element (index (k,j,i) ) (3D case).
void set_etat_zero()
Sets the logical state to ETATZERO (zero).
int get_dim(int i) const
Gives the i th dimension (ie {tt dim.dim[i] ).
int & set(int i)
Read/write of a particular element (index i ) (1D case).
int get_etat() const
Gives the logical state.
int * t
The array of int 's.
void annule_hard()
Sets the Itbl to zero in a hard way.
void operator+=(const Itbl &)
Addition of a Itbl to this.
void sauve(FILE *) const
Save in a file.
int & set(int k, int j, int i)
Read/write of a particular element (index (k,j,i) ) (3D case).
int & set(int j, int i)
Read/write of a particular element (index (j,i) ) (2D case).
int get_taille() const
Gives the total size (ie dim.taille ).
int operator()(int j, int i) const
Read-only of a particular element (index (j,i) ) (2D case).
void operator=(const Itbl &)
Assignment to another Itbl.
friend ostream & operator<<(ostream &, const Itbl &)
Display.
int get_ndim() const
Gives the number of dimensions (ie dim.ndim ).
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
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.
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 abs(const Cmp &)
Absolute value.
Tbl diffrelmax(const Cmp &a, const Cmp &b)
Relative difference between two Cmp (max version).
Cmp operator+(const Cmp &)