LORENE
metric.h
1  /*
2  * Definition of Lorene class Metric
3  *
4  */
5 
6 /*
7  * Copyright (c) 2003 Eric Gourgoulhon & Jerome Novak
8  *
9  * Copyright (c) 1999-2001 Philippe Grandclement (for previous class Metrique)
10  *
11  * This file is part of LORENE.
12  *
13  * LORENE is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License version 2
15  * as published by the Free Software Foundation.
16  *
17  * LORENE is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with LORENE; if not, write to the Free Software
24  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25  *
26  */
27 
28 #ifndef __METRIC_H_
29 #define __METRIC_H_
30 
31 /*
32  * $Id: metric.h,v 1.9 2014/10/13 08:52:35 j_novak Exp $
33  * $Log: metric.h,v $
34  * Revision 1.9 2014/10/13 08:52:35 j_novak
35  * Lorene classes and functions now belong to the namespace Lorene.
36  *
37  * Revision 1.8 2004/11/18 12:23:42 jl_jaramillo
38  * radial vector normal to a spherical slicing and pointing towards
39  * spatial infinity
40  *
41  * Revision 1.7 2004/03/22 13:12:42 j_novak
42  * Modification of comments to use doxygen instead of doc++
43  *
44  * Revision 1.6 2003/12/30 23:04:58 e_gourgoulhon
45  * Important reorganization of class Metric:
46  * -- suppression of virtual methods fait_* : the actual computations
47  * are now performed via the virtual methods con(), cov(), connect(),
48  * ricci(), ricci_scal(), determinant()
49  * -- the member p_connect is now treated as an ordinary derived data
50  * member
51  * -- the construction of the associated connection (member p_connect)
52  * is performed thanks to the new methods Map::flat_met_spher() and
53  * Map::flat_met_cart().
54  *
55  * Revision 1.5 2003/11/06 14:43:37 e_gourgoulhon
56  * Gave a name to const arguments in certain method prototypes (e.g.
57  * constructors) to correct a bug of DOC++.
58  *
59  * Revision 1.4 2003/10/06 15:30:32 j_novak
60  * Defined methods for flat metric.
61  *
62  * Revision 1.3 2003/10/06 13:58:45 j_novak
63  * The memory management has been improved.
64  * Implementation of the covariant derivative with respect to the exact Tensor
65  * type.
66  *
67  * Revision 1.2 2003/10/03 11:21:45 j_novak
68  * More methods for the class Metric
69  *
70  * Revision 1.1 2003/10/02 15:45:48 j_novak
71  * New class Metric
72  *
73  *
74  *
75  *
76  * $Header: /cvsroot/Lorene/C++/Include/metric.h,v 1.9 2014/10/13 08:52:35 j_novak Exp $
77  *
78  */
79 
80 // Lorene headers
81 #include "connection.h"
82 
83 #define N_TENSOR_DEPEND 200
84 
85 namespace Lorene {
90 class Metric {
91 
92  // Data :
93  // -----
94  protected:
95  const Map* const mp ;
96 
101 
106 
107 
108  // Derived data :
109  // ------------
110  protected:
111 
112  mutable Connection* p_connect ;
113 
119  mutable Scalar* p_ricci_scal ;
120 
126 
127 
128 
133 
139  mutable const Tensor* tensor_depend[N_TENSOR_DEPEND] ;
140 
141  // Constructors - Destructor
142  // -------------------------
143  public:
149  explicit Metric(const Sym_tensor& tens) ;
150 
151  Metric(const Metric& met) ;
152 
154  Metric(const Map&, FILE* ) ;
155 
156  protected:
158  explicit Metric(const Map& mpi) ;
159 
160  public:
161  virtual ~Metric() ;
162 
163 
164  // Memory management
165  // -----------------
166  protected:
168  void del_deriv() const ;
169 
171  void set_der_0x0() const ;
172 
178  void del_tensor_depend() const ;
179 
181  void set_tensor_depend_0x0() const ;
182 
183 
184  // Mutators / assignment
185  // ---------------------
186  public:
188  void operator=(const Metric& met) ;
189 
196  virtual void operator=(const Sym_tensor& tens) ;
197 
198  // Accessors
199  // ---------
200  public:
202  const Map& get_mp() const {return *mp ; } ;
203 
205  virtual const Sym_tensor& cov() const ;
206 
208  virtual const Sym_tensor& con() const ;
209 
211  virtual const Connection& connect() const ;
212 
216  const Sym_tensor& ricci() const ;
217 
219  virtual const Scalar& ricci_scal() const ;
220 
225  virtual const Vector& radial_vect() const ;
226 
227 
234  virtual const Scalar& determinant() const ;
235 
236 
237 
238 
239 
240  // Outputs
241  // -------
242  public:
243  virtual void sauve(FILE *) const ;
244 
246  friend ostream& operator<<(ostream& , const Metric& ) ;
247 
248  protected:
250  virtual ostream& operator>>(ostream& ) const ;
251 
252 
253  friend class Tensor ;
254 
255 };
256 
261 class Metric_flat: public Metric {
262 
263  // Data :
264  // -----
265  protected:
266 
270  const Base_vect* triad ;
271 
272  // Constructors - Destructor
273  // -------------------------
274  public:
279  Metric_flat(const Map&, const Base_vect& ) ;
280 
281  Metric_flat(const Metric_flat& ) ;
282 
284  Metric_flat(const Map&, FILE* ) ;
285 
286  public:
287  virtual ~Metric_flat() ;
288 
289 
290  // Mutators / assignment
291  // ---------------------
292  public:
294  void operator=(const Metric_flat&) ;
295 
300  virtual void operator=(const Sym_tensor& tens) ;
301 
302 
303  // Accessors
304  // ---------
305  public:
309  const Base_vect* get_triad() const {return triad;} ;
310 
312  virtual const Sym_tensor& cov() const ;
313 
315  virtual const Sym_tensor& con() const ;
316 
318  virtual const Connection& connect() const ;
319 
321  virtual const Scalar& ricci_scal() const ;
322 
329  virtual const Scalar& determinant() const ;
330 
331 
332  // Outputs
333  // -------
334  public:
335  virtual void sauve(FILE *) const ;
336 
337  protected:
339  virtual ostream& operator>>(ostream& ) const ;
340 
341 
342 };
343 
344 
345 
346 }
347 #endif
Metric for tensor calculation.
Definition: metric.h:90
virtual const Sym_tensor & con() const
Read-only access to the contravariant representation.
Definition: metric.C:293
void set_der_0x0() const
Sets to 0x0 all the pointers on derived quantities.
Definition: metric.C:191
virtual const Scalar & determinant() const
Returns the determinant.
Definition: metric_flat.C:217
const Map *const mp
Reference mapping.
Definition: metric.h:95
Scalar * p_determinant
Pointer on the determinant.
Definition: metric.h:132
Lorene prototypes.
Definition: app_hor.h:67
Flat metric for tensor calculation.
Definition: metric.h:261
Tensor field of valence 0 (or component of a tensorial field).
Definition: scalar.h:393
Base class for coordinate mappings.
Definition: map.h:688
const Base_vect * get_triad() const
Returns the vectorial basis (triad) on which the metric is defined.
Definition: metric.h:309
virtual const Vector & radial_vect() const
Returns the radial vector normal to a spherical slicing and pointing toward spatial infinity...
Definition: metric.C:365
void set_tensor_depend_0x0() const
Sets all elements of tensor_depend to 0x0.
Definition: metric.C:211
const Sym_tensor & ricci() const
Returns the Ricci tensor (given by the Connection p_connect )
Definition: metric.C:341
void del_tensor_depend() const
Deletes all the derivative members of the Tensor contained in tensor_depend .
Definition: metric.C:200
virtual ostream & operator>>(ostream &) const
Operator >> (virtual function called by the operator <<).
Definition: metric_flat.C:244
void operator=(const Metric &met)
Assignment to another Metric.
Definition: metric.C:223
Tensor field of valence 1.
Definition: vector.h:188
friend ostream & operator<<(ostream &, const Metric &)
Display.
Definition: metric.C:442
Vectorial bases (triads) with respect to which the tensorial components are defined.
Definition: base_vect.h:105
const Map & get_mp() const
Returns the mapping.
Definition: metric.h:202
Vector * p_radial_vect
Pointer to the radial vector normal to a spherical slicing and pointing toward spatial infinity...
Definition: metric.h:125
Sym_tensor * p_met_con
Pointer on the covariant representation.
Definition: metric.h:105
virtual void sauve(FILE *) const
Save in a file.
Definition: metric.C:417
virtual void sauve(FILE *) const
Save in a file.
Definition: metric_flat.C:234
virtual const Sym_tensor & con() const
Read-only access to the contravariant representation.
Definition: metric_flat.C:156
Connection * p_connect
Connection associated with the metric.
Definition: metric.h:112
virtual const Connection & connect() const
Returns the connection.
Definition: metric_flat.C:178
virtual const Scalar & ricci_scal() const
Returns the Ricci scalar.
Definition: metric.C:353
Class Connection.
Definition: connection.h:113
virtual const Connection & connect() const
Returns the connection.
Definition: metric.C:304
Metric_flat(const Map &, const Base_vect &)
Standard constructor.
Definition: metric_flat.C:79
virtual ~Metric_flat()
Destructor.
Definition: metric_flat.C:106
Tensor handling.
Definition: tensor.h:294
virtual const Scalar & determinant() const
Returns the determinant.
Definition: metric.C:395
virtual const Sym_tensor & cov() const
Read-only access to the covariant representation.
Definition: metric.C:283
virtual const Sym_tensor & cov() const
Read-only access to the covariant representation.
Definition: metric_flat.C:137
const Base_vect * triad
Vectorial basis (triad) with respect to which the components of the flat metric are defined...
Definition: metric.h:270
const Tensor * tensor_depend[N_TENSOR_DEPEND]
Pointer on the dependancies, that means the array contains pointers on all the Tensor whom derivative...
Definition: metric.h:139
virtual ostream & operator>>(ostream &) const
Operator >> (virtual function called by the operator <<).
Definition: metric.C:449
Scalar * p_ricci_scal
Pointer on the Ricci scalar.
Definition: metric.h:119
Metric(const Sym_tensor &tens)
Standard constructor from a Sym_tensor .
Definition: metric.C:107
void del_deriv() const
Deletes all the derived quantities.
Definition: metric.C:179
virtual const Scalar & ricci_scal() const
Returns the Ricci scalar.
Definition: metric_flat.C:204
Sym_tensor * p_met_cov
Pointer on the contravariant representation.
Definition: metric.h:100
Class intended to describe valence-2 symmetric tensors.
Definition: sym_tensor.h:226
virtual ~Metric()
Destructor.
Definition: metric.C:163
void operator=(const Metric_flat &)
Assignment to another Metric_flat.
Definition: metric_flat.C:115