31char mtbl_cf_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Mtbl_cf/mtbl_cf.C,v 1.9 2014/10/13 08:53:08 j_novak Exp $" ;
118#include "utilitaires.h"
155 assert(mtc.
get_etat() != ETATNONDEF) ;
159 if (mtc.
etat == ETATQCQ) {
161 for (
int i=0 ; i<
nzone ; i++) {
166 assert(mtc.
etat == ETATZERO) ;
178 if (*
mg != *mg_tmp) {
179 cout <<
"Mtbl_cf::Mtbl_cf(const Mg3d& , FILE*): grid not consistent !"
192 if (
etat == ETATQCQ) {
194 for (
int i=0 ; i<
nzone ; i++) {
199 fread_be(&dzpuis_vieux,
sizeof(
int), 1, fd) ;
209 if (
etat == ETATQCQ) {
210 for (
int i=0 ; i<
nzone ; i++) {
214 int dzpuis_vieux = 0 ;
215 fwrite_be(&dzpuis_vieux,
sizeof(
int), 1, fd) ;
223 assert (
mg == mtc.
mg) ;
224 assert(mtc.
get_etat() != ETATNONDEF) ;
236 for (
int i=0 ; i<
nzone ; i++) {
244 if ( x ==
double(0) ) {
249 for (
int i=0 ; i<
nzone ; i++) {
263 for (
int i=0 ; i<
nzone ; i++) {
279 for (
int l=0 ; l<
nzone ; l++) {
289 if (
etat == ETATZERO) return ;
295 if (
etat == ETATNONDEF) return ;
301 if (
etat == ETATQCQ) return ;
303 for (
int i=0 ; i<
nzone ; i++) {
307 t[i] =
new Tbl(nbp+2, nbt, nbr) ;
315 for (
int i=0 ; i<
nzone ; i++) {
319 t[i] =
new Tbl(nbp+2, nbt, nbr) ;
323 for (
int i=0 ; i<
nzone ; i++) {
334 assert( (l_min >= 0) && (l_min <
nzone) ) ;
335 assert( (l_max >= 0) && (l_max <
nzone) ) ;
338 if ( (l_min == 0) && (l_max ==
nzone-1) ) {
343 assert(
etat != ETATNONDEF ) ;
345 if (
etat == ETATZERO ) {
349 assert(
etat == ETATQCQ ) ;
350 for (
int l=l_min; l<=l_max; l++) {
366ostream& operator<<(ostream& o,
const Mtbl_cf& mt) {
368 assert(mt.
get_etat() != ETATNONDEF) ;
372 o.setf(ios::showpoint);
373 o <<
"*** MTBL_CF " << nzone <<
" domains" << endl ;
375 o << mt.
base << endl ;
377 o <<
"Values of the coefficients : " << endl ;
379 o <<
"Logically NUL" << endl ;
382 for (
int l=0 ; l<nzone ; l++) {
383 o <<
" Domain #" << l << endl ;
398 ost <<
"*** Mtbl_cf " <<
nzone <<
" domains" << endl ;
399 ost <<
base << endl ;
400 ost <<
"Values of the coefficients : " << endl ;
405 if (
etat == ETATNONDEF) {
406 ost <<
" state: UNDEFINED" << endl ;
410 if (
etat == ETATZERO) {
411 ost <<
" state: ZERO" << endl ;
419 for (
int l=0; l <
nzone; l++) {
430 const char* f = __FILE__ ;
435 const char* f = __FILE__ ;
Bases of the spectral expansions.
void sauve(FILE *) const
Save in a file.
int get_nzone() const
Returns the number of domains.
int get_np(int l) const
Returns the number of points in the azimuthal direction ( ) in domain no. l.
int get_nt(int l) const
Returns the number of points in the co-latitude direction ( ) in domain no. l.
int get_nzone() const
Returns the number of domains.
int get_nr(int l) const
Returns the number of points in the radial direction ( ) in domain no. l.
void sauve(FILE *fd, bool save_base=false) const
Saves into a file.
Coefficients storage for the multi-domain spectral method.
Base_val base
Bases of the spectral expansions.
void del_t()
Logical destructor: dellocates the memory occupied by the Tbl array t .
void set_etat_nondef()
Sets the logical state to ETATNONDEF (undefined).
void set_etat_zero()
Sets the logical state to ETATZERO (zero).
int get_etat() const
Returns the logical state.
const Mg3d * mg
Pointer on the multi-grid Mgd3 on which this is defined.
void operator*=(double)
*= double
void annule(int l_min, int l_max)
Sets the Mtbl_cf to zero in some domains.
void sauve(FILE *) const
Save in a file.
int get_nzone() const
Returns the number of zones (domains)
void affiche_seuil(ostream &ostr, int precision=4, double threshold=1.e-7) const
Prints only the values greater than a given threshold.
void operator=(const Mtbl_cf &)
Assignement to another Mtbl_cf.
int etat
Logical state (ETATNONDEF , ETATQCQ or ETATZERO ).
Tbl ** t
Array (size nzone ) of pointers on the Tbl 's which contain the spectral coefficients in each domain.
Mtbl_cf(const Mg3d &mgrid, const Base_val &basis)
Constructor.
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
void annule_hard()
Sets the Mtbl_cf to zero in a hard way.
void operator/=(double)
/= double
int nzone
Number of domains (zones)
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.