137#include "utilitaires.h"
157 dim(g.get_np(), g.get_nt(), g.get_nr()),
166 int* dims =
new int[n] ;
167 for (
int i=0 ; i<n ; i++)
181 if (tc.
etat == ETATQCQ) {
186 for (int i=0 ; i<n ; i++) {
203 if (
etat == ETATQCQ) {
214 dim( (aa.get_array()).
dim ) {
216 int nbl =
dim.dim[1] ;
217 int nbc =
dim.dim[0] ;
231 if (
etat == ETATQCQ) {
266 assert(tx.
get_etat() != ETATNONDEF) ;
278 for (
int i=0 ; i<n ; i++) {
286 cout <<
"Erreur bizarre !" << endl ;
295 if ( a ==
double(0) ) {
301 for (
int i=0 ; i<n ; i++) {
316 for (
int i=0 ; i<n ; i++) {
333 if (
etat == ETATQCQ) {
351 if (
etat == ETATZERO) return ;
358 if (
etat == ETATNONDEF) return ;
365 if (
etat == ETATQCQ) return ;
368 assert( (
etat == ETATZERO) || (
etat == ETATNONDEF) ) ;
396 int ndim =
t.get_ndim() ;
398 o.setf(ios::showpoint);
399 o <<
"*** Tbl " << ndim <<
"D" <<
" size: " ;
400 for (
int i = 0; i<ndim-1; i++) {
401 o <<
t.get_dim(i) <<
" x " ;
403 o <<
t.get_dim(ndim-1) <<
" = " <<
t.get_taille()
407 if (
t.get_etat() == ETATZERO) {
408 o <<
"Identically ZERO" << endl ;
412 if (
t.get_etat() == ETATNONDEF) {
413 o <<
"UNDEFINED STATE" << endl ;
417 assert(
t.etat == ETATQCQ) ;
421 for (
int i=0 ; i<
t.get_dim(0) ; i++) {
430 for (
int j=0 ; j<
t.get_dim(1) ; j++) {
431 o <<
" j = " << j <<
" : " << endl ;
432 for (
int i=0 ; i<
t.get_dim(0) ; i++) {
433 o <<
" " <<
t(j, i) ;
442 for (
int k=0 ; k<
t.get_dim(2) ; k++) {
443 o <<
"k = " << k <<
" : " << endl ;
444 for (
int j=0 ; j<
t.get_dim(1) ; j++) {
445 o <<
"j = " << j <<
" : " ;
446 for (
int i=0 ; i<
t.get_dim(0) ; i++) {
447 o <<
" " <<
t(k, j, i) ;
458 cout <<
"operator<< Tbl : unexpected dimension !" << endl ;
459 cout <<
" ndim = " << ndim << endl ;
474 ost <<
"*** Tbl " << ndim <<
"D" <<
" size: " ;
475 for (
int i = 0; i<ndim-1; i++) {
483 if (
etat == ETATNONDEF) {
484 ost <<
" state: UNDEFINED" << endl ;
488 if (
etat == ETATZERO) {
489 ost <<
" state: ZERO" << endl ;
496 ost <<
" threshold for display : " << seuil << endl ;
497 ost.precision(precis);
498 ost.setf(ios::showpoint);
503 for (
int i=0; i<
get_dim(0); i++) {
504 ost <<
" " << setw(precis) << (*this)(i) ;
512 for (
int j=0; j<
get_dim(1); j++) {
513 ost <<
" #j=" << j <<
" : " ;
514 for (
int i=0; i<
get_dim(0); i++){
515 ost <<
" " << setw(precis) << (*this)(j, i) ;
524 for (
int k=0; k<
get_dim(2); k++) {
525 for (
int j=0; j<
get_dim(1); j++){
527 for (
int i=0; i<
get_dim(0); i++){
528 if ( fabs( (*
this)(k, j, i) ) >= seuil )
531 if (test_imp == 1 ) {
532 ost <<
" #k=" << k <<
",j=" << j <<
" : " ;
533 for (
int i=0; i<
get_dim(0); i++){
534 ost <<
" " << setw(precis) << (*this)(k, j, i) ;
545 cout <<
"Tbl:affiche_seuil : unexpected dimension !" << endl ;
546 cout <<
" get_ndim() = " <<
get_ndim() << endl ;
555 ost.unsetf(ios::showpoint);
Storage of array dimensions.
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] ).
Tbl get_array() const
Returns the array of matrix elements.
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).
Tbl(int size0)
1D constructor
int get_etat() const
Gives the logical state.
int etat
logical state (ETATNONDEF, ETATQCQ or ETATZERO).
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...
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
void set_etat_nondef()
Sets the logical state to ETATNONDEF (undefined).
int get_taille() const
Gives the total size (ie dim.taille).
friend ostream & operator<<(ostream &, const Tbl &)
Display.
double * t
The array of double.
int get_dim(int i) const
Gives the i-th dimension (ie dim.dim[i]).
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.