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
30char des_coef_valeur_C[] = "$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Graphics/des_coef_valeur.C,v 1.4 2014/10/13 08:53:21 j_novak Exp $" ;
31
32
33
34/*
35 * $Id: des_coef_valeur.C,v 1.4 2014/10/13 08:53:21 j_novak Exp $
36 * $Log: des_coef_valeur.C,v $
37 * Revision 1.4 2014/10/13 08:53:21 j_novak
38 * Lorene classes and functions now belong to the namespace Lorene.
39 *
40 * Revision 1.3 2014/10/06 15:16:04 j_novak
41 * Modified #include directives to use c++ syntax.
42 *
43 * Revision 1.2 2008/08/19 06:42:00 j_novak
44 * Minor modifications to avoid warnings with gcc 4.3. Most of them concern
45 * cast-type operations, and constant strings that must be defined as const char*
46 *
47 * Revision 1.1.1.1 2001/11/20 15:19:29 e_gourgoulhon
48 * LORENE
49 *
50 * Revision 1.5 2000/02/25 10:28:02 eric
51 * Suppression des appels a Mtbl_cf::nettoie().
52 *
53 * Revision 1.4 1999/12/20 14:27:21 eric
54 * Amelioration des legendes.
55 *
56 * Revision 1.3 1999/12/20 10:57:33 eric
57 * Ajout des arguments device, newgraph, nxpage et nypage.
58 *
59 * Revision 1.2 1999/12/10 12:30:44 eric
60 * *** empty log message ***
61 *
62 * Revision 1.1 1999/12/10 12:14:28 eric
63 * Initial revision
64 *
65 *
66 * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Graphics/des_coef_valeur.C,v 1.4 2014/10/13 08:53:21 j_novak Exp $
67 *
68 */
69
70// Header C
71#include <cstdlib>
72#include <cstring>
73
74// Header Lorene
75#include "valeur.h"
76#include "graphique.h"
77
78 //-------------------------//
79 // xi coefficients //
80 //-------------------------//
81
82namespace Lorene {
83void des_coef_xi(const Valeur& uu, int l, int k, int j, double pzero,
84 const char* nomy, const char* title, const char* device,
85 int newgraph, int nxpage, int nypage) {
86
87 assert(uu.get_etat() != ETATNONDEF) ;
88 uu.coef() ;
89
90 int nr = uu.get_mg()->get_nr(l) ;
91
92 double* cf = new double[nr] ;
93
94 // Are all the coefficients zero ?
95 // -------------------------------
96 if (uu.get_etat() == ETATZERO) {
97 for (int i=0; i<nr; i++) {
98 cf[i] = 0 ;
99 }
100 }
101 else{
102 assert(uu.get_etat() == ETATQCQ) ;
103 for (int i=0; i<nr; i++) {
104 cf[i] = (*(uu.c_cf))(l, k, j, i) ;
105 }
106 }
107
108 const char* nomx = "i" ;
109
110 char title1[80] ;
111 char nomy1[80] ;
112 char bslash[2] = {92, '\0'} ; // 92 is the ASCII code for the backslash
113 // character
114 char nom_l[3] ;
115 sprintf(nom_l, "%d", l) ;
116 char nom_k[4] ;
117 sprintf(nom_k, "%d", k) ;
118 char nom_j[4] ;
119 sprintf(nom_j, "%d", j) ;
120
121 if (title == 0x0) {
122 strcpy(title1, bslash ) ;
123 strcat(title1, "gc coef. for k=" ) ;
124 strcat(title1, nom_k) ;
125 strcat(title1, ", j=" ) ;
126 strcat(title1, nom_j) ;
127 strcat(title1, " (domain " ) ;
128 strcat(title1, nom_l) ;
129 strcat(title1, ")" ) ;
130 }
131 else{
132 strncpy(title1, title, 80) ;
133 }
134
135 if (nomy == 0x0) {
136 strcpy(nomy1, "log| c" ) ;
137 strcat(nomy1, bslash ) ;
138 strcat(nomy1, "d" ) ;
139 strcat(nomy1, nom_k ) ;
140 strcat(nomy1, "," ) ;
141 strcat(nomy1, nom_j ) ;
142 strcat(nomy1, "," ) ;
143 strcat(nomy1, "i" ) ;
144 strcat(nomy1, bslash ) ;
145 strcat(nomy1, "u |" ) ;
146 }
147 else{
148 strncpy(nomy1, nomy, 80) ;
149 }
150
151 des_coef(cf, nr, pzero, nomx, nomy1, title1, device, newgraph,
152 nxpage, nypage) ;
153
154 delete [] cf ;
155
156}
157
158 //------------------------------//
159 // theta coefficients //
160 //------------------------------//
161
162void des_coef_theta(const Valeur& uu, int l, int k, int i, double pzero,
163 const char* nomy, const char* title, const char* device,
164 int newgraph, int nxpage, int nypage) {
165
166 assert(uu.get_etat() != ETATNONDEF) ;
167 uu.coef() ;
168
169 int nt = uu.get_mg()->get_nt(l) ;
170
171 double* cf = new double[nt] ;
172
173 // Are all the coefficients zero ?
174 // -------------------------------
175 if (uu.get_etat() == ETATZERO) {
176 for (int j=0; j<nt; j++) {
177 cf[j] = 0 ;
178 }
179 }
180 else{
181 assert(uu.get_etat() == ETATQCQ) ;
182 for (int j=0; j<nt; j++) {
183 cf[j] = (*(uu.c_cf))(l, k, j, i) ;
184 }
185 }
186
187 const char* nomx = "j" ;
188
189 char title1[80] ;
190 char nomy1[80] ;
191 char bslash[2] = {92, '\0'} ; // 92 is the ASCII code for the backslash
192 // character
193 char nom_l[3] ;
194 sprintf(nom_l, "%d", l) ;
195 char nom_k[4] ;
196 sprintf(nom_k, "%d", k) ;
197 char nom_i[4] ;
198 sprintf(nom_i, "%d", i) ;
199
200 if (title == 0x0) {
201 strcpy(title1, bslash ) ;
202 strcat(title1, "gh coef. for k=" ) ;
203 strcat(title1, nom_k) ;
204 strcat(title1, ", i=" ) ;
205 strcat(title1, nom_i) ;
206 strcat(title1, " (domain " ) ;
207 strcat(title1, nom_l) ;
208 strcat(title1, ")" ) ;
209 }
210 else{
211 strncpy(title1, title, 80) ;
212 }
213
214 if (nomy == 0x0) {
215 strcpy(nomy1, "log| c" ) ;
216 strcat(nomy1, bslash ) ;
217 strcat(nomy1, "d" ) ;
218 strcat(nomy1, nom_k ) ;
219 strcat(nomy1, ",j," ) ;
220 strcat(nomy1, nom_i ) ;
221 strcat(nomy1, bslash ) ;
222 strcat(nomy1, "u |" ) ;
223 }
224 else{
225 strncpy(nomy1, nomy, 80) ;
226 }
227
228 des_coef(cf, nt, pzero, nomx, nomy1, title1, device, newgraph,
229 nxpage, nypage) ;
230
231 delete [] cf ;
232
233}
234
235
236 //------------------------------//
237 // phi coefficients //
238 //------------------------------//
239
240void des_coef_phi(const Valeur& uu, int l, int j, int i, double pzero,
241 const char* nomy, const char* title, const char* device,
242 int newgraph, int nxpage, int nypage) {
243
244 assert(uu.get_etat() != ETATNONDEF) ;
245 uu.coef() ;
246
247 int np = uu.get_mg()->get_np(l) + 2 ;
248
249 double* cf = new double[np] ;
250
251 // Are all the coefficients zero ?
252 // -------------------------------
253 if (uu.get_etat() == ETATZERO) {
254 for (int k=0; k<np; k++) {
255 cf[k] = 0 ;
256 }
257 }
258 else{
259 assert(uu.get_etat() == ETATQCQ) ;
260 for (int k=0; k<np; k++) {
261 cf[k] = (*(uu.c_cf))(l, k, j, i) ;
262 }
263 }
264
265 const char* nomx = "k" ;
266
267 char title1[80] ;
268 char nomy1[80] ;
269 char bslash[2] = {92, '\0'} ; // 92 is the ASCII code for the backslash
270 // character
271 char nom_l[3] ;
272 sprintf(nom_l, "%d", l) ;
273 char nom_j[4] ;
274 sprintf(nom_j, "%d", j) ;
275 char nom_i[4] ;
276 sprintf(nom_i, "%d", i) ;
277
278 if (title == 0x0) {
279 strcpy(title1, bslash ) ;
280 strcat(title1, "gf coef. for j=" ) ;
281 strcat(title1, nom_j) ;
282 strcat(title1, ", i=" ) ;
283 strcat(title1, nom_i) ;
284 strcat(title1, " (domain " ) ;
285 strcat(title1, nom_l) ;
286 strcat(title1, ")" ) ;
287 }
288 else{
289 strncpy(title1, title, 80) ;
290 }
291
292 if (nomy == 0x0) {
293 strcpy(nomy1, "log| c" ) ;
294 strcat(nomy1, bslash ) ;
295 strcat(nomy1, "dk," ) ;
296 strcat(nomy1, nom_j ) ;
297 strcat(nomy1, "," ) ;
298 strcat(nomy1, nom_i ) ;
299 strcat(nomy1, bslash ) ;
300 strcat(nomy1, "u |" ) ;
301 }
302 else{
303 strncpy(nomy1, nomy, 80) ;
304 }
305
306 des_coef(cf, np, pzero, nomx, nomy1, title1, device, newgraph,
307 nxpage, nypage) ;
308
309 delete [] cf ;
310
311}
312}
void des_coef(const double *cf, int n, double pzero, const char *nomx, const char *nomy, const char *title, const char *device=0x0, int newgraph=3, int nxpage=1, int nypage=1)
Basic routine for drawing spectral coefficients.
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 .
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_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 .
Lorene prototypes.
Definition app_hor.h:64