83#include "grille_val.h"
196 assert (
etat == ETATQCQ) ;
197 assert(
dim->ndim == 1 ) ;
198 int fant =
gval->get_fantome() ;
199 assert( i >= - fant) ;
200 assert( i < dim->
dim[0] + fant) ;
206 assert (
etat == ETATQCQ) ;
207 assert(
dim->ndim == 1 ) ;
208 int fant =
gval->get_fantome() ;
209 assert( i >= -fant ) ;
210 assert( i < dim->
dim[0] + fant + 1) ;
211 return tzri[i+fant] ;
216 assert(
etat != ETATNONDEF) ;
217 assert(
dim->ndim == 1 ) ;
218 int fant =
gval->get_fantome() ;
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) ;
231 assert(
dim->ndim == 1 ) ;
232 int fant =
gval->get_fantome() ;
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) ;
245 assert(
dim->ndim == 2 ) ;
246 int fant =
gval->get_fantome() ;
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) ;
258 assert(
dim->ndim == 2 ) ;
259 int fant =
gval->get_fantome() ;
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) ;
271 assert(
dim->ndim == 2 ) ;
272 int fant =
gval->get_fantome() ;
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) ;
281 assert(
dim->ndim == 2 ) ;
282 int fant =
gval->get_fantome() ;
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) ;
298 assert(
dim->ndim == 2 ) ;
299 int fant =
gval->get_fantome() ;
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) ;
315 assert(
dim->ndim == 2 ) ;
316 int fant =
gval->get_fantome() ;
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) ;
329 assert(
dim->ndim == 3 ) ;
330 int fant =
gval->get_fantome() ;
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) ;
344 assert(
dim->ndim == 3 ) ;
345 int fant =
gval->get_fantome() ;
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) ) ;
349 return typi[(
dim->dim[1]+2*fant)*(
dim->dim[0]+2*fant)*(k+fant) +
350 (
dim->dim[0]+2*fant)*(j+fant) + i +fant] ;
358 assert (
etat == ETATQCQ) ;
359 assert(
dim->ndim == 3 ) ;
360 int fant =
gval->get_fantome() ;
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) ) ;
364 return txti[(
dim->dim[1]+2*fant+1)*(
dim->dim[0]+2*fant)*(k+fant) +
365 (
dim->dim[0]+2*fant)*(j+fant) + i +fant] ;
373 assert (
etat == ETATQCQ) ;
374 assert(
dim->ndim == 3 ) ;
375 int fant =
gval->get_fantome() ;
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) ) ;
379 return tzri[(
dim->dim[1]+2*fant)*(
dim->dim[0]+2*fant+1)*(k+fant) +
380 (
dim->dim[0]+2*fant+1)*(j+fant) + i +fant] ;
385 assert(
etat != ETATNONDEF) ;
386 assert(
dim->ndim == 3 ) ;
387 int fant =
gval->get_fantome() ;
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) ;
405 assert(
dim->ndim == 3 ) ;
406 int fant =
gval->get_fantome() ;
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) {
414 else return typi[(
dim->dim[1]+2*fant)*(
dim->dim[0]+2*fant)*(k+fant)
415 + (
dim->dim[0]+2*fant)*(j+fant) + i +fant] ;
423 assert(
etat != ETATNONDEF) ;
424 assert(
dim->ndim == 3 ) ;
425 int fant =
gval->get_fantome() ;
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) {
433 else return txti[(
dim->dim[1]+2*fant+1)*(
dim->dim[0]+2*fant)*(k+fant)
434 + (
dim->dim[0]+2*fant)*(j+fant) + i +fant] ;
442 assert(
etat != ETATNONDEF) ;
443 assert(
dim->ndim == 3 ) ;
444 int fant =
gval->get_fantome() ;
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) {
452 else return tzri[(
dim->dim[1]+2*fant)*(
dim->dim[0]+2*fant+1)*(k+fant)
453 + (
dim->dim[0]+2*fant+1)*(j+fant) + i +fant] ;
464 for (
int i=0; i<
dim->ndim; i++)
465 resu *=
dim->dim[i] + 2*(
gval->get_fantome()) ;
470 assert (i<dim->ndim) ;
472 for (
int j=0; j<
dim->ndim; j++)
474 resu *=
dim->dim[j] + 2*
gval->get_fantome() ;
477 resu *=
dim->dim[j] + 2*
gval->get_fantome() + 1 ;
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) ;
582Tbl_val
operator+(
const Tbl_val&,
const Tbl_val&) ;
584Tbl_val
operator+(
const Tbl_val&,
double) ;
586Tbl_val
operator+(
double,
const Tbl_val&) ;
592Tbl_val
operator-(
const Tbl_val&,
const Tbl_val&) ;
594Tbl_val
operator-(
const Tbl_val&,
double) ;
596Tbl_val
operator-(
double,
const Tbl_val&) ;
602Tbl_val
operator*(
const Tbl_val&,
const Tbl_val&) ;
604Tbl_val
operator*(
const Tbl_val&,
double) ;
606Tbl_val
operator*(
double,
const Tbl_val&) ;
612Tbl_val
operator/(
const Tbl_val&,
const Tbl_val&) ;
614Tbl_val
operator/(
const Tbl_val&,
double) ;
616Tbl_val
operator/(
double,
const Tbl_val&) ;
623Tbl_val
sin(
const Tbl_val& ) ;
625Tbl_val
cos(
const Tbl_val& ) ;
627Tbl_val
tan(
const Tbl_val& ) ;
629Tbl_val
asin(
const Tbl_val& ) ;
631Tbl_val
acos(
const Tbl_val& ) ;
633Tbl_val
atan(
const Tbl_val& ) ;
635Tbl_val
exp(
const Tbl_val& ) ;
Storage of array dimensions.
Base class for Godunov-type grids.
Tensor field of valence 0 (or component of a tensorial field).
Finite-difference array intended to store field values.
void del_t()
Logical destructor: dellocates the memory occupied by the array t and sets the logical state to ETATN...
const Grille_val * gval
The Grille_val (cartesian or spherical) on which the array is defined.
void operator=(const Tbl_val &)
Assignment to another Tbl_val.
void operator/=(const Tbl_val &)
Division of this by a Tbl_val.
double & set_zri(int i)
Read/write of a particular element on the interface (index i ) (1D case).
const Grille_val * get_grille() const
Returns a pointer on the grid on which the Tbl_val is defined.
void set_etat_nondef()
Sets the logical state to ETATNONDEF (undefined).
double & set(int k, int j, int i)
Read/write of a particular element (index (k,j,i) ) (3D case).
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).
int get_ndim() const
Gives the number of dimensions (ie dim->ndim ).
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).
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).
void operator*=(const Tbl_val &)
Multiplication of this by a Tbl_val.
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).
int get_dim(int i) const
Gives the i th dimension (ie dim->dim[i] , without hidden cells).
const Dim_tbl * dim
The Dim_tbl giving the dimensions and number of points (without the hidden cells).
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).
int get_taille_i(int i) const
Gives the size of the interface arrays (including the hidden cells).
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).
double * txti
The array at x (or ) 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).
double operator()(int i) const
Read-only of a particular element (index i ) (1D case).
double * tzri
The array at z (or r) interfaces.
double get_xti(int j, int i) const
Read-only of a particular element on the x (or ) interface (index (j,i) ) (2D case).
void annule_hard()
Sets the Tbl_val to zero in a hard way.
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).
double operator()(int k, int j, int i) const
Read-only of a particular element (index (k,j,i) ) (3D case).
friend ostream & operator<<(ostream &, const Tbl_val &)
Display.
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 & set(int j, int i)
Read/write of a particular element (index (j,i) ) (2D case).
double * t
The array of double at the nodes.
int get_etat() const
Gives the logical state.
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).
Tbl_val(const Grille_val *)
Constructor from a 3D grid.
void sauve(FILE *) const
Save in a file.
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 operator-=(const Tbl_val &)
Subtraction of a Tbl_val to this.
double & set_xti(int j, int i)
Read/write of a particular element on the x (or ) interface (index (j,i) ) (2D case).
double * typi
The array at y (or ) interfaces.
void operator+=(const Tbl_val &)
Addition of a Tbl_val to this.
int get_taille() const
Gives the size of the node array (including the hidden cells).
double operator()(int j, int i) const
Read-only of a particular element (index (j,i) ) (2D case).
double get_zri(int i) const
Read-only of a particular element on the interface (index i ) (1D case).
void set_etat_zero()
Sets the logical state to ETATZERO (zero).
void affiche_seuil(ostream &ostr, int precision=4, double threshold=1.e-7) const
Prints only the values greater than a given threshold.
int etat
logical state (ETATNONDEF , ETATQCQ or ETATZERO ).
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...
Base_val operator*(const Base_val &, const Base_val &)
This operator is used when calling multiplication or division of Valeur .
Cmp operator-(const Cmp &)
- Cmp
Cmp atan(const Cmp &)
Arctangent.
Cmp sqrt(const Cmp &)
Square root.
Cmp log10(const Cmp &)
Basis 10 logarithm.
Cmp operator/(const Cmp &, const Cmp &)
Cmp / Cmp.
Cmp exp(const Cmp &)
Exponential.
Cmp sin(const Cmp &)
Sine.
Tbl diffrel(const Cmp &a, const Cmp &b)
Relative difference between two Cmp (norme version).
Tbl norme(const Cmp &)
Sums of the absolute values of all the values of the Cmp in each domain.
Cmp acos(const Cmp &)
Arccosine.
Cmp asin(const Cmp &)
Arcsine.
Cmp racine_cubique(const Cmp &)
Cube root.
Tbl min(const Cmp &)
Minimum values of a Cmp in each domain.
Tbl max(const Cmp &)
Maximum values of a Cmp in each domain.
Cmp pow(const Cmp &, int)
Power .
Cmp cos(const Cmp &)
Cosine.
Cmp abs(const Cmp &)
Absolute value.
Tbl diffrelmax(const Cmp &a, const Cmp &b)
Relative difference between two Cmp (max version).
Cmp operator+(const Cmp &)
Cmp tan(const Cmp &)
Tangent.
Cmp log(const Cmp &)
Neperian logarithm.
Mtbl Heaviside(const Mtbl &)
Heaviside function.
Map(const Mg3d &)
Constructor from a multi-domain 3D grid.