LORENE
tenseur.h
1 /*
2  * Definition of Lorene classes Tenseur
3  * Tenseur_sym
4  *
5  */
6 
7 /*
8  * Copyright (c) 1999-2001 Philippe Grandclement
9  * Copyright (c) 2000-2001 Eric Gourgoulhon
10  * Copyright (c) 2002 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 __TENSEUR_H_
32 #define __TENSEUR_H_
33 
34 
35 /*
36  * $Id: tenseur.h,v 1.21 2026/03/04 15:47:04 j_novak Exp $
37  * $Log: tenseur.h,v $
38  * Revision 1.21 2026/03/04 15:47:04 j_novak
39  * Added 'verbose' flag (true by default) to limit the output of poisson solvers.
40  *
41  * Revision 1.20 2021/04/13 11:24:53 j_novak
42  * Corrected a bug in Etoile_rot::fait_shift() which was missing the np=1 case.
43  *
44  * Revision 1.19 2016/09/19 15:26:22 j_novak
45  * Correction of several bugs preventing the shared library compilation.
46  *
47  * Revision 1.18 2014/10/13 08:52:37 j_novak
48  * Lorene classes and functions now belong to the namespace Lorene.
49  *
50  * Revision 1.17 2010/02/02 13:34:12 e_gourgoulhon
51  * Marked DEPRECATED (in the documentation).
52  *
53  * Revision 1.16 2005/08/30 08:35:10 p_grandclement
54  * Addition of the Tau version of the vectorial Poisson equation for the Tensors
55  *
56  * Revision 1.15 2004/12/29 16:24:03 k_taniguchi
57  * Addition of the method for vectorial Poisson equations with a multipole
58  * falloff condition at the outer boundary.
59  *
60  * Revision 1.14 2004/12/22 18:25:12 k_taniguchi
61  * Change an argument of poisson_vect_falloff
62  *
63  * Revision 1.13 2004/11/30 20:43:32 k_taniguchi
64  * Addition of the method for vectorial Poisson equations with falloff
65  * condition at the outer boundary.
66  *
67  * Revision 1.12 2004/03/22 13:12:43 j_novak
68  * Modification of comments to use doxygen instead of doc++
69  *
70  * Revision 1.11 2003/11/06 12:17:31 r_prix
71  * fixed mini-bug in documentation: without explicit argument in function-prototype,
72  * doc++ seemed to merge docu of Tensor::operator=(Cmp&) and operator=(Tenseur&)
73  *
74  * Revision 1.10 2003/06/20 14:23:38 f_limousin
75  * Add the functions compare().
76  *
77  * Revision 1.9 2002/10/16 14:36:29 j_novak
78  * Reorganization of #include instructions of standard C++, in order to
79  * use experimental version 3 of gcc.
80  *
81  * Revision 1.8 2002/09/19 14:12:37 e_gourgoulhon
82  * Modif documentation for LaTeX compliance.
83  *
84  * Revision 1.7 2002/09/10 13:44:17 j_novak
85  * The method "manipule" of one indice has been removed for Tenseur_sym objects
86  * (the result cannot be a Tenseur_sym).
87  * The method "sans_trace" now computes the traceless part of a Tenseur (or
88  * Tenseur_sym) of valence 2.
89  *
90  * Revision 1.6 2002/09/06 14:49:25 j_novak
91  * Added method lie_derive for Tenseur and Tenseur_sym.
92  * Corrected various errors for derive_cov and arithmetic.
93  *
94  * Revision 1.5 2002/08/14 13:46:14 j_novak
95  * Derived quantities of a Tenseur can now depend on several Metrique's
96  *
97  * Revision 1.4 2002/08/08 15:10:44 j_novak
98  * The flag "plat" has been added to the class Metrique to show flat metrics.
99  *
100  * Revision 1.3 2002/08/07 16:14:11 j_novak
101  * class Tenseur can now also handle tensor densities, this should be transparent to older codes
102  *
103  * Revision 1.2 2002/06/17 14:05:17 j_novak
104  * friend functions are now also declared outside the class definition
105  *
106  * Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon
107  * LORENE
108  *
109  * Revision 2.46 2001/08/27 10:03:56 eric
110  * Ajout de l'operator% (produit tensoriel avec desaliasing)
111  *
112  * Revision 2.45 2001/06/19 15:38:00 eric
113  * Modif commentaires: mise en conformite Doc++ 3.4.8.
114  *
115  * Revision 2.44 2001/06/18 13:56:07 novak
116  * Ajout de la fonction abs()
117  *
118  * Revision 2.43 2001/05/29 16:10:43 eric
119  * Modif commentaires (mise en conformite Doc++ 3.4.7).
120  *
121  * Revision 2.42 2001/05/26 15:48:17 eric
122  * *** empty log message ***
123  *
124  * Revision 2.41 2001/05/26 15:42:54 eric
125  * Ajout de la fonction flat_scalar_prod_desal (desaliasage)
126  *
127  * Revision 2.40 2000/10/19 10:37:51 phil
128  * *** empty log message ***
129  *
130  * Revision 2.39 2000/10/19 09:47:15 phil
131  * *** empty log message ***
132  *
133  * Revision 2.38 2000/10/19 09:41:48 phil
134  * ajout de inverse_poisson_vect
135  *
136  * Revision 2.37 2000/10/06 12:37:09 keisuke
137  * Add a vectorial Poisson equation Tenseur::poisson_vect_regu.
138  *
139  * Revision 2.36 2000/09/27 08:52:34 eric
140  * Modif commentaires.
141  *
142  * Revision 2.35 2000/09/13 12:21:36 eric
143  * Modif commentaires.
144  *
145  * Revision 2.34 2000/09/13 12:11:26 eric
146  * Ajout de la fonction allocate_all().
147  *
148  * Revision 2.33 2000/05/22 14:39:11 phil
149  * ajout de inc_dzpuis et dec_dzpuis
150  *
151  * Revision 2.32 2000/04/03 15:18:54 phil
152  * suppression de poisson_vect_dirichlet
153  *
154  * Revision 2.31 2000/03/31 13:29:43 phil
155  * poisson_vect_neumann devient poisson_vect_dirichlet
156  *
157  * Revision 2.30 2000/03/30 16:10:46 phil
158  * *** empty log message ***
159  *
160  * Revision 2.29 2000/02/18 10:45:05 eric
161  * Modif commentaires.
162  *
163  * Revision 2.28 2000/02/11 19:11:55 phil
164  * commentaires
165  *
166  * Revision 2.27 2000/02/10 16:26:48 eric
167  * Modif commentaires.
168  *
169  * Revision 2.26 2000/02/10 16:10:49 eric
170  * Ajout de la fonction change_triad.
171  *
172  * Revision 2.25 2000/02/09 19:29:25 eric
173  * MODIF IMPORTANTE: la triade de decomposition est desormais passee en
174  * argument des constructeurs.
175  *
176  * Revision 2.24 2000/02/09 09:53:56 phil
177  * ajout de poisson_vect_oohara
178  * ,
179  *
180  * Revision 2.23 2000/02/08 19:04:25 eric
181  * Les fonctions arithmetiques ne sont plus amies.
182  * Ajout de nouvelles fonctions arithmetiques.
183  *
184  * Revision 2.22 2000/02/01 15:40:19 eric
185  * Ajout de la fonction sqrt
186  *
187  * Revision 2.21 2000/02/01 14:13:56 eric
188  * Modif commentaires.
189  * Ajout de la fonction amie flat_scalar_prod.
190  *
191  * Revision 2.20 2000/01/21 12:48:55 phil
192  * changement prototypage de Tenseur::poisson_vect
193  *
194  * Revision 2.19 2000/01/20 16:02:20 eric
195  * Ajout des operator=(double ) et operator=(int ).
196  *
197  * Revision 2.18 2000/01/20 14:52:08 phil
198  * *** empty log message ***
199  *
200  * Revision 2.17 2000/01/20 14:50:56 phil
201  * *** empty log message ***
202  *
203  * Revision 2.16 2000/01/20 14:39:31 phil
204  * *** empty log message ***
205  *
206  * Revision 2.15 2000/01/20 13:10:56 phil
207  * Ajout de Tenseur::poisson_vect (double)
208  *
209  * Revision 2.14 2000/01/20 11:20:17 phil
210  * changement prototypage
211  *
212  * Revision 2.13 2000/01/20 10:31:30 phil
213  * ajout de xksk
214  *
215  * Revision 2.12 2000/01/14 14:17:47 eric
216  * Modif commentaires.
217  *
218  * Revision 2.11 2000/01/14 14:04:07 eric
219  * Ajout de la fonction annule.
220  * classe Tenseur: constructeurs pour les classes derivees et fonctions
221  * de gestion memoire (del_t(), ...) declarees protected et non plus
222  * private.
223  *
224  * Revision 2.10 2000/01/13 14:15:30 eric
225  * Modif commentaires.
226  *
227  * Revision 2.9 2000/01/13 14:10:18 eric
228  * Ajout du constructeur par copie d'un Cmp (pour un scalaire)
229  * ainsi que l'affectation a un Cmp.
230  *
231  * Revision 2.8 2000/01/13 13:45:56 eric
232  * Ajout du membre p_gradient_spher et des fonctions fait_gradient_spher(),
233  * gradient_spher() pour le calcul du gradient d'un scalaire en
234  * coordonnees spheriques sur la triade spherique associee.
235  *
236  * Revision 2.7 2000/01/12 13:17:49 eric
237  * Les operator::(...) renvoie desormais une reference const sur le c[...]
238  * correspondant et non plus un Cmp copie de c[...].
239  * (ceci grace a Map::cmp_zero()).
240  *
241  * Revision 2.6 2000/01/11 11:13:16 eric
242  * Changement de nom pour la base vectorielle : base --> triad
243  *
244  * Revision 2.5 2000/01/10 17:22:26 eric
245  * Modif des #include
246  *
247  * Revision 2.4 2000/01/10 15:14:58 eric
248  * Ajout du membre base (base vectorielle sur laquelle sont definies
249  * les composantes).
250  *
251  * Revision 2.3 1999/12/09 12:39:39 phil
252  * changement prototypage des derivees
253  *
254  * Revision 2.2 1999/12/07 15:24:17 phil
255  * ajout include
256  *
257  * Revision 2.1 1999/12/03 09:37:11 phil
258  * *** empty log message ***
259  *
260  * Revision 2.0 1999/12/02 17:15:32 phil
261  * *** empty log message ***
262  *
263  * Revision 1.1 1999/12/02 17:13:29 phil
264  * Initial revision
265  *
266  *
267  * $Header: /cvsroot/Lorene/C++/Include/tenseur.h,v 1.21 2026/03/04 15:47:04 j_novak Exp $
268  *
269  */
270 
271 #define COV -1
272 #define CON +1
273 
274 #define N_MET_MAX 5
275 
276 // Headers Lorene
277 #include "cmp.h"
278 #include "itbl.h"
279 #include "base_vect.h"
280 
281 namespace Lorene {
282 class Metrique ;
283 class Tenseur_sym ;
284 
285  //---------------------------------//
286  // class Tenseur //
287  //---------------------------------//
288 
289 
307 class Tenseur {
308 
309  // Data :
310  // -----
311  protected:
312  const Map* const mp ;
313  int valence ;
314 
318  const Base_vect* triad ;
319 
325 
326  int n_comp ;
327  int etat ;
328  Cmp** c ;
329  double poids ;
330  const Metrique* metric ;
332 
333  // Derived data :
334  // ------------
335  protected:
343  const Metrique** met_depend ;
344 
349  mutable Tenseur* p_gradient ;
350 
357 
365 
372 
379 
380  // Constructors - Destructor :
381  // -------------------------
382  protected:
384  bool verif() const ;
385 
391  void new_der_met() ;
392 
393  public:
394  explicit Tenseur (const Map& map, const Metrique* met = 0x0,
395  double weight = 0) ;
396 
398  explicit Tenseur (const Cmp& cmp, const Metrique* met = 0x0,
399  double weight = 0) ;
400 
418  Tenseur (const Map& map, int val, const Itbl& tipe,
419  const Base_vect& triad_i, const Metrique* met = 0x0,
420  double weight = 0) ;
421 
440  Tenseur (const Map& map, int val, const Itbl& tipe,
441  const Base_vect* triad_i, const Metrique* met = 0x0,
442  double weight = 0) ;
443 
456  Tenseur (const Map& map, int val, int tipe, const
457  Base_vect& triad_i, const Metrique* met = 0x0,
458  double weight = 0) ;
459 
460  Tenseur (const Tenseur&) ;
461 
463  explicit Tenseur (const Tenseur_sym&) ;
464 
477  Tenseur (const Map& map, const Base_vect& triad_i, FILE* fich,
478  const Metrique* met = 0x0) ;
479 
489  Tenseur (const Map& map, FILE* fich, const Metrique* met = 0x0) ;
490 
491 
492  protected:
512  Tenseur (const Map& map, int val, const Itbl& tipe, int n_comp,
513  const Base_vect& triad_i, const Metrique* met = 0x0,
514  double weight = 0) ;
515 
530  Tenseur (const Map&, int val, int tipe, int n_comp,
531  const Base_vect& triad_i, const Metrique* met = 0x0,
532  double weight = 0) ;
533 
534 
535  public:
536 
537  virtual ~Tenseur() ;
538 
539  // Memory management
540  // -----------------
541  protected:
542  void del_t() ;
543 
548  void del_derive_met(int i) const ;
549 
553  void del_derive() const ;
554 
560  void set_der_met_0x0(int i) const ;
561 
566  void set_der_0x0() const ;
567 
568  // Mutators / assignment
569  // ---------------------
570  public:
575  void set_etat_nondef() ;
576 
581  void set_etat_zero() ;
582 
587  void set_etat_qcq() ;
588 
598  void allocate_all() ;
599 
603  void change_triad(const Base_vect& new_triad) ;
604 
611  void set_triad(const Base_vect& new_triad) ;
612  void set_poids(double weight) ;
613  void set_metric(const Metrique& met) ;
615 
617  virtual void operator=(const Tenseur& tens) ;
618 
620  void operator=(const Cmp& field) ;
621 
623  void operator=(double ) ;
624 
626  void operator=(int ) ;
627 
629  Cmp& set () ;
630  Cmp& set (int) ;
631  Cmp& set (int, int) ;
632  Cmp& set (int, int, int) ;
633  Cmp& set (const Itbl&) ;
634 
640  void annule(int l) ;
641 
653  void annule(int l_min, int l_max) ;
654 
660  void set_std_base() ;
661 
662  void dec_dzpuis() ;
663  void inc_dzpuis() ;
664  void dec2_dzpuis() ;
665  void inc2_dzpuis() ;
666  void mult_r_zec() ;
667 
672  Tenseur inverse_poisson_vect (double lambda) const ;
673 
674  // Accessors
675  // ---------
676  public:
687  virtual int donne_place (const Itbl& idx) const ;
688 
702  virtual Itbl donne_indices (int place) const ;
703 
705  const Map* get_mp() const {return mp ;} ;
706 
710  const Base_vect* get_triad() const {return triad;} ;
711 
713  int get_etat() const {return etat ;} ;
714 
716  int get_valence() const {return valence ; } ;
717 
719  int get_n_comp() const {return n_comp ;} ;
720 
732  int get_type_indice (int i) const {return type_indice(i) ;};
733 
741  Itbl get_type_indice () const {return type_indice ; } ;
742 
744  double get_poids() const {return poids ; } ;
745 
751  const Metrique* get_metric() const {return metric ; } ;
752 
753  const Cmp& operator()() const ;
754  const Cmp& operator()(int) const ;
755  const Cmp& operator()(int, int) const ;
756  const Cmp& operator()(int, int, int) const ;
757  const Cmp& operator()(const Itbl&) const ;
758 
759  // Outputs
760  // -------
761  public:
762  void sauve(FILE *) const ;
763  friend ostream& operator<<(ostream& , const Tenseur & ) ;
764 
765  // Computation of derived members
766  // ------------------------------
767  protected:
772  virtual void fait_gradient () const ;
773 
779  void fait_gradient_spher () const ;
780 
786  virtual void fait_derive_cov (const Metrique& met, int i) const ;
787 
793  virtual void fait_derive_con (const Metrique&, int i) const ;
794 
800  void fait_carre_scal (const Metrique&, int i) const ;
801 
811  void set_dependance (const Metrique& met) const ;
812 
818  int get_place_met(const Metrique& metre) const ;
819 
820  // Differential operators
821  // ----------------------
822  public:
824  const Tenseur& gradient() const ;
825 
829  const Tenseur& gradient_spher() const ;
830 
835  const Tenseur& derive_cov (const Metrique& met) const ;
836 
841  const Tenseur& derive_con (const Metrique&) const ;
842 
847  const Tenseur& carre_scal (const Metrique&) const ;
848 
849  // Resolution d'EDP :
877  void poisson_vect(double lambda, Param& par, Tenseur& shift, Tenseur& vect
878  , Tenseur& scal, bool verbose=true) const ;
879 
880  /*
881  * Same as poisson_vect with a Tau method
882  **/
883  void poisson_vect_tau(double lambda, Param& par, Tenseur& shift, Tenseur& vect
884  , Tenseur& scal) const ;
885 
886  void poisson_vect_falloff(double lambda, Param& par, Tenseur& shift,
887  Tenseur& vect, Tenseur& scal, int* k_falloff) const ;
888 
889  void poisson_vect_ylm(double lambda, Param& para, Tenseur& shift,
890  Tenseur& vecteur, Tenseur& scalaire, int nylm,
891  double* intvec) const ;
892 
920  Tenseur poisson_vect(double lambda, Tenseur& vect , Tenseur& scal ) const ;
921 
922  /*
923  * Same as poisson_vect with a Tau method
924  **/
925  Tenseur poisson_vect_tau(double lambda, Tenseur& vect , Tenseur& scal ) const ;
926 
927  Tenseur poisson_vect_falloff(double lambda, Tenseur& vect ,
928  Tenseur& scal, int* k_falloff ) const ;
929 
930  Tenseur poisson_vect_ylm(double lambda, Tenseur& vecteur,
931  Tenseur& scalaire, int nylm, double* intvec) const ;
932 
958  void poisson_vect_oohara(double lambda, Param& par, Tenseur& shift,
959  Tenseur& scal) const ;
960 
961  /*
962  * Same as poisson_vect_oohara with a Tau method
963  **/
964  void poisson_vect_oohara_tau(double lambda, Param& par, Tenseur& shift,
965  Tenseur& scal) const ;
966 
995  Tenseur poisson_vect_oohara(double lambda, Tenseur& scal) const ;
996  /*
997  * Same as poisson_vect_oohara with a Tau method
998  **/
999  Tenseur poisson_vect_oohara_tau(double lambda, Tenseur& scal) const ;
1000 
1029  void poisson_vect_regu(int k_div, int nzet, double unsgam1,
1030  double lambda, Param& par, Tenseur& shift,
1031  Tenseur& vect, Tenseur& scal) const ;
1032 
1033 
1034  // Friend classes
1035  // ---------------
1036  friend class Tenseur_sym ;
1037  friend class Metrique ;
1038 
1039  // Mathematical operators
1040  // ----------------------
1041 
1042  friend Tenseur operator* (const Tenseur&, const Tenseur&) ;
1043  friend Tenseur operator% (const Tenseur&, const Tenseur&) ;
1044  friend Tenseur contract(const Tenseur&, int id1, int id2) ;
1045  friend Tenseur contract(const Tenseur&, int id1, const Tenseur&,
1046  int id2) ;
1047  friend Tenseur contract_desal(const Tenseur&, int id1, const Tenseur&,
1048  int id2) ;
1049  friend Tenseur flat_scalar_prod(const Tenseur& t1, const Tenseur& t2) ;
1050  friend Tenseur flat_scalar_prod_desal(const Tenseur& t1,
1051  const Tenseur& t2) ;
1052  friend Tenseur manipule(const Tenseur&, const Metrique&, int idx) ;
1053  friend Tenseur manipule(const Tenseur&, const Metrique&) ;
1054  friend Tenseur skxk (const Tenseur&) ;
1055  friend Tenseur lie_derive(const Tenseur& , const Tenseur& ,
1056  const Metrique* ) ;
1057 
1058 };
1059 
1060 
1067 Tenseur operator*(const Tenseur&, const Tenseur&) ;
1069 
1071 Tenseur operator%(const Tenseur&, const Tenseur&) ;
1072 
1095 Tenseur contract(const Tenseur&, int id1, int id2) ;
1096 
1119 Tenseur contract(const Tenseur&, int id1, const Tenseur&, int id2) ;
1120 
1127 Tenseur flat_scalar_prod(const Tenseur& t1, const Tenseur& t2) ;
1128 
1132 Tenseur flat_scalar_prod_desal(const Tenseur& t1, const Tenseur& t2) ;
1133 
1138 Tenseur manipule(const Tenseur&, const Metrique&, int idx) ;
1139 
1144 Tenseur manipule(const Tenseur&, const Metrique&) ;
1145 
1153 Tenseur skxk (const Tenseur&) ;
1154 
1161 Tenseur lie_derive (const Tenseur& t, const Tenseur& x, const Metrique* = 0x0);
1162 
1171 Tenseur sans_trace(const Tenseur& tens, const Metrique& metre) ;
1172 
1173 
1182 Tenseur operator+(const Tenseur& ) ;
1183 Tenseur operator-(const Tenseur& ) ;
1184 Tenseur operator+(const Tenseur&, const Tenseur &) ;
1185 
1187 Tenseur operator+(const Tenseur&, double ) ;
1188 
1190 Tenseur operator+(double, const Tenseur& ) ;
1191 
1193 Tenseur operator+(const Tenseur&, int ) ;
1194 
1196 Tenseur operator+(int, const Tenseur& ) ;
1197 
1198 Tenseur operator-(const Tenseur &, const Tenseur &) ;
1199 
1201 Tenseur operator-(const Tenseur&, double ) ;
1202 
1204 Tenseur operator-(double, const Tenseur& ) ;
1205 
1207 Tenseur operator-(const Tenseur&, int ) ;
1208 
1210 Tenseur operator-(int, const Tenseur& ) ;
1211 
1213 Tenseur operator*(const Tenseur&, double ) ;
1214 
1216 Tenseur operator*(double, const Tenseur& ) ;
1217 
1219 Tenseur operator*(const Tenseur&, int ) ;
1220 
1222 Tenseur operator*(int, const Tenseur& ) ;
1223 
1225 Tenseur operator/(const Tenseur& a, const Tenseur& b) ;
1226 
1227 Tenseur operator/(const Tenseur&, double ) ;
1228 
1230 Tenseur operator/(double, const Tenseur &) ;
1231 
1232 Tenseur operator/(const Tenseur&, int ) ;
1233 
1235 Tenseur operator/(int, const Tenseur &) ;
1236 
1237 Tenseur exp(const Tenseur& ) ;
1238 Tenseur log(const Tenseur& ) ;
1239 Tenseur sqrt(const Tenseur& ) ;
1240 Tenseur abs(const Tenseur& ) ;
1241 Tenseur pow(const Tenseur&, int ) ;
1242 Tenseur pow(const Tenseur&, double ) ;
1243 
1250  //---------------------------------//
1251  // class Tenseur_sym //
1252  //---------------------------------//
1253 
1261 class Tenseur_sym : public Tenseur {
1262 
1263  // Constructors - Destructor :
1264  // -------------------------
1265 
1266  public:
1281  Tenseur_sym (const Map& map, int val, const Itbl& tipe,
1282  const Base_vect& triad_i, const Metrique* met = 0x0,
1283  double weight = 0) ;
1284 
1294  Tenseur_sym (const Map& map, int val, int tipe,
1295  const Base_vect& triad_i, const Metrique* met = 0x0,
1296  double weight = 0) ;
1297 
1298  Tenseur_sym (const Tenseur_sym&) ;
1299 
1303  explicit Tenseur_sym (const Tenseur&) ;
1304 
1315  Tenseur_sym (const Map& map, const Base_vect& triad_i, FILE* fich,
1316  const Metrique* met = 0x0) ;
1317 
1318  virtual ~Tenseur_sym() ;
1319 
1320  // Mutators / assignment
1321  // ---------------------
1322  public:
1328  virtual void operator= (const Tenseur&) ;
1329 
1330  void operator= (const Tenseur_sym&) ;
1331 
1332  // Accessors
1333  // ---------
1334  public:
1345  virtual int donne_place (const Itbl& idx) const ;
1346 
1358  virtual Itbl donne_indices (int place) const ;
1359 
1360  // Computation of derived members
1361  // ------------------------------
1362  protected:
1367  virtual void fait_gradient () const ;
1368 
1374  virtual void fait_derive_cov (const Metrique& met, int i) const ;
1375 
1381  virtual void fait_derive_con (const Metrique&, int i) const ;
1382 
1383  // Mathematical operators
1384  // ----------------------
1385  friend Tenseur_sym operator* (const Tenseur&, const Tenseur_sym&) ;
1386  friend Tenseur_sym manipule(const Tenseur_sym&, const Metrique&) ;
1387  friend Tenseur lie_derive (const Tenseur& , const Tenseur& ,
1388  const Metrique* );
1389 
1390 } ;
1397 Tenseur_sym operator* (const Tenseur&, const Tenseur_sym&) ;
1399 
1404 Tenseur_sym manipule(const Tenseur_sym&, const Metrique&) ;
1405 
1413 Tenseur_sym lie_derive (const Tenseur_sym& t, const Tenseur& x,
1414  const Metrique* = 0x0);
1415 
1424 Tenseur_sym sans_trace(const Tenseur_sym& tens, const Metrique& metre) ;
1425 
1436 Tenseur_sym operator+(const Tenseur_sym& ) ;
1437 Tenseur_sym operator-(const Tenseur_sym& ) ;
1438 
1440 Tenseur_sym operator+(const Tenseur_sym&, const Tenseur_sym &) ;
1441 
1443 Tenseur_sym operator-(const Tenseur_sym &, const Tenseur_sym &) ;
1444 
1446 Tenseur_sym operator*(const Tenseur_sym&, double ) ;
1447 
1449 Tenseur_sym operator*(double, const Tenseur_sym& ) ;
1450 
1452 Tenseur_sym operator*(const Tenseur_sym&, int ) ;
1453 
1455 Tenseur_sym operator*(int, const Tenseur_sym& ) ;
1456 
1458 Tenseur_sym operator/(const Tenseur_sym& a, const Tenseur& b) ;
1459 
1460 Tenseur_sym operator/(const Tenseur_sym&, double ) ;
1461 
1462 Tenseur_sym operator/(const Tenseur_sym&, int ) ;
1463 
1470 }
1471 #endif
Itbl type_indice
Array of size valence contening the type of each index, COV for a covariant one and CON for a contrav...
Definition: tenseur.h:324
const Map *const mp
Reference mapping.
Definition: tenseur.h:312
double get_poids() const
Returns the weight.
Definition: tenseur.h:744
const Base_vect * triad
Vectorial basis (triad) with respect to which the tensor components are defined.
Definition: tenseur.h:318
virtual ~Tenseur()
Destructor.
Definition: tenseur.C:549
Cmp log(const Cmp &)
Neperian logarithm.
Definition: cmp_math.C:299
int get_type_indice(int i) const
Returns the type of the index number i .
Definition: tenseur.h:732
void annule(int l)
Sets the Tenseur to zero in a given domain.
Definition: tenseur.C:916
int get_place_met(const Metrique &metre) const
Returns the position of the pointer on metre in the array met_depend .
Definition: tenseur.C:614
Component of a tensorial field *** DEPRECATED : use class Scalar instead ***.
Definition: cmp.h:449
Cmp exp(const Cmp &)
Exponential.
Definition: cmp_math.C:273
Cmp ** c
The components.
Definition: tenseur.h:328
void dec2_dzpuis()
dzpuis -= 2 ;
Definition: tenseur.C:1146
const Tenseur & gradient_spher() const
Returns the gradient of *this (Spherical coordinates) (scalar field only).
Definition: tenseur.C:1564
void set_triad(const Base_vect &new_triad)
Assigns a new vectorial basis (triad) of decomposition.
Definition: tenseur.C:690
void poisson_vect_oohara(double lambda, Param &par, Tenseur &shift, Tenseur &scal) const
Solves the vectorial Poisson equation .
Definition: tenseur_pde.C:225
Cmp sqrt(const Cmp &)
Square root.
Definition: cmp_math.C:223
int n_comp
Number of components, depending on the symmetry.
Definition: tenseur.h:326
Itbl get_type_indice() const
Returns the types of all the indices.
Definition: tenseur.h:741
void set_poids(double weight)
Sets the weight for a tensor density.
Definition: tenseur.C:696
void set_std_base()
Set the standard spectal basis of decomposition for each component.
Definition: tenseur.C:1186
Class intended to describe tensors with a symmetry on the two last indices *** DEPRECATED : use class...
Definition: tenseur.h:1261
Lorene prototypes.
Definition: app_hor.h:67
virtual int donne_place(const Itbl &idx) const
Returns the position in the Cmp 1-D array c of a component given by its indices.
Definition: tenseur.C:706
Base_val operator*(const Base_val &, const Base_val &)
This operator is used when calling multiplication or division of Valeur .
Base class for coordinate mappings.
Definition: map.h:696
int etat
Logical state ETATZERO , ETATQCQ or ETATNONDEF.
Definition: tenseur.h:327
Tenseur flat_scalar_prod(const Tenseur &t1, const Tenseur &t2)
Scalar product of two Tenseur when the metric is : performs the contraction of the last index of t1 w...
virtual Itbl donne_indices(int place) const
Returns the indices of a component given by its position in the Cmp 1-D array c . ...
Definition: tenseur.C:720
void new_der_met()
Builds the arrays met_depend , p_derive_cov , p_derive_con and p_carre_scal and fills them with null ...
Definition: tenseur.C:212
Basic integer array class.
Definition: itbl.h:122
virtual ~Tenseur_sym()
Destructor.
Definition: tenseur_sym.C:210
Cmp operator%(const Cmp &, const Cmp &)
Cmp * Cmp with desaliasing.
Definition: cmp_arithm.C:367
const Tenseur & derive_con(const Metrique &) const
Returns the contravariant derivative of *this , with respect to met .
Definition: tenseur.C:1584
Cmp operator/(const Cmp &, const Cmp &)
Cmp / Cmp.
Definition: cmp_arithm.C:460
virtual Itbl donne_indices(int place) const
Returns the indices of a component given by its position in the Cmp 1-D array c . ...
Definition: tenseur_sym.C:261
Vectorial bases (triads) with respect to which the tensorial components are defined.
Definition: base_vect.h:105
virtual void fait_gradient() const
Calculates, if needed, the gradient of *this .
Definition: tenseur.C:1361
void inc_dzpuis()
dzpuis += 1 ;
Definition: tenseur.C:1133
virtual void fait_derive_cov(const Metrique &met, int i) const
Calculates, if needed, the covariant derivative of *this , with respect to met .
Definition: tenseur_sym.C:385
const Cmp & operator()() const
Read only for a scalar.
Definition: tenseur.C:959
friend Tenseur_sym operator*(const Tenseur &, const Tenseur_sym &)
Tensorial product.
void inc2_dzpuis()
dzpuis += 2 ;
Definition: tenseur.C:1159
int get_valence() const
Returns the valence.
Definition: tenseur.h:716
void del_t()
Logical destructor.
Definition: tenseur.C:561
virtual void operator=(const Tenseur &tens)
Assignment to another Tenseur.
Definition: tenseur.C:734
void set_metric(const Metrique &met)
Sets the pointer on the metric for a tensor density.
Definition: tenseur.C:701
friend Tenseur operator*(const Tenseur &, const Tenseur &)
Tensorial product.
virtual void operator=(const Tenseur &)
Assignment from a Tenseur .
Definition: tenseur_sym.C:292
Tenseur * p_gradient_spher
Pointer on the gradient of *this in a spherical orthonormal basis (scalar field only).
Definition: tenseur.h:356
virtual void fait_gradient() const
Calculates, if needed, the gradient of *this .
Definition: tenseur_sym.C:338
void del_derive_met(int i) const
Logical destructor of the derivatives depending on the i-th element of *met_depend ...
Definition: tenseur.C:570
void change_triad(const Base_vect &new_triad)
Sets a new vectorial basis (triad) of decomposition and modifies the components accordingly.
Definition: tenseur.C:684
virtual void fait_derive_cov(const Metrique &met, int i) const
Calculates, if needed, the covariant derivative of *this , with respect to met .
Definition: tenseur.C:1445
friend Tenseur lie_derive(const Tenseur &, const Tenseur &, const Metrique *)
Lie Derivative of t with respect to x .
const Map * get_mp() const
Returns pointer on the mapping.
Definition: tenseur.h:705
void sauve(FILE *) const
Save in a file.
Definition: tenseur.C:1341
Tenseur flat_scalar_prod_desal(const Tenseur &t1, const Tenseur &t2)
Same as flat_scalar_prod but with desaliasing.
Tenseur * p_gradient
Pointer on the gradient of *this .
Definition: tenseur.h:349
Tenseur skxk(const Tenseur &)
Contraction of the last index of (*this) with or , depending on the type of S .
void mult_r_zec()
Multiplication by r in the external zone.
Definition: tenseur.C:1172
const Metrique * get_metric() const
Returns a pointer on the metric defining the conformal factor for tensor densities.
Definition: tenseur.h:751
virtual int donne_place(const Itbl &idx) const
Returns the position in the Cmp 1-D array c of a component given by its indices.
Definition: tenseur_sym.C:216
Cmp operator+(const Cmp &)
Definition: cmp_arithm.C:107
int valence
Valence.
Definition: tenseur.h:313
const Base_vect * get_triad() const
Returns the vectorial basis (triad) on which the components are defined.
Definition: tenseur.h:710
bool verif() const
Returns false for a tensor density without a defined metric.
Definition: tenseur.C:208
Tenseur lie_derive(const Tenseur &t, const Tenseur &x, const Metrique *=0x0)
Lie Derivative of t with respect to x .
double poids
For tensor densities: the weight.
Definition: tenseur.h:329
Parameter storage.
Definition: param.h:125
Tenseur ** p_derive_con
Array of pointers on the contravariant derivatives of *this with respect to the corresponding metric...
Definition: tenseur.h:371
int get_etat() const
Returns the logical state.
Definition: tenseur.h:713
virtual void fait_derive_con(const Metrique &, int i) const
Calculates, if needed, the contravariant derivative of *this , with respect to met ...
Definition: tenseur.C:1515
friend Tenseur contract(const Tenseur &, int id1, int id2)
Self contraction of two indices of a Tenseur .
void fait_carre_scal(const Metrique &, int i) const
Calculates, if needed, the scalar square of *this , with respect to met .
Definition: tenseur.C:1533
Cmp pow(const Cmp &, int)
Power .
Definition: cmp_math.C:351
friend Tenseur skxk(const Tenseur &)
Contraction of the last index of (*this) with or , depending on the type of S .
Tenseur contract(const Tenseur &, int id1, int id2)
Self contraction of two indices of a Tenseur .
const Metrique ** met_depend
Array of pointers on the Metrique &#39;s used to calculate derivatives members.
Definition: tenseur.h:343
friend Tenseur_sym manipule(const Tenseur_sym &, const Metrique &)
Raise or lower all the indices, depending on their type, using the given Metrique ...
int get_n_comp() const
Returns the number of components.
Definition: tenseur.h:719
Tenseur sans_trace(const Tenseur &tens, const Metrique &metre)
Computes the traceless part of a Tenseur of valence 2.
void set_der_0x0() const
Sets the pointers of all the derivatives to zero.
Definition: tenseur.C:607
Tenseur(const Map &map, const Metrique *met=0x0, double weight=0)
Constructor for a scalar field.
Definition: tenseur.C:225
void allocate_all()
Sets the logical state to ETATQCQ (ordinary state) and performs the memory allocation of all the elem...
Definition: tenseur.C:673
void dec_dzpuis()
dzpuis -= 1 ;
Definition: tenseur.C:1120
void set_dependance(const Metrique &met) const
To be used to describe the fact that the derivatives members have been calculated with met ...
Definition: tenseur.C:624
friend Tenseur flat_scalar_prod(const Tenseur &t1, const Tenseur &t2)
Scalar product of two Tenseur when the metric is : performs the contraction of the last index of t1 w...
friend Tenseur lie_derive(const Tenseur &, const Tenseur &, const Metrique *)
Lie Derivative of t with respect to x .
void set_der_met_0x0(int i) const
Sets the pointers of the derivatives depending on the i-th element of *met_depend to zero (as well as...
Definition: tenseur.C:599
Tenseur inverse_poisson_vect(double lambda) const
Compute of *this , *this being of valence 1.
Tenseur_sym(const Map &map, int val, const Itbl &tipe, const Base_vect &triad_i, const Metrique *met=0x0, double weight=0)
Standard constructor.
Definition: tenseur_sym.C:105
Cmp abs(const Cmp &)
Absolute value.
Definition: cmp_math.C:413
const Metrique * metric
For tensor densities: the metric defining the conformal factor.
Definition: tenseur.h:331
friend Tenseur manipule(const Tenseur &, const Metrique &, int idx)
Raise or lower the index idx depending on its type, using the given Metrique .
Tenseur ** p_derive_cov
Array of pointers on the covariant derivatives of *this with respect to the corresponding metric in ...
Definition: tenseur.h:364
Cmp operator-(const Cmp &)
- Cmp
Definition: cmp_arithm.C:111
friend Tenseur operator%(const Tenseur &, const Tenseur &)
Tensorial product with desaliasing.
const Tenseur & carre_scal(const Metrique &) const
Returns the scalar square of *this , with respect to met .
Definition: tenseur.C:1593
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Definition: tenseur.C:652
const Tenseur & derive_cov(const Metrique &met) const
Returns the covariant derivative of *this , with respect to met .
Definition: tenseur.C:1570
void del_derive() const
Logical destructor of all the derivatives.
Definition: tenseur.C:589
friend Tenseur flat_scalar_prod_desal(const Tenseur &t1, const Tenseur &t2)
Same as flat_scalar_prod but with desaliasing.
void set_etat_zero()
Sets the logical state to ETATZERO (zero state).
Definition: tenseur.C:661
void poisson_vect_regu(int k_div, int nzet, double unsgam1, double lambda, Param &par, Tenseur &shift, Tenseur &vect, Tenseur &scal) const
Solves the vectorial Poisson equation : .
virtual void fait_derive_con(const Metrique &, int i) const
Calculates, if needed, the contravariant derivative of *this , with respect to met ...
Definition: tenseur_sym.C:454
Tenseur ** p_carre_scal
Array of pointers on the scalar squares of *this with respect to the corresponding metric in *met_de...
Definition: tenseur.h:378
void fait_gradient_spher() const
Calculates, if needed, the gradient of *this in a spherical orthonormal basis (scalar field only)...
Definition: tenseur.C:1408
Tensor handling *** DEPRECATED : use class Tensor instead ***.
Definition: tenseur.h:307
void set_etat_nondef()
Sets the logical state to ETATNONDEF (undefined state).
Definition: tenseur.C:666
const Tenseur & gradient() const
Returns the gradient of *this (Cartesian coordinates)
Definition: tenseur.C:1558
void poisson_vect(double lambda, Param &par, Tenseur &shift, Tenseur &vect, Tenseur &scal, bool verbose=true) const
Solves the vectorial Poisson equation : .
Definition: tenseur_pde.C:124
Tenseur manipule(const Tenseur &, const Metrique &, int idx)
Raise or lower the index idx depending on its type, using the given Metrique .