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 char save_profile_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Graphics/save_profile.C,v 1.3 2016/09/19 15:26:23 j_novak Exp $" ;
29 
30 /*
31  * $Id: save_profile.C,v 1.3 2016/09/19 15:26:23 j_novak Exp $
32  * $Log: save_profile.C,v $
33  * Revision 1.3 2016/09/19 15:26:23 j_novak
34  * Correction of several bugs preventing the shared library compilation.
35  *
36  * Revision 1.2 2014/10/13 08:53:23 j_novak
37  * Lorene classes and functions now belong to the namespace Lorene.
38  *
39  * Revision 1.1 2011/03/27 16:36:41 e_gourgoulhon
40  * New function save_profile.
41  *
42  * Revision 1.4 2003/10/19 20:01:10 e_gourgoulhon
43  * Template file
44  *
45  * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Graphics/save_profile.C,v 1.3 2016/09/19 15:26:23 j_novak Exp $
46  *
47  */
48 
49 // C++ headers
50 #include <fstream>
51 
52 // Lorene headers
53 #include "scalar.h"
54 
55 namespace Lorene {
56 void save_profile(const Scalar& uu, double r_min, double r_max,
57  double theta, double phi, const char* filename) {
58 
59  const int npt = 400 ; // Number of points along the axis
60 
61  double hr = (r_max - r_min) / double(npt-1) ;
62 
63  ofstream file(filename) ;
64 
65  for (int i=0; i<npt; i++) {
66 
67  double r = hr * i + r_min ;
68 
69  file << r << " " << uu.val_point(r, theta, phi) << endl ;
70  }
71 
72  file.close() ;
73 
74 }
75 
76 }
Lorene
Lorene prototypes.
Definition: app_hor.h:64
save_profile
void save_profile(const Scalar &uu, double r_min, double r_max, double theta, double phi, const char *filename)
Saves in a file the profile of a Scalar along some radial axis determined by a fixed value of .