LORENE
valeur_d2sdp2.C
1/*
2 * Computation of d^2/dphi^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_d2sdp2.C,v 1.4 2016/12/05 16:18:20 j_novak Exp $
36 * $Log: valeur_d2sdp2.C,v $
37 * Revision 1.4 2016/12/05 16:18:20 j_novak
38 * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
39 *
40 * Revision 1.3 2014/10/13 08:53:49 j_novak
41 * Lorene classes and functions now belong to the namespace Lorene.
42 *
43 * Revision 1.2 2014/10/06 15:13:23 j_novak
44 * Modified #include directives to use c++ syntax.
45 *
46 * Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon
47 * LORENE
48 *
49 * Revision 2.8 1999/11/30 12:43:12 eric
50 * Valeur::base est desormais du type Base_val et non plus Base_val*.
51 *
52 * Revision 2.7 1999/11/23 16:15:57 eric
53 * Reorganisation du calcul dans le cas ETATZERO.
54 *
55 * Revision 2.6 1999/11/19 09:29:56 eric
56 * La valeur de retour est desormais const Valeur &.
57 *
58 * Revision 2.5 1999/10/28 07:58:56 eric
59 * Modif commentaires.
60 *
61 * Revision 2.4 1999/10/18 13:40:38 eric
62 * Suppression de l'argument base dans les routines de derivation des mtbl_cf.
63 *
64 * Revision 2.3 1999/09/07 15:47:03 phil
65 * correction de la gestion des bases
66 *
67 * Revision 2.2 1999/03/01 15:07:51 eric
68 * *** empty log message ***
69 *
70 * Revision 2.1 1999/02/23 11:43:58 hyc
71 * *** empty log message ***
72 *
73 * Revision 2.0 1999/02/23 11:32:52 hyc
74 * *** empty log message ***
75 *
76 * $Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_d2sdp2.C,v 1.4 2016/12/05 16:18:20 j_novak Exp $
77 *
78 */
79
80// Headers C
81#include <cassert>
82
83// Headers Lorene
84#include "mtbl_cf.h"
85#include "valeur.h"
86
87// Prototypage temporaire
88namespace Lorene {
89void _d2sdphi2_pas_prevu(Tbl *, int &) ;
90void _d2sdphi2_p_cossin(Tbl *, int &) ;
91
92// Version membre d'un Valeur
93// --------------------------
94
95const Valeur& Valeur::d2sdp2() const {
96
97 // Protection
98 assert(etat != ETATNONDEF) ;
99
100 // Peut-etre rien a faire ?
101 if (p_d2sdp2 != 0x0) {
102 return *p_d2sdp2 ;
103 }
104
105 // ... si, il faut bosser
106
107 p_d2sdp2 = new Valeur(mg) ;
108
109 if (etat == ETATZERO) {
110 p_d2sdp2->set_etat_zero() ;
111 }
112 else {
113 assert(etat == ETATQCQ) ;
114 p_d2sdp2->set_etat_cf_qcq() ;
115 Mtbl_cf* cfp = p_d2sdp2->c_cf ; // Pointeur sur le Mtbl_cf qui vient d'etre
116 // cree par le set_etat_cf_qcq()
117 // Initialisation de *cfp : recopie des coef. de la fonction
118
119 if (c_cf == 0x0) {
120 coef() ;
121 }
122 *cfp = *c_cf ;
123
124 cfp->d2sdp2() ; // calcul
125
126 p_d2sdp2->base = cfp->base ; // On remonte la base de sortie au niveau Valeur
127 }
128
129 // Termine
130 return *p_d2sdp2 ;
131}
132
133// Version membre d'un Mtbl_cf
134// ---------------------------
136
137// Routines de derivation
138static void (*_d2sdphi2[MAX_BASE])(Tbl *, int &) ;
139static int nap = 0 ;
140
141 // Premier appel
142 if (nap==0) {
143 nap = 1 ;
144 for (int i=0 ; i<MAX_BASE ; i++) {
145 _d2sdphi2[i] = _d2sdphi2_pas_prevu ;
146 }
147 // Les routines existantes
148 _d2sdphi2[P_COSSIN >> TRA_P] = _d2sdphi2_p_cossin ;
149 }
150
151 //- Debut de la routine -
152
153 // Protection
154 assert(etat == ETATQCQ) ;
155
156 // Boucle sur les zones
157 for (int l=0 ; l<nzone ; l++) {
158 int base_p = (base.b[l] & MSQ_P) >> TRA_P ;
159 assert(t[l] != 0x0) ;
160 _d2sdphi2[base_p](t[l], base.b[l]) ;
161 }
162}
163}
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(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 & d2sdp2() const
Returns of *this.
int etat
Logical state (ETATNONDEF , ETATQCQ or ETATZERO ).
Definition valeur.h:305
Valeur * p_d2sdp2
Pointer on .
Definition valeur.h:335
#define MAX_BASE
Nombre max. de bases differentes.
#define P_COSSIN
dev. standart
#define MSQ_P
Extraction de l'info sur Phi.
#define TRA_P
Translation en Phi, used for a bitwise shift (in hex).
Lorene prototypes.
Definition app_hor.h:67