LORENE
mtbl_cf.h
1/*
2 * Definition of Lorene class Mtbl_cf
3 *
4 */
5
6/*
7 * Copyright (c) 1999-2000 Jean-Alain Marck
8 * Copyright (c) 1999-2005 Eric Gourgoulhon
9 * Copyright (c) 1999-2001 Philippe Grandclement
10 * Copyright (c) 1999-2001 Jerome Novak
11 *
12 * This file is part of LORENE.
13 *
14 * LORENE is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * LORENE is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with LORENE; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 *
28 */
29
30
31#ifndef __MTBL_CF_H_
32#define __MTBL_CF_H_
33
34/*
35 * $Id: mtbl_cf.h,v 1.13 2023/05/24 09:54:32 g_servignat Exp $
36 * $Log: mtbl_cf.h,v $
37 * Revision 1.13 2023/05/24 09:54:32 g_servignat
38 * Added multiplication by \xi in a given shell
39 *
40 * Revision 1.12 2021/11/24 13:12:17 g_servignat
41 * Addition of new method mult_xm1_shell(int) to multiply by (\xi +1) in a given shell.
42 *
43 * Revision 1.11 2021/11/22 15:19:45 j_novak
44 * Addition of new method mult_xm1_shell(int) to multiply by (\xi -1) in a
45 * given shell.
46 *
47 * Revision 1.10 2014/10/13 08:52:36 j_novak
48 * Lorene classes and functions now belong to the namespace Lorene.
49 *
50 * Revision 1.9 2006/06/06 14:56:59 j_novak
51 * Summation functions for angular coefficients at xi=+/-1.
52 *
53 * Revision 1.8 2005/04/04 21:30:42 e_gourgoulhon
54 * Added argument lambda to method poisson_angu
55 * to treat the generalized angular Poisson equation:
56 * Lap_ang u + lambda u = source.
57 *
58 * Revision 1.7 2004/03/22 13:12:42 j_novak
59 * Modification of comments to use doxygen instead of doc++
60 *
61 * Revision 1.6 2003/11/06 14:43:37 e_gourgoulhon
62 * Gave a name to const arguments in certain method prototypes (e.g.
63 * constructors) to correct a bug of DOC++.
64 *
65 * Revision 1.5 2003/10/19 19:44:41 e_gourgoulhon
66 * Introduced new method display (to replace the old affiche_seuil).
67 *
68 * Revision 1.4 2003/10/15 21:09:22 e_gourgoulhon
69 * Added method poisson_regu.
70 *
71 * Revision 1.3 2002/09/13 09:17:33 j_novak
72 * Modif. commentaires
73 *
74 * Revision 1.2 2002/06/17 14:05:17 j_novak
75 * friend functions are now also declared outside the class definition
76 *
77 * Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon
78 * LORENE
79 *
80 * Revision 2.28 2000/09/11 13:52:21 eric
81 * Ajout des methodes mult_cp() et mult_sp().
82 *
83 * Revision 2.27 2000/08/16 10:42:54 eric
84 * Suppression du membre dzpuis.
85 *
86 * Revision 2.26 2000/08/04 11:41:52 eric
87 * Ajout de l'operateur (int l) et de la fonction set(int l) pour l'acces
88 * individuel aux Tbl.
89 *
90 * Revision 2.25 2000/03/06 10:26:24 eric
91 * Ajout des fonctions val_point_symy, val_point_asymy.
92 *
93 * Revision 2.24 2000/02/25 13:53:44 eric
94 * Suppression de la fonction nettoie().
95 *
96 * Revision 2.23 1999/12/29 13:11:34 eric
97 * Ajout de la fonction val_point_jk.
98 *
99 * Revision 2.22 1999/12/07 14:51:52 eric
100 * Changement ordre des arguments (phi,theta,xi) --> (xi,theta,phi)
101 * dans la routine val_point.
102 *
103 * Revision 2.21 1999/12/06 16:45:48 eric
104 * Ajout de la fonction val_point.
105 *
106 * Revision 2.20 1999/11/23 14:30:12 novak
107 * Ajout des membres mult_ct et mult_st
108 *
109 * Revision 2.19 1999/11/16 13:06:22 novak
110 * Ajout de mult_x et scost
111 *
112 * Revision 2.18 1999/10/29 15:07:10 eric
113 * Suppression des fonctions membres min() et max():
114 * elles deviennent des fonctions externes.
115 * Ajout de fonctions mathematiques (abs, norme, etc...).
116 *
117 * Revision 2.17 1999/10/21 13:42:00 eric
118 * *** empty log message ***
119 *
120 * Revision 2.16 1999/10/21 12:49:13 eric
121 * Ajout de la fonction membre nettoie().
122 *
123 * Revision 2.15 1999/10/18 15:06:50 eric
124 * La fonction membre annule() est rebaptisee annule_hard().
125 * Introduction de la fonction membre annule(int, int).
126 *
127 * Revision 2.14 1999/10/18 13:39:13 eric
128 * Suppression de l'argument base dans les routines de derivation.
129 *
130 * Revision 2.13 1999/10/13 15:49:22 eric
131 * Ajout du membre base.
132 * Modification des constructeurs (la base doit etre passee en argument).
133 *
134 * Revision 2.12 1999/10/01 14:49:19 eric
135 * Depoussierage.
136 * Documentation.
137 *
138 * Revision 2.11 1999/09/07 14:33:43 phil
139 * ajout de la fonction ssint(int*)
140 *
141 * Revision 2.10 1999/04/26 17:02:40 phil
142 * ajout de sx2(int*)
143 *
144 * Revision 2.9 1999/04/26 16:24:02 phil
145 * ajout de mult2_xm1_zec(int*)
146 *
147 * Revision 2.8 1999/04/26 16:12:27 phil
148 * ajout de mult_xm1_zec(int *)
149 *
150 * Revision 2.7 1999/04/26 15:48:43 phil
151 * ajout de sxm1_zec(int*)
152 *
153 * Revision 2.6 1999/04/26 14:50:30 phil
154 * ajout de sx(int*)
155 *
156 * Revision 2.5 1999/04/26 12:19:38 phil
157 * ajout lapang
158 *
159 * Revision 2.4 1999/03/03 10:32:44 hyc
160 * *** empty log message ***
161 *
162 * Revision 2.3 1999/03/02 18:55:00 eric
163 * Ajout de la fonction affiche_seuil.
164 *
165 *
166 * $Header: /cvsroot/Lorene/C++/Include/mtbl_cf.h,v 1.13 2023/05/24 09:54:32 g_servignat Exp $
167 *
168 */
169
170// Headers Lorene
171#include "tbl.h"
172#include "base_val.h"
173#include "grilles.h"
174
175namespace Lorene {
176class Mg3d ;
177
196class Mtbl_cf {
197
198 // Data :
199 // -----
200 private:
202 const Mg3d* mg ;
204 int nzone ;
206 int etat ;
207
208 public:
211
215 Tbl** t ;
216
217 // Constructors - Destructor
218 // -------------------------
219
220 public:
222 Mtbl_cf(const Mg3d& mgrid, const Base_val& basis) ;
224 Mtbl_cf(const Mg3d* p_mgrid, const Base_val& basis) ;
225
227 Mtbl_cf(const Mg3d&, FILE* ) ;
228
230 Mtbl_cf(const Mtbl_cf& ) ;
232 ~Mtbl_cf() ;
233
234 // Assignement
235 // -----------
237 void operator=(const Mtbl_cf& ) ;
239 void operator=(double ) ;
241 void operator=(int ) ;
242
243 // Memory management
244 // -----------------
245 private:
249 void del_t() ;
250
251 public:
252
257 void set_etat_nondef() ;
258
263 void set_etat_zero() ;
264
271 void set_etat_qcq() ;
272
281 void annule_hard() ;
282
293 void annule(int l_min, int l_max) ;
294
295 // Access to individual elements
296 // -----------------------------
297 public:
298
304 Tbl& set(int l) {
305 assert(l < nzone) ;
306 assert(etat == ETATQCQ) ;
307 return *(t[l]) ;
308 };
309
310
316 const Tbl& operator()(int l) const {
317 assert(l < nzone) ;
318 assert(etat == ETATQCQ) ;
319 return *(t[l]) ;
320 };
321
322
329 double& set(int l, int k, int j, int i) {
330 assert(l < nzone) ;
331 assert(etat == ETATQCQ) ;
332 return (t[l])->set(k, j, i) ;
333 };
334
335
342 double operator()(int l, int k, int j, int i) const {
343 assert(etat != ETATNONDEF) ;
344 assert(l < nzone) ;
345 if (etat == ETATZERO) {
346 double zero = 0. ;
347 return zero ;
348 }
349 else return (*t[l])(k, j, i) ;
350 };
351
362 double val_point(int l, double x, double theta, double phi) const ;
363
375 double val_point_symy(int l, double x, double theta, double phi) const ;
376
388 double val_point_asymy(int l, double x, double theta, double phi) const ;
389
402 double val_point_jk(int l, double x, int j, int k) const ;
403
417 double val_point_jk_symy(int l, double x, int j, int k) const ;
418
432 double val_point_jk_asymy(int l, double x, int j, int k) const ;
433
443 double val_out_bound_jk(int l, int j, int k) const ;
444
455 double val_in_bound_jk(int l, int j, int k) const ;
456
457
458
459 // Extraction of information
460 // -------------------------
461 public:
463 const Mg3d* get_mg() const { return mg ; };
464
466 int get_etat() const { return etat ; };
467
469 int get_nzone() const { return nzone ; } ;
470
471
472 // Outputs
473 // -------
474 public:
475
477 void sauve(FILE *) const ;
478
486 void display(double threshold = 1.e-7, int precision = 4,
487 ostream& ostr = cout) const ;
488
495 void affiche_seuil(ostream& ostr, int precision = 4,
496 double threshold = 1.e-7) const ;
498 friend ostream& operator<<(ostream& , const Mtbl_cf& ) ;
499
500 // Member arithmetics
501 // ------------------
502 public:
504 void operator+=(const Mtbl_cf & ) ;
506 void operator-=(const Mtbl_cf & ) ;
508 void operator*=(double ) ;
510 void operator/=(double ) ;
511
512 // Linear operators
513 // ----------------
514 public:
516 void dsdx() ;
517
519 void d2sdx2() ;
520
525 void sx() ;
526
531 void sx2() ;
532
537 void mult_x() ;
538
542 void sxm1_zec() ;
543
549 void mult_xm1_shell(int i) ;
550
556 void mult_xp1_shell(int i) ;
557
563 void mult_x_shell(int i) ;
564
568 void mult_xm1_zec() ;
569
573 void mult2_xm1_zec() ;
574
576 void dsdt() ;
577
579 void d2sdt2() ;
580
582 void ssint() ;
583
585 void scost() ;
586
588 void mult_ct() ;
589
591 void mult_st() ;
592
594 void dsdp() ;
595
597 void d2sdp2() ;
598
600 void mult_cp() ;
601
603 void mult_sp() ;
604
606 void lapang() ;
607
608 // PDE resolution
609 //---------------
610 public:
626 void poisson_angu(double lambda = 0) ;
627
628} ;
629ostream& operator<<(ostream& , const Mtbl_cf& ) ;
630
638Mtbl_cf operator+(const Mtbl_cf& ) ;
640Mtbl_cf operator-(const Mtbl_cf& ) ;
642Mtbl_cf operator+(const Mtbl_cf&, const Mtbl_cf& ) ;
644Mtbl_cf operator-(const Mtbl_cf&, const Mtbl_cf& ) ;
646Mtbl_cf operator*(const Mtbl_cf&, double ) ;
648Mtbl_cf operator*(double, const Mtbl_cf& ) ;
650Mtbl_cf operator*(const Mtbl_cf&, int ) ;
652Mtbl_cf operator*(int, const Mtbl_cf& ) ;
654Mtbl_cf operator/(const Mtbl_cf&, double ) ;
656Mtbl_cf operator/(const Mtbl_cf&, int ) ;
657
659Mtbl_cf abs(const Mtbl_cf& ) ;
660
666Tbl max(const Mtbl_cf& ) ;
667
673Tbl min(const Mtbl_cf& ) ;
674
680Tbl norme(const Mtbl_cf& ) ;
681
690Tbl diffrel(const Mtbl_cf& a, const Mtbl_cf& b) ;
691
700Tbl diffrelmax(const Mtbl_cf& a, const Mtbl_cf& b) ;
701
703
704}
705#endif
Bases of the spectral expansions.
Definition base_val.h:325
Multi-domain grid.
Definition grilles.h:279
Coefficients storage for the multi-domain spectral method.
Definition mtbl_cf.h:196
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...
Base_val base
Bases of the spectral expansions.
Definition mtbl_cf.h:210
void del_t()
Logical destructor: dellocates the memory occupied by the Tbl array t .
Definition mtbl_cf.C:279
void set_etat_nondef()
Sets the logical state to ETATNONDEF (undefined).
Definition mtbl_cf.C:297
void mult2_xm1_zec()
Id (r sampling = RARE, FIN ) \ (r -sampling = UNSURR ).
~Mtbl_cf()
Destructor.
Definition mtbl_cf.C:146
void mult_xm1_zec()
Id (r sampling = RARE, FIN ) \ (r -sampling = UNSURR ).
void set_etat_zero()
Sets the logical state to ETATZERO (zero).
Definition mtbl_cf.C:291
void poisson_angu(double lambda=0)
Resolution of the generalized angular Poisson equation.
Definition mtbl_cf_pde.C:86
double val_point_symy(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 ...
double val_point_jk_asymy(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...
void sx()
(r -sampling = RARE ) \ Id (r sampling = FIN ) \ (r -sampling = UNSURR )
Definition valeur_sx.C:156
int get_etat() const
Returns the logical state.
Definition mtbl_cf.h:466
const Tbl & operator()(int l) const
Read-only of the Tbl containing the coefficients in a given domain.
Definition mtbl_cf.h:316
double val_point_jk_symy(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...
double & set(int l, int k, int j, int i)
Read/write of a particular element.
Definition mtbl_cf.h:329
void sxm1_zec()
Id (r sampling = RARE, FIN ) \ (r -sampling = UNSURR ).
const Mg3d * mg
Pointer on the multi-grid Mgd3 on which this is defined.
Definition mtbl_cf.h:202
void operator*=(double)
*= double
Definition mtbl_cf.C:432
void annule(int l_min, int l_max)
Sets the Mtbl_cf to zero in some domains.
Definition mtbl_cf.C:335
void sauve(FILE *) const
Save in a file.
Definition mtbl_cf.C:207
Tbl & set(int l)
Read/write of the Tbl containing the coefficients in a given domain.
Definition mtbl_cf.h:304
void operator-=(const Mtbl_cf &)
-= Mtbl_cf
void mult_xm1_shell(int i)
Id (r sampling = RARE, UNSURR ) \ (r -sampling = FIN ).
void sx2()
(r -sampling = RARE ) \ Id (r sampling = FIN ) \ (r -sampling = UNSURR )
Definition valeur_sx2.C:160
int get_nzone() const
Returns the number of zones (domains).
Definition mtbl_cf.h:469
void affiche_seuil(ostream &ostr, int precision=4, double threshold=1.e-7) const
Prints only the values greater than a given threshold.
Definition mtbl_cf.C:400
const Mg3d * get_mg() const
Returns the Mg3d on which the Mtbl_cf is defined.
Definition mtbl_cf.h:463
void operator=(const Mtbl_cf &)
Assignement to another Mtbl_cf.
Definition mtbl_cf.C:223
int etat
Logical state (ETATNONDEF , ETATQCQ or ETATZERO ).
Definition mtbl_cf.h:206
Tbl ** t
Array (size nzone ) of pointers on the Tbl 's which contain the spectral coefficients in each domain.
Definition mtbl_cf.h:215
double val_point_asymy(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 ...
Mtbl_cf(const Mg3d &mgrid, const Base_val &basis)
Constructor.
Definition mtbl_cf.C:127
void display(double threshold=1.e-7, int precision=4, ostream &ostr=cout) const
Prints the coefficients whose values are greater than a given threshold, as well as the corresponding...
void mult_x()
(r -sampling = RARE ) \ Id (r sampling = FIN ) \ (r -sampling = UNSURR )
void mult_x_shell(int i)
Id (r sampling = RARE, UNSURR ) \ (r -sampling = FIN ).
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_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Definition mtbl_cf.C:303
void operator+=(const Mtbl_cf &)
+= Mtbl_cf
void mult_xp1_shell(int i)
Id (r sampling = RARE, UNSURR ) \ (r -sampling = FIN ).
void annule_hard()
Sets the Mtbl_cf to zero in a hard way.
Definition mtbl_cf.C:315
void operator/=(double)
/= double
Definition mtbl_cf.C:437
friend ostream & operator<<(ostream &, const Mtbl_cf &)
Display.
Definition mtbl_cf.C:369
void lapang()
Angular Laplacian.
double val_out_bound_jk(int l, int j, int k) const
Computes the angular coefficient of index j,k of the field represented by *this at by means of the s...
double val_in_bound_jk(int l, int j, int k) const
Computes the angular coefficient of index j,k of the field represented by *this at by means of the s...
int nzone
Number of domains (zones).
Definition mtbl_cf.h:204
double operator()(int l, int k, int j, int i) const
Read-only of a particular element.
Definition mtbl_cf.h:342
Basic array class.
Definition tbl.h:161
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
Definition cmp_arithm.C:111
Cmp operator/(const Cmp &, const Cmp &)
Cmp / Cmp.
Definition cmp_arithm.C:460
Tbl diffrel(const Cmp &a, const Cmp &b)
Relative difference between two Cmp (norme version).
Definition cmp_math.C:507
Tbl norme(const Cmp &)
Sums of the absolute values of all the values of the Cmp in each domain.
Definition cmp_math.C:484
Tbl min(const Cmp &)
Minimum values of a Cmp in each domain.
Definition cmp_math.C:461
Tbl max(const Cmp &)
Maximum values of a Cmp in each domain.
Definition cmp_math.C:438
Cmp abs(const Cmp &)
Absolute value.
Definition cmp_math.C:413
Tbl diffrelmax(const Cmp &a, const Cmp &b)
Relative difference between two Cmp (max version).
Definition cmp_math.C:542
Cmp operator+(const Cmp &)
Definition cmp_arithm.C:107
Lorene prototypes.
Definition app_hor.h:67
Coord phi
coordinate centered on the grid
Definition map.h:732
Coord x
x coordinate centered on the grid
Definition map.h:738