Debian Codegraph @

C++/Include/connection.h

raw symbols SCIP
1 /*
2 * Definition of Lorene class Connection
3 *
4 */
5
6 /*
7 * Copyright (c) 2003-2004 Eric Gourgoulhon & Jerome Novak
8 *
9 * This file is part of LORENE.
10 *
11 * LORENE is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2
13 * as published by the Free Software Foundation.
14 *
15 * LORENE is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with LORENE; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 *
24 */
25
26 #ifndef __CONNECTION_H_
27 #define __CONNECTION_H_
28
29 /*
30 * $Id: connection.h,v 1.14 2014/10/13 08:52:33 j_novak Exp $
31 * $Log: connection.h,v $
32 * Revision 1.14 2014/10/13 08:52:33 j_novak
33 * Lorene classes and functions now belong to the namespace Lorene.
34 *
35 * Revision 1.13 2004/03/22 13:12:40 j_novak
36 * Modification of comments to use doxygen instead of doc++
37 *
38 * Revision 1.12 2004/01/04 20:50:24 e_gourgoulhon
39 * Class Connection: data member delta is now of type Tensor_sym (and no
40 * longer of type Tensor_delta).
41 *
42 * Revision 1.11 2003/12/30 22:56:40 e_gourgoulhon
43 * Replaced member flat_conn (flat connection) by flat_met (flat metric)
44 * Added argument flat_met to the constructors of Connection.
45 * Suppressed method fait_ricci() (the computation of the Ricci is
46 * now devoted to the virtual method ricci()).
47 *
48 * Revision 1.10 2003/12/27 14:56:20 e_gourgoulhon
49 * -- Method derive_cov() suppressed.
50 * -- Change of the position of the derivation index from the first one
51 * to the last one in methods p_derive_cov() and p_divergence().
52 *
53 * Revision 1.9 2003/10/16 14:21:33 j_novak
54 * The calculation of the divergence of a Tensor is now possible.
55 *
56 * Revision 1.8 2003/10/06 13:58:45 j_novak
57 * The memory management has been improved.
58 * Implementation of the covariant derivative with respect to the exact Tensor
59 * type.
60 *
61 * Revision 1.7 2003/10/06 06:52:26 e_gourgoulhon
62 * Corrected documentation.
63 *
64 * Revision 1.6 2003/10/05 21:04:25 e_gourgoulhon
65 * Improved comments
66 *
67 * Revision 1.5 2003/10/03 14:07:23 e_gourgoulhon
68 * Added derived class Connection_fcart.
69 *
70 * Revision 1.4 2003/10/02 21:31:11 e_gourgoulhon
71 * Added methods fait_delta and update
72 * flat_conn is now a modifiable pointer.
73 *
74 * Revision 1.3 2003/10/02 15:44:23 j_novak
75 * The destructor is now public...
76 *
77 * Revision 1.2 2003/10/01 15:41:49 e_gourgoulhon
78 * Added mapping
79 *
80 * Revision 1.1 2003/09/29 21:14:10 e_gourgoulhon
81 * First version --- not ready yet.
82 *
83 *
84 *
85 * $Header: /cvsroot/Lorene/C++/Include/connection.h,v 1.14 2014/10/13 08:52:33 j_novak Exp $
86 *
87 */
88
89
90 // Lorene headers
91 #include "tensor.h"
92
93 namespace Lorene {
94 class Metric ;
95 class Metric_flat ;
96
97 //--------------------------//
98 // class Connection //
99 //--------------------------//
100
101 /**
102 * Class Connection. \ingroup (tensor)
103 *
104 * This class deals only with torsion-free connections.
105 *
106 * Note that we use the MTW convention for the indices of the connection
107 * coefficients with respect to a given triad \f$(e_i)\f$:
108 * \f[
109 * \Gamma^i_{\ jk} := \langle e^i, \nabla_{e_k} \, e_j \rangle
110 * \f]
111 *
112 */
113 class Connection {
114
115 // Data :
116 // -----
117 protected:
118
119 const Map* const mp ; ///< Reference mapping
120
121 /** Triad \f$(e_i)\f$ with respect to which the connection coefficients
122 * are defined.
123 */
124 const Base_vect* const triad ;
125
126 /** Tensor \f$\Delta^i_{\ jk}\f$ which defines
127 * the connection with respect to the flat one: \f$\Delta^i_{\ jk}\f$
128 * is the difference between the connection coefficients
129 * \f$\Gamma^i_{\ jk}\f$ and
130 * the connection coefficients \f${\bar \Gamma}^i_{\ jk}\f$ of the
131 * flat connection. The connection coefficients with respect to the
132 * triad \f$(e_i)\f$ are defined
133 * according to the MTW convention:
134 * \f[
135 * \Gamma^i_{\ jk} := \langle e^i, \nabla_{e_k} \, e_j \rangle
136 * \f]
137 * Note that \f$\Delta^i_{\ jk}\f$ is symmetric with respect to the
138 * indices j and k.
139 *
140 */
141 Tensor_sym delta ;
142
143 /** Indicates whether the connection is associated with a metric
144 * (in which case the Ricci tensor is symmetric, i.e. the
145 * actual type of \c p_ricci is a \c Sym_tensor )
146 */
147 bool assoc_metric ;
148
149
150 private:
151
152 /** Flat metric with respect to which \f$\Delta^i_{\ jk}\f$
153 * (member \c delta ) is defined.
154 *
155 */
156 const Metric_flat* flat_met ;
157
158
159 // Derived data :
160 // ------------
161 protected:
162
163 /// Pointer of the Ricci tensor associated with the connection
164 mutable Tensor* p_ricci ;
165
166 // Constructors - Destructor
167 // -------------------------
168 public:
169
170 /** Standard constructor ab initio.
171 *
172 * @param delta_i tensor \f$\Delta^i_{\ jk}\f$ which defines
173 * the connection with respect to the flat one: \f$\Delta^i_{\ jk}\f$
174 * is the difference between the connection coefficients
175 * \f$\Gamma^i_{\ jk}\f$ and
176 * the connection coefficients \f${\bar \Gamma}^i_{\ jk}\f$ of the
177 * flat connection. The connection coefficients with respect to the
178 * triad \f$(e_i)\f$ are defined according to the MTW convention:
179 * \f[
180 * \Gamma^i_{\ jk} := \langle e^i, \nabla_{e_k} \, e_j \rangle
181 * \f]
182 * \f$\Delta^i_{\ jk}\f$ must be symmetric with respect to the
183 * indices j and k.
184 * @param flat_met_i flat metric with respect to which \f$\Delta^i_{\ jk}\f$
185 * is defined
186 *
187 */
188 Connection(const Tensor_sym& delta_i, const Metric_flat& flat_met_i) ;
189
190 /** Standard constructor for a connection associated with a metric.
191 *
192 * @param met Metric to which the connection will be associated
193 * @param flat_met_i flat metric to define the \f$\Delta^i_{\ jk}\f$
194 * representation of the connection
195 *
196 */
197 Connection(const Metric& met, const Metric_flat& flat_met_i) ;
198
199 Connection(const Connection& ) ; ///< Copy constructor
200
201 protected:
202
203 /// Constructor for derived classes
204 Connection(const Map&, const Base_vect& ) ;
205
206 public:
207 virtual ~Connection() ; ///< Destructor
208
209
210 // Memory management
211 // -----------------
212 protected:
213
214 /// Deletes all the derived quantities
215 void del_deriv() const ;
216
217 /// Sets to \c 0x0 all the pointers on derived quantities
218 void set_der_0x0() const ;
219
220
221 // Mutators / assignment
222 // ---------------------
223 public:
224
225 /// Assignment to another \c Connection
226 void operator=(const Connection&) ;
227
228 /** Update the connection when it is defined ab initio.
229 *
230 * @param delta_i tensor \f$\Delta^i_{\ jk}\f$ which defines
231 * the connection with respect to the flat one: \f$\Delta^i_{\ jk}\f$
232 * is the difference between the connection coefficients
233 * \f$\Gamma^i_{\ jk}\f$ and
234 * the connection coefficients \f${\bar \Gamma}^i_{\ jk}\f$ of the
235 * flat connection.
236 * \f$\Delta^i_{\ jk}\f$ must be symmetric with respect to the
237 * indices j and k.
238 */
239 void update(const Tensor_sym& delta_i) ;
240
241 /** Update the connection when it is associated with a metric.
242 *
243 * @param met Metric to which the connection is associated
244 *
245 */
246 void update(const Metric& met) ;
247
248
249 // Accessors
250 // ---------
251 public:
252 /// Returns the mapping
253 const Map& get_mp() const {return *mp; } ;
254
255
256 /** Returns the tensor \f$\Delta^i_{\ jk}\f$ which defines
257 * the connection with respect to the flat one: \f$\Delta^i_{\ jk}\f$
258 * is the difference between the connection coefficients
259 * \f$\Gamma^i_{\ jk}\f$ and
260 * the connection coefficients \f${\bar \Gamma}^i_{\ jk}\f$ of the
261 * flat connection. The connection coefficients with respect to the
262 * triad \f$(e_i)\f$ are defined according to the MTW convention:
263 * \f[
264 * \Gamma^i_{\ jk} := \langle e^i, \nabla_{e_k} \, e_j \rangle
265 * \f]
266 * Note that \f$\Delta^i_{\ jk}\f$ is symmetric with respect to the
267 * indices j and k.
268 *
269 * @return \c delta}(i,j,k) = \f$\Delta^i_{\ jk}\f$
270 */
271 const Tensor_sym& get_delta() const {return delta; } ;
272
273 // Computational methods
274 // ---------------------
275
276 public:
277
278 /** Computes the covariant derivative \f$\nabla T\f$ of a tensor \f$T\f$
279 * (with respect to the current connection).
280 *
281 * The extra index (with respect to the indices of \f$T\f$)
282 * of \f$\nabla T\f$ is chosen to be the \b last one.
283 * This convention agrees with that of MTW (see Eq. (10.17) of MTW).
284 * For instance, if \f$T\f$ is a 1-form, whose components
285 * w.r.t. the triad \f$e^i\f$ are \f$T_i\f$: \f$T=T_i \; e^i\f$,
286 * then the covariant derivative of \f$T\f$ is the bilinear form
287 * \f$\nabla T\f$ whose components \f$\nabla_j T_i\f$ are
288 * such that
289 * \f[
290 * \nabla T = \nabla_j T_i \; e^i \otimes e^j
291 * \f]
292 *
293 * @param tens tensor \f$T\f$
294 * @return pointer on the covariant derivative \f$\nabla T\f$ ;
295 * this pointer is
296 * polymorphe, i.e. it is a pointer on a \c Vector
297 * if the argument is a \c Scalar , and on a \c Tensor otherwise.
298 * NB: The corresponding memory is allocated by the method
299 * \c p_derive_cov() and
300 * must be deallocated by the user afterwards.
301 */
302 virtual Tensor* p_derive_cov(const Tensor& tens) const ;
303
304 /** Computes the divergence of a tensor \f$T\f$
305 * (with respect to the current connection).
306 * The divergence is taken with respect of the last index of \f$T\f$
307 * which thus must be contravariant.
308 * For instance if \f$T\f$ is a twice contravariant tensor, whose
309 * components w.r.t. the
310 * triad \f$e_i\f$ are \f$T^{ij}\f$: \f$T = T^{ij} \; e_i \otimes e_j\f$,
311 * the divergence of \f$T\f$ is the vector
312 * \f[
313 * {\rm div}\, T = \nabla_k T^{ik} \; e_i
314 * \f]
315 * where \f$\nabla\f$ denotes the current connection.
316 * @param tens tensor \f$T\f$
317 * @return pointer on the divergence of \f$T\f$ ;
318 * this pointer is
319 * polymorphe, i.e. its is a pointer on a \c Scalar
320 * if \f$T\f$ is a \c Vector , on a \c Vector if \f$T\f$ is a tensor
321 * of valence 2, and on a \c Tensor otherwise.
322 * NB: The corresponding memory is allocated by the method
323 * \c p_divergence() and
324 * must be deallocated by the user afterwards.
325 */
326 virtual Tensor* p_divergence(const Tensor& tens) const ;
327
328 /** Computes (if not up to date) and returns the Ricci tensor
329 * associated with the current connection
330 */
331 virtual const Tensor& ricci() const ;
332
333 private:
334 /** Computes the difference \f$\Delta^i_{\ jk}\f$ between the
335 * connection coefficients and that a the flat connection
336 * in the case where the current connection is associated
337 * with a metric
338 */
339 void fait_delta(const Metric& ) ;
340
341 };
342
343
344 //-------------------------------//
345 // class Connection_flat //
346 //-------------------------------//
347
348 /**
349 * Class Connection_flat. \ingroup (tensor)
350 *
351 * Abstract class for connections associated with a flat metric.
352 *
353 */
354 class Connection_flat : public Connection {
355
356 // Constructors - Destructor
357 // -------------------------
358 protected:
359
360 /// Contructor from a triad, has to be defined in the derived classes
361 Connection_flat(const Map&, const Base_vect&) ;
362
363 public:
364
365 Connection_flat(const Connection_flat & ) ; ///< Copy constructor
366
367 virtual ~Connection_flat() ; ///< destructor
368
369
370 // Mutators / assignment
371 // ---------------------
372 public:
373
374 /// Assignment to another \c Connection_flat
375 void operator=(const Connection_flat&) ;
376
377
378 // Computational methods
379 // ---------------------
380
381 public:
382
383 /** Computes the covariant derivative \f$\nabla T\f$ of a tensor \f$T\f$
384 * (with respect to the current connection).
385 *
386 * The extra index (with respect to the indices of \f$T\f$)
387 * of \f$\nabla T\f$ is chosen to be the \b last one.
388 * This convention agrees with that of MTW (see Eq. (10.17) of MTW).
389 * For instance, if \f$T\f$ is a 1-form, whose components
390 * w.r.t. the triad \f$e^i\f$ are \f$T_i\f$: \f$T=T_i \; e^i\f$,
391 * then the covariant derivative of \f$T\f$ is the bilinear form
392 * \f$\nabla T\f$ whose components \f$\nabla_j T_i\f$ are
393 * such that
394 * \f[
395 * \nabla T = \nabla_j T_i \; e^i \otimes e^j
396 * \f]
397 *
398 * @param tens tensor \f$T\f$
399 * @return pointer on the covariant derivative \f$\nabla T\f$ ;
400 * this pointer is
401 * polymorphe, i.e. it is a pointer on a \c Vector
402 * if the argument is a \c Scalar , and on a \c Tensor otherwise.
403 * NB: The corresponding memory is allocated by the method
404 * \c p_derive_cov() and
405 * must be deallocated by the user afterwards.
406 */
407 virtual Tensor* p_derive_cov(const Tensor& tens) const = 0 ;
408
409 /** Computes the divergence of a tensor \f$T\f$
410 * (with respect to the current connection).
411 * The divergence is taken with respect of the last index of \f$T\f$
412 * which thus must be contravariant.
413 * For instance if \f$T\f$ is a twice contravariant tensor, whose
414 * components w.r.t. the
415 * triad \f$e_i\f$ are \f$T^{ij}\f$: \f$T = T^{ij} \; e_i \otimes e_j\f$,
416 * the divergence of \f$T\f$ is the vector
417 * \f[
418 * {\rm div} T = \nabla_k T^{ik} \; e_i
419 * \f]
420 * where \f$\nabla\f$ denotes the current connection.
421 * @param tens tensor \f$T\f$
422 * @return pointer on the divergence of \f$T\f$ ;
423 * this pointer is
424 * polymorphe, i.e. its is a pointer on a \c Scalar
425 * if \f$T\f$ is a \c Vector , on a \c Vector if \f$T\f$ is a tensor
426 * of valence 2, and on a \c Tensor otherwise.
427 * NB: The corresponding memory is allocated by the method
428 * \c p_divergence() and
429 * must be deallocated by the user afterwards.
430 */
431 virtual Tensor* p_divergence(const Tensor& tens) const = 0 ;
432
433 /** Computes (if not up to date) and returns the Ricci tensor
434 * associated with the current connection
435 */
436 virtual const Tensor& ricci() const ;
437
438 };
439
440
441 //-------------------------------//
442 // class Connection_fspher //
443 //-------------------------------//
444
445 /**
446 * Class Connection_fspher.\ingroup (tensor)
447 *
448 * Class for connections associated with a flat metric and given onto
449 * an orthonormal spherical triad.
450 *
451 */
452 class Connection_fspher : public Connection_flat {
453
454 // Constructors - Destructor
455 // -------------------------
456
457 public:
458
459 /// Contructor from a spherical flat-metric-orthonormal basis
460 Connection_fspher(const Map&, const Base_vect_spher&) ;
461
462 Connection_fspher(const Connection_fspher& ) ; ///< Copy constructor
463
464 public:
465
466 virtual ~Connection_fspher() ; ///<destructor
467
468
469 // Mutators / assignment
470 // ---------------------
471 public:
472
473 /// Assignment to another \c Connection_fspher
474 void operator=(const Connection_fspher&) ;
475
476
477 // Computational methods
478 // ---------------------
479
480 public:
481 /** Computes the covariant derivative \f$\nabla T\f$ of a tensor \f$T\f$
482 * (with respect to the current connection).
483 *
484 * The extra index (with respect to the indices of \f$T\f$)
485 * of \f$\nabla T\f$ is chosen to be the \b last one.
486 * This convention agrees with that of MTW (see Eq. (10.17) of MTW).
487 * For instance, if \f$T\f$ is a 1-form, whose components
488 * w.r.t. the triad \f$e^i\f$ are \f$T_i\f$: \f$T=T_i \; e^i\f$,
489 * then the covariant derivative of \f$T\f$ is the bilinear form
490 * \f$\nabla T\f$ whose components \f$\nabla_j T_i\f$ are
491 * such that
492 * \f[
493 * \nabla T = \nabla_j T_i \; e^i \otimes e^j
494 * \f]
495 *
496 * @param tens tensor \f$T\f$
497 * @return pointer on the covariant derivative \f$\nabla T\f$ ;
498 * this pointer is
499 * polymorphe, i.e. it is a pointer on a \c Vector
500 * if the argument is a \c Scalar , and on a \c Tensor otherwise.
501 * NB: The corresponding memory is allocated by the method
502 * \c p_derive_cov() and
503 * must be deallocated by the user afterwards.
504 */
505 virtual Tensor* p_derive_cov(const Tensor& tens) const ;
506
507 /** Computes the divergence of a tensor \f$T\f$
508 * (with respect to the current connection).
509 * The divergence is taken with respect of the last index of \f$T\f$
510 * which thus must be contravariant.
511 * For instance if \f$T\f$ is a twice contravariant tensor, whose
512 * components w.r.t. the
513 * triad \f$e_i\f$ are \f$T^{ij}\f$: \f$T = T^{ij} \; e_i \otimes e_j\f$,
514 * the divergence of \f$T\f$ is the vector
515 * \f[
516 * {\rm div} T = \nabla_k T^{ik} \; e_i
517 * \f]
518 * where \f$\nabla\f$ denotes the current connection.
519 * @param tens tensor \f$T\f$
520 * @return pointer on the divergence of \f$T\f$ ;
521 * this pointer is
522 * polymorphe, i.e. its is a pointer on a \c Scalar
523 * if \f$T\f$ is a \c Vector , on a \c Vector if \f$T\f$ is a tensor
524 * of valence 2, and on a \c Tensor otherwise.
525 * NB: The corresponding memory is allocated by the method
526 * \c p_divergence() and
527 * must be deallocated by the user afterwards.
528 */
529 virtual Tensor* p_divergence(const Tensor& tens) const ;
530
531 };
532
533
534
535 //-------------------------------//
536 // class Connection_fcart //
537 //-------------------------------//
538
539 /**
540 * Class Connection_fcart.\ingroup (tensor)
541 *
542 * Class for connections associated with a flat metric and given onto
543 * an orthonormal Cartesian triad.
544 *
545 */
546 class Connection_fcart : public Connection_flat {
547
548 // Constructors - Destructor
549 // -------------------------
550
551 public:
552
553 /// Contructor from a Cartesian flat-metric-orthonormal basis
554 Connection_fcart(const Map&, const Base_vect_cart&) ;
555
556 Connection_fcart(const Connection_fcart& ) ; ///< Copy constructor
557
558 public:
559
560 virtual ~Connection_fcart() ; ///<destructor
561
562
563 // Mutators / assignment
564 // ---------------------
565 public:
566
567 /// Assignment to another \c Connection_fcart
568 void operator=(const Connection_fcart&) ;
569
570
571 // Computational methods
572 // ---------------------
573
574 public:
575 /** Computes the covariant derivative \f$\nabla T\f$ of a tensor \f$T\f$
576 * (with respect to the current connection).
577 *
578 * The extra index (with respect to the indices of \f$T\f$)
579 * of \f$\nabla T\f$ is chosen to be the \b last one.
580 * This convention agrees with that of MTW (see Eq. (10.17) of MTW).
581 * For instance, if \f$T\f$ is a 1-form, whose components
582 * w.r.t. the triad \f$e^i\f$ are \f$T_i\f$: \f$T=T_i \; e^i\f$,
583 * then the covariant derivative of \f$T\f$ is the bilinear form
584 * \f$\nabla T\f$ whose components \f$\nabla_j T_i\f$ are
585 * such that
586 * \f[
587 * \nabla T = \nabla_j T_i \; e^i \otimes e^j
588 * \f]
589 *
590 * @param tens tensor \f$T\f$
591 * @return pointer on the covariant derivative \f$\nabla T\f$ ;
592 * this pointer is
593 * polymorphe, i.e. it is a pointer on a \c Vector
594 * if the argument is a \c Scalar , and on a \c Tensor otherwise.
595 * NB: The corresponding memory is allocated by the method
596 * \c p_derive_cov() and
597 * must be deallocated by the user afterwards.
598 */
599 virtual Tensor* p_derive_cov(const Tensor& tens) const ;
600
601 /** Computes the divergence of a tensor \f$T\f$
602 * (with respect to the current connection).
603 * The divergence is taken with respect of the last index of \f$T\f$
604 * which thus must be contravariant.
605 * For instance if \f$T\f$ is a twice contravariant tensor, whose
606 * components w.r.t. the
607 * triad \f$e_i\f$ are \f$T^{ij}\f$: \f$T = T^{ij} \; e_i \otimes e_j\f$,
608 * the divergence of \f$T\f$ is the vector
609 * \f[
610 * {\rm div} T = \nabla_k T^{ik} \; e_i
611 * \f]
612 * where \f$\nabla\f$ denotes the current connection.
613 * @param tens tensor \f$T\f$
614 * @return pointer on the divergence of \f$T\f$ ;
615 * this pointer is
616 * polymorphe, i.e. its is a pointer on a \c Scalar
617 * if \f$T\f$ is a \c Vector , on a \c Vector if \f$T\f$ is a tensor
618 * of valence 2, and on a \c Tensor otherwise.
619 * NB: The corresponding memory is allocated by the method
620 * \c p_divergence() and
621 * must be deallocated by the user afterwards.
622 */
623 virtual Tensor* p_divergence(const Tensor& tens) const ;
624
625
626 };
627
628
629
630
631 }
632 #endif