32char valeur_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Valeur/valeur.C,v 1.8 2014/10/13 08:53:49 j_novak Exp $" ;
190#include "utilitaires.h"
230 assert((vc.
c != 0x0) || (vc.
c_cf != 0x0) ) ;
242 if (vc.
c_cf != 0x0) {
255 cout <<
"Etat pas possible" << endl ;
267 if (*
mg != *mg_tmp) {
269 "Valeur::Valeur(const Mg3d& g, FILE* fd): grid not consistent !"
277 if (
etat == ETATQCQ) {
278 c =
new Mtbl(g, fd) ;
320 base.set_base_nondef() ;
376 cout <<
"Unkwon state in Valeur::operator=(const Valeur&) !"
391 assert(mt.
get_etat() != ETATNONDEF) ;
396 base.set_base_nondef() ;
419 cout <<
"Unkwon state in Valeur::operator=(const Mtbl&) !"
434 assert(mt.
get_etat() != ETATNONDEF) ;
436 assert(&mt !=
c_cf) ;
462 cout <<
"Unkwon state in Valeur::operator=(const Mtbl_cf&) !"
481 if (
etat == ETATQCQ) {
500 o <<
"*** Valeur in UNDEFINED STATE" ;
505 o <<
"*** Valeur IDENTICALLY ZERO" ;
511 o <<
"*** Valeur (configuration space) :" << endl ;
512 o << *(vi.
c) << endl ;
514 if (vi.
c_cf != 0x0) {
515 o <<
"*** Valeur (coefficients) :" << endl ;
516 o << *(vi.
c_cf) << endl ;
522 cout <<
"operator<<(ostream&, const Valeur&) : unknown state !"
538 if (
etat == ETATNONDEF) {
539 ost <<
" state: UNDEFINED" << endl ;
543 if (
etat == ETATZERO) {
544 ost <<
" state: ZERO" << endl ;
550 c_cf->display(thres, precis, ost) ;
559 double seuil)
const {
560 ost <<
"*** Valeur " << endl ;
566 if (
etat == ETATNONDEF) {
567 ost <<
" state: UNDEFINED" << endl ;
571 if (
etat == ETATZERO) {
572 ost <<
" state: ZERO" << endl ;
579 ost <<
" Coefficients of the Valeur : " << endl ;
580 c_cf->affiche_seuil(ost, precis, seuil) ;
586 ost <<
" Values of the Valeur at the collocation points: " << endl ;
587 c->affiche_seuil(ost, precis, seuil) ;
594 ost <<
" Coefficients of the Valeur : " << endl ;
595 c_cf->affiche_seuil(ost, precis, seuil) ;
596 ost <<
" Values of the Valeur at the collocation points: " << endl ;
597 c->affiche_seuil(ost, precis, seuil) ;
602 cout <<
"Unknown type in Valeur::affiche_seuil !" << endl ;
690 if (
etat == ETATZERO) return ;
696 if (
etat == ETATNONDEF) return ;
735 c_cf->annule_hard() ;
757 if ( (l_min == 0) && (l_max ==
mg->get_nzone()-1) ) {
762 assert(
etat != ETATNONDEF ) ;
764 if (
etat == ETATZERO ) {
768 assert(
etat == ETATQCQ ) ;
771 c->annule(l_min, l_max) ;
775 c_cf->annule(l_min, l_max) ;
782 if (
p_sx != 0x0)
p_sx->annule(l_min, l_max) ;
783 if (
p_sx2 != 0x0)
p_sx2->annule(l_min, l_max) ;
815 if ( !(
c_cf->base == base_i) ) {
838 base.set_base_r(l, base_r) ;
851 base.set_base_t(base_t) ;
864 base.set_base_p(base_p) ;
884 assert(
etat != ETATNONDEF) ;
888 if (
etat == ETATZERO) {
892 assert(
etat == ETATQCQ) ;
894 resu =
c_cf->val_point(l,
x, theta,
phi) ;
902 assert(
etat != ETATNONDEF) ;
906 if (
etat == ETATZERO) {
910 assert(
etat == ETATQCQ) ;
912 resu =
c_cf->val_point_jk(l,
x, j, k) ;
926 int nz =
mg->get_nzone() ;
927 int nr =
mg->get_nr(0) ;
928 int nt =
mg->get_nt(0) ;
929 int np =
mg->get_np(0) ;
931 if (
etat != ETATZERO) {
932 assert (
etat == ETATQCQ) ;
934 for (
int lz=nz1; lz<=nz2; lz++) {
935 if (
c_cf->operator()(lz).get_etat() != ETATZERO)
936 for (
int k=0; k<np+1; k++)
937 for (
int j=0; j<nt; j++) {
938 int l_q, m_q, base_r ;
939 if (nullite_plm(j, nt, k, np,
base) == 1) {
940 donne_lm(nz, lz, j, k,
base, m_q, l_q,base_r) ;
942 for (
int i=0; i<nr; i++)
943 c_cf->set(lz, k, j, i) = 0. ;
Bases of the spectral expansions.
Coefficients storage for the multi-domain spectral method.
Base_val base
Bases of the spectral expansions.
int get_etat() const
Returns the logical state.
const Mg3d * get_mg() const
Returns the Mg3d on which the Mtbl_cf is defined.
const Mg3d * get_mg() const
Gives the Mg3d on which the Mtbl is defined.
int get_etat() const
Gives the logical state.
void filtre_tp(int nn, int nz1, int nz2)
Sets the n lasts coefficients in to 0 in the domain nz1 to nz2 when expressed in spherical harmonics...
void del_t()
Logical destructor.
void set_etat_cf_qcq()
Sets the logical state to ETATQCQ (ordinary state) for values in the configuration space (Mtbl_cf c_c...
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 ).
double val_point_jk(int l, double x, int j, int k) const
Computes the value of the field represented by *this at an arbitrary point in , but collocation point...
Valeur * p_dsdp
Pointer on .
friend ostream & operator<<(ostream &, const Valeur &)
Display.
Valeur * p_mult_sp
Pointer on .
Valeur * p_mult_x
Pointer on .
Valeur * p_scost
Pointer on .
int get_etat() const
Returns the logical state.
Valeur * p_sx2
Pointer on .
Valeur * p_d2sdx2
Pointer on .
void set_etat_zero()
Sets the logical state to ETATZERO (zero).
void set_base(const Base_val &)
Sets the bases for spectral expansions (member base ).
Valeur * p_dsdx
Pointer on .
Valeur(const Mg3d &mgrid)
Constructor.
void nouveau()
Memory allocation.
void ylm()
Computes the coefficients of *this.
Valeur * p_d2sdt2
Pointer on .
Mtbl * c
Values of the function at the points of the multi-grid.
Valeur * p_mult_cp
Pointer on .
void display_coef(double threshold=1.e-7, int precision=4, ostream &ostr=cout) const
Displays the spectral coefficients and the associated basis functions.
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 operator=(const Valeur &a)
Assignement to another Valeur.
void std_base_scal_odd()
Sets the bases for spectral expansions (member base ) to the standard odd ones for a scalar.
Valeur * p_sx
Pointer on .
void coef_i() const
Computes the physical value 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.
Mtbl_cf * c_cf
Coefficients of the spectral expansion of the function.
void coef() const
Computes the coeffcients of *this.
Valeur * p_ssint
Pointer on .
void set_der_0x0()
Sets the pointers for derivatives to 0x0.
Valeur * p_stdsdp
Pointer on .
const Mg3d * get_mg() const
Returns the Mg3d on which the this is defined.
void set_base_r(int l, int base_r)
Sets the expansion basis for r ( ) functions in a given domain.
Valeur * p_dsdt
Pointer on .
Valeur * p_lapang
Pointer on the angular Laplacian.
Base_val base
Bases on which the spectral expansion is performed.
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.
Valeur * p_mult_ct
Pointer on .
int etat
Logical state (ETATNONDEF , ETATQCQ or ETATZERO ).
void set_base_t(int base_t)
Sets the expansion basis for functions in all domains.
void set_base_p(int base_p)
Sets the expansion basis for functions in all domains.
void set_etat_nondef()
Sets the logical state to ETATNONDEF (undefined).
Valeur * p_d2sdp2
Pointer on .
Valeur * p_mult_st
Pointer on .
void del_deriv()
Logical destructor of the derivatives.
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.
Coord phi
coordinate centered on the grid
Coord x
x coordinate centered on the grid