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.20 2021/04/13 11:24:53 j_novak Exp $
37  * $Log: tenseur.h,v $
38  * Revision 1.20 2021/04/13 11:24:53 j_novak
39  * Corrected a bug in Etoile_rot::fait_shift() which was missing the np=1 case.
40  *
41  * Revision 1.19 2016/09/19 15:26:22 j_novak
42  * Correction of several bugs preventing the shared library compilation.
43  *
44  * Revision 1.18 2014/10/13 08:52:37 j_novak
45  * Lorene classes and functions now belong to the namespace Lorene.
46  *
47  * Revision 1.17 2010/02/02 13:34:12 e_gourgoulhon
48  * Marked DEPRECATED (in the documentation).
49  *
50  * Revision 1.16 2005/08/30 08:35:10 p_grandclement
51  * Addition of the Tau version of the vectorial Poisson equation for the Tensors
52  *
53  * Revision 1.15 2004/12/29 16:24:03 k_taniguchi
54  * Addition of the method for vectorial Poisson equations with a multipole
55  * falloff condition at the outer boundary.
56  *
57  * Revision 1.14 2004/12/22 18:25:12 k_taniguchi
58  * Change an argument of poisson_vect_falloff
59  *
60  * Revision 1.13 2004/11/30 20:43:32 k_taniguchi
61  * Addition of the method for vectorial Poisson equations with falloff
62  * condition at the outer boundary.
63  *
64  * Revision 1.12 2004/03/22 13:12:43 j_novak
65  * Modification of comments to use doxygen instead of doc++
66  *
67  * Revision 1.11 2003/11/06 12:17:31 r_prix
68  * fixed mini-bug in documentation: without explicit argument in function-prototype,
69  * doc++ seemed to merge docu of Tensor::operator=(Cmp&) and operator=(Tenseur&)
70  *
71  * Revision 1.10 2003/06/20 14:23:38 f_limousin
72  * Add the functions compare().
73  *
74  * Revision 1.9 2002/10/16 14:36:29 j_novak
75  * Reorganization of #include instructions of standard C++, in order to
76  * use experimental version 3 of gcc.
77  *
78  * Revision 1.8 2002/09/19 14:12:37 e_gourgoulhon
79  * Modif documentation for LaTeX compliance.
80  *
81  * Revision 1.7 2002/09/10 13:44:17 j_novak
82  * The method "manipule" of one indice has been removed for Tenseur_sym objects
83  * (the result cannot be a Tenseur_sym).
84  * The method "sans_trace" now computes the traceless part of a Tenseur (or
85  * Tenseur_sym) of valence 2.
86  *
87  * Revision 1.6 2002/09/06 14:49:25 j_novak
88  * Added method lie_derive for Tenseur and Tenseur_sym.
89  * Corrected various errors for derive_cov and arithmetic.
90  *
91  * Revision 1.5 2002/08/14 13:46:14 j_novak
92  * Derived quantities of a Tenseur can now depend on several Metrique's
93  *
94  * Revision 1.4 2002/08/08 15:10:44 j_novak
95  * The flag "plat" has been added to the class Metrique to show flat metrics.
96  *
97  * Revision 1.3 2002/08/07 16:14:11 j_novak
98  * class Tenseur can now also handle tensor densities, this should be transparent to older codes
99  *
100  * Revision 1.2 2002/06/17 14:05:17 j_novak
101  * friend functions are now also declared outside the class definition
102  *
103  * Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon
104  * LORENE
105  *
106  * Revision 2.46 2001/08/27 10:03:56 eric
107  * Ajout de l'operator% (produit tensoriel avec desaliasing)
108  *
109  * Revision 2.45 2001/06/19 15:38:00 eric
110  * Modif commentaires: mise en conformite Doc++ 3.4.8.
111  *
112  * Revision 2.44 2001/06/18 13:56:07 novak
113  * Ajout de la fonction abs()
114  *
115  * Revision 2.43 2001/05/29 16:10:43 eric
116  * Modif commentaires (mise en conformite Doc++ 3.4.7).
117  *
118  * Revision 2.42 2001/05/26 15:48:17 eric
119  * *** empty log message ***
120  *
121  * Revision 2.41 2001/05/26 15:42:54 eric
122  * Ajout de la fonction flat_scalar_prod_desal (desaliasage)
123  *
124  * Revision 2.40 2000/10/19 10:37:51 phil
125  * *** empty log message ***
126  *
127  * Revision 2.39 2000/10/19 09:47:15 phil
128  * *** empty log message ***
129  *
130  * Revision 2.38 2000/10/19 09:41:48 phil
131  * ajout de inverse_poisson_vect
132  *
133  * Revision 2.37 2000/10/06 12:37:09 keisuke
134  * Add a vectorial Poisson equation Tenseur::poisson_vect_regu.
135  *
136  * Revision 2.36 2000/09/27 08:52:34 eric
137  * Modif commentaires.
138  *
139  * Revision 2.35 2000/09/13 12:21:36 eric
140  * Modif commentaires.
141  *
142  * Revision 2.34 2000/09/13 12:11:26 eric
143  * Ajout de la fonction allocate_all().
144  *
145  * Revision 2.33 2000/05/22 14:39:11 phil
146  * ajout de inc_dzpuis et dec_dzpuis
147  *
148  * Revision 2.32 2000/04/03 15:18:54 phil
149  * suppression de poisson_vect_dirichlet
150  *
151  * Revision 2.31 2000/03/31 13:29:43 phil
152  * poisson_vect_neumann devient poisson_vect_dirichlet
153  *
154  * Revision 2.30 2000/03/30 16:10:46 phil
155  * *** empty log message ***
156  *
157  * Revision 2.29 2000/02/18 10:45:05 eric
158  * Modif commentaires.
159  *
160  * Revision 2.28 2000/02/11 19:11:55 phil
161  * commentaires
162  *
163  * Revision 2.27 2000/02/10 16:26:48 eric
164  * Modif commentaires.
165  *
166  * Revision 2.26 2000/02/10 16:10:49 eric
167  * Ajout de la fonction change_triad.
168  *
169  * Revision 2.25 2000/02/09 19:29:25 eric
170  * MODIF IMPORTANTE: la triade de decomposition est desormais passee en
171  * argument des constructeurs.
172  *
173  * Revision 2.24 2000/02/09 09:53:56 phil
174  * ajout de poisson_vect_oohara
175  * ,
176  *
177  * Revision 2.23 2000/02/08 19:04:25 eric
178  * Les fonctions arithmetiques ne sont plus amies.
179  * Ajout de nouvelles fonctions arithmetiques.
180  *
181  * Revision 2.22 2000/02/01 15:40:19 eric
182  * Ajout de la fonction sqrt
183  *
184  * Revision 2.21 2000/02/01 14:13:56 eric
185  * Modif commentaires.
186  * Ajout de la fonction amie flat_scalar_prod.
187  *
188  * Revision 2.20 2000/01/21 12:48:55 phil
189  * changement prototypage de Tenseur::poisson_vect
190  *
191  * Revision 2.19 2000/01/20 16:02:20 eric
192  * Ajout des operator=(double ) et operator=(int ).
193  *
194  * Revision 2.18 2000/01/20 14:52:08 phil
195  * *** empty log message ***
196  *
197  * Revision 2.17 2000/01/20 14:50:56 phil
198  * *** empty log message ***
199  *
200  * Revision 2.16 2000/01/20 14:39:31 phil
201  * *** empty log message ***
202  *
203  * Revision 2.15 2000/01/20 13:10:56 phil
204  * Ajout de Tenseur::poisson_vect (double)
205  *
206  * Revision 2.14 2000/01/20 11:20:17 phil
207  * changement prototypage
208  *
209  * Revision 2.13 2000/01/20 10:31:30 phil
210  * ajout de xksk
211  *
212  * Revision 2.12 2000/01/14 14:17:47 eric
213  * Modif commentaires.
214  *
215  * Revision 2.11 2000/01/14 14:04:07 eric
216  * Ajout de la fonction annule.
217  * classe Tenseur: constructeurs pour les classes derivees et fonctions
218  * de gestion memoire (del_t(), ...) declarees protected et non plus
219  * private.
220  *
221  * Revision 2.10 2000/01/13 14:15:30 eric
222  * Modif commentaires.
223  *
224  * Revision 2.9 2000/01/13 14:10:18 eric
225  * Ajout du constructeur par copie d'un Cmp (pour un scalaire)
226  * ainsi que l'affectation a un Cmp.
227  *
228  * Revision 2.8 2000/01/13 13:45:56 eric
229  * Ajout du membre p_gradient_spher et des fonctions fait_gradient_spher(),
230  * gradient_spher() pour le calcul du gradient d'un scalaire en
231  * coordonnees spheriques sur la triade spherique associee.
232  *
233  * Revision 2.7 2000/01/12 13:17:49 eric
234  * Les operator::(...) renvoie desormais une reference const sur le c[...]
235  * correspondant et non plus un Cmp copie de c[...].
236  * (ceci grace a Map::cmp_zero()).
237  *
238  * Revision 2.6 2000/01/11 11:13:16 eric
239  * Changement de nom pour la base vectorielle : base --> triad
240  *
241  * Revision 2.5 2000/01/10 17:22:26 eric
242  * Modif des #include
243  *
244  * Revision 2.4 2000/01/10 15:14:58 eric
245  * Ajout du membre base (base vectorielle sur laquelle sont definies
246  * les composantes).
247  *
248  * Revision 2.3 1999/12/09 12:39:39 phil
249  * changement prototypage des derivees
250  *
251  * Revision 2.2 1999/12/07 15:24:17 phil
252  * ajout include
253  *
254  * Revision 2.1 1999/12/03 09:37:11 phil
255  * *** empty log message ***
256  *
257  * Revision 2.0 1999/12/02 17:15:32 phil
258  * *** empty log message ***
259  *
260  * Revision 1.1 1999/12/02 17:13:29 phil
261  * Initial revision
262  *
263  *
264  * $Header: /cvsroot/Lorene/C++/Include/tenseur.h,v 1.20 2021/04/13 11:24:53 j_novak Exp $
265  *
266  */
267 
268 #define COV -1
269 #define CON +1
270 
271 #define N_MET_MAX 5
272 
273 // Headers Lorene
274 #include "cmp.h"
275 #include "itbl.h"
276 #include "base_vect.h"
277 
278 namespace Lorene {
279 class Metrique ;
280 class Tenseur_sym ;
281 
282  //---------------------------------//
283  // class Tenseur //
284  //---------------------------------//
285 
286 
304 class Tenseur {
305 
306  // Data :
307  // -----
308  protected:
309  const Map* const mp ;
310  int valence ;
311 
315  const Base_vect* triad ;
316 
322 
323  int n_comp ;
324  int etat ;
325  Cmp** c ;
326  double poids ;
327  const Metrique* metric ;
329 
330  // Derived data :
331  // ------------
332  protected:
340  const Metrique** met_depend ;
341 
346  mutable Tenseur* p_gradient ;
347 
354 
362 
369 
376 
377  // Constructors - Destructor :
378  // -------------------------
379  protected:
381  bool verif() const ;
382 
388  void new_der_met() ;
389 
390  public:
391  explicit Tenseur (const Map& map, const Metrique* met = 0x0,
392  double weight = 0) ;
393 
395  explicit Tenseur (const Cmp& cmp, const Metrique* met = 0x0,
396  double weight = 0) ;
397 
415  Tenseur (const Map& map, int val, const Itbl& tipe,
416  const Base_vect& triad_i, const Metrique* met = 0x0,
417  double weight = 0) ;
418 
437  Tenseur (const Map& map, int val, const Itbl& tipe,
438  const Base_vect* triad_i, const Metrique* met = 0x0,
439  double weight = 0) ;
440 
453  Tenseur (const Map& map, int val, int tipe, const
454  Base_vect& triad_i, const Metrique* met = 0x0,
455  double weight = 0) ;
456 
457  Tenseur (const Tenseur&) ;
458 
460  explicit Tenseur (const Tenseur_sym&) ;
461 
474  Tenseur (const Map& map, const Base_vect& triad_i, FILE* fich,
475  const Metrique* met = 0x0) ;
476 
486  Tenseur (const Map& map, FILE* fich, const Metrique* met = 0x0) ;
487 
488 
489  protected:
509  Tenseur (const Map& map, int val, const Itbl& tipe, int n_comp,
510  const Base_vect& triad_i, const Metrique* met = 0x0,
511  double weight = 0) ;
512 
527  Tenseur (const Map&, int val, int tipe, int n_comp,
528  const Base_vect& triad_i, const Metrique* met = 0x0,
529  double weight = 0) ;
530 
531 
532  public:
533 
534  virtual ~Tenseur() ;
535 
536  // Memory management
537  // -----------------
538  protected:
539  void del_t() ;
540 
545  void del_derive_met(int i) const ;
546 
550  void del_derive() const ;
551 
557  void set_der_met_0x0(int i) const ;
558 
563  void set_der_0x0() const ;
564 
565  // Mutators / assignment
566  // ---------------------
567  public:
572  void set_etat_nondef() ;
573 
578  void set_etat_zero() ;
579 
584  void set_etat_qcq() ;
585 
595  void allocate_all() ;
596 
600  void change_triad(const Base_vect& new_triad) ;
601 
608  void set_triad(const Base_vect& new_triad) ;
609  void set_poids(double weight) ;
610  void set_metric(const Metrique& met) ;
612 
614  virtual void operator=(const Tenseur& tens) ;
615 
617  void operator=(const Cmp& field) ;
618 
620  void operator=(double ) ;
621 
623  void operator=(int ) ;
624 
626  Cmp& set () ;
627  Cmp& set (int) ;
628  Cmp& set (int, int) ;
629  Cmp& set (int, int, int) ;
630  Cmp& set (const Itbl&) ;
631 
637  void annule(int l) ;
638 
650  void annule(int l_min, int l_max) ;
651 
657  void set_std_base() ;
658 
659  void dec_dzpuis() ;
660  void inc_dzpuis() ;
661  void dec2_dzpuis() ;
662  void inc2_dzpuis() ;
663  void mult_r_zec() ;
664 
669  Tenseur inverse_poisson_vect (double lambda) const ;
670 
671  // Accessors
672  // ---------
673  public:
684  virtual int donne_place (const Itbl& idx) const ;
685 
699  virtual Itbl donne_indices (int place) const ;
700 
702  const Map* get_mp() const {return mp ;} ;
703 
707  const Base_vect* get_triad() const {return triad;} ;
708 
710  int get_etat() const {return etat ;} ;
711 
713  int get_valence() const {return valence ; } ;
714 
716  int get_n_comp() const {return n_comp ;} ;
717 
729  int get_type_indice (int i) const {return type_indice(i) ;};
730 
738  Itbl get_type_indice () const {return type_indice ; } ;
739 
741  double get_poids() const {return poids ; } ;
742 
748  const Metrique* get_metric() const {return metric ; } ;
749 
750  const Cmp& operator()() const ;
751  const Cmp& operator()(int) const ;
752  const Cmp& operator()(int, int) const ;
753  const Cmp& operator()(int, int, int) const ;
754  const Cmp& operator()(const Itbl&) const ;
755 
756  // Outputs
757  // -------
758  public:
759  void sauve(FILE *) const ;
760  friend ostream& operator<<(ostream& , const Tenseur & ) ;
761 
762  // Computation of derived members
763  // ------------------------------
764  protected:
769  virtual void fait_gradient () const ;
770 
776  void fait_gradient_spher () const ;
777 
783  virtual void fait_derive_cov (const Metrique& met, int i) const ;
784 
790  virtual void fait_derive_con (const Metrique&, int i) const ;
791 
797  void fait_carre_scal (const Metrique&, int i) const ;
798 
808  void set_dependance (const Metrique& met) const ;
809 
815  int get_place_met(const Metrique& metre) const ;
816 
817  // Differential operators
818  // ----------------------
819  public:
821  const Tenseur& gradient() const ;
822 
826  const Tenseur& gradient_spher() const ;
827 
832  const Tenseur& derive_cov (const Metrique& met) const ;
833 
838  const Tenseur& derive_con (const Metrique&) const ;
839 
844  const Tenseur& carre_scal (const Metrique&) const ;
845 
846  // Resolution d'EDP :
872  void poisson_vect(double lambda, Param& par, Tenseur& shift, Tenseur& vect
873  , Tenseur& scal) const ;
874 
875  /*
876  * Same as poisson_vect with a Tau method
877  **/
878  void poisson_vect_tau(double lambda, Param& par, Tenseur& shift, Tenseur& vect
879  , Tenseur& scal) const ;
880 
881  void poisson_vect_falloff(double lambda, Param& par, Tenseur& shift,
882  Tenseur& vect, Tenseur& scal, int* k_falloff) const ;
883 
884  void poisson_vect_ylm(double lambda, Param& para, Tenseur& shift,
885  Tenseur& vecteur, Tenseur& scalaire, int nylm,
886  double* intvec) const ;
887 
915  Tenseur poisson_vect(double lambda, Tenseur& vect , Tenseur& scal ) const ;
916 
917  /*
918  * Same as poisson_vect with a Tau method
919  **/
920  Tenseur poisson_vect_tau(double lambda, Tenseur& vect , Tenseur& scal ) const ;
921 
922  Tenseur poisson_vect_falloff(double lambda, Tenseur& vect ,
923  Tenseur& scal, int* k_falloff ) const ;
924 
925  Tenseur poisson_vect_ylm(double lambda, Tenseur& vecteur,
926  Tenseur& scalaire, int nylm, double* intvec) const ;
927 
953  void poisson_vect_oohara(double lambda, Param& par, Tenseur& shift,
954  Tenseur& scal) const ;
955 
956  /*
957  * Same as poisson_vect_oohara with a Tau method
958  **/
959  void poisson_vect_oohara_tau(double lambda, Param& par, Tenseur& shift,
960  Tenseur& scal) const ;
961 
990  Tenseur poisson_vect_oohara(double lambda, Tenseur& scal) const ;
991  /*
992  * Same as poisson_vect_oohara with a Tau method
993  **/
994  Tenseur poisson_vect_oohara_tau(double lambda, Tenseur& scal) const ;
995 
1024  void poisson_vect_regu(int k_div, int nzet, double unsgam1,
1025  double lambda, Param& par, Tenseur& shift,
1026  Tenseur& vect, Tenseur& scal) const ;
1027 
1028 
1029  // Friend classes
1030  // ---------------
1031  friend class Tenseur_sym ;
1032  friend class Metrique ;
1033 
1034  // Mathematical operators
1035  // ----------------------
1036 
1037  friend Tenseur operator* (const Tenseur&, const Tenseur&) ;
1038  friend Tenseur operator% (const Tenseur&, const Tenseur&) ;
1039  friend Tenseur contract(const Tenseur&, int id1, int id2) ;
1040  friend Tenseur contract(const Tenseur&, int id1, const Tenseur&,
1041  int id2) ;
1042  friend Tenseur contract_desal(const Tenseur&, int id1, const Tenseur&,
1043  int id2) ;
1044  friend Tenseur flat_scalar_prod(const Tenseur& t1, const Tenseur& t2) ;
1045  friend Tenseur flat_scalar_prod_desal(const Tenseur& t1,
1046  const Tenseur& t2) ;
1047  friend Tenseur manipule(const Tenseur&, const Metrique&, int idx) ;
1048  friend Tenseur manipule(const Tenseur&, const Metrique&) ;
1049  friend Tenseur skxk (const Tenseur&) ;
1050  friend Tenseur lie_derive(const Tenseur& , const Tenseur& ,
1051  const Metrique* ) ;
1052 
1053 };
1054 
1055 
1062 Tenseur operator*(const Tenseur&, const Tenseur&) ;
1064 
1066 Tenseur operator%(const Tenseur&, const Tenseur&) ;
1067 
1090 Tenseur contract(const Tenseur&, int id1, int id2) ;
1091 
1114 Tenseur contract(const Tenseur&, int id1, const Tenseur&, int id2) ;
1115 
1122 Tenseur flat_scalar_prod(const Tenseur& t1, const Tenseur& t2) ;
1123 
1127 Tenseur flat_scalar_prod_desal(const Tenseur& t1, const Tenseur& t2) ;
1128 
1133 Tenseur manipule(const Tenseur&, const Metrique&, int idx) ;
1134 
1139 Tenseur manipule(const Tenseur&, const Metrique&) ;
1140 
1148 Tenseur skxk (const Tenseur&) ;
1149 
1156 Tenseur lie_derive (const Tenseur& t, const Tenseur& x, const Metrique* = 0x0);
1157 
1166 Tenseur sans_trace(const Tenseur& tens, const Metrique& metre) ;
1167 
1168 
1177 Tenseur operator+(const Tenseur& ) ;
1178 Tenseur operator-(const Tenseur& ) ;
1179 Tenseur operator+(const Tenseur&, const Tenseur &) ;
1180 
1182 Tenseur operator+(const Tenseur&, double ) ;
1183 
1185 Tenseur operator+(double, const Tenseur& ) ;
1186 
1188 Tenseur operator+(const Tenseur&, int ) ;
1189 
1191 Tenseur operator+(int, const Tenseur& ) ;
1192 
1193 Tenseur operator-(const Tenseur &, const Tenseur &) ;
1194 
1196 Tenseur operator-(const Tenseur&, double ) ;
1197 
1199 Tenseur operator-(double, const Tenseur& ) ;
1200 
1202 Tenseur operator-(const Tenseur&, int ) ;
1203 
1205 Tenseur operator-(int, const Tenseur& ) ;
1206 
1208 Tenseur operator*(const Tenseur&, double ) ;
1209 
1211 Tenseur operator*(double, const Tenseur& ) ;
1212 
1214 Tenseur operator*(const Tenseur&, int ) ;
1215 
1217 Tenseur operator*(int, const Tenseur& ) ;
1218 
1220 Tenseur operator/(const Tenseur& a, const Tenseur& b) ;
1221 
1222 Tenseur operator/(const Tenseur&, double ) ;
1223 
1225 Tenseur operator/(double, const Tenseur &) ;
1226 
1227 Tenseur operator/(const Tenseur&, int ) ;
1228 
1230 Tenseur operator/(int, const Tenseur &) ;
1231 
1232 Tenseur exp(const Tenseur& ) ;
1233 Tenseur log(const Tenseur& ) ;
1234 Tenseur sqrt(const Tenseur& ) ;
1235 Tenseur abs(const Tenseur& ) ;
1236 Tenseur pow(const Tenseur&, int ) ;
1237 Tenseur pow(const Tenseur&, double ) ;
1238 
1245  //---------------------------------//
1246  // class Tenseur_sym //
1247  //---------------------------------//
1248 
1256 class Tenseur_sym : public Tenseur {
1257 
1258  // Constructors - Destructor :
1259  // -------------------------
1260 
1261  public:
1276  Tenseur_sym (const Map& map, int val, const Itbl& tipe,
1277  const Base_vect& triad_i, const Metrique* met = 0x0,
1278  double weight = 0) ;
1279 
1289  Tenseur_sym (const Map& map, int val, int tipe,
1290  const Base_vect& triad_i, const Metrique* met = 0x0,
1291  double weight = 0) ;
1292 
1293  Tenseur_sym (const Tenseur_sym&) ;
1294 
1298  explicit Tenseur_sym (const Tenseur&) ;
1299 
1310  Tenseur_sym (const Map& map, const Base_vect& triad_i, FILE* fich,
1311  const Metrique* met = 0x0) ;
1312 
1313  virtual ~Tenseur_sym() ;
1314 
1315  // Mutators / assignment
1316  // ---------------------
1317  public:
1323  virtual void operator= (const Tenseur&) ;
1324 
1325  void operator= (const Tenseur_sym&) ;
1326 
1327  // Accessors
1328  // ---------
1329  public:
1340  virtual int donne_place (const Itbl& idx) const ;
1341 
1353  virtual Itbl donne_indices (int place) const ;
1354 
1355  // Computation of derived members
1356  // ------------------------------
1357  protected:
1362  virtual void fait_gradient () const ;
1363 
1369  virtual void fait_derive_cov (const Metrique& met, int i) const ;
1370 
1376  virtual void fait_derive_con (const Metrique&, int i) const ;
1377 
1378  // Mathematical operators
1379  // ----------------------
1380  friend Tenseur_sym operator* (const Tenseur&, const Tenseur_sym&) ;
1381  friend Tenseur_sym manipule(const Tenseur_sym&, const Metrique&) ;
1382  friend Tenseur lie_derive (const Tenseur& , const Tenseur& ,
1383  const Metrique* );
1384 
1385 } ;
1392 Tenseur_sym operator* (const Tenseur&, const Tenseur_sym&) ;
1394 
1399 Tenseur_sym manipule(const Tenseur_sym&, const Metrique&) ;
1400 
1408 Tenseur_sym lie_derive (const Tenseur_sym& t, const Tenseur& x,
1409  const Metrique* = 0x0);
1410 
1419 Tenseur_sym sans_trace(const Tenseur_sym& tens, const Metrique& metre) ;
1420 
1431 Tenseur_sym operator+(const Tenseur_sym& ) ;
1432 Tenseur_sym operator-(const Tenseur_sym& ) ;
1433 
1435 Tenseur_sym operator+(const Tenseur_sym&, const Tenseur_sym &) ;
1436 
1438 Tenseur_sym operator-(const Tenseur_sym &, const Tenseur_sym &) ;
1439 
1441 Tenseur_sym operator*(const Tenseur_sym&, double ) ;
1442 
1444 Tenseur_sym operator*(double, const Tenseur_sym& ) ;
1445 
1447 Tenseur_sym operator*(const Tenseur_sym&, int ) ;
1448 
1450 Tenseur_sym operator*(int, const Tenseur_sym& ) ;
1451 
1453 Tenseur_sym operator/(const Tenseur_sym& a, const Tenseur& b) ;
1454 
1455 Tenseur_sym operator/(const Tenseur_sym&, double ) ;
1456 
1457 Tenseur_sym operator/(const Tenseur_sym&, int ) ;
1458 
1465 }
1466 #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:321
const Map *const mp
Reference mapping.
Definition: tenseur.h:309
double get_poids() const
Returns the weight.
Definition: tenseur.h:741
const Base_vect * triad
Vectorial basis (triad) with respect to which the tensor components are defined.
Definition: tenseur.h:315
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:729
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:446
Cmp exp(const Cmp &)
Exponential.
Definition: cmp_math.C:273
Cmp ** c
The components.
Definition: tenseur.h:325
void dec2_dzpuis()
dzpuis -= 2 ;
Definition: tenseur.C:1146
void poisson_vect(double lambda, Param &par, Tenseur &shift, Tenseur &vect, Tenseur &scal) const
Solves the vectorial Poisson equation : .
Definition: tenseur_pde.C:121
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:221
Cmp sqrt(const Cmp &)
Square root.
Definition: cmp_math.C:223
int n_comp
Number of components, depending on the symmetry.
Definition: tenseur.h:323
Itbl get_type_indice() const
Returns the types of all the indices.
Definition: tenseur.h:738
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:1256
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:682
int etat
Logical state ETATZERO , ETATQCQ or ETATNONDEF.
Definition: tenseur.h:324
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:713
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:353
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:702
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:346
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:748
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:310
const Base_vect * get_triad() const
Returns the vectorial basis (triad) on which the components are defined.
Definition: tenseur.h:707
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:326
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:368
int get_etat() const
Returns the logical state.
Definition: tenseur.h:710
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:340
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:716
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:328
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:361
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:375
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:304
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
Tenseur manipule(const Tenseur &, const Metrique &, int idx)
Raise or lower the index idx depending on its type, using the given Metrique .