LORENE
valeur_mult_ct.C
1/*
2 * Multiplication by cos(theta)
3 *
4 * for:
5 * - Valeur
6 * - Mtbl_cf
7 */
8
9/*
10 * Copyright (c) 1999-2001 Jerome Novak
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_mult_ct_C[] = "$Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_mult_ct.C,v 1.5 2014/10/13 08:53:50 j_novak Exp $" ;
33
34/*
35 * $Id: valeur_mult_ct.C,v 1.5 2014/10/13 08:53:50 j_novak Exp $
36 * $Log: valeur_mult_ct.C,v $
37 * Revision 1.5 2014/10/13 08:53:50 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/09 14:01:06 j_novak
44 * 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 1.4 1999/11/30 12:44:45 eric
54 * Valeur::base est desormais du type Base_val et non plus Base_val*.
55 *
56 * Revision 1.3 1999/11/24 09:33:02 eric
57 * Modif commentaires.
58 *
59 * Revision 1.2 1999/11/23 16:17:47 eric
60 * Reorganisation du calcul dans le cas ETATZERO.
61 *
62 * Revision 1.1 1999/11/23 14:31:28 novak
63 * Initial revision
64 *
65 *
66 * $Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_mult_ct.C,v 1.5 2014/10/13 08:53:50 j_novak Exp $
67 *
68 */
69
70
71
72// Headers C
73#include <cassert>
74
75// Headers Lorene
76#include "mtbl_cf.h"
77#include "valeur.h"
78
79// Local prototypes
80namespace Lorene {
81void _mult_ct_pas_prevu (Tbl*, int&) ;
82void _mult_ct_t_cos (Tbl*, int&) ;
83void _mult_ct_t_sin (Tbl*, int&) ;
84void _mult_ct_t_sin_p (Tbl*, int&) ;
85void _mult_ct_t_sin_i (Tbl*, int&) ;
86void _mult_ct_t_cos_i (Tbl*, int&) ;
87void _mult_ct_t_cos_p (Tbl*, int&) ;
88void _mult_ct_t_cossin_si (Tbl*, int&) ;
89void _mult_ct_t_cossin_ci (Tbl*, int&) ;
90void _mult_ct_t_cossin_cp (Tbl*, int&) ;
91void _mult_ct_t_cossin_sp (Tbl*, int&) ;
92void _mult_ct_t_cossin_c (Tbl*, int&) ;
93void _mult_ct_t_cossin_s (Tbl*, int&) ;
94
95// Version membre d'un Valeur
96// --------------------------
97
98const Valeur& Valeur::mult_ct() const {
99
100 // Protection
101 assert(etat != ETATNONDEF) ;
102
103 // Peut-etre rien a faire ?
104 if (p_mult_ct != 0x0) {
105 return *p_mult_ct ;
106 }
107
108 // ... si, il faut bosser
109
110 p_mult_ct = new Valeur(mg) ;
111
112 if (etat == ETATZERO) {
114 }
115 else {
116 assert(etat == ETATQCQ) ;
118 Mtbl_cf* cfp = p_mult_ct->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->mult_ct() ; // calcul
128
129 p_mult_ct->base = cfp->base ; // On remonte la base de sortie au niveau Valeur
130 }
131
132 // Termine
133 return *p_mult_ct ;
134}
135
136
137
138// Version membre d'un Mtbl_cf
139// ---------------------------
140
142
143// Routines de derivation
144static void (*_mult_ct[MAX_BASE])(Tbl *, int &) ;
145static int nap = 0 ;
146
147 // Premier appel
148 if (nap==0) {
149 nap = 1 ;
150 for (int i=0 ; i<MAX_BASE ; i++) {
151 _mult_ct[i] = _mult_ct_pas_prevu ;
152 }
153 // Les routines existantes
154 _mult_ct[T_COS >> TRA_T] = _mult_ct_t_cos ;
155 _mult_ct[T_SIN >> TRA_T] = _mult_ct_t_sin ;
156 _mult_ct[T_COS_P >> TRA_T] = _mult_ct_t_cos_p ;
157 _mult_ct[T_COS_I >> TRA_T] = _mult_ct_t_cos_i ;
158 _mult_ct[T_SIN_P >> TRA_T] = _mult_ct_t_sin_p ;
159 _mult_ct[T_SIN_I >> TRA_T] = _mult_ct_t_sin_i ;
160 _mult_ct[T_COSSIN_SI >> TRA_T] = _mult_ct_t_cossin_si ;
161 _mult_ct[T_COSSIN_CI >> TRA_T] = _mult_ct_t_cossin_ci ;
162 _mult_ct[T_COSSIN_CP >> TRA_T] = _mult_ct_t_cossin_cp ;
163 _mult_ct[T_COSSIN_SP >> TRA_T] = _mult_ct_t_cossin_sp ;
164 _mult_ct[T_COSSIN_C >> TRA_T] = _mult_ct_t_cossin_c ;
165 _mult_ct[T_COSSIN_S >> TRA_T] = _mult_ct_t_cossin_s ;
166 }
167
168 // Debut de la routine
169
170 // Protection
171 assert(etat == ETATQCQ) ;
172
173 // Boucle sur les zones
174 int base_t ;
175 for (int l=0 ; l<nzone ; l++) {
176 base_t = (base.b[l] & MSQ_T) >> TRA_T ;
177 assert(t[l] != 0x0) ;
178 _mult_ct[base_t](t[l], base.b[l]) ;
179 }
180}
181}
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
const Valeur & mult_ct() const
Returns applied to *this.
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
Valeur * p_mult_ct
Pointer on .
Definition valeur.h:320
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