LORENE
valeur_d2sdt2.C
1/*
2 * Computation of d^2/dtheta^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_d2sdt2.C,v 1.6 2016/12/05 16:18:20 j_novak Exp $
36 * $Log: valeur_d2sdt2.C,v $
37 * Revision 1.6 2016/12/05 16:18:20 j_novak
38 * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
39 *
40 * Revision 1.5 2014/10/13 08:53:49 j_novak
41 * Lorene classes and functions now belong to the namespace Lorene.
42 *
43 * Revision 1.4 2014/10/06 15:13:23 j_novak
44 * Modified #include directives to use c++ syntax.
45 *
46 * Revision 1.3 2009/10/09 14:01:06 j_novak
47 * New bases T_cos and T_SIN.
48 *
49 * Revision 1.2 2004/11/23 15:17:19 m_forot
50 * Added the bases for the cases without any equatorial symmetry
51 * (T_COSSIN_C, T_COSSIN_S, T_LEG, R_CHEBPI_P, R_CHEBPI_I).
52 *
53 * Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon
54 * LORENE
55 *
56 * Revision 2.7 1999/11/30 12:43:25 eric
57 * Valeur::base est desormais du type Base_val et non plus Base_val*.
58 *
59 * Revision 2.6 1999/11/23 16:16:23 eric
60 * Reorganisation du calcul dans le cas ETATZERO.
61 *
62 * Revision 2.5 1999/11/19 09:30:26 eric
63 * La valeur de retour est desormais const Valeur &.
64 *
65 * Revision 2.4 1999/10/28 07:59:16 eric
66 * Modif commentaires.
67 *
68 * Revision 2.3 1999/10/18 13:41:00 eric
69 * Suppression de l'argument base dans les routines de derivation des mtbl_cf.
70 *
71 * Revision 2.2 1999/09/07 15:45:25 phil
72 * correction gestion des bases
73 *
74 * Revision 2.1 1999/03/01 15:08:18 eric
75 * *** empty log message ***
76 *
77 * Revision 2.0 1999/02/23 11:23:27 hyc
78 * *** empty log message ***
79 *
80 *
81 * $Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_d2sdt2.C,v 1.6 2016/12/05 16:18:20 j_novak Exp $
82 *
83 */
84
85// Headers C
86#include <cassert>
87
88// Headers Lorene
89#include "mtbl_cf.h"
90#include "valeur.h"
91
92// Prototypage temporaire
93namespace Lorene {
94void _d2sdtet2_pas_prevu(Tbl *, int &) ;
95void _d2sdtet2_t_cos(Tbl *, int &) ;
96void _d2sdtet2_t_sin(Tbl *, int &) ;
97void _d2sdtet2_t_cos_p(Tbl *, int &) ;
98void _d2sdtet2_t_sin_p(Tbl *, int &) ;
99void _d2sdtet2_t_sin_i(Tbl *, int &) ;
100void _d2sdtet2_t_cos_i(Tbl *, int &) ;
101void _d2sdtet2_t_cossin_cp(Tbl *, int &) ;
102void _d2sdtet2_t_cossin_sp(Tbl *, int &) ;
103void _d2sdtet2_t_cossin_si(Tbl *, int &) ;
104void _d2sdtet2_t_cossin_c(Tbl *, int &) ;
105void _d2sdtet2_t_cossin_s(Tbl *, int &) ;
106
107// Version membre d'un Valeur
108// --------------------------
109
110const Valeur& Valeur::d2sdt2() const {
111
112 // Protection
113 assert(etat != ETATNONDEF) ;
114
115 // Peut-etre rien a faire ?
116 if (p_d2sdt2 != 0x0) {
117 return *p_d2sdt2 ;
118 }
119
120 // ... si, il faut bosser
121
122 p_d2sdt2 = new Valeur(mg) ;
123
124 if (etat == ETATZERO) {
125 p_d2sdt2->set_etat_zero() ;
126 }
127 else {
128 assert(etat == ETATQCQ) ;
129 p_d2sdt2->set_etat_cf_qcq() ;
130 Mtbl_cf* cfp = p_d2sdt2->c_cf ; // Pointeur sur le Mtbl_cf qui vient d'etre
131 // cree par le set_etat_cf_qcq()
132
133 // Initialisation de *cfp : recopie des coef. de la fonction
134 if (c_cf == 0x0) {
135 coef() ;
136 }
137 *cfp = *c_cf ;
138
139 cfp->d2sdt2() ; // calcul
140
141 p_d2sdt2->base = cfp->base ; // On remonte la base de sortie au niveau Valeur
142 }
143
144 // Termine
145 return *p_d2sdt2 ;
146}
147
148// Version membre d'un Mtbl_cf
149// ---------------------------
150
152
153// Routines de derivation
154static void (*_d2sdtet2[MAX_BASE])(Tbl *, int &) ;
155static int nap = 0 ;
156
157 // Premier appel
158 if (nap==0) {
159 nap = 1 ;
160 for (int i=0 ; i<MAX_BASE ; i++) {
161 _d2sdtet2[i] = _d2sdtet2_pas_prevu ;
162 }
163 // Les routines existantes
164 _d2sdtet2[T_COS >> TRA_T] = _d2sdtet2_t_cos ;
165 _d2sdtet2[T_SIN >> TRA_T] = _d2sdtet2_t_sin ;
166 _d2sdtet2[T_COS_P >> TRA_T] = _d2sdtet2_t_cos_p ;
167 _d2sdtet2[T_SIN_P >> TRA_T] = _d2sdtet2_t_sin_p ;
168 _d2sdtet2[T_SIN_I >> TRA_T] = _d2sdtet2_t_sin_i ;
169 _d2sdtet2[T_COS_I >> TRA_T] = _d2sdtet2_t_cos_i ;
170 _d2sdtet2[T_COSSIN_CP >> TRA_T] = _d2sdtet2_t_cossin_cp ;
171 _d2sdtet2[T_COSSIN_SP >> TRA_T] = _d2sdtet2_t_cossin_sp ;
172 _d2sdtet2[T_COSSIN_SI >> TRA_T] = _d2sdtet2_t_cossin_si ;
173 _d2sdtet2[T_COSSIN_S >> TRA_T] = _d2sdtet2_t_cossin_s ;
174 _d2sdtet2[T_COSSIN_C >> TRA_T] = _d2sdtet2_t_cossin_c ;
175 }
176
177 //- Debut de la routine -
178
179 // Protection
180 assert(etat == ETATQCQ) ;
181
182 // Boucle sur les zones
183 for (int l=0 ; l<nzone ; l++) {
184 int base_t = (base.b[l] & MSQ_T) >> TRA_T ;
185 assert(t[l] != 0x0) ;
186 _d2sdtet2[base_t](t[l], base.b[l]) ;
187 }
188}
189}
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
const Valeur & d2sdt2() const
Returns of *this.
Valeur(const Mg3d &mgrid)
Constructor.
Definition valeur.C:203
Valeur * p_d2sdt2
Pointer on .
Definition valeur.h:327
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.
int etat
Logical state (ETATNONDEF , ETATQCQ or ETATZERO ).
Definition valeur.h:305
#define TRA_T
Translation en Theta, used for a bitwise shift (in hex).
#define MAX_BASE
Nombre max. de bases differentes.
#define T_COSSIN_SP
sin pair-cos impair alternes, sin pour m=0
#define T_SIN_P
dev. sin seulement, harmoniques paires
#define T_COSSIN_S
dev. cos-sin alternes, sin pour m=0
#define T_COSSIN_SI
sin impair-cos pair alternes, sin pour m=0
#define T_COS_P
dev. cos seulement, harmoniques paires
#define MSQ_T
Extraction de l'info sur Theta.
#define T_COSSIN_CP
cos pair-sin impair alternes, cos pour m=0
#define T_SIN_I
dev. sin seulement, harmoniques impaires
#define T_COS
dev. cos seulement
#define T_SIN
dev. sin seulement
#define T_COS_I
dev. cos seulement, harmoniques impaires
#define T_COSSIN_C
dev. cos-sin alternes, cos pour m=0
Lorene prototypes.
Definition app_hor.h:67