LORENE
base_vect.C
1
/*
2
* Methods of class Base_vect
3
*
4
* (see file bse_vect.h for documentation)
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
char
base_vect_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Base_vect/base_vect.C,v 1.5 2014/10/13 08:52:39 j_novak Exp $"
;
31
32
/*
33
* $Id: base_vect.C,v 1.5 2014/10/13 08:52:39 j_novak Exp $
34
* $Log: base_vect.C,v $
35
* Revision 1.5 2014/10/13 08:52:39 j_novak
36
* Lorene classes and functions now belong to the namespace Lorene.
37
*
38
* Revision 1.4 2014/10/06 15:12:57 j_novak
39
* Modified #include directives to use c++ syntax.
40
*
41
* Revision 1.3 2002/10/16 14:36:31 j_novak
42
* Reorganization of #include instructions of standard C++, in order to
43
* use experimental version 3 of gcc.
44
*
45
* Revision 1.2 2001/12/04 21:27:52 e_gourgoulhon
46
*
47
* All writing/reading to a binary file are now performed according to
48
* the big endian convention, whatever the system is big endian or
49
* small endian, thanks to the functions fwrite_be and fread_be
50
*
51
* Revision 1.1.1.1 2001/11/20 15:19:28 e_gourgoulhon
52
* LORENE
53
*
54
* Revision 2.2 2000/02/09 13:24:12 eric
55
* REFONTE COMPLETE DE LA CLASSE
56
* L'identification n'est plus base sur un membre statique (numero
57
* d'instance) mais sur les caracteres physiques (rot_phi, etc...)
58
* Ajout des constructeurs par copie et lecture de fichier.
59
*
60
* Revision 2.1 2000/01/10 15:43:11 eric
61
* Methode change_basis (bidon).
62
*
63
* Revision 2.0 2000/01/10 12:43:21 eric
64
* *** empty log message ***
65
*
66
*
67
* $Header: /cvsroot/Lorene/C++/Source/Base_vect/base_vect.C,v 1.5 2014/10/13 08:52:39 j_novak Exp $
68
*
69
*/
70
71
// Headers C
72
#include <cstdlib>
73
#include <cstring>
74
75
// Headers Lorene
76
#include "headcpp.h"
77
#include "base_vect.h"
78
#include "utilitaires.h"
79
80
//--------------//
81
// Constructors //
82
//--------------//
83
84
// Standard constructor without name
85
// ---------------------------------
86
namespace
Lorene
{
87
Base_vect::Base_vect
(){
88
89
set_name
(
""
) ;
90
91
}
92
93
// Standard constructor with name
94
// ------------------------------
95
Base_vect::Base_vect
(
const
char
* name_i){
96
97
set_name
(name_i) ;
98
99
}
100
101
102
// Copy constructor
103
// ----------------
104
Base_vect::Base_vect
(
const
Base_vect
& bvect_i){
105
106
set_name
(bvect_i.
name
) ;
107
108
}
109
110
// Constructor from file
111
// ---------------------
112
Base_vect::Base_vect
(FILE* fich){
113
114
fread(
name
,
sizeof
(
char
), 100, fich) ;
115
116
}
117
118
119
//--------------//
120
// Destructor //
121
//--------------//
122
123
Base_vect::~Base_vect
(){
124
125
// does nothing
126
127
}
128
129
//-------------------------//
130
// Manipulation of name //
131
//-------------------------//
132
133
134
void
Base_vect::set_name
(
const
char
* name_i) {
135
136
strncpy(
name
, name_i, 100) ;
137
138
}
139
140
const
char
*
Base_vect::get_name
()
const
{
141
142
return
name
;
143
144
}
145
146
//------------//
147
// Outputs //
148
//------------//
149
150
void
Base_vect::sauve
(FILE* fich)
const
{
151
152
int
ident =
identify
() ;
153
fwrite_be
(&ident,
sizeof
(
int
), 1, fich) ;
154
155
fwrite(
name
,
sizeof
(
char
), 100, fich) ;
156
157
}
158
159
160
161
162
ostream& operator<<(ostream& ost,
const
Base_vect
& bvect) {
163
ost << bvect.
get_name
() << endl ;
164
bvect >> ost ;
165
return
ost ;
166
}
167
168
169
170
//----------------------//
171
// Comparison operator //
172
//----------------------//
173
174
bool
Base_vect::operator!=
(
const
Base_vect
& bi)
const
{
175
176
return
!(bi == *
this
) ;
177
178
}
179
180
}
Lorene::Base_vect::operator!=
bool operator!=(const Base_vect &) const
Comparison operator (difference)
Definition:
base_vect.C:174
Lorene::Base_vect::~Base_vect
virtual ~Base_vect()
Destructor.
Definition:
base_vect.C:123
Lorene::Base_vect::set_name
void set_name(const char *name_i)
Sets the basis name.
Definition:
base_vect.C:134
Lorene
Lorene prototypes.
Definition:
app_hor.h:64
Lorene::Base_vect::identify
virtual int identify() const =0
Returns a number to identify the sub-classe of Base_vect the object belongs to.
Lorene::Base_vect::sauve
virtual void sauve(FILE *) const
Save in a file.
Definition:
base_vect.C:150
Lorene::Base_vect::name
char name[100]
Name of the basis.
Definition:
base_vect.h:110
Lorene::fwrite_be
int fwrite_be(const int *aa, int size, int nb, FILE *fich)
Writes integer(s) into a binary file according to the big endian convention.
Definition:
fwrite_be.C:70
Lorene::Base_vect::Base_vect
Base_vect()
Standard constructor.
Definition:
base_vect.C:87
Lorene::Base_vect::get_name
const char * get_name() const
Returns the basis name.
Definition:
base_vect.C:140
Lorene::Base_vect
Vectorial bases (triads) with respect to which the tensorial components are defined.
Definition:
base_vect.h:105
C++
Source
Base_vect
base_vect.C
Generated by
1.8.17