Debian Codegraph @

C++/Source/Map_cart/map_cart_aff.C

raw
1 /*
2 * Methods of class Map_cart_aff
3 *
4 */
5
6 /*
7 * Copyright (c) 2002 Nicolas Chamel
8 * Copyright (c) 2002 Eric Gourgoulhon
9 *
10 * This file is part of LORENE.
11 *
12 * LORENE is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2
14 * as published by the Free Software Foundation.
15 *
16 * LORENE is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with LORENE; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 *
25 */
26
27 char map_cart_aff_C[] = "$Header: /cvsroot/Lorene/C++/Source/Map_cart/map_cart_aff.C,v 1.2 2002/10/16 14:36:42 j_novak Exp $" ;
28
29 /*
30 * $Id: map_cart_aff.C,v 1.2 2002/10/16 14:36:42 j_novak Exp $
31 * $Log: map_cart_aff.C,v $
32 * Revision 1.2 2002/10/16 14:36:42 j_novak
33 * Reorganization of #include instructions of standard C++, in order to
34 * use experimental version 3 of gcc.
35 *
36 * Revision 1.1 2002/03/15 13:16:23 n_chamel
37 * Mapping between grid coordinates and physical coordinates
38 *
39 *
40 *
41 *
42 * $Header: /cvsroot/Lorene/C++/Source/Map_cart/map_cart_aff.C,v 1.2 2002/10/16 14:36:42 j_novak Exp $
43 *
44 */
45
46 // C headers
47
48 // Lorene headers
49 #include "headcpp.h"
50 #include "map_cart.h"
51 #include "utilitaires.h"
52
53 //-------------------------//
54 // Constructors //
55 //-------------------------//
56
57
58 // Standard constructor
59 // ---------------
60
61 Map_cart_aff::Map_cart_aff(const Grille_cart& grid_i, double alpha1_i, double beta1_i,
62 double alpha2_i, double beta2_i,
63 double alpha3_i, double beta3_i) :
64 Map_cart(grid_i),
65 alpha1(alpha1_i),
66 beta1(beta1_i),
67 alpha2(alpha2_i),
68 beta2(beta2_i),
69 alpha3(alpha3_i),
70 beta3(beta3_i)
71 {}
72
73
74
75 // Copy constructor
76 // ------------
77
78 Map_cart_aff:: Map_cart_aff(const Map_cart_aff& map_i) :
79 Map_cart(map_i),
80 alpha1(map_i.alpha1),
81 beta1(map_i.beta1),
82 alpha2(map_i.alpha2),
83 beta2(map_i.beta2),
84 alpha3(map_i.alpha3),
85 beta3(map_i.beta3)
86 {}
87
88
89 // Constructor from file
90 // ---------------
91
92 Map_cart_aff:: Map_cart_aff(const Grille_cart& grid_i, FILE* fich) : Map_cart(grid_i)
93 {
94
95 fread_be(&alpha1, sizeof(double), 1, fich) ;
96 fread_be(&beta1, sizeof(double), 1, fich) ;
97 fread_be(&alpha2, sizeof(double), 1, fich) ;
98 fread_be(&beta2, sizeof(double), 1, fich) ;
99 fread_be(&alpha3, sizeof(double), 1, fich) ;
100 fread_be(&beta3, sizeof(double), 1, fich) ;
101
102 }
103
104
105
106
107
108 //-------------------------//
109 // Destructors //
110 //-------------------------//
111
112 Map_cart_aff::~Map_cart_aff(){}
113
114
115 //--------------------//
116 // Outputs //
117 //--------------------//
118
119
120
121 // Operateurs >>
122 ostream & Map_cart_aff::operator>>(ostream & ost) const {
123
124 ost << "Affine Cartesian mapping (class Map_cart_aff)" << endl ;
125
126 ost << " alpha1 = " << alpha1 << " beta1 = " << beta1 << endl ;
127 ost << " alpha2 = " << alpha2 << " beta2 = " << beta2 << endl ;
128 ost << " alpha3 = " << alpha3 << " beta3 = " << beta3 << endl ;
129
130 return ost ;
131 }
132
133 // Save in a file
134 void Map_cart_aff::sauve(FILE* fich) const {
135
136 fwrite_be(&alpha1, sizeof(double), 1, fich) ;
137 fwrite_be(&beta1, sizeof(double), 1, fich) ;
138 fwrite_be(&alpha2, sizeof(double), 1, fich) ;
139 fwrite_be(&beta2, sizeof(double), 1, fich) ;
140 fwrite_be(&alpha3, sizeof(double), 1, fich) ;
141 fwrite_be(&beta3, sizeof(double), 1, fich) ;
142
143 }