File: map_cart_aff.C

package info (click to toggle)
lorene 0.0.0~cvs20161116%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, stretch
  • size: 26,444 kB
  • ctags: 13,953
  • sloc: cpp: 212,946; fortran: 21,645; makefile: 1,750; sh: 4
file content (143 lines) | stat: -rw-r--r-- 4,626 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
/*
 *  Methods of class Map_cart_aff
 *
 */

/*
 *   Copyright (c) 2002 Nicolas Chamel
 *   Copyright (c) 2002 Eric Gourgoulhon
 *
 *   This file is part of LORENE.
 *
 *   LORENE is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License version 2
 *   as published by the Free Software Foundation.
 *
 *   LORENE is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with LORENE; if not, write to the Free Software
 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */

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 $" ;

/*
 * $Id: map_cart_aff.C,v 1.2 2002/10/16 14:36:42 j_novak Exp $
 * $Log: map_cart_aff.C,v $
 * Revision 1.2  2002/10/16 14:36:42  j_novak
 * Reorganization of #include instructions of standard C++, in order to
 * use experimental version 3 of gcc.
 *
 * Revision 1.1  2002/03/15 13:16:23  n_chamel
 * Mapping between grid coordinates and physical coordinates
 *
 *
 *
 *
 * $Header: /cvsroot/Lorene/C++/Source/Map_cart/map_cart_aff.C,v 1.2 2002/10/16 14:36:42 j_novak Exp $
 *
 */

// C headers

// Lorene headers
#include "headcpp.h"
#include "map_cart.h"
#include "utilitaires.h"

                                                                //-------------------------//
                                                                //              Constructors                      //
                                                               //-------------------------//


// Standard constructor
// ---------------

Map_cart_aff::Map_cart_aff(const Grille_cart&  grid_i,   double alpha1_i, double beta1_i,
                                                                                double alpha2_i, double beta2_i,
                                                                                double alpha3_i, double beta3_i) :
        Map_cart(grid_i),
        alpha1(alpha1_i),
        beta1(beta1_i),
        alpha2(alpha2_i),
        beta2(beta2_i),
        alpha3(alpha3_i),
        beta3(beta3_i)
        {}



// Copy constructor
// ------------

Map_cart_aff:: Map_cart_aff(const Map_cart_aff& map_i) :
        Map_cart(map_i),
        alpha1(map_i.alpha1),
        beta1(map_i.beta1),
        alpha2(map_i.alpha2),
        beta2(map_i.beta2),
        alpha3(map_i.alpha3),
        beta3(map_i.beta3)
        {}


// Constructor  from file
// ---------------

Map_cart_aff:: Map_cart_aff(const Grille_cart&  grid_i,   FILE* fich)  :  Map_cart(grid_i)
{

                fread_be(&alpha1, sizeof(double), 1, fich) ;
                fread_be(&beta1, sizeof(double), 1, fich) ;
                fread_be(&alpha2, sizeof(double), 1, fich) ;
                fread_be(&beta2, sizeof(double), 1, fich) ;
                fread_be(&alpha3, sizeof(double), 1, fich) ;
                fread_be(&beta3, sizeof(double), 1, fich) ;

}





                                                              //-------------------------//
                                                               //              Destructors                        //
                                                               //-------------------------//

Map_cart_aff::~Map_cart_aff(){}


                                                       //--------------------//
                                                        //              Outputs                  //
                                                       //--------------------//



// Operateurs >>
ostream & Map_cart_aff::operator>>(ostream & ost) const {

    ost << "Affine Cartesian mapping (class Map_cart_aff)" << endl ;

    ost << "  alpha1 = " << alpha1 << "  beta1 = " << beta1 << endl ;
    ost << "  alpha2 = " << alpha2 << "  beta2 = " << beta2 << endl ;
    ost << "  alpha3 = " << alpha3 << "  beta3 = " << beta3 << endl ;

    return ost ;
}

// Save in a file
void Map_cart_aff::sauve(FILE* fich) const {

                fwrite_be(&alpha1, sizeof(double), 1, fich) ;
                fwrite_be(&beta1, sizeof(double), 1, fich) ;
                fwrite_be(&alpha2, sizeof(double), 1, fich) ;
                fwrite_be(&beta2, sizeof(double), 1, fich) ;
                fwrite_be(&alpha3, sizeof(double), 1, fich) ;
                fwrite_be(&beta3, sizeof(double), 1, fich) ;

}