LORENE
base_vect.h
1 /*
2  * Definition of Lorene classes Base_vect
3  * Base_vect_cart
4  * Base_vect_spher
5  *
6  */
7 
8 /*
9  * Copyright (c) 2000-2001 Eric Gourgoulhon
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 as published by
15  * the Free Software Foundation; either version 2 of the License, or
16  * (at your option) any later version.
17  *
18  * LORENE is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with LORENE; if not, write to the Free Software
25  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26  *
27  */
28 
29 
30 #ifndef __BASE_VECT_H_
31 #define __BASE_VECT_H_
32 
33 
34 /*
35  * $Id: base_vect.h,v 1.7 2014/10/13 08:52:31 j_novak Exp $
36  * $Log: base_vect.h,v $
37  * Revision 1.7 2014/10/13 08:52:31 j_novak
38  * Lorene classes and functions now belong to the namespace Lorene.
39  *
40  * Revision 1.6 2014/10/06 15:09:39 j_novak
41  * Modified #include directives to use c++ syntax.
42  *
43  * Revision 1.5 2004/03/22 13:12:40 j_novak
44  * Modification of comments to use doxygen instead of doc++
45  *
46  * Revision 1.4 2002/10/16 14:36:28 j_novak
47  * Reorganization of #include instructions of standard C++, in order to
48  * use experimental version 3 of gcc.
49  *
50  * Revision 1.3 2002/09/13 09:17:31 j_novak
51  * Modif. commentaires
52  *
53  * Revision 1.2 2002/06/17 14:05:16 j_novak
54  * friend functions are now also declared outside the class definition
55  *
56  * Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon
57  * LORENE
58  *
59  * Revision 2.6 2000/02/28 15:42:15 eric
60  * Ajout de la fonction Base_vect_cart::get_align().
61  *
62  * Revision 2.5 2000/02/09 14:45:40 eric
63  * *** empty log message ***
64  *
65  * Revision 2.4 2000/02/09 13:22:50 eric
66  * REFONTE COMPLETE DE LA CLASSE
67  * L'identification n'est plus base sur un membre statique (numero
68  * d'instance) mais sur les caracteres physiques (rot_phi, etc...)
69  * Ajout des constructeurs par copie et lecture de fichier.
70  *
71  * Revision 2.3 2000/01/12 16:27:13 eric
72  * Les constructeurs a un seul argument sont declares explicit.
73  *
74  * Revision 2.2 2000/01/10 13:34:52 eric
75  * Modif commentairez.
76  *
77  * Revision 2.1 2000/01/10 13:26:49 eric
78  * Ajout de la fonction set_rot_phi.
79  *
80  * Revision 2.0 2000/01/10 12:43:15 eric
81  * *** empty log message ***
82  *
83  *
84  * $Header: /cvsroot/Lorene/C++/Include/base_vect.h,v 1.7 2014/10/13 08:52:31 j_novak Exp $
85  *
86  */
87 
88 // Headers C
89 #include <cstdio>
90 #include "headcpp.h"
91 
92 // Lorene classes
93 namespace Lorene {
94 class Tenseur ;
95 
96  //-----------------------------------//
97  // class Base_vect (base class) //
98  //-----------------------------------//
99 
105 class Base_vect {
106 
107  // Data :
108  // -----
109  protected:
110  char name[100] ;
111 
112 
113  // Constructors - Destructor
114  // -------------------------
115 
116  protected:
117  Base_vect() ;
118 
120  explicit Base_vect(const char* name_i) ;
121 
122  Base_vect(const Base_vect& ) ;
123 
124  protected:
130  explicit Base_vect(FILE* ) ;
131 
132  public:
133  virtual ~Base_vect() ;
134 
135  // Mutator / Assignment
136  // --------------------
137 
138  private:
140  void operator=(const Base_vect& ) ;
141 
142 
143  public:
145  void set_name(const char* name_i) ;
146 
147 
148  // Extraction of information
149  // -------------------------
150  public:
151  const char* get_name() const ;
152 
156  virtual int identify() const = 0 ;
157 
158  // Outputs
159  // -------
160  public:
161  virtual void sauve(FILE* ) const ;
162 
164  friend ostream& operator<<(ostream& , const Base_vect& ) ;
165 
166  protected:
167  virtual ostream& operator>>(ostream &) const = 0 ;
168 
169  // Miscellaneous
170  // -------------
171 
172  public:
176  static Base_vect* bvect_from_file(FILE* ) ;
177 
179  virtual bool operator==(const Base_vect& ) const = 0 ;
180 
182  bool operator!=(const Base_vect& ) const ;
183 
185  virtual void change_basis(Tenseur& ) const = 0 ;
186 
187 };
188 
189 ostream& operator<<(ostream& , const Base_vect& ) ;
190 
191 
192  //-----------------------------------//
193  // class Base_vect_cart //
194  //-----------------------------------//
195 
196 
201 class Base_vect_cart : public Base_vect {
202 
203  // Data :
204  // -----
205  private:
207  double rot_phi ;
208 
217  int align ;
218 
219  // Constructors - Destructor
220  // -------------------------
221 
222  public:
223  explicit Base_vect_cart(double rot_phi_i) ;
224 
226  Base_vect_cart(double rot_phi_i, const char* name_i) ;
227 
228  Base_vect_cart(const Base_vect_cart& ) ;
229 
230  protected:
236  explicit Base_vect_cart(FILE* ) ;
237 
239  friend Base_vect* Base_vect::bvect_from_file(FILE* ) ;
240 
241  public:
242  virtual ~Base_vect_cart() ;
243 
244  // Mutators
245  // --------
246 
247  public:
249  void operator=(const Base_vect_cart& ) ;
250 
254  void set_rot_phi(double rot_phi_i) ;
255 
256  private:
258  void set_align() ;
259 
260  // Miscellaneous
261  // -------------
262 
263  public:
265  virtual bool operator==(const Base_vect& ) const ;
266 
268  virtual void change_basis(Tenseur& ) const ;
269 
273  virtual int identify() const ;
274 
285  int get_align() const {return align;} ;
286 
287  // Outputs
288  // -------
289 
290  public:
291  virtual void sauve(FILE* ) const ;
292 
293  protected:
294  virtual ostream& operator>>(ostream &) const ;
295 
296 
297 };
298 
299  //-----------------------------------//
300  // class Base_vect_spher //
301  //-----------------------------------//
302 
303 
308 class Base_vect_spher : public Base_vect {
309 
310  // Data :
311  // -----
312  private:
313  double ori_x ;
314  double ori_y ;
315  double ori_z ;
316 
318  double rot_phi ;
319 
320 
321 
322  // Constructors - Destructor
323  // -------------------------
324 
325  public:
326  Base_vect_spher(double xa0, double ya0, double za0,
327  double rot_phi_i) ;
328 
330  Base_vect_spher(double xa0, double ya0, double za0,
331  double rot_phi_i, const char* name_i) ;
332 
333  Base_vect_spher(const Base_vect_spher& ) ;
334 
335  protected:
341  explicit Base_vect_spher(FILE* ) ;
342 
344  friend Base_vect* Base_vect::bvect_from_file(FILE* ) ;
345 
346  public:
347  virtual ~Base_vect_spher() ;
348 
349  // Mutators
350  // --------
351  public:
353  void operator=(const Base_vect_spher& ) ;
354 
355  public:
357  void set_ori(double xa0, double ya0, double za0) ;
358 
362  void set_rot_phi(double rot_phi_i) ;
363 
364  // Miscellaneous
365  // -------------
366 
367  public:
369  virtual bool operator==(const Base_vect& ) const ;
370 
372  virtual void change_basis(Tenseur& ) const ;
373 
377  virtual int identify() const ;
378 
379  // Outputs
380  // -------
381 
382  public:
383  virtual void sauve(FILE* ) const ;
384 
385  protected:
386  virtual ostream& operator>>(ostream &) const ;
387 
388 
389 };
390 
391 }
392 #endif
double rot_phi
Angle between the x –axis and the absolute frame X –axis.
Definition: base_vect.h:207
double ori_y
Absolute coordinate Y of the origin.
Definition: base_vect.h:314
void set_ori(double xa0, double ya0, double za0)
Sets a new origin.
void operator=(const Base_vect_spher &)
Assignment to another Base_vect_spher.
int get_align() const
Returns the indicator of alignment with respect to the absolute frame.
Definition: base_vect.h:285
virtual ~Base_vect_cart()
Destructor.
Base_vect_spher(double xa0, double ya0, double za0, double rot_phi_i)
Standard constructor.
virtual ~Base_vect()
Destructor.
Definition: base_vect.C:126
void set_rot_phi(double rot_phi_i)
Sets a new value to the angle rot_phi between the x –axis and the absolute frame X –axis...
double rot_phi
Angle between the x –axis and the absolute frame X –axis.
Definition: base_vect.h:318
Lorene prototypes.
Definition: app_hor.h:67
bool operator!=(const Base_vect &) const
Comparison operator (difference)
Definition: base_vect.C:177
int align
Indicator of alignment with respect to the absolute frame: \ align = 1 : basis aligned with the absol...
Definition: base_vect.h:217
virtual void sauve(FILE *) const
Save in a file.
Definition: base_vect.C:153
void set_rot_phi(double rot_phi_i)
Sets a new value to the angle rot_phi between the x –axis and the absolute frame X –axis...
Vectorial bases (triads) with respect to which the tensorial components are defined.
Definition: base_vect.h:105
virtual void change_basis(Tenseur &) const =0
Change the basis in which the components of a tensor are expressed.
static Base_vect * bvect_from_file(FILE *)
Construction of a vectorial basis from a file (see sauve(FILE* ) ).
const char * get_name() const
Returns the basis name.
Definition: base_vect.C:143
void operator=(const Base_vect &)
Assignement operator (not implemented).
virtual void change_basis(Tenseur &) const
Change the basis in which the components of a tensor are expressed.
friend ostream & operator<<(ostream &, const Base_vect &)
Display.
Definition: base_vect.C:165
virtual bool operator==(const Base_vect &) const
Comparison operator (egality)
virtual ostream & operator>>(ostream &) const =0
Operator >>
virtual void sauve(FILE *) const
Save in a file.
virtual ostream & operator>>(ostream &) const
Operator >>
virtual int identify() const =0
Returns a number to identify the sub-classe of Base_vect the object belongs to.
Base_vect()
Standard constructor.
Definition: base_vect.C:90
virtual void sauve(FILE *) const
Save in a file.
virtual bool operator==(const Base_vect &) const
Comparison operator (egality)
char name[100]
Name of the basis.
Definition: base_vect.h:110
virtual bool operator==(const Base_vect &) const =0
Comparison operator (egality)
virtual int identify() const
Returns a number to identify the sub-classe of Base_vect the object belongs to.
Cartesian vectorial bases (triads).
Definition: base_vect.h:201
Spherical orthonormal vectorial bases (triads).
Definition: base_vect.h:308
Base_vect_cart(double rot_phi_i)
Standard constructor.
virtual ~Base_vect_spher()
Destructor.
virtual ostream & operator>>(ostream &) const
Operator >>
double ori_z
Absolute coordinate Z of the origin.
Definition: base_vect.h:315
double ori_x
Absolute coordinate X of the origin.
Definition: base_vect.h:313
virtual void change_basis(Tenseur &) const
Change the basis in which the components of a tensor are expressed.
void set_name(const char *name_i)
Sets the basis name.
Definition: base_vect.C:137
Tensor handling *** DEPRECATED : use class Tensor instead ***.
Definition: tenseur.h:304
virtual int identify() const
Returns a number to identify the sub-classe of Base_vect the object belongs to.
void set_align()
Computes align from the value of rot_phi.
void operator=(const Base_vect_cart &)
Assignment to another Base_vect_cart.