201 #include "type_parite.h" 202 #include "utilitaires.h" 228 Cmp::Cmp(
const Cmp& ci) : mp(ci.mp), etat(ci.etat), dzpuis(ci.dzpuis),
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) ) ;
368 assert(
etat != ETATNONDEF ) ;
370 if (
etat == ETATZERO ) {
374 assert(
etat == ETATQCQ ) ;
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)) {
580 ostream& operator<<(ostream& o,
const Cmp& ci) {
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 ;
665 assert(
etat != ETATNONDEF) ;
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 ) ;
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) ;
766 assert (
etat != ETATNONDEF) ;
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)) ;
void del_t()
Logical destructor.
Cmp * p_dsdy
Pointer on of *this , where .
Mtbl_cf * c_cf
Coefficients of the spectral expansion of the function.
Component of a tensorial field *** DEPRECATED : use class Scalar instead ***.
void operator=(const Cmp &a)
Assignment to another Cmp defined on the same mapping.
int ind_lap
Power of r by which the last computed Laplacian has been multiplied in the external compactified doma...
int get_np(int l) const
Returns the number of points in the azimuthal direction ( ) in domain no. l.
void coef() const
Computes the coeffcients of *this.
void annule(int l)
Sets the Cmp to zero in a given domain.
void set_etat_zero()
Sets the logical state to ETATZERO (zero).
void set_der_0x0()
Sets the pointers for derivatives to 0x0.
void ylm()
Computes the coefficients of *this.
void annule_hard()
Sets the Valeur to zero in a hard way.
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
double & set(int i)
Read/write of a particular element (index i) (1D case)
int etat
Logical state (ETATNONDEF , ETATQCQ or ETATZERO ).
Base class for coordinate mappings.
void del_deriv()
Logical destructor of the derivatives.
void annule_hard()
Sets the Cmp to zero in a hard way.
Values and coefficients of a (real-value) function.
Tbl * p_integ
Pointer on the space integral of *this (values in each domain)
void annule(int l)
Sets the Valeur to zero in a given domain.
void std_base_scal()
Sets the bases for spectral expansions (member base ) to the standard ones for a scalar.
Cmp * p_lap
Pointer on the Laplacian of *this.
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
int get_etat() const
Gives the logical state.
int get_etat() const
Returns the logical state.
const Mg3d * mg
Multi-grid Mgd3 on which this is defined.
void set_etat_zero()
Sets the logical state to ETATZERO (zero).
int get_nzone() const
Gives the number of zones (domains)
double val_point(int l, double x, 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_srstdsdp
Pointer on of *this.
Tbl multipole_spectrum()
Gives the spectrum in terms of multipolar modes l .
void sauve(FILE *) const
Save in a file.
void del_t()
Logical destructor.
int dzpuis
Power of r by which the quantity represented by this must be divided in the external compactified zo...
Mtbl * c
Values of the function at the points of the multi-grid.
bool dz_nonzero() const
Returns true if the last domain is compactified and *this is not zero in this domain.
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 get_nzone() const
Returns the number of domains.
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 set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
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.
void set_etat_zero()
Sets the logical state to ETATZERO (zero).
void std_base_scal()
Sets the spectral bases of the Valeur va to the standard ones for a scalar.
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_nr(int l) const
Returns the number of points in the radial direction ( ) in domain no. l.
void allocate_all()
Sets the logical state to ETATQCQ (ordinary state) and performs the memory allocation of all the elem...
Bases of the spectral expansions.
const Map * mp
Reference mapping.
int get_dzpuis() const
Returns dzpuis.
Cmp * p_srdsdt
Pointer on of *this.
void set_etat_nondef()
Sets the logical state to ETATNONDEF (undefined).
Cmp * p_dsdz
Pointer on of *this , where .
Cmp * p_dsdr
Pointer on of *this.
Cmp(const Map &map)
Constructor from mapping.
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...
void set_etat_c_qcq()
Sets the logical state to ETATQCQ (ordinary state) for values in the configuration space (Mtbl c )...
Base_val base
Bases of the spectral expansions.
int etat
Logical state (ETATNONDEF , ETATQCQ or ETATZERO ).
void set_dzpuis(int)
Set a value to dzpuis.
int get_nt(int l) const
Returns the number of points in the co-latitude direction ( ) in domain no. l.
void sauve(FILE *) const
Save in a file.
int get_type_r(int l) const
Returns the type of sampling in the radial direction in domain no.
Tbl ** t
Array (size nzone ) of pointers on the Tbl 's.
Cmp * p_dsdx
Pointer on of *this , where .
void annule_hard()
Sets the Tbl to zero in a hard way.
Valeur va
The numerical value of the Cmp.
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...
virtual void val_lx(double rr, double theta, double pphi, int &l, double &xi) const =0
Computes the domain index l and the value of corresponding to a point given by its physical coordina...