83 #include "grille_val.h" 196 assert (
etat == ETATQCQ) ;
199 assert( i >= - fant) ;
200 assert( i < dim->
dim[0] + fant) ;
206 assert (
etat == ETATQCQ) ;
209 assert( i >= -fant ) ;
210 assert( i < dim->
dim[0] + fant + 1) ;
211 return tzri[i+fant] ;
216 assert(
etat != ETATNONDEF) ;
219 assert( i >= -fant ) ;
220 assert( i < dim->
dim[0] + fant ) ;
221 if (
etat == ETATZERO) {
225 else return t[i+fant] ;
230 assert(
etat != ETATNONDEF) ;
233 assert( i >= -fant ) ;
234 assert( i < dim->
dim[0] + fant +1) ;
235 if (
etat == ETATZERO) {
239 else return tzri[i+fant] ;
243 double&
set(
int j,
int i) {
244 assert (
etat == ETATQCQ) ;
247 assert( (i>=-fant) && (i<dim->
dim[0]+fant) ) ;
248 assert( (j>=-fant) && (j<dim->
dim[1]+fant) ) ;
249 return t[(
dim->
dim[0] +2*fant)* (j+fant) + i + fant] ;
257 assert (
etat == ETATQCQ) ;
260 assert( (i>=-fant) && (i<dim->
dim[0]+fant) ) ;
261 assert( (j>=-fant) && (j<dim->
dim[1]+fant+1) ) ;
262 return txti[(
dim->
dim[0] +2*fant)*(j+fant) + i + fant] ;
270 assert (
etat == ETATQCQ) ;
273 assert( (i>=-fant) && (i<dim->
dim[0] + fant+1) ) ;
274 assert( (j>=-fant) && (j<dim->
dim[1] + fant) ) ;
275 return tzri[(
dim->
dim[0] +2*fant+1)*(j+fant) + i + fant] ;
280 assert(
etat != ETATNONDEF) ;
283 assert( (i>=-fant) && (i<dim->
dim[0] + fant) ) ;
284 assert( (j>=-fant) && (j<dim->
dim[1] + fant) ) ;
285 if (
etat == ETATZERO) {
289 else return t[(
dim->
dim[0] + 2*fant) *(j+fant) + i + fant] ;
297 assert(
etat != ETATNONDEF) ;
300 assert( (i>=-fant) && (i<dim->
dim[0] + fant) ) ;
301 assert( (j>=-fant) && (j<dim->
dim[1] + fant + 1) ) ;
302 if (
etat == ETATZERO) {
306 else return txti[(
dim->
dim[0] + 2*fant) *(j+fant) + i + fant] ;
314 assert(
etat != ETATNONDEF) ;
317 assert( (i>=-fant) && (i<dim->
dim[0] + fant + 1) ) ;
318 assert( (j>=-fant) && (j<dim->
dim[1] + fant) ) ;
319 if (
etat == ETATZERO) {
323 else return tzri[(
dim->
dim[0] + 2*fant + 1) *(j+fant) + i + fant] ;
327 double&
set(
int k,
int j,
int i) {
328 assert (
etat == ETATQCQ) ;
331 assert( (i>=-fant) && (i<dim->
dim[0] + fant) ) ;
332 assert( (j>=-fant) && (j<dim->
dim[1] + fant) ) ;
333 assert( (k>=-fant) && (k<dim->
dim[2] + fant) ) ;
334 return t[(
dim->
dim[1]+2*fant)*(
dim->
dim[0]+2*fant)*(k+fant) +
335 (
dim->
dim[0]+2*fant)*(j+fant) + i +fant] ;
343 assert (
etat == ETATQCQ) ;
346 assert( (i>=-fant) && (i<dim->
dim[0] + fant) ) ;
347 assert( (j>=-fant) && (j<dim->
dim[1] + fant) ) ;
348 assert( (k>=-fant) && (k<dim->
dim[2] + fant + 1) ) ;
350 (
dim->
dim[0]+2*fant)*(j+fant) + i +fant] ;
358 assert (
etat == ETATQCQ) ;
361 assert( (i>=-fant) && (i<dim->
dim[0] + fant) ) ;
362 assert( (j>=-fant) && (j<dim->
dim[1] + fant + 1) ) ;
363 assert( (k>=-fant) && (k<dim->
dim[2] + fant) ) ;
365 (
dim->
dim[0]+2*fant)*(j+fant) + i +fant] ;
373 assert (
etat == ETATQCQ) ;
376 assert( (i>=-fant) && (i<dim->
dim[0] + fant + 1) ) ;
377 assert( (j>=-fant) && (j<dim->
dim[1] + fant) ) ;
378 assert( (k>=-fant) && (k<dim->
dim[2] + fant) ) ;
380 (
dim->
dim[0]+2*fant+1)*(j+fant) + i +fant] ;
385 assert(
etat != ETATNONDEF) ;
388 assert( (i>=-fant) && (i<dim->
dim[0] + fant) ) ;
389 assert( (j>=-fant) && (j<dim->
dim[1] + fant) ) ;
390 assert( (k>=-fant) && (k<dim->
dim[2] + fant) ) ;
391 if (
etat == ETATZERO) {
395 else return t[(
dim->
dim[1]+2*fant)*(
dim->
dim[0]+2*fant)*(k+fant)
396 + (
dim->
dim[0]+2*fant)*(j+fant) + i +fant] ;
404 assert(
etat != ETATNONDEF) ;
407 assert( (i>=-fant) && (i<dim->
dim[0] + fant) ) ;
408 assert( (j>=-fant) && (j<dim->
dim[1] + fant) ) ;
409 assert( (k>=-fant) && (k<dim->
dim[2] + fant + 1) ) ;
410 if (
etat == ETATZERO) {
415 + (
dim->
dim[0]+2*fant)*(j+fant) + i +fant] ;
423 assert(
etat != ETATNONDEF) ;
426 assert( (i>=-fant) && (i<dim->
dim[0] + fant) ) ;
427 assert( (j>=-fant) && (j<dim->
dim[1] + fant + 1) ) ;
428 assert( (k>=-fant) && (k<dim->
dim[2] + fant) ) ;
429 if (
etat == ETATZERO) {
434 + (
dim->
dim[0]+2*fant)*(j+fant) + i +fant] ;
442 assert(
etat != ETATNONDEF) ;
445 assert( (i>=-fant) && (i<dim->
dim[0] + fant + 1) ) ;
446 assert( (j>=-fant) && (j<dim->
dim[1] + fant) ) ;
447 assert( (k>=-fant) && (k<dim->
dim[2] + fant) ) ;
448 if (
etat == ETATZERO) {
453 + (
dim->
dim[0]+2*fant+1)*(j+fant) + i +fant] ;
464 for (
int i=0; i<
dim->
ndim; i++)
470 assert (i<dim->ndim) ;
472 for (
int j=0; j<
dim->
ndim; j++)
486 assert( (i>=0) && (i<dim->ndim) ) ;
497 void sauve(FILE* )
const ;
506 double threshold = 1.e-7)
const ;
554 int type_inter = 2)
const ;
564 bool interfr =
false,
bool interft =
false) ;
567 void smooth_atmosphere(
double atmosphere_thr) ;
582 Tbl_val
operator+(
const Tbl_val&,
const Tbl_val&) ;
584 Tbl_val
operator+(
const Tbl_val&,
double) ;
586 Tbl_val
operator+(
double,
const Tbl_val&) ;
592 Tbl_val
operator-(
const Tbl_val&,
const Tbl_val&) ;
594 Tbl_val
operator-(
const Tbl_val&,
double) ;
596 Tbl_val
operator-(
double,
const Tbl_val&) ;
602 Tbl_val
operator*(
const Tbl_val&,
const Tbl_val&) ;
604 Tbl_val
operator*(
const Tbl_val&,
double) ;
606 Tbl_val
operator*(
double,
const Tbl_val&) ;
612 Tbl_val
operator/(
const Tbl_val&,
const Tbl_val&) ;
614 Tbl_val
operator/(
const Tbl_val&,
double) ;
616 Tbl_val
operator/(
double,
const Tbl_val&) ;
623 Tbl_val
sin(
const Tbl_val& ) ;
625 Tbl_val
cos(
const Tbl_val& ) ;
627 Tbl_val
tan(
const Tbl_val& ) ;
629 Tbl_val
asin(
const Tbl_val& ) ;
631 Tbl_val
acos(
const Tbl_val& ) ;
633 Tbl_val
atan(
const Tbl_val& ) ;
635 Tbl_val
exp(
const Tbl_val& ) ;
639 Tbl_val
log(
const Tbl_val& ) ;
641 Tbl_val
log10(
const Tbl_val& ) ;
643 Tbl_val
sqrt(
const Tbl_val& ) ;
647 Tbl_val
pow(
const Tbl_val& ,
int ) ;
649 Tbl_val
pow(
const Tbl_val& ,
double ) ;
651 Tbl_val
abs(
const Tbl_val& ) ;
653 double max(
const Tbl_val& ) ;
655 double min(
const Tbl_val& ) ;
658 double norme(
const Tbl_val& ) ;
665 double diffrel(
const Tbl_val& a,
const Tbl_val& b) ;
672 double diffrelmax(
const Tbl_val& a,
const Tbl_val& b) ;
double operator()(int k, int j, int i) const
Read-only of a particular element (index (k,j,i) ) (3D case)
int get_fantome() const
Returns the number of hidden cells.
Cmp log(const Cmp &)
Neperian logarithm.
Cmp asin(const Cmp &)
Arcsine.
Cmp exp(const Cmp &)
Exponential.
double & set_xti(int k, int j, int i)
Read/write of a particular element on the x (or ) interface (index (k,j,i) ) (3D case) ...
Cmp sqrt(const Cmp &)
Square root.
double & set_zri(int i)
Read/write of a particular element on the interface (index i ) (1D case)
void append_array(double *t_in)
Appends an array of doubles as the main array t of this (DO NOT use it, unless you REALLY know how it...
Cmp racine_cubique(const Cmp &)
Cube root.
int get_ndim() const
Gives the number of dimensions (ie dim->ndim )
Tensor field of valence 0 (or component of a tensorial field).
void operator=(const Tbl_val &)
Assignment to another Tbl_val.
Base_val operator*(const Base_val &, const Base_val &)
This operator is used when calling multiplication or division of Valeur .
double get_xti(int j, int i) const
Read-only of a particular element on the x (or ) interface (index (j,i) ) (2D case) ...
Base class for coordinate mappings.
const Dim_tbl * dim
The Dim_tbl giving the dimensions and number of points (without the hidden cells).
double get_ypi(int k, int j, int i) const
Read-only of a particular element on the y (or ) interface (index (k,j,i) ) (3D case) ...
int etat
logical state (ETATNONDEF , ETATQCQ or ETATZERO ).
double & set_ypi(int k, int j, int i)
Read/write of a particular element on the y (or ) interface (index (k,j,i) ) (3D case) ...
void set_etat_nondef()
Sets the logical state to ETATNONDEF (undefined).
double & set_zri(int j, int i)
Read/write of a particular element on the z (or r) interface (index (j,i) ) (2D case) ...
void del_t()
Logical destructor: dellocates the memory occupied by the array t and sets the logical state to ETATN...
void operator+=(const Tbl_val &)
Addition of a Tbl_val to this.
double operator()(int i) const
Read-only of a particular element (index i ) (1D case)
Cmp operator/(const Cmp &, const Cmp &)
Cmp / Cmp.
Tbl min(const Cmp &)
Minimum values of a Cmp in each domain.
Cmp cos(const Cmp &)
Cosine.
Tbl diffrel(const Cmp &a, const Cmp &b)
Relative difference between two Cmp (norme version).
double get_zri(int i) const
Read-only of a particular element on the interface (index i ) (1D case)
Base class for Godunov-type grids.
double get_zri(int j, int i) const
Read-only of a particular element on the z (or r) interface (index (j,i) ) (2D case) ...
Cmp tan(const Cmp &)
Tangent.
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
void operator-=(const Tbl_val &)
Subtraction of a Tbl_val to this.
void operator/=(const Tbl_val &)
Division of this by a Tbl_val.
void operator*=(const Tbl_val &)
Multiplication of this by a Tbl_val.
int get_taille_i(int i) const
Gives the size of the interface arrays (including the hidden cells)
double & set_zri(int k, int j, int i)
Read/write of a particular element on the z (or r) interface (index (k,j,i) ) (3D case) ...
Tbl norme(const Cmp &)
Sums of the absolute values of all the values of the Cmp in each domain.
Cmp atan(const Cmp &)
Arctangent.
Cmp operator+(const Cmp &)
int get_etat() const
Gives the logical state.
double operator()(int j, int i) const
Read-only of a particular element (index (j,i) ) (2D case)
void set_etat_zero()
Sets the logical state to ETATZERO (zero).
Tbl max(const Cmp &)
Maximum values of a Cmp in each domain.
double * tzri
The array at z (or r) interfaces.
double get_zri(int k, int j, int i) const
Read-only of a particular element on the z (or r) interface (index (k,j,i) ) (3D case) ...
Finite-difference array intended to store field values.
Cmp pow(const Cmp &, int)
Power .
void affiche_seuil(ostream &ostr, int precision=4, double threshold=1.e-7) const
Prints only the values greater than a given threshold.
double * typi
The array at y (or ) interfaces.
int ndim
Number of dimensions of the Tbl: can be 1, 2 or 3.
Storage of array dimensions.
friend ostream & operator<<(ostream &, const Tbl_val &)
Display.
int get_dim(int i) const
Gives the i th dimension (ie dim->dim[i] , without hidden cells)
Cmp log10(const Cmp &)
Basis 10 logarithm.
Cmp acos(const Cmp &)
Arccosine.
Cmp abs(const Cmp &)
Absolute value.
void annule_hard()
Sets the Tbl_val to zero in a hard way.
double * t
The array of double at the nodes.
void sauve(FILE *) const
Save in a file.
int get_taille() const
Gives the size of the node array (including the hidden cells)
double & set_xti(int j, int i)
Read/write of a particular element on the x (or ) interface (index (j,i) ) (2D case) ...
Cmp operator-(const Cmp &)
- Cmp
Cmp sin(const Cmp &)
Sine.
Mtbl Heaviside(const Mtbl &)
Heaviside function.
Tbl_val(const Grille_val *)
Constructor from a 3D grid.
void from_spectral(const Scalar &meudon, int lmax, int lmin=0, bool interfr=false, bool interft=false)
Interpolation from a Scalar to a Tbl_val (spectral summation).
Scalar to_spectral(const Map &map, const int lmax, const int lmin=0, int type_inter=2) const
Interpolation from a Tbl_val to a Scalar .
double * txti
The array at x (or ) interfaces.
const Grille_val * gval
The Grille_val (cartesian or spherical) on which the array is defined.
Tbl diffrelmax(const Cmp &a, const Cmp &b)
Relative difference between two Cmp (max version).
int * dim
Array of dimensions (size: ndim).
const Grille_val * get_grille() const
Returns a pointer on the grid on which the Tbl_val is defined.
double get_xti(int k, int j, int i) const
Read-only of a particular element on the x (or ) interface (index (k,j,i) ) (3D case) ...