90 #include "utilitaires.h" 119 Itbl::Itbl(
int n2,
int n1,
int n0) : etat(ETATQCQ), dim(n2, n1, n0) {
139 if (tc.
etat == ETATQCQ) {
157 if (
etat == ETATQCQ) {
171 if (
t != 0x0)
delete []
t ;
183 assert(tx.
get_etat() != ETATNONDEF) ;
193 for (
int i=0 ; i<n ; i++) {
199 cout <<
"Erreur bizarre !" << endl ;
215 for (
int i=0 ; i<n ; i++) {
233 if (
etat == ETATQCQ) {
244 if (
t != 0x0)
delete []
t ;
251 if (
etat == ETATZERO) return ;
258 if (
etat == ETATNONDEF) return ;
265 if (
etat == ETATQCQ) return ;
268 assert( (
etat == ETATZERO) || (
etat == ETATNONDEF) ) ;
294 ostream& operator<<(ostream& o,
const Itbl& t) {
298 o.setf(ios::showpoint);
299 o <<
"*** Itbl " << ndim <<
"D" <<
" size: " ;
300 for (
int i = 0; i<ndim-1; i++) {
303 o << t.
get_dim(ndim-1) << endl ;
306 o <<
"Identically ZERO" << endl ;
311 o <<
"UNDEFINED STATE" << endl ;
315 assert(t.
etat == ETATQCQ) ;
319 for (
int i=0 ; i<t.
get_dim(0) ; i++) {
328 for (
int j=0 ; j<t.
get_dim(1) ; j++) {
329 o <<
" J = " << j <<
" : " << endl ;
330 for (
int i=0 ; i<t.
get_dim(0) ; i++) {
331 o <<
" " << t(j, i) ;
340 for (
int k=0 ; k<t.
get_dim(2) ; k++) {
341 o <<
" K = " << k <<
" : " << endl ;
342 for (
int j=0 ; j<t.
get_dim(1) ; j++) {
343 o <<
" J = " << j <<
" : " ;
344 for (
int i=0 ; i<t.
get_dim(0) ; i++) {
345 o <<
" " << t(k, j, i) ;
356 cout <<
"operator<< Itbl : unexpected dimension !" << endl ;
357 cout <<
" ndim = " << ndim << endl ;
void del_t()
Logical destructor: dellocates the memory occupied by the array t and sets the logical state to ETATN...
Itbl(int size0)
1D constructor.
void sauve(FILE *) const
Save in a file.
int get_taille() const
Gives the total size (ie dim.taille )
int get_ndim() const
Gives the number of dimensions (ie dim.ndim )
void annule_hard()
Sets the Itbl to zero in a hard way.
Basic integer array class.
Dim_tbl dim
Number of dimensions, size,...
void sauve(FILE *) const
Save in a file.
void set_etat_nondef()
Sets the logical state to ETATNONDEF (undefined).
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
int fwrite_be(const int *aa, int size, int nb, FILE *fich)
Writes integer(s) into a binary file according to the big endian convention.
int get_etat() const
Gives the logical state.
int fread_be(int *aa, int size, int nb, FILE *fich)
Reads integer(s) from a binary file according to the big endian convention.
Storage of array dimensions.
void operator=(const Itbl &)
Assignment to another Itbl.
int get_dim(int i) const
Gives the i th dimension (ie {tt dim.dim[i] )
int * t
The array of int 's.
void set_etat_zero()
Sets the logical state to ETATZERO (zero).
int etat
logical state (ETATNONDEF , ETATQCQ or ETATZERO ).