76#include "utilitaires.h"
94 if (tc.
etat == ETATQCQ) {
95 t = new double[get_taille()] ;
96 for (int i=0 ; i<get_taille() ; i++) {
131 if (
etat == ETATQCQ) {
170 assert(tx.
get_etat() != ETATNONDEF) ;
181 for (
int i=0 ; i<n ; i++) {
192 cout <<
"Erreur bizarre !" << endl ;
201 if ( a ==
double(0) ) {
207 for (
int i=0 ; i<n ; i++) {
230 for (
int i=0 ; i<n ; i++) {
255 if (
etat == ETATQCQ) {
271 if (
t != 0x0)
delete []
t ;
284 if (
etat == ETATZERO) return ;
291 if (
etat == ETATNONDEF) return ;
298 if (
etat == ETATQCQ) return ;
301 assert( (
etat == ETATZERO) || (
etat == ETATNONDEF) ) ;
340 assert (t_in != 0x0) ;
356 int ndim =
t.get_ndim() ;
358 o.setf(ios::showpoint);
359 o <<
"*** Tbl_val " << ndim <<
"D" <<
" size: " ;
360 for (
int i = 0; i<ndim-1; i++) {
361 o <<
t.get_dim(ndim-1-i) ;
362 if (ndim-i == 3) o <<
"(Y)" <<
" x " ;
363 if (ndim-i == 2) o <<
"(X)" <<
" x " ;
365 o <<
t.get_dim(0) <<
"(Z)" <<
" + " <<
t.gval->get_fantome() <<
366 " hidden cells on each side = " <<
t.get_taille() << endl ;
368 if (
t.get_etat() == ETATZERO) {
369 o <<
"Identically ZERO" << endl ;
373 if (
t.get_etat() == ETATNONDEF) {
374 o <<
"UNDEFINED STATE" << endl ;
378 assert(
t.etat == ETATQCQ) ;
382 for (
int i=0 ; i<
t.get_dim(0) ; i++) {
391 for (
int j=0 ; j<
t.get_dim(1) ; j++) {
392 o <<
" J_x " << j <<
" : " << endl ;
393 for (
int i=0 ; i<
t.get_dim(0) ; i++) {
394 o <<
" " <<
t(j, i) ;
403 for (
int k=0 ; k<
t.get_dim(2) ; k++) {
404 o <<
" K_y = " << k <<
" : " << endl ;
405 for (
int j=0 ; j<
t.get_dim(1) ; j++) {
406 o <<
" J_x = " << j <<
" : " ;
407 for (
int i=0 ; i<
t.get_dim(0) ; i++) {
408 o <<
" " <<
t(k, j, i) ;
419 cout <<
"operator<< Tbl_val : unexpected dimension !" << endl ;
420 cout <<
" ndim = " << ndim << endl ;
435 ost <<
"*** Tbl_val " << ndim <<
"D" <<
" size: " ;
436 for (
int i = 0; i<ndim-1; i++) {
439 ost <<
get_dim(ndim-1) <<
" + " <<
gval->get_fantome() <<
440 " hidden cells on each side = " <<
get_taille() << endl ;
445 if (
etat == ETATNONDEF) {
446 ost <<
" state: UNDEFINED" << endl ;
450 if (
etat == ETATZERO) {
451 ost <<
" state: ZERO" << endl ;
458 ost <<
" threshold for display : " << seuil << endl ;
459 ost.precision(precis);
460 ost.setf(ios::showpoint);
462 ost <<
" Values on the nodes, without hidden cells:" << endl ;
466 for (
int i=0; i<
get_dim(0); i++) {
467 ost <<
" " << setw(precis) << (*this)(i) ;
475 for (
int j=0; j<
get_dim(1); j++) {
476 ost <<
" #j=" << j <<
" : " ;
477 for (
int i=0; i<
get_dim(0); i++){
478 ost <<
" " << setw(precis) << (*this)(j, i) ;
487 for (
int k=0; k<
get_dim(2); k++) {
488 for (
int j=0; j<
get_dim(1); j++){
490 for (
int i=0; i<
get_dim(0); i++){
491 if ( fabs( (*
this)(k, j, i) ) >= seuil )
494 if (test_imp == 1 ) {
495 ost <<
" #k=" << k <<
",j=" << j <<
" : " ;
496 for (
int i=0; i<
get_dim(0); i++){
497 ost <<
" " << setw(precis) << (*this)(k, j, i) ;
508 cout <<
"Tbl_val:affiche_seuil : unexpected dimension !" << endl ;
509 cout <<
" get_ndim() = " <<
get_ndim() << endl ;
518 ost.unsetf(ios::showpoint);
Base class for Godunov-type grids.
void del_t()
Logical destructor: dellocates the memory occupied by the array t and sets the logical state to ETATN...
const Grille_val * gval
The Grille_val (cartesian or spherical) on which the array is defined.
void operator=(const Tbl_val &)
Assignment to another Tbl_val.
void set_etat_nondef()
Sets the logical state to ETATNONDEF (undefined).
int get_ndim() const
Gives the number of dimensions (ie dim->ndim ).
int get_dim(int i) const
Gives the i th dimension (ie dim->dim[i] , without hidden cells).
const Dim_tbl * dim
The Dim_tbl giving the dimensions and number of points (without the hidden cells).
int get_taille_i(int i) const
Gives the size of the interface arrays (including the hidden cells).
double * txti
The array at x (or ) interfaces.
double * tzri
The array at z (or r) interfaces.
void annule_hard()
Sets the Tbl_val to zero in a hard way.
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
friend ostream & operator<<(ostream &, const Tbl_val &)
Display.
double * t
The array of double at the nodes.
int get_etat() const
Gives the logical state.
Tbl_val(const Grille_val *)
Constructor from a 3D grid.
void sauve(FILE *) const
Save in a file.
double * typi
The array at y (or ) interfaces.
int get_taille() const
Gives the size of the node array (including the hidden cells).
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 etat
logical state (ETATNONDEF , ETATQCQ or ETATZERO ).
void append_array(double *t_in)
Appends an array of doubles as the main array t of this (DO NOT use it, unless you REALLY know how it...
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.