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