83 #include "grille_val.h" 196 assert (etat == ETATQCQ) ;
197 assert( dim->
ndim == 1 ) ;
199 assert( i >= - fant) ;
200 assert( i < dim->dim[0] + fant) ;
206 assert (etat == ETATQCQ) ;
207 assert( dim->
ndim == 1 ) ;
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 ) ;
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 ) ;
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 ) ;
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 ) ;
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 ) ;
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 ) ;
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 ) ;
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 ) ;
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 ) ;
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 ) ;
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 ) ;
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 ) ;
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 ) ;
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 ) ;
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 ) ;
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 ) ;
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++)
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) ;
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) ...