Debian Codegraph @

C++/Include/base_vect.h

raw symbols SCIP
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
100 /**
101 * Vectorial bases (triads) with respect to which the tensorial components are
102 * defined. \ingroup (tensor)
103 *
104 */
105 class Base_vect {
106
107 // Data :
108 // -----
109 protected:
110 char name[100] ; ///< Name of the basis
111
112
113 // Constructors - Destructor
114 // -------------------------
115
116 protected:
117 Base_vect() ; ///< Standard constructor
118
119 /// Standard constructor with name
120 explicit Base_vect(const char* name_i) ;
121
122 Base_vect(const Base_vect& ) ; ///< Copy constructor
123
124 protected:
125 /** Constructor from a file.
126 * This constructor is protected because any \c Base_vect
127 * construction from a file must be done via the function
128 * \c Base_vect::bvect_from_file .
129 */
130 explicit Base_vect(FILE* ) ;
131
132 public:
133 virtual ~Base_vect() ; ///< Destructor
134
135 // Mutator / Assignment
136 // --------------------
137
138 private:
139 /// Assignement operator (not implemented).
140 void operator=(const Base_vect& ) ;
141
142
143 public:
144 /// Sets the basis name
145 void set_name(const char* name_i) ;
146
147
148 // Extraction of information
149 // -------------------------
150 public:
151 const char* get_name() const ; ///< Returns the basis name
152
153 /** Returns a number to identify the sub-classe of \c Base_vect the
154 * object belongs to.
155 */
156 virtual int identify() const = 0 ;
157
158 // Outputs
159 // -------
160 public:
161 virtual void sauve(FILE* ) const ; ///< Save in a file
162
163 /// Display
164 friend ostream& operator<<(ostream& , const Base_vect& ) ;
165
166 protected:
167 virtual ostream& operator>>(ostream &) const = 0 ; ///< Operator >>
168
169 // Miscellaneous
170 // -------------
171
172 public:
173 /** Construction of a vectorial basis from a file
174 * (see \c sauve(FILE* ) ).
175 */
176 static Base_vect* bvect_from_file(FILE* ) ;
177
178 /// Comparison operator (egality)
179 virtual bool operator==(const Base_vect& ) const = 0 ;
180
181 /// Comparison operator (difference)
182 bool operator!=(const Base_vect& ) const ;
183
184 /// Change the basis in which the components of a tensor are expressed
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
197 /**
198 * Cartesian vectorial bases (triads). \ingroup (tensor)
199 *
200 */
201 class Base_vect_cart : public Base_vect {
202
203 // Data :
204 // -----
205 private:
206 /// Angle between the \e x --axis and the absolute frame \e X --axis
207 double rot_phi ;
208
209 /**
210 * Indicator of alignment with respect to the absolute frame: \\
211 * \c align = 1 : basis aligned with the absolute frame
212 * (\f${\tt rot\_phi = 0}\f$) \\
213 * \c align = -1 : basis anti-aligned with the absolute frame
214 * (\f${\tt rot\_phi} = \pi\f$) \\
215 * \c align = 0 : general case
216 */
217 int align ;
218
219 // Constructors - Destructor
220 // -------------------------
221
222 public:
223 explicit Base_vect_cart(double rot_phi_i) ; ///< Standard constructor
224
225 /// Standard constructor with name
226 Base_vect_cart(double rot_phi_i, const char* name_i) ;
227
228 Base_vect_cart(const Base_vect_cart& ) ; ///< Copy constructor
229
230 protected:
231 /** Constructor from a file.
232 * This constructor is protected because any \c Base_vect_cart
233 * construction from a file must be done via the function
234 * \c Base_vect::bvect_from_file .
235 */
236 explicit Base_vect_cart(FILE* ) ;
237
238 /// The construction function from a file
239 friend Base_vect* Base_vect::bvect_from_file(FILE* ) ;
240
241 public:
242 virtual ~Base_vect_cart() ; ///< Destructor
243
244 // Mutators
245 // --------
246
247 public:
248 /// Assignment to another \c Base_vect_cart
249 void operator=(const Base_vect_cart& ) ;
250
251 /** Sets a new value to the angle \c rot_phi
252 * between the \e x --axis and the absolute frame \e X --axis
253 */
254 void set_rot_phi(double rot_phi_i) ;
255
256 private:
257 /// Computes \c align from the value of \c rot_phi
258 void set_align() ;
259
260 // Miscellaneous
261 // -------------
262
263 public:
264 /// Comparison operator (egality)
265 virtual bool operator==(const Base_vect& ) const ;
266
267 /// Change the basis in which the components of a tensor are expressed
268 virtual void change_basis(Tenseur& ) const ;
269
270 /** Returns a number to identify the sub-classe of \c Base_vect the
271 * object belongs to.
272 */
273 virtual int identify() const ;
274
275 /** Returns the
276 * indicator of alignment with respect to the absolute frame.
277 *
278 * @return
279 * 1 : basis aligned with the absolute frame
280 * (\f${\tt rot\_phi = 0}\f$) \\
281 * -1 : basis anti-aligned with the absolute frame
282 * (\f${\tt rot\_phi} = \pi\f$) \\
283 * 0 : general case
284 */
285 int get_align() const {return align;} ;
286
287 // Outputs
288 // -------
289
290 public:
291 virtual void sauve(FILE* ) const ; ///< Save in a file
292
293 protected:
294 virtual ostream& operator>>(ostream &) const ; ///< Operator >>
295
296
297 };
298
299 //-----------------------------------//
300 // class Base_vect_spher //
301 //-----------------------------------//
302
303
304 /**
305 * Spherical orthonormal vectorial bases (triads).\ingroup (tensor)
306 *
307 */
308 class Base_vect_spher : public Base_vect {
309
310 // Data :
311 // -----
312 private:
313 double ori_x ; ///< Absolute coordinate \e X of the origin
314 double ori_y ; ///< Absolute coordinate \e Y of the origin
315 double ori_z ; ///< Absolute coordinate \e Z of the origin
316
317 /// Angle between the \e x --axis and the absolute frame \e X --axis
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) ; ///< Standard constructor
328
329 /// Standard constructor with name
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& ) ; ///< Copy constructor
334
335 protected:
336 /** Constructor from a file.
337 * This constructor is protected because any \c Base_vect_spher
338 * construction from a file must be done via the function
339 * \c Base_vect::bvect_from_file .
340 */
341 explicit Base_vect_spher(FILE* ) ;
342
343 /// The construction function from a file
344 friend Base_vect* Base_vect::bvect_from_file(FILE* ) ;
345
346 public:
347 virtual ~Base_vect_spher() ; ///< Destructor
348
349 // Mutators
350 // --------
351 public:
352 /// Assignment to another \c Base_vect_spher
353 void operator=(const Base_vect_spher& ) ;
354
355 public:
356 /// Sets a new origin
357 void set_ori(double xa0, double ya0, double za0) ;
358
359 /** Sets a new value to the angle \c rot_phi
360 * between the \e x --axis and the absolute frame \e X --axis
361 */
362 void set_rot_phi(double rot_phi_i) ;
363
364 // Miscellaneous
365 // -------------
366
367 public:
368 /// Comparison operator (egality)
369 virtual bool operator==(const Base_vect& ) const ;
370
371 /// Change the basis in which the components of a tensor are expressed
372 virtual void change_basis(Tenseur& ) const ;
373
374 /** Returns a number to identify the sub-classe of \c Base_vect the
375 * object belongs to.
376 */
377 virtual int identify() const ;
378
379 // Outputs
380 // -------
381
382 public:
383 virtual void sauve(FILE* ) const ; ///< Save in a file
384
385 protected:
386 virtual ostream& operator>>(ostream &) const ; ///< Operator >>
387
388
389 };
390
391 }
392 #endif