LORENE
valeur_d2sdx2.C
1/*
2 * Computation of d^2/dx^2
3 *
4 * for:
5 * - Valeur
6 * - Mtbl_cf
7 */
8
9/*
10 * Copyright (c) 1999-2000 Jean-Alain Marck
11 * Copyright (c) 1999-2001 Eric Gourgoulhon
12 *
13 * This file is part of LORENE.
14 *
15 * LORENE is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
19 *
20 * LORENE is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with LORENE; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 *
29 */
30
31
32
33
34/*
35 * $Id: valeur_d2sdx2.C,v 1.7 2016/12/05 16:18:20 j_novak Exp $
36 * $Log: valeur_d2sdx2.C,v $
37 * Revision 1.7 2016/12/05 16:18:20 j_novak
38 * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
39 *
40 * Revision 1.6 2014/10/13 08:53:49 j_novak
41 * Lorene classes and functions now belong to the namespace Lorene.
42 *
43 * Revision 1.5 2014/10/06 15:13:23 j_novak
44 * Modified #include directives to use c++ syntax.
45 *
46 * Revision 1.4 2013/06/14 15:54:07 j_novak
47 * Inclusion of Legendre bases.
48 *
49 * Revision 1.3 2008/08/27 08:52:55 jl_cornou
50 * Added Jacobi(0,2) polynomials case
51 *
52 * Revision 1.2 2004/11/23 15:17:19 m_forot
53 * Added the bases for the cases without any equatorial symmetry
54 * (T_COSSIN_C, T_COSSIN_S, T_LEG, R_CHEBPI_P, R_CHEBPI_I).
55 *
56 * Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon
57 * LORENE
58 *
59 * Revision 2.9 2000/08/16 10:46:03 eric
60 * Suppression de Mtbl_cf::dzpuis.
61 *
62 * Revision 2.8 1999/11/30 12:43:41 eric
63 * Valeur::base est desormais du type Base_val et non plus Base_val*.
64 *
65 * Revision 2.7 1999/11/23 16:16:32 eric
66 * Reorganisation du calcul dans le cas ETATZERO.
67 *
68 * Revision 2.6 1999/11/19 09:30:38 eric
69 * La valeur de retour est desormais const Valeur &.
70 *
71 * Revision 2.5 1999/10/28 07:59:29 eric
72 * Modif commentaires.
73 *
74 * Revision 2.4 1999/10/18 13:41:11 eric
75 * Suppression de l'argument base dans les routines de derivation des mtbl_cf.
76 *
77 * Revision 2.3 1999/09/07 15:43:08 phil
78 * coreection bases
79 *
80 * Revision 2.2 1999/03/01 15:08:40 eric
81 * *** empty log message ***
82 *
83 * Revision 2.1 1999/02/23 10:39:02 hyc
84 * *** empty log message ***
85 *
86 *
87 * $Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_d2sdx2.C,v 1.7 2016/12/05 16:18:20 j_novak Exp $
88 *
89 */
90
91// Headers C
92#include <cassert>
93
94// Headers Lorene
95#include "mtbl_cf.h"
96#include "valeur.h"
97
98// Prototypage temporaire
99namespace Lorene {
100void _d2sdx2_pas_prevu(Tbl *, int &) ;
101void _d2sdx2_r_cheb(Tbl *, int &) ;
102void _d2sdx2_r_chebu_0(Tbl *, int &) ;
103void _d2sdx2_r_chebp(Tbl *, int &) ;
104void _d2sdx2_r_chebi(Tbl *, int &) ;
105void _d2sdx2_r_chebpim_p(Tbl *, int &) ;
106void _d2sdx2_r_chebpim_i(Tbl *, int &) ;
107void _d2sdx2_r_chebpi_p(Tbl *, int &) ;
108void _d2sdx2_r_chebpi_i(Tbl *, int &) ;
109void _d2sdx2_r_leg(Tbl *, int &) ;
110void _d2sdx2_r_legp(Tbl *, int &) ;
111void _d2sdx2_r_legi(Tbl *, int &) ;
112void _d2sdx2_r_jaco02(Tbl *, int &) ;
113
114// Version membre d'un Valeur
115// --------------------------
116
117const Valeur& Valeur::d2sdx2() const {
118
119 // Protection
120 assert(etat != ETATNONDEF) ;
121
122 // Peut-etre rien a faire ?
123 if (p_d2sdx2 != 0x0) {
124 return *p_d2sdx2 ;
125 }
126
127 // ... si, il faut bosser
128
129 p_d2sdx2 = new Valeur(mg) ;
130
131 if (etat == ETATZERO) {
132 p_d2sdx2->set_etat_zero() ;
133 }
134 else {
135 assert(etat == ETATQCQ) ;
136 p_d2sdx2->set_etat_cf_qcq() ;
137 Mtbl_cf* cfp = p_d2sdx2->c_cf ; // Pointeur sur le Mtbl_cf qui vient d'etre
138 // cree par le set_etat_cf_qcq()
139
140 // Initialisation de *cfp : recopie des coef. de la fonction
141 if (c_cf == 0x0) {
142 coef() ;
143 }
144 *cfp = *c_cf ;
145
146 cfp->d2sdx2() ; // calcul
147
148 p_d2sdx2->base = cfp->base ; // On remonte la base de sortie au niveau Valeur
149 }
150
151 // Termine
152 return *p_d2sdx2 ;
153}
154
155// Version membre d'un Mtbl_cf
156// ---------------------------
157
159
160// Routines de derivation
161static void (*_d2sdx2[MAX_BASE])(Tbl *, int &) ;
162static int nap = 0 ;
163
164 // Premier appel
165 if (nap==0) {
166 nap = 1 ;
167 for (int i=0 ; i<MAX_BASE ; i++) {
168 _d2sdx2[i] = _d2sdx2_pas_prevu ;
169 }
170 // Les routines existantes
171 _d2sdx2[R_CHEB >> TRA_R] = _d2sdx2_r_cheb ;
172 _d2sdx2[R_CHEBU >> TRA_R] = _d2sdx2_r_chebu_0 ;
173 _d2sdx2[R_CHEBP >> TRA_R] = _d2sdx2_r_chebp ;
174 _d2sdx2[R_CHEBI >> TRA_R] = _d2sdx2_r_chebi ;
175 _d2sdx2[R_CHEBPIM_P >> TRA_R] = _d2sdx2_r_chebpim_p ;
176 _d2sdx2[R_CHEBPIM_I >> TRA_R] = _d2sdx2_r_chebpim_i ;
177 _d2sdx2[R_CHEBPI_P >> TRA_R] = _d2sdx2_r_chebpi_p ;
178 _d2sdx2[R_CHEBPI_I >> TRA_R] = _d2sdx2_r_chebpi_i ;
179 _d2sdx2[R_LEG >> TRA_R] = _d2sdx2_r_leg ;
180 _d2sdx2[R_LEGP >> TRA_R] = _d2sdx2_r_legp ;
181 _d2sdx2[R_LEGI >> TRA_R] = _d2sdx2_r_legi ;
182 _d2sdx2[R_JACO02 >> TRA_R] = _d2sdx2_r_jaco02 ;
183 }
184
185 //- Debut de la routine -
186
187 // Protection
188 assert(etat == ETATQCQ) ;
189
190 // Boucle sur les zones
191 for (int l=0 ; l<nzone ; l++) {
192 int base_r = (base.b[l] & MSQ_R) >> TRA_R ;
193 assert(t[l] != 0x0) ;
194 _d2sdx2[base_r](t[l], base.b[l]) ;
195 }
196}
197}
Coefficients storage for the multi-domain spectral method.
Definition mtbl_cf.h:196
Base_val base
Bases of the spectral expansions.
Definition mtbl_cf.h:210
int etat
Logical state (ETATNONDEF , ETATQCQ or ETATZERO ).
Definition mtbl_cf.h:206
Tbl ** t
Array (size nzone ) of pointers on the Tbl 's which contain the spectral coefficients in each domain.
Definition mtbl_cf.h:215
int nzone
Number of domains (zones).
Definition mtbl_cf.h:204
Basic array class.
Definition tbl.h:161
Valeur * p_d2sdx2
Pointer on .
Definition valeur.h:321
Valeur(const Mg3d &mgrid)
Constructor.
Definition valeur.C:203
const Mg3d * mg
Multi-grid Mgd3 on which this is defined.
Definition valeur.h:302
Mtbl_cf * c_cf
Coefficients of the spectral expansion of the function.
Definition valeur.h:312
void coef() const
Computes the coeffcients of *this.
const Valeur & d2sdx2() const
Returns of *this.
int etat
Logical state (ETATNONDEF , ETATQCQ or ETATZERO ).
Definition valeur.h:305
#define R_LEGP
base de Legendre paire (rare) seulement
#define MAX_BASE
Nombre max. de bases differentes.
#define R_CHEBU
base de Chebychev ordinaire (fin), dev. en 1/r
#define R_JACO02
base de Jacobi(0,2) ordinaire (finjac)
#define R_LEGI
base de Legendre impaire (rare) seulement
#define R_CHEBI
base de Cheb. impaire (rare) seulement
#define MSQ_R
Extraction de l'info sur R.
#define R_CHEBPIM_I
Cheb. pair-impair suivant m, impair pour m=0.
#define R_CHEBPI_I
Cheb. pair-impair suivant l impair pour l=0.
#define R_LEG
base de Legendre ordinaire (fin)
#define R_CHEBPIM_P
Cheb. pair-impair suivant m, pair pour m=0.
#define TRA_R
Translation en R, used for a bitwise shift (in hex).
#define R_CHEB
base de Chebychev ordinaire (fin)
#define R_CHEBP
base de Cheb. paire (rare) seulement
#define R_CHEBPI_P
Cheb. pair-impair suivant l pair pour l=0.
Lorene prototypes.
Definition app_hor.h:67