LORENE
connection.h
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 
113 class Connection {
114 
115  // Data :
116  // -----
117  protected:
118 
119  const Map* const mp ;
120 
124  const Base_vect* const triad ;
125 
142 
148 
149 
150  private:
151 
157 
158 
159  // Derived data :
160  // ------------
161  protected:
162 
164  mutable Tensor* p_ricci ;
165 
166  // Constructors - Destructor
167  // -------------------------
168  public:
169 
188  Connection(const Tensor_sym& delta_i, const Metric_flat& flat_met_i) ;
189 
197  Connection(const Metric& met, const Metric_flat& flat_met_i) ;
198 
199  Connection(const Connection& ) ;
200 
201  protected:
202 
204  Connection(const Map&, const Base_vect& ) ;
205 
206  public:
207  virtual ~Connection() ;
208 
209 
210  // Memory management
211  // -----------------
212  protected:
213 
215  void del_deriv() const ;
216 
218  void set_der_0x0() const ;
219 
220 
221  // Mutators / assignment
222  // ---------------------
223  public:
224 
226  void operator=(const Connection&) ;
227 
239  void update(const Tensor_sym& delta_i) ;
240 
246  void update(const Metric& met) ;
247 
248 
249  // Accessors
250  // ---------
251  public:
253  const Map& get_mp() const {return *mp; } ;
254 
255 
271  const Tensor_sym& get_delta() const {return delta; } ;
272 
273  // Computational methods
274  // ---------------------
275 
276  public:
277 
302  virtual Tensor* p_derive_cov(const Tensor& tens) const ;
303 
326  virtual Tensor* p_divergence(const Tensor& tens) const ;
327 
331  virtual const Tensor& ricci() const ;
332 
333  private:
339  void fait_delta(const Metric& ) ;
340 
341 };
342 
343 
344  //-------------------------------//
345  // class Connection_flat //
346  //-------------------------------//
347 
354 class Connection_flat : public Connection {
355 
356  // Constructors - Destructor
357  // -------------------------
358  protected:
359 
361  Connection_flat(const Map&, const Base_vect&) ;
362 
363  public:
364 
365  Connection_flat(const Connection_flat & ) ;
366 
367  virtual ~Connection_flat() ;
368 
369 
370  // Mutators / assignment
371  // ---------------------
372  public:
373 
375  void operator=(const Connection_flat&) ;
376 
377 
378  // Computational methods
379  // ---------------------
380 
381  public:
382 
407  virtual Tensor* p_derive_cov(const Tensor& tens) const = 0 ;
408 
431  virtual Tensor* p_divergence(const Tensor& tens) const = 0 ;
432 
436  virtual const Tensor& ricci() const ;
437 
438 };
439 
440 
441  //-------------------------------//
442  // class Connection_fspher //
443  //-------------------------------//
444 
453 
454  // Constructors - Destructor
455  // -------------------------
456 
457  public:
458 
460  Connection_fspher(const Map&, const Base_vect_spher&) ;
461 
463 
464  public:
465 
466  virtual ~Connection_fspher() ;
467 
468 
469  // Mutators / assignment
470  // ---------------------
471  public:
472 
474  void operator=(const Connection_fspher&) ;
475 
476 
477  // Computational methods
478  // ---------------------
479 
480  public:
505  virtual Tensor* p_derive_cov(const Tensor& tens) const ;
506 
529  virtual Tensor* p_divergence(const Tensor& tens) const ;
530 
531 };
532 
533 
534 
535  //-------------------------------//
536  // class Connection_fcart //
537  //-------------------------------//
538 
547 
548  // Constructors - Destructor
549  // -------------------------
550 
551  public:
552 
554  Connection_fcart(const Map&, const Base_vect_cart&) ;
555 
557 
558  public:
559 
560  virtual ~Connection_fcart() ;
561 
562 
563  // Mutators / assignment
564  // ---------------------
565  public:
566 
568  void operator=(const Connection_fcart&) ;
569 
570 
571  // Computational methods
572  // ---------------------
573 
574  public:
599  virtual Tensor* p_derive_cov(const Tensor& tens) const ;
600 
623  virtual Tensor* p_divergence(const Tensor& tens) const ;
624 
625 
626 };
627 
628 
629 
630 
631 }
632 #endif
Connection_fspher(const Map &, const Base_vect_spher &)
Contructor from a spherical flat-metric-orthonormal basis.
Metric for tensor calculation.
Definition: metric.h:90
virtual Tensor * p_divergence(const Tensor &tens) const
Computes the divergence of a tensor (with respect to the current connection).
virtual const Tensor & ricci() const
Computes (if not up to date) and returns the Ricci tensor associated with the current connection...
Definition: connection.C:665
void set_der_0x0() const
Sets to 0x0 all the pointers on derived quantities.
Definition: connection.C:216
const Map *const mp
Reference mapping.
Definition: connection.h:119
Class Connection_flat.
Definition: connection.h:354
bool assoc_metric
Indicates whether the connection is associated with a metric (in which case the Ricci tensor is symme...
Definition: connection.h:147
Lorene prototypes.
Definition: app_hor.h:67
virtual Tensor * p_divergence(const Tensor &tens) const
Computes the divergence of a tensor (with respect to the current connection).
void operator=(const Connection &)
Assignment to another Connection.
Definition: connection.C:228
virtual Tensor * p_derive_cov(const Tensor &tens) const
Computes the covariant derivative of a tensor (with respect to the current connection).
Flat metric for tensor calculation.
Definition: metric.h:261
Base class for coordinate mappings.
Definition: map.h:682
virtual Tensor * p_derive_cov(const Tensor &tens) const
Computes the covariant derivative of a tensor (with respect to the current connection).
Definition: connection.C:310
Tensor_sym delta
Tensor which defines the connection with respect to the flat one: is the difference between the con...
Definition: connection.h:141
Vectorial bases (triads) with respect to which the tensorial components are defined.
Definition: base_vect.h:105
virtual ~Connection_flat()
destructor
const Tensor_sym & get_delta() const
Returns the tensor which defines the connection with respect to the flat one: is the difference bet...
Definition: connection.h:271
const Metric_flat * flat_met
Flat metric with respect to which (member delta ) is defined.
Definition: connection.h:156
void operator=(const Connection_flat &)
Assignment to another Connection_flat.
void del_deriv() const
Deletes all the derived quantities.
Definition: connection.C:208
Class Connection.
Definition: connection.h:113
void update(const Tensor_sym &delta_i)
Update the connection when it is defined ab initio.
Definition: connection.C:238
Connection(const Tensor_sym &delta_i, const Metric_flat &flat_met_i)
Standard constructor ab initio.
Definition: connection.C:132
virtual Tensor * p_divergence(const Tensor &tens) const =0
Computes the divergence of a tensor (with respect to the current connection).
Class Connection_fcart.
Definition: connection.h:546
virtual ~Connection_fspher()
destructor
void operator=(const Connection_fcart &)
Assignment to another Connection_fcart.
virtual ~Connection()
Destructor.
Definition: connection.C:198
Connection_flat(const Map &, const Base_vect &)
Contructor from a triad, has to be defined in the derived classes.
void operator=(const Connection_fspher &)
Assignment to another Connection_fspher.
Tensor handling.
Definition: tensor.h:294
Cartesian vectorial bases (triads).
Definition: base_vect.h:201
Spherical orthonormal vectorial bases (triads).
Definition: base_vect.h:308
void fait_delta(const Metric &)
Computes the difference between the connection coefficients and that a the flat connection in the ca...
Definition: connection.C:281
Connection_fcart(const Map &, const Base_vect_cart &)
Contructor from a Cartesian flat-metric-orthonormal basis.
virtual Tensor * p_derive_cov(const Tensor &tens) const =0
Computes the covariant derivative of a tensor (with respect to the current connection).
Class Connection_fspher.
Definition: connection.h:452
Symmetric tensors (with respect to two of their arguments).
Definition: tensor.h:1050
Tensor * p_ricci
Pointer of the Ricci tensor associated with the connection.
Definition: connection.h:164
virtual Tensor * p_derive_cov(const Tensor &tens) const
Computes the covariant derivative of a tensor (with respect to the current connection).
const Map & get_mp() const
Returns the mapping.
Definition: connection.h:253
const Base_vect *const triad
Triad with respect to which the connection coefficients are defined.
Definition: connection.h:124
virtual const Tensor & ricci() const
Computes (if not up to date) and returns the Ricci tensor associated with the current connection...
virtual ~Connection_fcart()
destructor
virtual Tensor * p_divergence(const Tensor &tens) const
Computes the divergence of a tensor (with respect to the current connection).
Definition: connection.C:466