LORENE
valeur_dsdp.C
1/*
2 * Computation of d/dphi
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
32char valeur_dsdp_C[] = "$Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_dsdp.C,v 1.4 2014/10/13 08:53:49 j_novak Exp $" ;
33
34/*
35 * $Id: valeur_dsdp.C,v 1.4 2014/10/13 08:53:49 j_novak Exp $
36 * $Log: valeur_dsdp.C,v $
37 * Revision 1.4 2014/10/13 08:53:49 j_novak
38 * Lorene classes and functions now belong to the namespace Lorene.
39 *
40 * Revision 1.3 2014/10/06 15:13:23 j_novak
41 * Modified #include directives to use c++ syntax.
42 *
43 * Revision 1.2 2012/01/17 15:08:16 j_penner
44 * using MAX_BASE_2 for the phi coordinate
45 *
46 * Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon
47 * LORENE
48 *
49 * Revision 2.10 2000/10/04 12:50:53 eric
50 * Ajout de la base P_COSSIN_I.
51 *
52 * Revision 2.9 1999/11/30 12:43:52 eric
53 * Valeur::base est desormais du type Base_val et non plus Base_val*.
54 *
55 * Revision 2.8 1999/11/23 16:16:44 eric
56 * Reorganisation du calcul dans le cas ETATZERO.
57 *
58 * Revision 2.7 1999/11/19 09:30:46 eric
59 * La valeur de retour est desormais const Valeur &.
60 *
61 * Revision 2.6 1999/10/28 07:59:37 eric
62 * Modif commentaires.
63 *
64 * Revision 2.5 1999/10/18 13:41:24 eric
65 * Suppression de l'argument base dans les routines de derivation des mtbl_cf.
66 *
67 * Revision 2.4 1999/09/07 15:46:22 phil
68 * correction des bases
69 *
70 * Revision 2.3 1999/03/01 15:09:01 eric
71 * *** empty log message ***
72 *
73 * Revision 2.2 1999/02/23 11:26:27 hyc
74 * *** empty log message ***
75 *
76 *
77 * $Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_dsdp.C,v 1.4 2014/10/13 08:53:49 j_novak Exp $
78 *
79 */
80
81// Headers C
82#include <cassert>
83
84// Headers Lorene
85#include "mtbl_cf.h"
86#include "valeur.h"
87
88// Prototypage
89namespace Lorene {
90void _dsdphi_pas_prevu(Tbl *, int &) ;
91void _dsdphi_p_cossin(Tbl *, int &) ;
92void _dsdphi_p_cossin_p(Tbl *, int &) ;
93void _dsdphi_p_cossin_i(Tbl *, int &) ;
94
95// Version membre d'un Valeur
96// --------------------------
97
98const Valeur& Valeur::dsdp() const {
99
100 // Protection
101 assert(etat != ETATNONDEF) ;
102
103 // Peut-etre rien a faire ?
104 if (p_dsdp != 0x0) {
105 return *p_dsdp ;
106 }
107
108 // ... si, il faut bosser
109
110 p_dsdp = new Valeur(mg) ;
111
112 if (etat == ETATZERO) {
114 }
115 else {
116 assert(etat == ETATQCQ) ;
118 Mtbl_cf* cfp = p_dsdp->c_cf ; // Pointeur sur le Mtbl_cf qui vient d'etre
119 // cree par le set_etat_cf_qcq()
120
121 // Initialisation de *cfp : recopie des coef. de la fonction
122 if (c_cf == 0x0) {
123 coef() ;
124 }
125 *cfp = *c_cf ;
126
127 cfp->dsdp() ; // calcul
128
129 p_dsdp->base = cfp->base ; // On remonte la base de sortie au niveau Valeur
130 }
131
132 // Termine
133 return *p_dsdp ;
134}
135
136// Version membre d'un Mtbl_cf
137// ---------------------------
138
140
141// Routines de derivation
142static void (*_dsdphi[MAX_BASE_2])(Tbl *, int &) ;
143static int nap = 0 ;
144
145 // Premier appel
146 if (nap==0) {
147 nap = 1 ;
148 for (int i=0 ; i<MAX_BASE_2 ; i++) {
149 _dsdphi[i] = _dsdphi_pas_prevu ;
150 }
151 // Les routines existantes
152 _dsdphi[P_COSSIN >> TRA_P] = _dsdphi_p_cossin ;
153 _dsdphi[P_COSSIN_P >> TRA_P] = _dsdphi_p_cossin_p ;
154 _dsdphi[P_COSSIN_I >> TRA_P] = _dsdphi_p_cossin_i ;
155 }
156
157 //- Debut de la routine -
158
159 // Protection
160 assert(etat == ETATQCQ) ;
161
162 // Boucle sur les zones
163 for (int l=0 ; l<nzone ; l++) {
164 int base_p = (base.b[l] & MSQ_P) >> TRA_P ;
165 assert(t[l] != 0x0) ;
166 _dsdphi[base_p](t[l], base.b[l]) ;
167 }
168}
169}
int * b
Array (size: nzone ) of the spectral basis in each domain.
Definition base_val.h:331
Time evolution with partial storage (*** under development ***).
Definition evolution.h:371
Coefficients storage for the multi-domain spectral method.
Definition mtbl_cf.h:186
Base_val base
Bases of the spectral expansions.
Definition mtbl_cf.h:200
int etat
Logical state (ETATNONDEF , ETATQCQ or ETATZERO ).
Definition mtbl_cf.h:196
Tbl ** t
Array (size nzone ) of pointers on the Tbl 's which contain the spectral coefficients in each domain.
Definition mtbl_cf.h:205
int nzone
Number of domains (zones)
Definition mtbl_cf.h:194
Basic array class.
Definition tbl.h:161
Values and coefficients of a (real-value) function.
Definition valeur.h:287
void set_etat_cf_qcq()
Sets the logical state to ETATQCQ (ordinary state) for values in the configuration space (Mtbl_cf c_c...
Definition valeur.C:712
Valeur * p_dsdp
Pointer on .
Definition valeur.h:323
const Valeur & dsdp() const
Returns of *this.
Definition valeur_dsdp.C:98
void set_etat_zero()
Sets the logical state to ETATZERO (zero).
Definition valeur.C:689
const Mg3d * mg
Multi-grid Mgd3 on which this is defined.
Definition valeur.h:292
Mtbl_cf * c_cf
Coefficients of the spectral expansion of the function.
Definition valeur.h:302
void coef() const
Computes the coeffcients of *this.
Base_val base
Bases on which the spectral expansion is performed.
Definition valeur.h:305
int etat
Logical state (ETATNONDEF , ETATQCQ or ETATZERO ).
Definition valeur.h:295
#define MAX_BASE_2
Smaller maximum bases used for phi (and higher dimensions for now)
#define P_COSSIN_P
dev. sur Phi = 2*phi, freq. paires
#define P_COSSIN
dev. standart
#define P_COSSIN_I
dev. sur Phi = 2*phi, freq. impaires
#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:64