31char mtbl_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Mtbl/mtbl.C,v 1.9 2014/10/13 08:53:08 j_novak Exp $" ;
118#include "type_parite.h"
119#include "utilitaires.h"
139 if (c1.
c == 0x0) c1.
fait() ;
165 assert(mtc.
get_etat() != ETATNONDEF) ;
169 if (mtc.
etat == ETATQCQ) {
171 for (
int i=0 ; i<
nzone ; i++) {
176 assert(mtc.
etat == ETATZERO) ;
186 if (*
mg != *mg_tmp) {
187 cout <<
"Mtbl::Mtbl(Mg3d & , FILE*): grid not consistent !" << endl ;
198 if (
etat == ETATQCQ) {
200 for (
int i=0 ; i<
nzone ; i++) {
205 fread_be(&dzpuis_vieux,
sizeof(
int), 1, fd) ;
213 if (
etat == ETATQCQ) {
214 for (
int i=0 ; i<
nzone ; i++) {
218 int dzpuis_vieux = 0 ;
219 fwrite_be(&dzpuis_vieux,
sizeof(
int), 1, fd) ;
227 assert (
mg == mtc.
mg) ;
228 assert(mtc.
get_etat() != ETATNONDEF) ;
237 for (
int i=0 ; i<
nzone ; i++) {
245 if (x ==
double(0)) {
250 for (
int i=0 ; i<
nzone ; i++) {
264 for (
int i=0 ; i<
nzone ; i++) {
279 for (
int l=0 ; l<
nzone ; l++) {
288 if (
etat == ETATZERO) return ;
294 if (
etat == ETATNONDEF) return ;
300 if (
etat == ETATQCQ) return ;
303 assert( (
etat == ETATZERO) || (
etat == ETATNONDEF) ) ;
306 for (
int i=0 ; i<
nzone ; i++) {
315 for (
int i=0 ; i<
nzone ; i++) {
320 for (
int i=0 ; i<
nzone ; i++) {
331 assert( (l_min >= 0) && (l_min <
nzone) ) ;
332 assert( (l_max >= 0) && (l_max <
nzone) ) ;
335 if ( (l_min == 0) && (l_max ==
nzone-1) ) {
340 assert(
etat != ETATNONDEF ) ;
342 if (
etat == ETATZERO ) {
346 assert(
etat == ETATQCQ ) ;
347 for (
int l=l_min; l<=l_max; l++) {
365ostream& operator<<(ostream& o,
const Mtbl& mt) {
367 assert(mt.
get_etat() != ETATNONDEF) ;
371 o.setf(ios::showpoint);
372 o <<
"*** Mtbl " << nzone <<
" domains" << endl ;
375 o <<
"Logically NULL" << endl ;
378 for (
int l=0 ; l<nzone ; l++) {
379 o <<
" Domain #" << l << endl ;
394 ost <<
"*** Mtbl " <<
nzone <<
" domains" << endl ;
399 if (
etat == ETATNONDEF) {
400 ost <<
" state: UNDEFINED" << endl ;
404 if (
etat == ETATZERO) {
405 ost <<
" state: ZERO" << endl ;
412 for (
int l=0; l <
nzone; l++) {
424 const char* f = __FILE__ ;
429 const char* f = __FILE__ ;
434 const char* f = __FILE__ ;
439 const char* f = __FILE__ ;
Active physical coordinates and mapping derivatives.
void fait() const
Computes, at each point of the grid, the value of the coordinate or mapping derivative represented by...
Mtbl * c
The coordinate values at each grid point.
const Grille3d * get_grille3d(int l) const
Returns a pointer on the 3D mono-grid for domain no. l.
int get_nzone() const
Returns the number of domains.
void sauve(FILE *fd, bool save_base=false) const
Saves into a file.
void sauve(FILE *) const
Save in a file.
void annule(int l_min, int l_max)
Sets the Mtbl to zero in some domains.
const Mg3d * get_mg() const
Gives the Mg3d on which the Mtbl is defined.
int get_etat() const
Gives the logical state.
void del_t()
Logical destructor: dellocates the memory occupied by the Tbl array t .
void affiche_seuil(ostream &ostr, int precision=4, double threshold=1.e-7) const
Prints only the values greater than a given threshold.
Mtbl(const Mg3d &mgrid)
Constructor.
void operator/=(const Mtbl &)
/= Mtbl
const Mg3d * mg
Pointer on the multi-grid Mgd3 on which this is defined.
void operator+=(const Mtbl &)
+= Mtbl
Tbl ** t
Array (size nzone ) of pointers on the Tbl 's.
void operator=(const Mtbl &)
Assignement to another Mtbl.
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
void set_etat_nondef()
Sets the logical state to ETATNONDEF (undefined).
int nzone
Number of domains (zones)
void set_etat_zero()
Sets the logical state to ETATZERO (zero).
int get_nzone() const
Gives the number of zones (domains)
void operator*=(const Mtbl &)
*= Mtbl
int etat
Logical state (ETATNONDEF , ETATQCQ or ETATZERO ).
void annule_hard()
Sets the Mtbl to zero in a hard way.
void operator-=(const Mtbl &)
-= Mtbl
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 c_est_pas_fait(const char *)
Helpful function to say something is not implemented yet.
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.