LORENE
valeur_mult_sp.C
1/*
2 * Methods for multiplication by sin(phi) for classes
3 * - Valeur
4 * - Mtbl_cf
5 */
6
7/*
8 * Copyright (c) 1999-2001 Eric Gourgoulhon
9 *
10 * This file is part of LORENE.
11 *
12 * LORENE is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * LORENE is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with LORENE; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 *
26 */
27
28
29char valeur_mult_sp_C[] = "$Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_mult_sp.C,v 1.4 2014/10/13 08:53:50 j_novak Exp $" ;
30
31/*
32 * $Id: valeur_mult_sp.C,v 1.4 2014/10/13 08:53:50 j_novak Exp $
33 * $Log: valeur_mult_sp.C,v $
34 * Revision 1.4 2014/10/13 08:53:50 j_novak
35 * Lorene classes and functions now belong to the namespace Lorene.
36 *
37 * Revision 1.3 2014/10/06 15:13:23 j_novak
38 * Modified #include directives to use c++ syntax.
39 *
40 * Revision 1.2 2012/01/17 15:08:32 j_penner
41 * using MAX_BASE_2 for the phi coordinate
42 *
43 * Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon
44 * LORENE
45 *
46 * Revision 2.2 2000/09/18 10:15:20 eric
47 * Ajout des bases P_COSSIN_P et P_COSSIN_I
48 *
49 * Revision 2.1 2000/09/11 15:04:04 eric
50 * *** empty log message ***
51 *
52 * Revision 2.0 2000/09/11 13:54:00 eric
53 * *** empty log message ***
54 *
55 *
56 * $Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_mult_sp.C,v 1.4 2014/10/13 08:53:50 j_novak Exp $
57 *
58 */
59
60// Headers C
61#include <cassert>
62
63// Headers Lorene
64#include "mtbl_cf.h"
65#include "valeur.h"
66
67// Local prototypes
68namespace Lorene {
69void _mult_sp_pas_prevu(Tbl*, int&) ;
70void _mult_sp_p_cossin(Tbl*, int&) ;
71void _mult_sp_p_cossin_p(Tbl*, int&) ;
72void _mult_sp_p_cossin_i(Tbl*, int&) ;
73
74// Version membre d'un Valeur
75// --------------------------
76
77const Valeur& Valeur::mult_sp() const {
78
79 // Protection
80 assert(etat != ETATNONDEF) ;
81
82 // Peut-etre rien a faire ?
83 if (p_mult_sp != 0x0) {
84 return *p_mult_sp ;
85 }
86
87 // ... si, il faut bosser
88
89 p_mult_sp = new Valeur(mg) ;
90
91 if (etat == ETATZERO) {
93 }
94 else {
95 assert(etat == ETATQCQ) ;
97 Mtbl_cf* cfp = p_mult_sp->c_cf ; // Pointeur sur le Mtbl_cf qui vient d'etre
98 // cree par le set_etat_cf_qcq()
99
100 // Initialisation de *cfp : recopie des coef. de la fonction
101 if (c_cf == 0x0) {
102 coef() ;
103 }
104 *cfp = *c_cf ;
105
106 cfp->mult_sp() ; // calcul
107
108 p_mult_sp->base = cfp->base ; // On remonte la base de sortie au niveau Valeur
109 }
110
111 // Termine
112 return *p_mult_sp ;
113}
114
115
116
117// Version membre d'un Mtbl_cf
118// ---------------------------
119
121
122// Routines de derivation
123static void (*_mult_sp[MAX_BASE_2])(Tbl *, int &) ;
124static int nap = 0 ;
125
126 // Premier appel
127 if (nap==0) {
128 nap = 1 ;
129 for (int i=0 ; i<MAX_BASE_2 ; i++) {
130 _mult_sp[i] = _mult_sp_pas_prevu ;
131 }
132 // Les routines existantes
133 _mult_sp[P_COSSIN >> TRA_P] = _mult_sp_p_cossin ;
134 _mult_sp[P_COSSIN_P >> TRA_P] = _mult_sp_p_cossin_p ;
135 _mult_sp[P_COSSIN_I >> TRA_P] = _mult_sp_p_cossin_i ;
136 }
137
138 // Debut de la routine
139
140 // Protection
141 assert(etat == ETATQCQ) ;
142
143 // Boucle sur les zones
144 for (int l=0 ; l<nzone ; l++) {
145 int base_p = (base.b[l] & MSQ_P) >> TRA_P ;
146 assert(t[l] != 0x0) ;
147 _mult_sp[base_p](t[l], base.b[l]) ;
148 }
149}
150}
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_mult_sp
Pointer on .
Definition valeur.h:327
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
const Valeur & mult_sp() const
Returns applied to *this.
#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