31char itbl_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Itbl/itbl.C,v 1.8 2014/10/13 08:53:01 j_novak Exp $" ;
87#include "utilitaires.h"
116Itbl::Itbl(
int n2,
int n1,
int n0) : etat(ETATQCQ), dim(n2, n1, n0) {
136 if (tc.
etat == ETATQCQ) {
154 if (
etat == ETATQCQ) {
168 if (
t != 0x0)
delete []
t ;
180 assert(tx.
get_etat() != ETATNONDEF) ;
190 for (
int i=0 ; i<n ; i++) {
196 cout <<
"Erreur bizarre !" << endl ;
212 for (
int i=0 ; i<n ; i++) {
230 if (
etat == ETATQCQ) {
241 if (
t != 0x0)
delete []
t ;
248 if (
etat == ETATZERO) return ;
255 if (
etat == ETATNONDEF) return ;
262 if (
etat == ETATQCQ) return ;
265 assert( (
etat == ETATZERO) || (
etat == ETATNONDEF) ) ;
291ostream& operator<<(ostream& o,
const Itbl& t) {
295 o.setf(ios::showpoint);
296 o <<
"*** Itbl " << ndim <<
"D" <<
" size: " ;
297 for (
int i = 0; i<ndim-1; i++) {
300 o << t.
get_dim(ndim-1) << endl ;
303 o <<
"Identically ZERO" << endl ;
308 o <<
"UNDEFINED STATE" << endl ;
312 assert(t.
etat == ETATQCQ) ;
316 for (
int i=0 ; i<t.
get_dim(0) ; i++) {
325 for (
int j=0 ; j<t.
get_dim(1) ; j++) {
326 o <<
" J = " << j <<
" : " << endl ;
327 for (
int i=0 ; i<t.
get_dim(0) ; i++) {
328 o <<
" " << t(j, i) ;
337 for (
int k=0 ; k<t.
get_dim(2) ; k++) {
338 o <<
" K = " << k <<
" : " << endl ;
339 for (
int j=0 ; j<t.
get_dim(1) ; j++) {
340 o <<
" J = " << j <<
" : " ;
341 for (
int i=0 ; i<t.
get_dim(0) ; i++) {
342 o <<
" " << t(k, j, i) ;
353 cout <<
"operator<< Itbl : unexpected dimension !" << endl ;
354 cout <<
" ndim = " << ndim << endl ;
Storage of array dimensions.
void sauve(FILE *) const
Save in a file.
Basic integer array class.
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...
int etat
logical state (ETATNONDEF , ETATQCQ or ETATZERO ).
void set_etat_nondef()
Sets the logical state to ETATNONDEF (undefined).
Dim_tbl dim
Number of dimensions, size,...
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 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 sauve(FILE *) const
Save in a file.
int get_taille() const
Gives the total size (ie dim.taille )
void operator=(const Itbl &)
Assignment to another Itbl.
int get_ndim() const
Gives the number of dimensions (ie dim.ndim )
int fread_be(int *aa, int size, int nb, FILE *fich)
Reads integer(s) from a binary file according to the big endian convention.
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.