LORENE
valeur_mult_xm1.C
1 /*
2  *
3  * Multiplication by (x-1) in the external compactified domain
4  *
5  * for:
6  * - Valeur
7  * - Mtbl_cf
8  */
9 
10 /*
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_mult_xm1.C,v 1.5 2021/11/22 15:19:45 j_novak Exp $
36  * $Log: valeur_mult_xm1.C,v $
37  * Revision 1.5 2021/11/22 15:19:45 j_novak
38  * Addition of new method mult_xm1_shell(int) to multiply by (\xi -1) in a
39  * given shell.
40  *
41  * Revision 1.4 2016/12/05 16:18:21 j_novak
42  * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
43  *
44  * Revision 1.3 2014/10/13 08:53:51 j_novak
45  * Lorene classes and functions now belong to the namespace Lorene.
46  *
47  * Revision 1.2 2014/10/06 15:13:24 j_novak
48  * Modified #include directives to use c++ syntax.
49  *
50  * Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon
51  * LORENE
52  *
53  * Revision 2.3 2000/03/09 16:54:23 eric
54  * Traitement du cas etat=ETATZERO
55  *
56  * Revision 2.2 1999/11/30 12:45:18 eric
57  * Valeur::base est desormais du type Base_val et non plus Base_val*.
58  *
59  * Revision 2.1 1999/10/18 13:42:33 eric
60  * Suppression de l'argument base dans les routines de derivation des mtbl_cf.
61  *
62  * Revision 2.0 1999/04/26 16:16:17 phil
63  * *** empty log message ***
64  *
65  *
66  * $Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_mult_xm1.C,v 1.5 2021/11/22 15:19:45 j_novak Exp $
67  *
68  */
69 
70 // Headers C
71 #include <cassert>
72 
73 // Headers Lorene
74 #include "mtbl_cf.h"
75 #include "valeur.h"
76 
77 // Local prototypes
78 namespace Lorene {
79 void _mult_xm1_identite(Tbl*, int&) ;
80 void _mult_xm1_cheb(Tbl*, int&) ;
81 
82 
83 void Valeur::mult_xm1_shell(int lz) {
84 
85  // Peut-etre ne rien faire ?
86  if (etat==ETATZERO) {
87  return ;
88  }
89 
90  assert(etat==ETATQCQ) ;
91 
92  // Calcul des coef.
93  coef() ;
94 
95  // Division par (x-1) dans la ZEC
96  c_cf->mult_xm1_shell(lz) ;
97  set_etat_cf_qcq() ;
98 
99  base = c_cf->base ; // On remonte la base de sortie au niveau Valeur
100 
101 }
102 
103 
104 /*
105  * Fonction membre de la classe Mtbl_cf pour la multiplication par (x-1)
106  * dans la zone externe compactifiee applique a this
107  *
108  */
109 
111 {
112 
113  if (mg->get_type_r(lz) != FIN) {
114  cerr << "Mtbl_cf::mult_xm1_shell() : not called on a shell!" << endl ;
115  abort() ;
116  }
117 
118  // Peut-etre ne rien faire ?
119  if (etat==ETATZERO) {
120  return ;
121  }
122 
123  assert(etat==ETATQCQ) ;
124 
125  _mult_xm1_cheb(t[lz], base.b[lz]) ;
126 
127 }
128 
130 
131  // Peut-etre ne rien faire ?
132  if (etat==ETATZERO) {
133  return ;
134  }
135 
136  assert(etat==ETATQCQ) ;
137 
138  // Calcul des coef.
139  coef() ;
140 
141  // Division par (x-1) dans la ZEC
142  c_cf->mult_xm1_zec() ;
143  set_etat_cf_qcq() ;
144 
145  base = c_cf->base ; // On remonte la base de sortie au niveau Valeur
146 
147 }
148 
149 
150 /*
151  * Fonction membre de la classe Mtbl_cf pour la multiplication par (x-1)
152  * dans la zone externe compactifiee applique a this
153  *
154  */
155 
157 {
158 
159 // Routines de derivation
160 static void (*_mult_xm1[MAX_BASE])(Tbl *, int&) ;
161 static int nap = 0 ;
162 
163  if (nap==0) {
164  nap = 1 ;
165  for (int i=0 ; i<MAX_BASE ; i++) {
166  _mult_xm1[i] = _mult_xm1_identite ;
167  }
168 
169  // Les routines existantes cas UNSURR
170  _mult_xm1[R_CHEBU >> TRA_R] = _mult_xm1_cheb ;
171  }
172 
173  // Peut-etre ne rien faire ?
174  if (etat==ETATZERO) {
175  return ;
176  }
177 
178  assert(etat==ETATQCQ) ;
179 
180  // Boucle sur les zones
181  for (int l=0 ; l<nzone ; l++) {
182  int base_r = (base.b[l] & MSQ_R) >> TRA_R ;
183  _mult_xm1[base_r](t[l], base.b[l]) ;
184  }
185 
186 }
187 
188 
189 }
Mtbl_cf * c_cf
Coefficients of the spectral expansion of the function.
Definition: valeur.h:312
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
Lorene prototypes.
Definition: app_hor.h:67
const Mg3d * mg
Pointer on the multi-grid Mgd3 on which this is defined.
Definition: mtbl_cf.h:202
void mult_xm1_zec()
Applies the following operator to *this : \ Id (r sampling = RARE, FIN ) \ (r -sampling = UNSURR ) ...
#define TRA_R
Translation en R, used for a bitwise shift (in hex)
Definition: type_parite.h:158
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
#define MSQ_R
Extraction de l&#39;info sur R.
Definition: type_parite.h:152
int nzone
Number of domains (zones)
Definition: mtbl_cf.h:204
void mult_xm1_shell(int index)
Applies the following operator to *this : \ Id (r sampling = RARE, UNSURR ) \ (r -sampling = FIN ) \...
void mult_xm1_zec()
Id (r sampling = RARE, FIN ) \ (r -sampling = UNSURR )
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
Basic array class.
Definition: tbl.h:164
#define R_CHEBU
base de Chebychev ordinaire (fin), dev. en 1/r
Definition: type_parite.h:180
int get_type_r(int l) const
Returns the type of sampling in the radial direction in domain no.
Definition: grilles.h:491
#define MAX_BASE
Nombre max. de bases differentes.
Definition: type_parite.h:144
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
void mult_xm1_shell(int i)
Id (r sampling = RARE, UNSURR ) \ (r -sampling = FIN )