LORENE
save_profile.C
1/*
2 * save_profile function
3 *
4 * (see file graphique.h for documentation).
5 *
6 */
7
8/*
9 * Copyright (c) 2011 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 version 2
15 * as published by the Free Software Foundation.
16 *
17 * LORENE is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with LORENE; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 *
26 */
27
28
29
30/*
31 * $Id: save_profile.C,v 1.4 2016/12/05 16:18:07 j_novak Exp $
32 * $Log: save_profile.C,v $
33 * Revision 1.4 2016/12/05 16:18:07 j_novak
34 * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
35 *
36 * Revision 1.3 2016/09/19 15:26:23 j_novak
37 * Correction of several bugs preventing the shared library compilation.
38 *
39 * Revision 1.2 2014/10/13 08:53:23 j_novak
40 * Lorene classes and functions now belong to the namespace Lorene.
41 *
42 * Revision 1.1 2011/03/27 16:36:41 e_gourgoulhon
43 * New function save_profile.
44 *
45 * Revision 1.4 2003/10/19 20:01:10 e_gourgoulhon
46 * Template file
47 *
48 * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Graphics/save_profile.C,v 1.4 2016/12/05 16:18:07 j_novak Exp $
49 *
50 */
51
52// C++ headers
53#include <fstream>
54
55// Lorene headers
56#include "scalar.h"
57
58namespace Lorene {
59void save_profile(const Scalar& uu, double r_min, double r_max,
60 double theta, double phi, const char* filename) {
61
62 const int npt = 400 ; // Number of points along the axis
63
64 double hr = (r_max - r_min) / double(npt-1) ;
65
66 ofstream file(filename) ;
67
68 for (int i=0; i<npt; i++) {
69
70 double r = hr * i + r_min ;
71
72 file << r << " " << uu.val_point(r, theta, phi) << endl ;
73 }
74
75 file.close() ;
76
77}
78
79}
Tensor field of valence 0 (or component of a tensorial field).
Definition scalar.h:393
Lorene prototypes.
Definition app_hor.h:67
Coord phi
coordinate centered on the grid
Definition map.h:732
Coord r
r coordinate centered on the grid
Definition map.h:730