193#include "utilitaires.h"
233 assert((vc.
c != 0x0) || (vc.
c_cf != 0x0) ) ;
245 if (vc.
c_cf != 0x0) {
258 cout <<
"Etat pas possible" << endl ;
270 if (*
mg != *mg_tmp) {
272 "Valeur::Valeur(const Mg3d& g, FILE* fd): grid not consistent !"
280 if (
etat == ETATQCQ) {
281 c =
new Mtbl(g, fd) ;
323 base.set_base_nondef() ;
379 cout <<
"Unkwon state in Valeur::operator=(const Valeur&) !"
394 assert(mt.
get_etat() != ETATNONDEF) ;
399 base.set_base_nondef() ;
422 cout <<
"Unkwon state in Valeur::operator=(const Mtbl&) !"
437 assert(mt.
get_etat() != ETATNONDEF) ;
439 assert(&mt !=
c_cf) ;
465 cout <<
"Unkwon state in Valeur::operator=(const Mtbl_cf&) !"
484 if (
etat == ETATQCQ) {
503 o <<
"*** Valeur in UNDEFINED STATE" ;
508 o <<
"*** Valeur IDENTICALLY ZERO" ;
514 o <<
"*** Valeur (configuration space) :" << endl ;
515 o << *(vi.
c) << endl ;
517 if (vi.
c_cf != 0x0) {
518 o <<
"*** Valeur (coefficients) :" << endl ;
519 o << *(vi.
c_cf) << endl ;
525 cout <<
"operator<<(ostream&, const Valeur&) : unknown state !"
541 if (
etat == ETATNONDEF) {
542 ost <<
" state: UNDEFINED" << endl ;
546 if (
etat == ETATZERO) {
547 ost <<
" state: ZERO" << endl ;
553 c_cf->display(thres, precis, ost) ;
562 double seuil)
const {
563 ost <<
"*** Valeur " << endl ;
569 if (
etat == ETATNONDEF) {
570 ost <<
" state: UNDEFINED" << endl ;
574 if (
etat == ETATZERO) {
575 ost <<
" state: ZERO" << endl ;
582 ost <<
" Coefficients of the Valeur : " << endl ;
583 c_cf->affiche_seuil(ost, precis, seuil) ;
589 ost <<
" Values of the Valeur at the collocation points: " << endl ;
590 c->affiche_seuil(ost, precis, seuil) ;
597 ost <<
" Coefficients of the Valeur : " << endl ;
598 c_cf->affiche_seuil(ost, precis, seuil) ;
599 ost <<
" Values of the Valeur at the collocation points: " << endl ;
600 c->affiche_seuil(ost, precis, seuil) ;
605 cout <<
"Unknown type in Valeur::affiche_seuil !" << endl ;
693 if (
etat == ETATZERO) return ;
699 if (
etat == ETATNONDEF) return ;
738 c_cf->annule_hard() ;
760 if ( (l_min == 0) && (l_max ==
mg->get_nzone()-1) ) {
765 assert(
etat != ETATNONDEF ) ;
767 if (
etat == ETATZERO ) {
771 assert(
etat == ETATQCQ ) ;
774 c->annule(l_min, l_max) ;
778 c_cf->annule(l_min, l_max) ;
785 if (
p_sx != 0x0)
p_sx->annule(l_min, l_max) ;
786 if (
p_sx2 != 0x0)
p_sx2->annule(l_min, l_max) ;
818 if ( !(
c_cf->base == base_i) ) {
841 base.set_base_r(l, base_r) ;
854 base.set_base_t(base_t) ;
867 base.set_base_p(base_p) ;
887 assert(
etat != ETATNONDEF) ;
891 if (
etat == ETATZERO) {
895 assert(
etat == ETATQCQ) ;
897 resu =
c_cf->val_point(l,
x, theta,
phi) ;
905 assert(
etat != ETATNONDEF) ;
909 if (
etat == ETATZERO) {
913 assert(
etat == ETATQCQ) ;
915 resu =
c_cf->val_point_jk(l,
x, j, k) ;
929 int nz =
mg->get_nzone() ;
930 int nr =
mg->get_nr(0) ;
931 int nt =
mg->get_nt(0) ;
932 int np =
mg->get_np(0) ;
934 if (
etat != ETATZERO) {
935 assert (
etat == ETATQCQ) ;
937 for (
int lz=nz1; lz<=nz2; lz++) {
938 if (
c_cf->operator()(lz).get_etat() != ETATZERO)
939 for (
int k=0; k<np+1; k++)
940 for (
int j=0; j<nt; j++) {
941 int l_q, m_q, base_r ;
942 if (nullite_plm(j, nt, k, np,
base) == 1) {
943 donne_lm(nz, lz, j, k,
base, m_q, l_q,base_r) ;
945 for (
int i=0; i<nr; i++)
946 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