Debian Codegraph @

School05/Thursday/Sol_one_grid/monopole.C

raw
1 #include "map.h"
2 #include "scalar.h"
3 #include "monopole.h"
4 #include "utilitaires.h"
5
6 // Standard constructor :
7 Monopole::Monopole (const Map_af& mpi, double bet) : mp(mpi), radius (mp), beta(bet),
8 big_W (mp), small_w (mp), big_H (mp), small_h(mp) {
9
10 radius.set_etat_qcq() ;
11 radius = mp.r ;
12 nz = mp.get_mg()->get_nzone() ;
13 }
14
15
16 // Constructor by copy
17 Monopole::Monopole (const Monopole& so) : mp(so.mp), radius(so.radius), nz(so.nz),
18 beta (so.beta), big_W (so.big_W),small_w (so.small_w),
19 big_H(so.big_H), small_h(so.small_h) {}
20
21 // Constructor from a file :
22 Monopole::Monopole (const Map_af& mpi, FILE* fiche) :
23 mp(mpi), radius(mp), big_W (mp), small_w(mp), big_H (mp), small_h(mp) {
24
25 nz = mp.get_mg()->get_nzone() ;
26 fread_be (&beta, sizeof(double), 1, fiche) ;
27
28 radius.set_etat_qcq() ;
29 radius = mp.r ;
30
31 Scalar big_W_file (mp, *mp.get_mg(), fiche) ;
32 big_W = big_W_file ;
33
34 Scalar small_w_file (mp, *mp.get_mg(), fiche) ;
35 small_w = small_w_file ;
36
37 Scalar big_H_file (mp, *mp.get_mg(), fiche) ;
38 big_H = big_H_file ;
39
40 Scalar small_h_file (mp, *mp.get_mg(), fiche) ;
41 small_h = small_h_file ;
42 }
43
44 // Destructor
45 Monopole::~Monopole() {} ;
46
47 // Assignement :
48 void Monopole::operator= (const Monopole& so) {
49 assert (mp == so.mp) ;
50 beta = so.beta ;
51
52 radius = so.radius ;
53 nz = so.nz ;
54
55 big_W = so.big_W ;
56 small_w = so.small_w ;
57 big_H = so.big_H ;
58 small_h = so.small_h ;
59 }
60
61 // Write to a file :
62 void Monopole::sauve (FILE* fiche) const {
63
64 fwrite_be (&beta, sizeof(double), 1, fiche) ;
65
66 big_W.sauve(fiche) ;
67 small_w.sauve (fiche) ;
68 big_H.sauve(fiche) ;
69 small_h.sauve (fiche) ;
70 }
71
72