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.18 2014/10/13 08:52:37 j_novak Exp $
37  * $Log: tenseur.h,v $
38  * Revision 1.18 2014/10/13 08:52:37 j_novak
39  * Lorene classes and functions now belong to the namespace Lorene.
40  *
41  * Revision 1.17 2010/02/02 13:34:12 e_gourgoulhon
42  * Marked DEPRECATED (in the documentation).
43  *
44  * Revision 1.16 2005/08/30 08:35:10 p_grandclement
45  * Addition of the Tau version of the vectorial Poisson equation for the Tensors
46  *
47  * Revision 1.15 2004/12/29 16:24:03 k_taniguchi
48  * Addition of the method for vectorial Poisson equations with a multipole
49  * falloff condition at the outer boundary.
50  *
51  * Revision 1.14 2004/12/22 18:25:12 k_taniguchi
52  * Change an argument of poisson_vect_falloff
53  *
54  * Revision 1.13 2004/11/30 20:43:32 k_taniguchi
55  * Addition of the method for vectorial Poisson equations with falloff
56  * condition at the outer boundary.
57  *
58  * Revision 1.12 2004/03/22 13:12:43 j_novak
59  * Modification of comments to use doxygen instead of doc++
60  *
61  * Revision 1.11 2003/11/06 12:17:31 r_prix
62  * fixed mini-bug in documentation: without explicit argument in function-prototype,
63  * doc++ seemed to merge docu of Tensor::operator=(Cmp&) and operator=(Tenseur&)
64  *
65  * Revision 1.10 2003/06/20 14:23:38 f_limousin
66  * Add the functions compare().
67  *
68  * Revision 1.9 2002/10/16 14:36:29 j_novak
69  * Reorganization of #include instructions of standard C++, in order to
70  * use experimental version 3 of gcc.
71  *
72  * Revision 1.8 2002/09/19 14:12:37 e_gourgoulhon
73  * Modif documentation for LaTeX compliance.
74  *
75  * Revision 1.7 2002/09/10 13:44:17 j_novak
76  * The method "manipule" of one indice has been removed for Tenseur_sym objects
77  * (the result cannot be a Tenseur_sym).
78  * The method "sans_trace" now computes the traceless part of a Tenseur (or
79  * Tenseur_sym) of valence 2.
80  *
81  * Revision 1.6 2002/09/06 14:49:25 j_novak
82  * Added method lie_derive for Tenseur and Tenseur_sym.
83  * Corrected various errors for derive_cov and arithmetic.
84  *
85  * Revision 1.5 2002/08/14 13:46:14 j_novak
86  * Derived quantities of a Tenseur can now depend on several Metrique's
87  *
88  * Revision 1.4 2002/08/08 15:10:44 j_novak
89  * The flag "plat" has been added to the class Metrique to show flat metrics.
90  *
91  * Revision 1.3 2002/08/07 16:14:11 j_novak
92  * class Tenseur can now also handle tensor densities, this should be transparent to older codes
93  *
94  * Revision 1.2 2002/06/17 14:05:17 j_novak
95  * friend functions are now also declared outside the class definition
96  *
97  * Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon
98  * LORENE
99  *
100  * Revision 2.46 2001/08/27 10:03:56 eric
101  * Ajout de l'operator% (produit tensoriel avec desaliasing)
102  *
103  * Revision 2.45 2001/06/19 15:38:00 eric
104  * Modif commentaires: mise en conformite Doc++ 3.4.8.
105  *
106  * Revision 2.44 2001/06/18 13:56:07 novak
107  * Ajout de la fonction abs()
108  *
109  * Revision 2.43 2001/05/29 16:10:43 eric
110  * Modif commentaires (mise en conformite Doc++ 3.4.7).
111  *
112  * Revision 2.42 2001/05/26 15:48:17 eric
113  * *** empty log message ***
114  *
115  * Revision 2.41 2001/05/26 15:42:54 eric
116  * Ajout de la fonction flat_scalar_prod_desal (desaliasage)
117  *
118  * Revision 2.40 2000/10/19 10:37:51 phil
119  * *** empty log message ***
120  *
121  * Revision 2.39 2000/10/19 09:47:15 phil
122  * *** empty log message ***
123  *
124  * Revision 2.38 2000/10/19 09:41:48 phil
125  * ajout de inverse_poisson_vect
126  *
127  * Revision 2.37 2000/10/06 12:37:09 keisuke
128  * Add a vectorial Poisson equation Tenseur::poisson_vect_regu.
129  *
130  * Revision 2.36 2000/09/27 08:52:34 eric
131  * Modif commentaires.
132  *
133  * Revision 2.35 2000/09/13 12:21:36 eric
134  * Modif commentaires.
135  *
136  * Revision 2.34 2000/09/13 12:11:26 eric
137  * Ajout de la fonction allocate_all().
138  *
139  * Revision 2.33 2000/05/22 14:39:11 phil
140  * ajout de inc_dzpuis et dec_dzpuis
141  *
142  * Revision 2.32 2000/04/03 15:18:54 phil
143  * suppression de poisson_vect_dirichlet
144  *
145  * Revision 2.31 2000/03/31 13:29:43 phil
146  * poisson_vect_neumann devient poisson_vect_dirichlet
147  *
148  * Revision 2.30 2000/03/30 16:10:46 phil
149  * *** empty log message ***
150  *
151  * Revision 2.29 2000/02/18 10:45:05 eric
152  * Modif commentaires.
153  *
154  * Revision 2.28 2000/02/11 19:11:55 phil
155  * commentaires
156  *
157  * Revision 2.27 2000/02/10 16:26:48 eric
158  * Modif commentaires.
159  *
160  * Revision 2.26 2000/02/10 16:10:49 eric
161  * Ajout de la fonction change_triad.
162  *
163  * Revision 2.25 2000/02/09 19:29:25 eric
164  * MODIF IMPORTANTE: la triade de decomposition est desormais passee en
165  * argument des constructeurs.
166  *
167  * Revision 2.24 2000/02/09 09:53:56 phil
168  * ajout de poisson_vect_oohara
169  * ,
170  *
171  * Revision 2.23 2000/02/08 19:04:25 eric
172  * Les fonctions arithmetiques ne sont plus amies.
173  * Ajout de nouvelles fonctions arithmetiques.
174  *
175  * Revision 2.22 2000/02/01 15:40:19 eric
176  * Ajout de la fonction sqrt
177  *
178  * Revision 2.21 2000/02/01 14:13:56 eric
179  * Modif commentaires.
180  * Ajout de la fonction amie flat_scalar_prod.
181  *
182  * Revision 2.20 2000/01/21 12:48:55 phil
183  * changement prototypage de Tenseur::poisson_vect
184  *
185  * Revision 2.19 2000/01/20 16:02:20 eric
186  * Ajout des operator=(double ) et operator=(int ).
187  *
188  * Revision 2.18 2000/01/20 14:52:08 phil
189  * *** empty log message ***
190  *
191  * Revision 2.17 2000/01/20 14:50:56 phil
192  * *** empty log message ***
193  *
194  * Revision 2.16 2000/01/20 14:39:31 phil
195  * *** empty log message ***
196  *
197  * Revision 2.15 2000/01/20 13:10:56 phil
198  * Ajout de Tenseur::poisson_vect (double)
199  *
200  * Revision 2.14 2000/01/20 11:20:17 phil
201  * changement prototypage
202  *
203  * Revision 2.13 2000/01/20 10:31:30 phil
204  * ajout de xksk
205  *
206  * Revision 2.12 2000/01/14 14:17:47 eric
207  * Modif commentaires.
208  *
209  * Revision 2.11 2000/01/14 14:04:07 eric
210  * Ajout de la fonction annule.
211  * classe Tenseur: constructeurs pour les classes derivees et fonctions
212  * de gestion memoire (del_t(), ...) declarees protected et non plus
213  * private.
214  *
215  * Revision 2.10 2000/01/13 14:15:30 eric
216  * Modif commentaires.
217  *
218  * Revision 2.9 2000/01/13 14:10:18 eric
219  * Ajout du constructeur par copie d'un Cmp (pour un scalaire)
220  * ainsi que l'affectation a un Cmp.
221  *
222  * Revision 2.8 2000/01/13 13:45:56 eric
223  * Ajout du membre p_gradient_spher et des fonctions fait_gradient_spher(),
224  * gradient_spher() pour le calcul du gradient d'un scalaire en
225  * coordonnees spheriques sur la triade spherique associee.
226  *
227  * Revision 2.7 2000/01/12 13:17:49 eric
228  * Les operator::(...) renvoie desormais une reference const sur le c[...]
229  * correspondant et non plus un Cmp copie de c[...].
230  * (ceci grace a Map::cmp_zero()).
231  *
232  * Revision 2.6 2000/01/11 11:13:16 eric
233  * Changement de nom pour la base vectorielle : base --> triad
234  *
235  * Revision 2.5 2000/01/10 17:22:26 eric
236  * Modif des #include
237  *
238  * Revision 2.4 2000/01/10 15:14:58 eric
239  * Ajout du membre base (base vectorielle sur laquelle sont definies
240  * les composantes).
241  *
242  * Revision 2.3 1999/12/09 12:39:39 phil
243  * changement prototypage des derivees
244  *
245  * Revision 2.2 1999/12/07 15:24:17 phil
246  * ajout include
247  *
248  * Revision 2.1 1999/12/03 09:37:11 phil
249  * *** empty log message ***
250  *
251  * Revision 2.0 1999/12/02 17:15:32 phil
252  * *** empty log message ***
253  *
254  * Revision 1.1 1999/12/02 17:13:29 phil
255  * Initial revision
256  *
257  *
258  * $Header: /cvsroot/Lorene/C++/Include/tenseur.h,v 1.18 2014/10/13 08:52:37 j_novak Exp $
259  *
260  */
261 
262 #define COV -1
263 #define CON +1
264 
265 #define N_MET_MAX 5
266 
267 // Headers Lorene
268 #include "cmp.h"
269 #include "itbl.h"
270 #include "base_vect.h"
271 
272 namespace Lorene {
273 class Metrique ;
274 class Tenseur_sym ;
275 
276  //---------------------------------//
277  // class Tenseur //
278  //---------------------------------//
279 
280 
298 class Tenseur {
299 
300  // Data :
301  // -----
302  protected:
303  const Map* const mp ;
304  int valence ;
305 
309  const Base_vect* triad ;
310 
316 
317  int n_comp ;
318  int etat ;
319  Cmp** c ;
320  double poids ;
321  const Metrique* metric ;
323 
324  // Derived data :
325  // ------------
326  protected:
334  const Metrique** met_depend ;
335 
340  mutable Tenseur* p_gradient ;
341 
348 
356 
363 
370 
371  // Constructors - Destructor :
372  // -------------------------
373  protected:
375  bool verif() const ;
376 
382  void new_der_met() ;
383 
384  public:
385  explicit Tenseur (const Map& map, const Metrique* met = 0x0,
386  double weight = 0) ;
387 
389  explicit Tenseur (const Cmp& cmp, const Metrique* met = 0x0,
390  double weight = 0) ;
391 
409  Tenseur (const Map& map, int val, const Itbl& tipe,
410  const Base_vect& triad_i, const Metrique* met = 0x0,
411  double weight = 0) ;
412 
431  Tenseur (const Map& map, int val, const Itbl& tipe,
432  const Base_vect* triad_i, const Metrique* met = 0x0,
433  double weight = 0) ;
434 
447  Tenseur (const Map& map, int val, int tipe, const
448  Base_vect& triad_i, const Metrique* met = 0x0,
449  double weight = 0) ;
450 
451  Tenseur (const Tenseur&) ;
452 
454  explicit Tenseur (const Tenseur_sym&) ;
455 
468  Tenseur (const Map& map, const Base_vect& triad_i, FILE* fich,
469  const Metrique* met = 0x0) ;
470 
480  Tenseur (const Map& map, FILE* fich, const Metrique* met = 0x0) ;
481 
482 
483  protected:
503  Tenseur (const Map& map, int val, const Itbl& tipe, int n_comp,
504  const Base_vect& triad_i, const Metrique* met = 0x0,
505  double weight = 0) ;
506 
521  Tenseur (const Map&, int val, int tipe, int n_comp,
522  const Base_vect& triad_i, const Metrique* met = 0x0,
523  double weight = 0) ;
524 
525 
526  public:
527 
528  virtual ~Tenseur() ;
529 
530  // Memory management
531  // -----------------
532  protected:
533  void del_t() ;
534 
539  void del_derive_met(int i) const ;
540 
544  void del_derive() const ;
545 
551  void set_der_met_0x0(int i) const ;
552 
557  void set_der_0x0() const ;
558 
559  // Mutators / assignment
560  // ---------------------
561  public:
566  void set_etat_nondef() ;
567 
572  void set_etat_zero() ;
573 
578  void set_etat_qcq() ;
579 
589  void allocate_all() ;
590 
594  void change_triad(const Base_vect& new_triad) ;
595 
602  void set_triad(const Base_vect& new_triad) ;
603  void set_poids(double weight) ;
604  void set_metric(const Metrique& met) ;
606 
608  virtual void operator=(const Tenseur& tens) ;
609 
611  void operator=(const Cmp& field) ;
612 
614  void operator=(double ) ;
615 
617  void operator=(int ) ;
618 
620  Cmp& set () ;
621  Cmp& set (int) ;
622  Cmp& set (int, int) ;
623  Cmp& set (int, int, int) ;
624  Cmp& set (const Itbl&) ;
625 
631  void annule(int l) ;
632 
644  void annule(int l_min, int l_max) ;
645 
651  void set_std_base() ;
652 
653  void dec_dzpuis() ;
654  void inc_dzpuis() ;
655  void dec2_dzpuis() ;
656  void inc2_dzpuis() ;
657  void mult_r_zec() ;
658 
663  Tenseur inverse_poisson_vect (double lambda) const ;
664 
665  // Accessors
666  // ---------
667  public:
678  virtual int donne_place (const Itbl& idx) const ;
679 
693  virtual Itbl donne_indices (int place) const ;
694 
696  const Map* get_mp() const {return mp ;} ;
697 
701  const Base_vect* get_triad() const {return triad;} ;
702 
704  int get_etat() const {return etat ;} ;
705 
707  int get_valence() const {return valence ; } ;
708 
710  int get_n_comp() const {return n_comp ;} ;
711 
723  int get_type_indice (int i) const {return type_indice(i) ;};
724 
732  Itbl get_type_indice () const {return type_indice ; } ;
733 
735  double get_poids() const {return poids ; } ;
736 
742  const Metrique* get_metric() const {return metric ; } ;
743 
744  const Cmp& operator()() const ;
745  const Cmp& operator()(int) const ;
746  const Cmp& operator()(int, int) const ;
747  const Cmp& operator()(int, int, int) const ;
748  const Cmp& operator()(const Itbl&) const ;
749 
750  // Outputs
751  // -------
752  public:
753  void sauve(FILE *) const ;
754  friend ostream& operator<<(ostream& , const Tenseur & ) ;
755 
756  // Computation of derived members
757  // ------------------------------
758  protected:
763  virtual void fait_gradient () const ;
764 
770  void fait_gradient_spher () const ;
771 
777  virtual void fait_derive_cov (const Metrique& met, int i) const ;
778 
784  virtual void fait_derive_con (const Metrique&, int i) const ;
785 
791  void fait_carre_scal (const Metrique&, int i) const ;
792 
802  void set_dependance (const Metrique& met) const ;
803 
809  int get_place_met(const Metrique& metre) const ;
810 
811  // Differential operators
812  // ----------------------
813  public:
815  const Tenseur& gradient() const ;
816 
820  const Tenseur& gradient_spher() const ;
821 
826  const Tenseur& derive_cov (const Metrique& met) const ;
827 
832  const Tenseur& derive_con (const Metrique&) const ;
833 
838  const Tenseur& carre_scal (const Metrique&) const ;
839 
840  // Resolution d'EDP :
866  void poisson_vect(double lambda, Param& par, Tenseur& shift, Tenseur& vect
867  , Tenseur& scal) const ;
868 
869  /*
870  * Same as poisson_vect with a Tau method
871  **/
872  void poisson_vect_tau(double lambda, Param& par, Tenseur& shift, Tenseur& vect
873  , Tenseur& scal) const ;
874 
875  void poisson_vect_falloff(double lambda, Param& par, Tenseur& shift,
876  Tenseur& vect, Tenseur& scal, int* k_falloff) const ;
877 
878  void poisson_vect_ylm(double lambda, Param& para, Tenseur& shift,
879  Tenseur& vecteur, Tenseur& scalaire, int nylm,
880  double* intvec) const ;
881 
909  Tenseur poisson_vect(double lambda, Tenseur& vect , Tenseur& scal ) const ;
910 
911  /*
912  * Same as poisson_vect with a Tau method
913  **/
914  Tenseur poisson_vect_tau(double lambda, Tenseur& vect , Tenseur& scal ) const ;
915 
916  Tenseur poisson_vect_falloff(double lambda, Tenseur& vect ,
917  Tenseur& scal, int* k_falloff ) const ;
918 
919  Tenseur poisson_vect_ylm(double lambda, Tenseur& vecteur,
920  Tenseur& scalaire, int nylm, double* intvec) const ;
921 
947  void poisson_vect_oohara(double lambda, Param& par, Tenseur& shift,
948  Tenseur& scal) const ;
949 
950  /*
951  * Same as poisson_vect_oohara with a Tau method
952  **/
953  void poisson_vect_oohara_tau(double lambda, Param& par, Tenseur& shift,
954  Tenseur& scal) const ;
955 
984  Tenseur poisson_vect_oohara(double lambda, Tenseur& scal) const ;
985  /*
986  * Same as poisson_vect_oohara with a Tau method
987  **/
988  Tenseur poisson_vect_oohara_tau(double lambda, Tenseur& scal) const ;
989 
1018  void poisson_vect_regu(int k_div, int nzet, double unsgam1,
1019  double lambda, Param& par, Tenseur& shift,
1020  Tenseur& vect, Tenseur& scal) const ;
1021 
1022 
1024 
1025  void compare( const Tenseur& tens, const char* name ) ;
1026  void compare( FILE* fich, const char* name_i ) ;
1027 
1028 
1029 
1030  // Friend classes
1031  // ---------------
1032  friend class Tenseur_sym ;
1033  friend class Metrique ;
1034 
1035  // Mathematical operators
1036  // ----------------------
1037 
1038  friend Tenseur operator* (const Tenseur&, const Tenseur&) ;
1039  friend Tenseur operator% (const Tenseur&, const Tenseur&) ;
1040  friend Tenseur contract(const Tenseur&, int id1, int id2) ;
1041  friend Tenseur contract(const Tenseur&, int id1, const Tenseur&,
1042  int id2) ;
1043  friend Tenseur contract_desal(const Tenseur&, int id1, const Tenseur&,
1044  int id2) ;
1045  friend Tenseur flat_scalar_prod(const Tenseur& t1, const Tenseur& t2) ;
1046  friend Tenseur flat_scalar_prod_desal(const Tenseur& t1,
1047  const Tenseur& t2) ;
1048  friend Tenseur manipule(const Tenseur&, const Metrique&, int idx) ;
1049  friend Tenseur manipule(const Tenseur&, const Metrique&) ;
1050  friend Tenseur skxk (const Tenseur&) ;
1051  friend Tenseur lie_derive(const Tenseur& , const Tenseur& ,
1052  const Metrique* ) ;
1053 
1054 };
1055 
1056 
1063 Tenseur operator*(const Tenseur&, const Tenseur&) ;
1065 
1067 Tenseur operator%(const Tenseur&, const Tenseur&) ;
1068 
1091 Tenseur contract(const Tenseur&, int id1, int id2) ;
1092 
1115 Tenseur contract(const Tenseur&, int id1, const Tenseur&, int id2) ;
1116 
1123 Tenseur flat_scalar_prod(const Tenseur& t1, const Tenseur& t2) ;
1124 
1128 Tenseur flat_scalar_prod_desal(const Tenseur& t1, const Tenseur& t2) ;
1129 
1134 Tenseur manipule(const Tenseur&, const Metrique&, int idx) ;
1135 
1140 Tenseur manipule(const Tenseur&, const Metrique&) ;
1141 
1149 Tenseur skxk (const Tenseur&) ;
1150 
1157 Tenseur lie_derive (const Tenseur& t, const Tenseur& x, const Metrique* = 0x0);
1158 
1167 Tenseur sans_trace(const Tenseur& tens, const Metrique& metre) ;
1168 
1169 
1178 Tenseur operator+(const Tenseur& ) ;
1179 Tenseur operator-(const Tenseur& ) ;
1180 Tenseur operator+(const Tenseur&, const Tenseur &) ;
1181 
1183 Tenseur operator+(const Tenseur&, double ) ;
1184 
1186 Tenseur operator+(double, const Tenseur& ) ;
1187 
1189 Tenseur operator+(const Tenseur&, int ) ;
1190 
1192 Tenseur operator+(int, const Tenseur& ) ;
1193 
1194 Tenseur operator-(const Tenseur &, const Tenseur &) ;
1195 
1197 Tenseur operator-(const Tenseur&, double ) ;
1198 
1200 Tenseur operator-(double, const Tenseur& ) ;
1201 
1203 Tenseur operator-(const Tenseur&, int ) ;
1204 
1206 Tenseur operator-(int, const Tenseur& ) ;
1207 
1209 Tenseur operator*(const Tenseur&, double ) ;
1210 
1212 Tenseur operator*(double, const Tenseur& ) ;
1213 
1215 Tenseur operator*(const Tenseur&, int ) ;
1216 
1218 Tenseur operator*(int, const Tenseur& ) ;
1219 
1221 Tenseur operator/(const Tenseur& a, const Tenseur& b) ;
1222 
1223 Tenseur operator/(const Tenseur&, double ) ;
1224 
1226 Tenseur operator/(double, const Tenseur &) ;
1227 
1228 Tenseur operator/(const Tenseur&, int ) ;
1229 
1231 Tenseur operator/(int, const Tenseur &) ;
1232 
1233 Tenseur exp(const Tenseur& ) ;
1234 Tenseur log(const Tenseur& ) ;
1235 Tenseur sqrt(const Tenseur& ) ;
1236 Tenseur abs(const Tenseur& ) ;
1237 Tenseur pow(const Tenseur&, int ) ;
1238 Tenseur pow(const Tenseur&, double ) ;
1239 
1246  //---------------------------------//
1247  // class Tenseur_sym //
1248  //---------------------------------//
1249 
1257 class Tenseur_sym : public Tenseur {
1258 
1259  // Constructors - Destructor :
1260  // -------------------------
1261 
1262  public:
1277  Tenseur_sym (const Map& map, int val, const Itbl& tipe,
1278  const Base_vect& triad_i, const Metrique* met = 0x0,
1279  double weight = 0) ;
1280 
1290  Tenseur_sym (const Map& map, int val, int tipe,
1291  const Base_vect& triad_i, const Metrique* met = 0x0,
1292  double weight = 0) ;
1293 
1294  Tenseur_sym (const Tenseur_sym&) ;
1295 
1299  explicit Tenseur_sym (const Tenseur&) ;
1300 
1311  Tenseur_sym (const Map& map, const Base_vect& triad_i, FILE* fich,
1312  const Metrique* met = 0x0) ;
1313 
1314  virtual ~Tenseur_sym() ;
1315 
1316  // Mutators / assignment
1317  // ---------------------
1318  public:
1324  virtual void operator= (const Tenseur&) ;
1325 
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:315
const Map *const mp
Reference mapping.
Definition: tenseur.h:303
double get_poids() const
Returns the weight.
Definition: tenseur.h:735
const Base_vect * triad
Vectorial basis (triad) with respect to which the tensor components are defined.
Definition: tenseur.h:309
void compare(const Tenseur &tens, const char *name)
Functions to compare the values of tensors.
virtual ~Tenseur()
Destructor.
Definition: tenseur.C:533
Cmp log(const Cmp &)
Neperian logarithm.
Definition: cmp_math.C:296
int get_type_indice(int i) const
Returns the type of the index number i .
Definition: tenseur.h:723
void annule(int l)
Sets the Tenseur to zero in a given domain.
Definition: tenseur.C:900
int get_place_met(const Metrique &metre) const
Returns the position of the pointer on metre in the array met_depend .
Definition: tenseur.C:598
Component of a tensorial field *** DEPRECATED : use class Scalar instead ***.
Definition: cmp.h:443
Cmp exp(const Cmp &)
Exponential.
Definition: cmp_math.C:270
Cmp ** c
The components.
Definition: tenseur.h:319
void dec2_dzpuis()
dzpuis -= 2 ;
Definition: tenseur.C:1130
void poisson_vect(double lambda, Param &par, Tenseur &shift, Tenseur &vect, Tenseur &scal) const
Solves the vectorial Poisson equation : .
Definition: tenseur_pde.C:118
const Tenseur & gradient_spher() const
Returns the gradient of *this (Spherical coordinates) (scalar field only).
Definition: tenseur.C:1548
void set_triad(const Base_vect &new_triad)
Assigns a new vectorial basis (triad) of decomposition.
Definition: tenseur.C:674
void poisson_vect_oohara(double lambda, Param &par, Tenseur &shift, Tenseur &scal) const
Solves the vectorial Poisson equation .
Definition: tenseur_pde.C:218
Cmp sqrt(const Cmp &)
Square root.
Definition: cmp_math.C:220
int n_comp
Number of components, depending on the symmetry.
Definition: tenseur.h:317
Itbl get_type_indice() const
Returns the types of all the indices.
Definition: tenseur.h:732
void set_poids(double weight)
Sets the weight for a tensor density.
Definition: tenseur.C:680
void set_std_base()
Set the standard spectal basis of decomposition for each component.
Definition: tenseur.C:1170
Class intended to describe tensors with a symmetry on the two last indices *** DEPRECATED : use class...
Definition: tenseur.h:1257
Lorene prototypes.
Definition: app_hor.h:64
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:690
Base class for coordinate mappings.
Definition: map.h:670
int etat
Logical state ETATZERO , ETATQCQ or ETATNONDEF.
Definition: tenseur.h:318
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:704
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:196
Basic integer array class.
Definition: itbl.h:122
const Tenseur & derive_con(const Metrique &) const
Returns the contravariant derivative of *this , with respect to met .
Definition: tenseur.C:1568
Cmp operator/(const Cmp &, const Cmp &)
Cmp / Cmp.
Definition: cmp_arithm.C:457
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:1345
void inc_dzpuis()
dzpuis += 1 ;
Definition: tenseur.C:1117
const Cmp & operator()() const
Read only for a scalar.
Definition: tenseur.C:943
void inc2_dzpuis()
dzpuis += 2 ;
Definition: tenseur.C:1143
int get_valence() const
Returns the valence.
Definition: tenseur.h:707
void del_t()
Logical destructor.
Definition: tenseur.C:545
virtual void operator=(const Tenseur &tens)
Assignment to another Tenseur.
Definition: tenseur.C:718
void set_metric(const Metrique &met)
Sets the pointer on the metric for a tensor density.
Definition: tenseur.C:685
friend Tenseur operator*(const Tenseur &, const Tenseur &)
Tensorial product.
Tenseur * p_gradient_spher
Pointer on the gradient of *this in a spherical orthonormal basis (scalar field only).
Definition: tenseur.h:347
void del_derive_met(int i) const
Logical destructor of the derivatives depending on the i-th element of *met_depend ...
Definition: tenseur.C:554
void change_triad(const Base_vect &new_triad)
Sets a new vectorial basis (triad) of decomposition and modifies the components accordingly.
Definition: tenseur.C:668
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:1429
const Map * get_mp() const
Returns pointer on the mapping.
Definition: tenseur.h:696
void sauve(FILE *) const
Save in a file.
Definition: tenseur.C:1325
Tenseur * p_gradient
Pointer on the gradient of *this .
Definition: tenseur.h:340
void mult_r_zec()
Multiplication by r in the external zone.
Definition: tenseur.C:1156
const Metrique * get_metric() const
Returns a pointer on the metric defining the conformal factor for tensor densities.
Definition: tenseur.h:742
Cmp operator+(const Cmp &)
Definition: cmp_arithm.C:104
int valence
Valence.
Definition: tenseur.h:304
const Base_vect * get_triad() const
Returns the vectorial basis (triad) on which the components are defined.
Definition: tenseur.h:701
bool verif() const
Returns false for a tensor density without a defined metric.
Definition: tenseur.C:192
double poids
For tensor densities: the weight.
Definition: tenseur.h:320
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:362
int get_etat() const
Returns the logical state.
Definition: tenseur.h:704
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:1499
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:1517
Cmp pow(const Cmp &, int)
Power .
Definition: cmp_math.C:348
friend Tenseur skxk(const Tenseur &)
Contraction of the last index of (*this) with or , depending on the type of S .
const Metrique ** met_depend
Array of pointers on the Metrique &#39;s used to calculate derivatives members.
Definition: tenseur.h:334
int get_n_comp() const
Returns the number of components.
Definition: tenseur.h:710
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:591
Tenseur(const Map &map, const Metrique *met=0x0, double weight=0)
Constructor for a scalar field.
Definition: tenseur.C:209
void allocate_all()
Sets the logical state to ETATQCQ (ordinary state) and performs the memory allocation of all the elem...
Definition: tenseur.C:657
void dec_dzpuis()
dzpuis -= 1 ;
Definition: tenseur.C:1104
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:608
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:583
Tenseur inverse_poisson_vect(double lambda) const
Compute of *this , *this being of valence 1.
Cmp abs(const Cmp &)
Absolute value.
Definition: cmp_math.C:410
const Metrique * metric
For tensor densities: the metric defining the conformal factor.
Definition: tenseur.h:322
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:355
Cmp operator-(const Cmp &)
- Cmp
Definition: cmp_arithm.C:108
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:1577
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Definition: tenseur.C:636
const Tenseur & derive_cov(const Metrique &met) const
Returns the covariant derivative of *this , with respect to met .
Definition: tenseur.C:1554
void del_derive() const
Logical destructor of all the derivatives.
Definition: tenseur.C:573
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:645
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 : .
Tenseur ** p_carre_scal
Array of pointers on the scalar squares of *this with respect to the corresponding metric in *met_dep...
Definition: tenseur.h:369
void fait_gradient_spher() const
Calculates, if needed, the gradient of *this in a spherical orthonormal basis (scalar field only)...
Definition: tenseur.C:1392
Tensor handling *** DEPRECATED : use class Tensor instead ***.
Definition: tenseur.h:298
void set_etat_nondef()
Sets the logical state to ETATNONDEF (undefined state).
Definition: tenseur.C:650
const Tenseur & gradient() const
Returns the gradient of *this (Cartesian coordinates)
Definition: tenseur.C:1542