201#include "type_parite.h"
202#include "utilitaires.h"
239 assert( mpi.get_mg() == &mgi ) ;
293 if (
etat == ETATZERO) return ;
301 if (
etat == ETATNONDEF) return ;
309 if (
etat == ETATQCQ) {
315 assert( (
etat == ETATZERO) || (
etat == ETATNONDEF) ) ;
329 va.set_etat_c_qcq() ;
363 if ( (l_min == 0) && (l_max ==
va.mg->get_nzone()-1) ) {
368 assert(
etat != ETATNONDEF ) ;
370 if (
etat == ETATZERO ) {
374 assert(
etat == ETATQCQ ) ;
376 va.annule(l_min, l_max) ;
385 if (
p_lap != 0x0)
p_lap->annule(l_min, l_max) ;
403 assert(&ci !=
this) ;
435 cout <<
"Unkwown state in Cmp::operator=(const Cmp&) !"
454 assert(vi.
get_etat() != ETATNONDEF) ;
479 cout <<
"Unkwown state in Cmp::operator=(const Valeur&) !" << endl ;
492 assert(mi.
get_etat() != ETATNONDEF) ;
494 assert(&mi !=
va.c) ;
518 cout <<
"Unkwown state in Cmp::operator=(const Mtbl&) !" << endl ;
531 if (
x ==
double(0)) {
584 o <<
"*** Cmp in UNDEFINED STATE" ;
589 o <<
"*** Cmp IDENTICALLY ZERO" ;
594 o <<
"*** Cmp : " << endl ;
595 o <<
" dzpuis = " << ci.
get_dzpuis() << endl ;
601 cout <<
"operator<<(ostream&, const Cmp&) : unknown state !"
616 double seuil)
const {
617 ost <<
"*** Cmp " << endl ;
622 if (
etat == ETATNONDEF) {
623 ost <<
" state: UNDEFINED" << endl ;
627 if (
etat == ETATZERO) {
628 ost <<
" state: ZERO" << endl ;
635 ost <<
" dzpuis = " <<
dzpuis << endl ;
636 va.affiche_seuil(ost, type, precis, seuil) ;
665 assert(
etat != ETATNONDEF) ;
667 const Mg3d* mg =
mp->get_mg() ;
674 if (
etat == ETATZERO) {
678 assert(
etat == ETATQCQ) ;
680 if (
va.etat == ETATZERO) {
684 assert(
va.etat == ETATQCQ) ;
687 if ( (
va.c)->get_etat() == ETATZERO ) {
691 assert( (
va.c)->get_etat() == ETATQCQ ) ;
692 if ( (
va.c)->t[nzm1]->get_etat() == ETATZERO ) {
696 assert( (
va.c)->t[nzm1]->get_etat() == ETATQCQ ) ;
701 assert(
va.c_cf != 0x0) ;
702 if ( (
va.c_cf)->get_etat() == ETATZERO ) {
705 assert( (
va.c_cf)->get_etat() == ETATQCQ ) ;
706 if ( (
va.c_cf)->t[nzm1]->get_etat() == ETATZERO ) {
710 assert( (
va.c_cf)->t[nzm1]->get_etat() == ETATQCQ ) ;
737 assert(
etat != ETATNONDEF) ;
739 if (
etat == ETATZERO) {
743 assert(
etat == ETATQCQ) ;
751 mp->val_lx(
r, theta,
phi, l, xi) ;
756 return va.val_point(l, xi, theta,
phi) ;
766 assert (
etat != ETATNONDEF) ;
768 const Mg3d* mg =
mp->get_mg() ;
772 for (
int lz=0; lz<nzone; lz++)
773 lmax = (lmax < 2*mg->get_nt(lz) - 1 ? 2*mg->
get_nt(lz) - 1 : lmax) ;
775 Tbl resu(nzone, lmax) ;
776 if (
etat == ETATZERO) {
781 assert(
etat == ETATQCQ) ;
787 int m_quant, l_quant, base_r ;
788 for (
int lz=0; lz<nzone; lz++)
789 for (
int k=0 ; k<mg->
get_np(lz) ; k++)
790 for (
int j=0 ; j<mg->
get_nt(lz) ; j++) {
791 if (nullite_plm(j, mg->
get_nt(lz), k, mg->
get_np(lz), base) == 1)
794 donne_lm(nzone, lz, j, k, base, m_quant, l_quant, base_r) ;
795 for (
int i=0; i<mg->
get_nr(lz); i++) resu.
set(lz, l_quant)
796 += fabs((*
va.c_cf)(0, k, j, i)) ;
Bases of the spectral expansions.
Cmp * p_dsdx
Pointer on of *this , where .
const Map * mp
Reference mapping.
Cmp(const Map &map)
Constructor from mapping.
void allocate_all()
Sets the logical state to ETATQCQ (ordinary state) and performs the memory allocation of all the elem...
Cmp * p_srstdsdp
Pointer on of *this.
void sauve(FILE *) const
Save in a file.
Cmp * p_srdsdt
Pointer on of *this.
void operator=(const Cmp &a)
Assignment to another Cmp defined on the same mapping.
int dzpuis
Power of r by which the quantity represented by this must be divided in the external compactified z...
Valeur va
The numerical value of the Cmp.
void std_base_scal()
Sets the spectral bases of the Valeur va to the standard ones for a scalar.
int etat
Logical state (ETATNONDEF , ETATQCQ or ETATZERO ).
void annule(int l)
Sets the Cmp to zero in a given domain.
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
int get_dzpuis() const
Returns dzpuis.
bool dz_nonzero() const
Returns true if the last domain is compactified and *this is not zero in this domain.
friend ostream & operator<<(ostream &, const Cmp &)
Display.
void set_etat_zero()
Sets the logical state to ETATZERO (zero).
void set_dzpuis(int)
Set a value to dzpuis.
bool check_dzpuis(int dzi) const
Returns false if the last domain is compactified and *this is not zero in this domain and dzpuis is n...
Cmp * p_dsdr
Pointer on of *this.
void del_deriv()
Logical destructor of the derivatives.
void set_der_0x0()
Sets the pointers for derivatives to 0x0.
double val_point(double r, double theta, double phi) const
Computes the value of the field represented by *this at an arbitrary point , by means of the spectral...
Cmp * p_dsdy
Pointer on of *this , where .
void set_etat_nondef()
Sets the logical state to ETATNONDEF (undefined).
Cmp * p_lap
Pointer on the Laplacian of *this.
void affiche_seuil(ostream &ostr, int type=0, int precision=4, double threshold=1.e-7) const
Prints only the values greater than a given threshold.
int ind_lap
Power of r by which the last computed Laplacian has been multiplied in the external compactified doma...
void annule_hard()
Sets the Cmp to zero in a hard way.
void del_t()
Logical destructor.
Tbl * p_integ
Pointer on the space integral of *this (values in each domain).
Tbl multipole_spectrum()
Gives the spectrum in terms of multipolar modes l .
Cmp * p_dsdz
Pointer on of *this , where .
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.
int get_type_r(int l) const
Returns the type of sampling in the radial direction in domain no.
int get_etat() const
Gives the logical state.
Tbl ** t
Array (size nzone ) of pointers on the Tbl 's.
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
int get_nzone() const
Gives the number of zones (domains).
void annule_hard()
Sets the Tbl to zero in a hard way.
void set_etat_zero()
Sets the logical state to ETATZERO (zero).
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
double & set(int i)
Read/write of a particular element (index i) (1D case).
Values and coefficients of a (real-value) function.
int get_etat() const
Returns the logical state.
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.
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
Map(const Mg3d &)
Constructor from a multi-domain 3D grid.
Coord phi
coordinate centered on the grid
Coord x
x coordinate centered on the grid
Coord r
r coordinate centered on the grid