LORENE
des_evolution.C
1 /*
2  * Plot of time evolution
3  *
4  * (see file graphique.h for documentation).
5  *
6  */
7 
8 /*
9  * Copyright (c) 2004 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: des_evolution.C,v 1.6 2016/12/05 16:18:06 j_novak Exp $
32  * $Log: des_evolution.C,v $
33  * Revision 1.6 2016/12/05 16:18:06 j_novak
34  * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
35  *
36  * Revision 1.5 2014/10/13 08:53:22 j_novak
37  * Lorene classes and functions now belong to the namespace Lorene.
38  *
39  * Revision 1.4 2008/08/19 06:42:00 j_novak
40  * Minor modifications to avoid warnings with gcc 4.3. Most of them concern
41  * cast-type operations, and constant strings that must be defined as const char*
42  *
43  * Revision 1.3 2004/05/20 20:29:31 e_gourgoulhon
44  * Added argument 'device'.
45  *
46  * Revision 1.2 2004/05/11 20:09:47 e_gourgoulhon
47  * Corrected bug when j_min != 0.
48  * Added version of des_evol for plot on the whole Evolution's time range.
49  *
50  * Revision 1.1 2004/02/17 22:16:08 e_gourgoulhon
51  * First version
52  *
53  *
54  * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Graphics/des_evolution.C,v 1.6 2016/12/05 16:18:06 j_novak Exp $
55  *
56  */
57 
58 
59 // Lorene headers
60 #include "graphique.h"
61 #include "evolution.h"
62 
63 // Plot on the whole time range
64 //------------------------------
65 
66 namespace Lorene {
67 void des_evol(const Evolution<double>& uu, const char* nomy,
68  const char* title, int ngraph, const char* device,
69  bool closeit, bool show_time, const char* nomx) {
70 
71  int jmin = uu.j_min() ;
72  int jmax = uu.j_max() ;
73 
74  des_evol(uu, jmin, jmax, nomy, title, ngraph, device, closeit,
75  show_time, nomx) ;
76 }
77 
78 
79 // Plot within a specified time range
80 //------------------------------------
81 
82 void des_evol(const Evolution<double>& uu, int j_min, int j_max,
83  const char* nomy, const char* title, int ngraph, const char* device,
84  bool closeit, bool show_time, const char* nomx) {
85 
86  // Special case of no graphical output:
87  if (device != 0x0) {
88  if ((device[0] == '/') && (device[1] == 'n')) return ;
89  }
90 
91  int npt = j_max - j_min + 1 ;
92 
93  float* uutab = new float[npt] ; // Values of uu at the npt points
94  float* xtab = new float[npt] ; // Values of t at the npt points
95 
96  for (int j=j_min; j<=j_max; j++) {
97  uutab[j-j_min] = float(uu[j]) ;
98  }
99 
100  if (show_time) {
101  for (int j=j_min; j<=j_max; j++) {
102  xtab[j-j_min] = float(uu.get_time(j)) ;
103  }
104  }
105  else{
106  for (int j=j_min; j<=j_max; j++) {
107  xtab[j-j_min] = float(j) ;
108  }
109  }
110 
111  if (nomx == 0x0) nomx = (show_time) ? "t" : "j" ;
112 
113  if (nomy == 0x0) nomy = "" ;
114 
115  if (title == 0x0) title = "" ;
116 
117  des_profile_mult(uutab, 1, npt, xtab, nomx, nomy, title, 0x0, ngraph,
118  closeit, device) ;
119 
120  delete [] uutab ;
121 
122 }
123 
124 }
int j_min() const
Returns the smaller time step j stored in *this.
Definition: evolution.C:463
Lorene prototypes.
Definition: app_hor.h:67
double get_time(int j) const
Returns the time t at time step j.
Definition: evolution.h:199
void des_evol(const Evolution< double > &uu, const char *nomy, const char *title, int ngraph, const char *device, bool closeit, bool show_time, const char *nomx)
Plots the variation of some quantity against time.
Definition: des_evolution.C:67
void des_profile_mult(const float *uutab, int nprof, int nx, float xmin, float xmax, const char *nomx, const char *nomy, const char *title, const int *line_style, int ngraph, bool closeit, const char *device=0x0, int nbound=0, float *xbound=0x0, bool logscale=false)
Basic routine for drawing multiple profiles with uniform x sampling.
Definition: des_profile.C:189
int j_max() const
Returns the larger time step j stored in *this.
Definition: evolution.C:482