32char scalar_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Tensor/Scalar/scalar.C,v 1.40 2015/12/18 15:52:52 j_novak Exp $" ;
192#include "type_parite.h"
193#include "utilitaires.h"
216 dzpuis(
ti.cmp[0]->dzpuis), va(
ti.cmp[0]->va) {
229 dzpuis(
sci.dzpuis), va(
sci.va) {
240 dzpuis(
ci.get_dzpuis()),
371 for (
int l=0;
l<
mt->get_nzone();
l++) {
372 mt->t[
l]->set_etat_qcq() ;
401 if (
etat == ETATZERO ) {
488 cout <<
"Unkwown state in Scalar::operator=(const Scalar&) !"
511 switch(
ci.get_etat()) {
534 cout <<
"Unkwown state in Scalar::operator=(const Cmp&) !"
557 assert(
vi.get_etat() != ETATNONDEF) ;
564 switch(
vi.get_etat()) {
582 cout <<
"Unkwown state in Scalar::operator=(const Valeur&) !" <<
endl ;
595 assert(
mi.get_etat() != ETATNONDEF) ;
604 switch(
mi.get_etat()) {
621 cout <<
"Unkwown state in Scalar::operator=(const Mtbl&) !" <<
endl ;
634 if (x ==
double(0)) {
638 if (x ==
double(1)) {
674Scalar::operator
Cmp()
const {
678 resu.set_dzpuis(dzpuis) ;
706 ost <<
"*** UNDEFINED STATE *** " <<
endl ;
711 ost <<
"*** identically ZERO ***" <<
endl ;
716 ost <<
"*** identically ONE ***" <<
endl ;
721 ost <<
"*** dzpuis = " <<
ci.get_dzpuis() <<
endl ;
727 cout <<
"operator<<(ostream&, const Scalar&) : unknown state !"
752 if (
etat == ETATNONDEF) {
757 if (
etat == ETATZERO) {
758 ost <<
"*** identically ZERO ***" <<
endl ;
762 if (
etat == ETATUN) {
763 ost <<
"*** identically ONE ***" <<
endl ;
818 const Mg3d* mg =
mp->get_mg() ;
825 if (
etat == ETATZERO) {
829 if (
etat == ETATUN) {
835 if (
va.
etat == ETATZERO) {
842 if ( (
va.
c)->get_etat() == ETATZERO ) {
846 assert( (
va.
c)->get_etat() == ETATQCQ ) ;
847 if ( (
va.
c)->t[
nzm1]->get_etat() == ETATZERO ) {
857 if ( (
va.
c_cf)->get_etat() == ETATZERO ) {
861 if ( (
va.
c_cf)->t[
nzm1]->get_etat() == ETATZERO ) {
895 if (
etat == ETATZERO) {
899 if (
etat == ETATUN) {
913 if (
l ==
mp->get_mg()->get_nzone() - 1){
942 cout <<
"scalar::val_point unexpected value of dzpuis !" <<
endl;
960 const Mg3d* mg =
mp->get_mg() ;
964 for (
int lz=0;
lz<nzone;
lz++)
968 if (
etat == ETATZERO) {
969 resu.set_etat_zero() ;
982 for (
int lz=0;
lz<nzone;
lz++)
988 donne_lm(nzone,
lz,
j,
k, base,
m_quant, l_quant, base_r) ;
999 cout <<
"WARNING: Scalar::change_triad : "<<
endl ;
1000 cout <<
"This method does nothing ... " <<
endl ;
1011 if (
etat == ETATQCQ) {
1018 int nz =
mp->get_mg()->get_nzone() ;
1019 for (
int lz=0;
lz<nz;
lz++) {
1025 int np =
mp->get_mg()->get_np(
lz) ;
1026 int nt =
mp->get_mg()->get_nt(
lz) ;
1027 int nr =
mp->get_mg()->get_nr(
lz) ;
1028 for (
int k=0;
k<np;
k++) {
1029 for (
int j=0;
j<nt;
j++) {
1030 for (
int i=0;
i<nr;
i++) {
1034 cout <<
"NaN found at physical grid point domain = " <<
lz
1035 <<
", i= " <<
i <<
", j= " <<
j <<
", k= " <<
k <<
endl ;
1043 int np =
mp->get_mg()->get_np(
lz) + 2 ;
1044 int nt =
mp->get_mg()->get_nt(
lz) ;
1045 int nr =
mp->get_mg()->get_nr(
lz) ;
1046 for (
int k=0;
k<np;
k++) {
1047 for (
int j=0;
j<nt;
j++) {
1048 for (
int i=0;
i<nr;
i++) {
1052 cout <<
"NaN found at coefficient, domain = " <<
lz
1053 <<
", i= " <<
i <<
", j= " <<
j <<
", k= " <<
k <<
endl ;
Bases of the spectral expansions.
Vectorial bases (triads) with respect to which the tensorial components are defined.
Component of a tensorial field *** DEPRECATED : use class Scalar instead ***.
Time evolution with partial storage (*** under development ***).
Base class for coordinate mappings.
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
Returns the logical state.
int get_etat() const
Gives the logical state.
Tensor field of valence 0 (or component of a tensorial field).
virtual void sauve(FILE *) const
Save in a file.
void set_etat_one()
Sets the logical state to ETATUN (one).
virtual void del_deriv() const
Logical destructor of the derivatives.
Scalar * p_lap
Pointer on the Laplacian of *this (0x0 if not up to date)
Scalar * p_dsdy
Pointer on of *this , where (0x0 if not up to date)
virtual ~Scalar()
Destructor.
Scalar * p_dsdrho
Pointer on of *this
void operator=(const Scalar &a)
Assignment to another Scalar defined on the same mapping.
virtual void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
bool dz_nonzero() const
Returns true if the last domain is compactified and *this is not zero in this domain.
Scalar * p_dsdr
Pointer on of *this (0x0 if not up to date)
Scalar * p_stdsdp
Pointer on of *this (0x0 if not up to date)
Scalar * p_dsdx
Pointer on of *this , where (0x0 if not up to date)
virtual void std_spectral_base()
Sets the spectral bases of the Valeur va to the standard ones for a scalar field.
bool is_nan(bool verbose=false) const
Looks for NaNs (not a number) in the scalar field.
Scalar * p_dsdz
Pointer on of *this , where (0x0 if not up to date)
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...
virtual void set_etat_zero()
Sets the logical state to ETATZERO (zero).
virtual void change_triad(const Base_vect &new_triad)
Sets a new vectorial basis (triad) of decomposition and modifies the components accordingly.
int ind_lap
Power of r by which the last computed Laplacian has been multiplied in the compactified external doma...
virtual void annule(int l_min, int l_max)
Sets the Scalar to zero in several domains.
Scalar * p_srstdsdp
Pointer on of *this (0x0 if not up to date)
void annule_hard()
Sets the Scalar to zero in a hard way.
void del_t()
Logical destructor.
int etat
The logical state ETATNONDEF (undefined), ETATZERO (null), ETATUN (one), or ETATQCQ (ordinary).
virtual void allocate_all()
Sets the logical state to ETATQCQ (ordinary state) and performs the memory allocation of all the elem...
virtual void set_etat_nondef()
Sets the logical state to ETATNONDEF (undefined).
void set_dzpuis(int)
Modifies the dzpuis flag.
Scalar * p_lapang
Pointer on the Laplacian of *this (0x0 if not up to date)
double val_point(double r, double theta, double phi) const
Computes the value of the field at an arbitrary point , by means of the spectral expansion.
Tbl multipole_spectrum() const
Gives the spectrum in terms of multipolar modes l .
virtual void std_spectral_base_odd()
Sets the spectral bases of the Valeur va to the standard odd ones for a scalar field.
Valeur va
The numerical value of the Scalar
virtual void spectral_display(const char *comment=0x0, double threshold=1.e-7, int precision=4, ostream &ostr=cout) const
Displays the spectral coefficients and the associated basis functions.
Scalar * p_dsdradial
Pointer on of *this
Tbl * p_integ
Pointer on the space integral of *this (values in each domain) (0x0 if not up to date)
Scalar * p_dsdt
Pointer on of *this (0x0 if not up to date)
void set_der_0x0() const
Sets the pointers for derivatives to 0x0.
Scalar * p_srdsdt
Pointer on of *this (0x0 if not up to date)
void set_spectral_base(const Base_val &)
Sets the spectral bases of the Valeur va
int dzpuis
Power of r by which the quantity represented by this must be divided in the compactified external d...
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 ).
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 )
Mtbl * c
Values of the function at the points of the multi-grid
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 std_base_scal_odd()
Sets the bases for spectral expansions (member base ) to the standard odd ones for a scalar.
Mtbl_cf * c_cf
Coefficients of the spectral expansion of the function.
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 set_etat_nondef()
Sets the logical state to ETATNONDEF (undefined).
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.
const Map *const mp
Mapping on which the numerical values at the grid points are defined.
Scalar ** cmp
Array of size n_comp of pointers onto the components.
virtual void del_deriv() const
Deletes the derived quantities.