32char cmp_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Cmp/cmp.C,v 1.10 2014/10/13 08:52:46 j_novak Exp $" ;
198#include "type_parite.h"
199#include "utilitaires.h"
225Cmp::Cmp(
const Cmp& ci) : mp(ci.mp), etat(ci.etat), dzpuis(ci.dzpuis),
236 assert( mpi.
get_mg() == &mgi ) ;
290 if (
etat == ETATZERO) return ;
298 if (
etat == ETATNONDEF) return ;
306 if (
etat == ETATQCQ) {
312 assert( (
etat == ETATZERO) || (
etat == ETATNONDEF) ) ;
365 assert(
etat != ETATNONDEF ) ;
367 if (
etat == ETATZERO ) {
371 assert(
etat == ETATQCQ ) ;
400 assert(&ci !=
this) ;
432 cout <<
"Unkwown state in Cmp::operator=(const Cmp&) !"
451 assert(vi.
get_etat() != ETATNONDEF) ;
476 cout <<
"Unkwown state in Cmp::operator=(const Valeur&) !" << endl ;
489 assert(mi.
get_etat() != ETATNONDEF) ;
491 assert(&mi !=
va.
c) ;
515 cout <<
"Unkwown state in Cmp::operator=(const Mtbl&) !" << endl ;
528 if (x ==
double(0)) {
577ostream& operator<<(ostream& o,
const Cmp& ci) {
581 o <<
"*** Cmp in UNDEFINED STATE" ;
586 o <<
"*** Cmp IDENTICALLY ZERO" ;
591 o <<
"*** Cmp : " << endl ;
592 o <<
" dzpuis = " << ci.
get_dzpuis() << endl ;
598 cout <<
"operator<<(ostream&, const Cmp&) : unknown state !"
613 double seuil)
const {
614 ost <<
"*** Cmp " << endl ;
619 if (
etat == ETATNONDEF) {
620 ost <<
" state: UNDEFINED" << endl ;
624 if (
etat == ETATZERO) {
625 ost <<
" state: ZERO" << endl ;
632 ost <<
" dzpuis = " <<
dzpuis << endl ;
662 assert(
etat != ETATNONDEF) ;
671 if (
etat == ETATZERO) {
675 assert(
etat == ETATQCQ) ;
677 if (
va.
etat == ETATZERO) {
681 assert(
va.
etat == ETATQCQ) ;
684 if ( (
va.
c)->get_etat() == ETATZERO ) {
688 assert( (
va.
c)->get_etat() == ETATQCQ ) ;
689 if ( (
va.
c)->t[nzm1]->get_etat() == ETATZERO ) {
693 assert( (
va.
c)->t[nzm1]->get_etat() == ETATQCQ ) ;
699 if ( (
va.
c_cf)->get_etat() == ETATZERO ) {
702 assert( (
va.
c_cf)->get_etat() == ETATQCQ ) ;
703 if ( (
va.
c_cf)->t[nzm1]->get_etat() == ETATZERO ) {
707 assert( (
va.
c_cf)->t[nzm1]->get_etat() == ETATQCQ ) ;
734 assert(
etat != ETATNONDEF) ;
736 if (
etat == ETATZERO) {
740 assert(
etat == ETATQCQ) ;
763 assert (
etat != ETATNONDEF) ;
769 for (
int lz=0; lz<nzone; lz++)
770 lmax = (lmax < 2*mg->get_nt(lz) - 1 ? 2*mg->
get_nt(lz) - 1 : lmax) ;
772 Tbl resu(nzone, lmax) ;
773 if (
etat == ETATZERO) {
778 assert(
etat == ETATQCQ) ;
784 int m_quant, l_quant, base_r ;
785 for (
int lz=0; lz<nzone; lz++)
786 for (
int k=0 ; k<mg->
get_np(lz) ; k++)
787 for (
int j=0 ; j<mg->
get_nt(lz) ; j++) {
788 if (nullite_plm(j, mg->
get_nt(lz), k, mg->
get_np(lz), base) == 1)
791 donne_lm(nzone, lz, j, k, base, m_quant, l_quant, base_r) ;
792 for (
int i=0; i<mg->
get_nr(lz); i++) resu.
set(lz, l_quant)
793 += fabs((*
va.
c_cf)(0, k, j, i)) ;
Bases of the spectral expansions.
Component of a tensorial field *** DEPRECATED : use class Scalar instead ***.
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.
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 .
Base class for coordinate mappings.
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...
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
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.
Base_val base
Bases of the spectral expansions.
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.
void del_t()
Logical destructor.
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 ...
void set_etat_c_qcq()
Sets the logical state to ETATQCQ (ordinary state) for values in the configuration space (Mtbl c ).
int get_etat() const
Returns the logical state.
void set_etat_zero()
Sets the logical state to ETATZERO (zero).
void ylm()
Computes the coefficients of *this.
Mtbl * c
Values of the function at the points of the multi-grid
void annule(int l)
Sets the Valeur to zero in a given domain.
const Mg3d * mg
Multi-grid Mgd3 on which this is defined.
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.
Mtbl_cf * c_cf
Coefficients of the spectral expansion of the function.
void coef() const
Computes the coeffcients of *this.
void std_base_scal()
Sets the bases for spectral expansions (member base ) to the standard ones for a scalar.
void annule_hard()
Sets the Valeur to zero in a hard way.
int etat
Logical state (ETATNONDEF , ETATQCQ or ETATZERO ).
void sauve(FILE *) const
Save in a file.
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.