LORENE
des_coef_valeur.C
1 /*
2  * Plots the spectral coefficients of a Valeur.
3  *
4  * (see file graphique.h for the documentation).
5  *
6  */
7 
8 /*
9  * Copyright (c) 1999-2001 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 as published by
15  * the Free Software Foundation; either version 2 of the License, or
16  * (at your option) any later version.
17  *
18  * LORENE is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with LORENE; if not, write to the Free Software
25  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26  *
27  */
28 
29 
30 
31 
32 
33 
34 /*
35  * $Id: des_coef_valeur.C,v 1.7 2022/07/01 08:10:19 j_novak Exp $
36  * $Log: des_coef_valeur.C,v $
37  * Revision 1.7 2022/07/01 08:10:19 j_novak
38  * Added a missing 'include'
39  *
40  * Revision 1.6 2022/02/10 16:56:57 j_novak
41  * Using C++ strings to avoid warnings
42  *
43  * Revision 1.5 2016/12/05 16:18:06 j_novak
44  * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
45  *
46  * Revision 1.4 2014/10/13 08:53:21 j_novak
47  * Lorene classes and functions now belong to the namespace Lorene.
48  *
49  * Revision 1.3 2014/10/06 15:16:04 j_novak
50  * Modified #include directives to use c++ syntax.
51  *
52  * Revision 1.2 2008/08/19 06:42:00 j_novak
53  * Minor modifications to avoid warnings with gcc 4.3. Most of them concern
54  * cast-type operations, and constant strings that must be defined as const char*
55  *
56  * Revision 1.1.1.1 2001/11/20 15:19:29 e_gourgoulhon
57  * LORENE
58  *
59  * Revision 1.5 2000/02/25 10:28:02 eric
60  * Suppression des appels a Mtbl_cf::nettoie().
61  *
62  * Revision 1.4 1999/12/20 14:27:21 eric
63  * Amelioration des legendes.
64  *
65  * Revision 1.3 1999/12/20 10:57:33 eric
66  * Ajout des arguments device, newgraph, nxpage et nypage.
67  *
68  * Revision 1.2 1999/12/10 12:30:44 eric
69  * *** empty log message ***
70  *
71  * Revision 1.1 1999/12/10 12:14:28 eric
72  * Initial revision
73  *
74  *
75  * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Graphics/des_coef_valeur.C,v 1.7 2022/07/01 08:10:19 j_novak Exp $
76  *
77  */
78 
79 // Header C
80 #include <cstdlib>
81 #include <cstring>
82 
83 // Header C++
84 #include <sstream>
85 
86 // Header Lorene
87 #include "valeur.h"
88 #include "graphique.h"
89 
90  //-------------------------//
91  // xi coefficients //
92  //-------------------------//
93 
94 namespace Lorene {
95 void des_coef_xi(const Valeur& uu, int l, int k, int j, double pzero,
96  const char* nomy, const char* title, const char* device,
97  int newgraph, int nxpage, int nypage) {
98 
99  assert(uu.get_etat() != ETATNONDEF) ;
100  uu.coef() ;
101 
102  int nr = uu.get_mg()->get_nr(l) ;
103 
104  double* cf = new double[nr] ;
105 
106  // Are all the coefficients zero ?
107  // -------------------------------
108  if (uu.get_etat() == ETATZERO) {
109  for (int i=0; i<nr; i++) {
110  cf[i] = 0 ;
111  }
112  }
113  else{
114  assert(uu.get_etat() == ETATQCQ) ;
115  for (int i=0; i<nr; i++) {
116  cf[i] = (*(uu.c_cf))(l, k, j, i) ;
117  }
118  }
119 
120  const char* nomx = "i" ;
121 
122  string title1 ;
123  if (title == 0x0) {
124  ostringstream str_tit1 ;
125  str_tit1 << "\\gc coef. for k=" << k << ", j=" << j << " (domain "
126  << l << ")" ;// << endl ;
127  title1 = str_tit1.str() ;
128  }
129  else
130  title1 = title ;
131 
132  string nomy1 ;
133  if (nomy == 0x0) {
134  ostringstream str_nomy ;
135  str_nomy << "log| c\\d" << k << ',' << j << ",i\\u |" ;
136  nomy1 = str_nomy.str() ;
137  }
138  else{
139  nomy1 = nomy ;
140  }
141 
142  des_coef(cf, nr, pzero, nomx, nomy1.c_str(), title1.c_str(), device, newgraph,
143  nxpage, nypage) ;
144 
145  delete [] cf ;
146 
147 }
148 
149  //------------------------------//
150  // theta coefficients //
151  //------------------------------//
152 
153 void des_coef_theta(const Valeur& uu, int l, int k, int i, double pzero,
154  const char* nomy, const char* title, const char* device,
155  int newgraph, int nxpage, int nypage) {
156 
157  assert(uu.get_etat() != ETATNONDEF) ;
158  uu.coef() ;
159 
160  int nt = uu.get_mg()->get_nt(l) ;
161 
162  double* cf = new double[nt] ;
163 
164  // Are all the coefficients zero ?
165  // -------------------------------
166  if (uu.get_etat() == ETATZERO) {
167  for (int j=0; j<nt; j++) {
168  cf[j] = 0 ;
169  }
170  }
171  else{
172  assert(uu.get_etat() == ETATQCQ) ;
173  for (int j=0; j<nt; j++) {
174  cf[j] = (*(uu.c_cf))(l, k, j, i) ;
175  }
176  }
177 
178  const char* nomx = "j" ;
179 
180  string title1 ;
181  if (title == 0x0) {
182  ostringstream str_tit1 ;
183  str_tit1 << "\\gh coef. for k=" << k << ", i=" << i << " (domain "
184  << l << ")" ;// << endl ;
185  title1 = str_tit1.str() ;
186  }
187  else
188  title1 = title ;
189 
190  string nomy1 ;
191  if (nomy == 0x0) {
192  ostringstream str_nomy ;
193  str_nomy << "log| c\\d" << k << ",j," << i << "\\u |" ;
194  nomy1 = str_nomy.str() ;
195  }
196  else{
197  nomy1 = nomy ;
198  }
199 
200  des_coef(cf, nt, pzero, nomx, nomy1.c_str(), title1.c_str(), device, newgraph,
201  nxpage, nypage) ;
202 
203  delete [] cf ;
204 
205 }
206 
207 
208  //------------------------------//
209  // phi coefficients //
210  //------------------------------//
211 
212 void des_coef_phi(const Valeur& uu, int l, int j, int i, double pzero,
213  const char* nomy, const char* title, const char* device,
214  int newgraph, int nxpage, int nypage) {
215 
216  assert(uu.get_etat() != ETATNONDEF) ;
217  uu.coef() ;
218 
219  int np = uu.get_mg()->get_np(l) + 2 ;
220 
221  double* cf = new double[np] ;
222 
223  // Are all the coefficients zero ?
224  // -------------------------------
225  if (uu.get_etat() == ETATZERO) {
226  for (int k=0; k<np; k++) {
227  cf[k] = 0 ;
228  }
229  }
230  else{
231  assert(uu.get_etat() == ETATQCQ) ;
232  for (int k=0; k<np; k++) {
233  cf[k] = (*(uu.c_cf))(l, k, j, i) ;
234  }
235  }
236 
237  const char* nomx = "k" ;
238 
239  string title1 ;
240  if (title == 0x0) {
241  ostringstream str_tit1 ;
242  str_tit1 << "\\gf coef. for j=" << j << ", i=" << i << " (domain "
243  << l << ")" ;// << endl ;
244  title1 = str_tit1.str() ;
245  }
246  else
247  title1 = title ;
248 
249  string nomy1 ;
250  if (nomy == 0x0) {
251  ostringstream str_nomy ;
252  str_nomy << "log| c\\dk," << j << ',' << i << "\\u |" ;
253  nomy1 = str_nomy.str() ;
254  }
255  else{
256  nomy1 = nomy ;
257  }
258 
259  des_coef(cf, np, pzero, nomx, nomy1.c_str(), title1.c_str(), device, newgraph,
260  nxpage, nypage) ;
261 
262  delete [] cf ;
263 
264 }
265 }
Lorene prototypes.
Definition: app_hor.h:67
void des_coef_xi(const Valeur &uu, int l, int k, int j, double pzero=1.e-14, const char *nomy=0x0, const char *title=0x0, const char *device=0x0, int newgraph=3, int nxpage=1, int nypage=1)
Plots the coefficients of the spectral expansion in of a Valeur .
void des_coef_phi(const Valeur &uu, int l, int j, int i, double pzero=1.e-14, const char *nomy=0x0, const char *title=0x0, const char *device=0x0, int newgraph=3, int nxpage=1, int nypage=1)
Plots the coefficients of the spectral expansion in of a Valeur .
void des_coef(const double *cf, int n, double pzero, const char *nomx, const char *nomy, const char *title, const char *device, int newgraph, int nxpage, int nypage)
Basic routine for drawing spectral coefficients.
Definition: des_coef.C:78
void des_coef_theta(const Valeur &uu, int l, int k, int i, double pzero=1.e-14, const char *nomy=0x0, const char *title=0x0, const char *device=0x0, int newgraph=3, int nxpage=1, int nypage=1)
Plots the coefficients of the spectral expansion in of a Valeur .