76 #include "utilitaires.h" 87 dim(g->get_dim_tbl()), gval(g), t(0x0), tzri(0x0), txti(0x0), typi(0x0) {}
94 if (tc.
etat == ETATQCQ) {
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) ;
354 ostream& operator<<(ostream& o,
const Tbl_val& t) {
358 o.setf(ios::showpoint);
359 o <<
"*** Tbl_val " << ndim <<
"D" <<
" size: " ;
360 for (
int i = 0; i<ndim-1; i++) {
362 if (ndim-i == 3) o <<
"(Y)" <<
" x " ;
363 if (ndim-i == 2) o <<
"(X)" <<
" x " ;
366 " hidden cells on each side = " << t.
get_taille() << endl ;
369 o <<
"Identically ZERO" << endl ;
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++) {
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);
int get_fantome() const
Returns the number of hidden cells.
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 get_ndim() const
Gives the number of dimensions (ie dim->ndim )
void operator=(const Tbl_val &)
Assignment to another Tbl_val.
int etat
logical state (ETATNONDEF , ETATQCQ or ETATZERO ).
void set_etat_nondef()
Sets the logical state to ETATNONDEF (undefined).
void del_t()
Logical destructor: dellocates the memory occupied by the array t and sets the logical state to ETATN...
Base class for Godunov-type grids.
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
int get_taille_i(int i) const
Gives the size of the interface arrays (including the hidden cells)
int get_etat() const
Gives the logical state.
void set_etat_zero()
Sets the logical state to ETATZERO (zero).
double * tzri
The array at z (or r) interfaces.
Finite-difference array intended to store field values.
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.
void affiche_seuil(ostream &ostr, int precision=4, double threshold=1.e-7) const
Prints only the values greater than a given threshold.
double * typi
The array at y (or ) interfaces.
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 get_dim(int i) const
Gives the i th dimension (ie dim->dim[i] , without hidden cells)
void annule_hard()
Sets the Tbl_val to zero in a hard way.
double * t
The array of double at the nodes.
void sauve(FILE *) const
Save in a file.
int get_taille() const
Gives the size of the node array (including the hidden cells)
Tbl_val(const Grille_val *)
Constructor from a 3D grid.
double * txti
The array at x (or ) interfaces.
const Grille_val * gval
The Grille_val (cartesian or spherical) on which the array is defined.