LORENE
valeur_dsdt.C
1/*
2 * Computaiton of d/dtheta
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_dsdt_C[] = "$Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_dsdt.C,v 1.5 2014/10/13 08:53:49 j_novak Exp $" ;
33
34/*
35 * $Id: valeur_dsdt.C,v 1.5 2014/10/13 08:53:49 j_novak Exp $
36 * $Log: valeur_dsdt.C,v $
37 * Revision 1.5 2014/10/13 08:53:49 j_novak
38 * Lorene classes and functions now belong to the namespace Lorene.
39 *
40 * Revision 1.4 2014/10/06 15:13:23 j_novak
41 * Modified #include directives to use c++ syntax.
42 *
43 * Revision 1.3 2009/10/08 16:23:14 j_novak
44 * Addition of new bases T_COS and T_SIN.
45 *
46 * Revision 1.2 2004/11/23 15:17:19 m_forot
47 * Added the bases for the cases without any equatorial symmetry
48 * (T_COSSIN_C, T_COSSIN_S, T_LEG, R_CHEBPI_P, R_CHEBPI_I).
49 *
50 * Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon
51 * LORENE
52 *
53 * Revision 2.8 1999/11/30 12:44:02 eric
54 * Valeur::base est desormais du type Base_val et non plus Base_val*.
55 *
56 * Revision 2.7 1999/11/23 16:16:55 eric
57 * Reorganisation du calcul dans le cas ETATZERO.
58 *
59 * Revision 2.6 1999/11/19 09:30:55 eric
60 * La valeur de retour est desormais const Valeur &.
61 *
62 * Revision 2.5 1999/10/28 08:00:06 eric
63 * Modif commentaires.
64 *
65 * Revision 2.4 1999/10/18 13:41:37 eric
66 * Suppression de l'argument base dans les routines de derivation des mtbl_cf.
67 *
68 * Revision 2.3 1999/09/07 15:41:40 phil
69 * correction Valeur Valeur::dsdx
70 *
71 * Revision 2.2 1999/03/01 15:09:32 eric
72 * *** empty log message ***
73 *
74 * Revision 2.1 1999/02/23 10:52:11 hyc
75 * *** empty log message ***
76 *
77 * Revision 2.0 1999/02/22 15:39:23 hyc
78 * *** empty log message ***
79 *
80 *
81 * $Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_dsdt.C,v 1.5 2014/10/13 08:53:49 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 _dsdtet_pas_prevu(Tbl *, int &) ;
95void _dsdtet_t_cos(Tbl *, int &) ;
96void _dsdtet_t_sin(Tbl *, int &) ;
97void _dsdtet_t_cos_p(Tbl *, int &) ;
98void _dsdtet_t_sin_p(Tbl *, int &) ;
99void _dsdtet_t_sin_i(Tbl *, int &) ;
100void _dsdtet_t_cos_i(Tbl *, int &) ;
101void _dsdtet_t_cossin_cp(Tbl *, int &) ;
102void _dsdtet_t_cossin_sp(Tbl *, int &) ;
103void _dsdtet_t_cossin_ci(Tbl *, int &) ;
104void _dsdtet_t_cossin_si(Tbl *, int &) ;
105void _dsdtet_t_cossin_s(Tbl *, int &) ;
106void _dsdtet_t_cossin_c(Tbl *, int &) ;
107
108
109// Version membre d'un Valeur
110// --------------------------
111
112const Valeur& Valeur::dsdt() const {
113
114 // Protection
115 assert(etat != ETATNONDEF) ;
116
117 // Peut-etre rien a faire ?
118 if (p_dsdt != 0x0) {
119 return *p_dsdt ;
120 }
121
122 // ... si, il faut bosser
123
124 p_dsdt = new Valeur(mg) ;
125
126 if (etat == ETATZERO) {
128 }
129 else {
130 assert(etat == ETATQCQ) ;
132 Mtbl_cf* cfp = p_dsdt->c_cf ; // Pointeur sur le Mtbl_cf qui vient d'etre
133 // cree par le set_etat_cf_qcq()
134
135 // Initialisation de *cfp : recopie des coef. de la fonction
136 if (c_cf == 0x0) {
137 coef() ;
138 }
139 *cfp = *c_cf ;
140
141 cfp->dsdt() ; // calcul
142
143 p_dsdt->base = cfp->base ; // On remonte la base de sortie au niveau Valeur
144 }
145
146 // Termine
147 return *p_dsdt ;
148}
149
150// Version membre d'un Mtbl_cf
151// ---------------------------
153
154// Routines de derivation
155static void (*_dsdtet[MAX_BASE])(Tbl *, int &) ;
156static int nap = 0 ;
157
158 // Premier appel
159 if (nap==0) {
160 nap = 1 ;
161 for (int i=0 ; i<MAX_BASE ; i++) {
162 _dsdtet[i] = _dsdtet_pas_prevu ;
163 }
164 // Les routines existantes
165 _dsdtet[T_COS >> TRA_T] = _dsdtet_t_cos ;
166 _dsdtet[T_SIN >> TRA_T] = _dsdtet_t_sin ;
167 _dsdtet[T_COS_P >> TRA_T] = _dsdtet_t_cos_p ;
168 _dsdtet[T_SIN_P >> TRA_T] = _dsdtet_t_sin_p ;
169 _dsdtet[T_SIN_I >> TRA_T] = _dsdtet_t_sin_i ;
170 _dsdtet[T_COS_I >> TRA_T] = _dsdtet_t_cos_i ;
171 _dsdtet[T_COSSIN_CP >> TRA_T] = _dsdtet_t_cossin_cp ;
172 _dsdtet[T_COSSIN_SP >> TRA_T] = _dsdtet_t_cossin_sp ;
173 _dsdtet[T_COSSIN_CI >> TRA_T] = _dsdtet_t_cossin_ci ;
174 _dsdtet[T_COSSIN_SI >> TRA_T] = _dsdtet_t_cossin_si ;
175 _dsdtet[T_COSSIN_C >> TRA_T] = _dsdtet_t_cossin_c ;
176 _dsdtet[T_COSSIN_S >> TRA_T] = _dsdtet_t_cossin_s ;
177 }
178
179 //- Debut de la routine -
180
181 // Protection
182 assert(etat == ETATQCQ) ;
183
184 // Boucle sur les zones
185 for (int l=0 ; l<nzone ; l++) {
186 int base_t = (base.b[l] & MSQ_T) >> TRA_T ;
187 assert(t[l] != 0x0) ;
188 _dsdtet[base_t](t[l], base.b[l]) ;
189 }
190}
191}
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
void set_etat_zero()
Sets the logical state to ETATZERO (zero).
Definition valeur.C:689
const Valeur & dsdt() const
Returns of *this.
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.
Valeur * p_dsdt
Pointer on .
Definition valeur.h:316
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 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 T_COSSIN_CI
cos impair-sin pair alternes, cos pour m=0
#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:64