LORENE
valeur_mult_cp.C
1/*
2 * Methods for multiplication by cos(phi) for classes
3 * - Valeur
4 * - Mtbl_cf
5 */
6
7/*
8 * Copyright (c) 2000-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
29
30
31/*
32 * $Id: valeur_mult_cp.C,v 1.5 2016/12/05 16:18:21 j_novak Exp $
33 * $Log: valeur_mult_cp.C,v $
34 * Revision 1.5 2016/12/05 16:18:21 j_novak
35 * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
36 *
37 * Revision 1.4 2014/10/13 08:53:50 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:27 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.2 2000/09/18 10:15:08 eric
50 * Ajout des bases P_COSSIN_P et P_COSSIN_I
51 *
52 * Revision 2.1 2000/09/11 15:03:56 eric
53 * *** empty log message ***
54 *
55 * Revision 2.0 2000/09/11 13:53:52 eric
56 * *** empty log message ***
57 *
58 *
59 * $Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_mult_cp.C,v 1.5 2016/12/05 16:18:21 j_novak Exp $
60 *
61 */
62
63// Headers C
64#include <cassert>
65
66// Headers Lorene
67#include "mtbl_cf.h"
68#include "valeur.h"
69
70// Local prototypes
71namespace Lorene {
72void _mult_cp_pas_prevu(Tbl*, int&) ;
73void _mult_cp_p_cossin(Tbl*, int&) ;
74void _mult_cp_p_cossin_p(Tbl*, int&) ;
75void _mult_cp_p_cossin_i(Tbl*, int&) ;
76
77// Version membre d'un Valeur
78// --------------------------
79
80const Valeur& Valeur::mult_cp() const {
81
82 // Protection
83 assert(etat != ETATNONDEF) ;
84
85 // Peut-etre rien a faire ?
86 if (p_mult_cp != 0x0) {
87 return *p_mult_cp ;
88 }
89
90 // ... si, il faut bosser
91
92 p_mult_cp = new Valeur(mg) ;
93
94 if (etat == ETATZERO) {
95 p_mult_cp->set_etat_zero() ;
96 }
97 else {
98 assert(etat == ETATQCQ) ;
99 p_mult_cp->set_etat_cf_qcq() ;
100 Mtbl_cf* cfp = p_mult_cp->c_cf ; // Pointeur sur le Mtbl_cf qui vient d'etre
101 // cree par le set_etat_cf_qcq()
102
103 // Initialisation de *cfp : recopie des coef. de la fonction
104 if (c_cf == 0x0) {
105 coef() ;
106 }
107 *cfp = *c_cf ;
108
109 cfp->mult_cp() ; // calcul
110
111 p_mult_cp->base = cfp->base ; // On remonte la base de sortie au niveau Valeur
112 }
113
114 // Termine
115 return *p_mult_cp ;
116}
117
118
119
120// Version membre d'un Mtbl_cf
121// ---------------------------
122
124
125// Routines de derivation
126static void (*_mult_cp[MAX_BASE_2])(Tbl *, int &) ;
127static int nap = 0 ;
128
129 // Premier appel
130 if (nap==0) {
131 nap = 1 ;
132 for (int i=0 ; i<MAX_BASE_2 ; i++) {
133 _mult_cp[i] = _mult_cp_pas_prevu ;
134 }
135 // Les routines existantes
136 _mult_cp[P_COSSIN >> TRA_P] = _mult_cp_p_cossin ;
137 _mult_cp[P_COSSIN_P >> TRA_P] = _mult_cp_p_cossin_p ;
138 _mult_cp[P_COSSIN_I >> TRA_P] = _mult_cp_p_cossin_i ;
139 }
140
141 // Debut de la routine
142
143 // Protection
144 assert(etat == ETATQCQ) ;
145
146 // Boucle sur les zones
147 for (int l=0 ; l<nzone ; l++) {
148 int base_p = (base.b[l] & MSQ_P) >> TRA_P ;
149 assert(t[l] != 0x0) ;
150 _mult_cp[base_p](t[l], base.b[l]) ;
151 }
152}
153}
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
Valeur * p_mult_cp
Pointer on .
Definition valeur.h:336
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.
int etat
Logical state (ETATNONDEF , ETATQCQ or ETATZERO ).
Definition valeur.h:305
const Valeur & mult_cp() 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:67