LORENE
valeur_smooth.C
1 /*
2  * Method of the class Valeur to make a function be smooth
3  * between the nucleus and the first shell.
4  *
5  * (see file valeur.h for the documentation).
6  */
7 
8 /*
9  * Copyright (c) 2000-2001 Keisuke Taniguchi
10  *
11  * This file is part of LORENE.
12  *
13  * LORENE is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 2 of the License, or
16  * (at your option) any later version.
17  *
18  * LORENE is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with LORENE; if not, write to the Free Software
25  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26  *
27  */
28 
29 
30 
31 
32 /*
33  * $Id: valeur_smooth.C,v 1.5 2016/12/05 16:18:21 j_novak Exp $
34  * $Log: valeur_smooth.C,v $
35  * Revision 1.5 2016/12/05 16:18:21 j_novak
36  * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
37  *
38  * Revision 1.4 2014/10/13 08:53:51 j_novak
39  * Lorene classes and functions now belong to the namespace Lorene.
40  *
41  * Revision 1.3 2014/10/06 15:13:24 j_novak
42  * Modified #include directives to use c++ syntax.
43  *
44  * Revision 1.2 2002/10/16 14:37:16 j_novak
45  * Reorganization of #include instructions of standard C++, in order to
46  * use experimental version 3 of gcc.
47  *
48  * Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon
49  * LORENE
50  *
51  * Revision 1.4 2001/10/10 13:56:07 eric
52  * Modif Joachim: pow(-1,i) --> pow(-1.,i).
53  *
54  * Revision 1.3 2001/01/16 16:11:41 keisuke
55  * Correct the initialization of the summation
56  * and insert some explanations.
57  *
58  * Revision 1.2 2001/01/16 15:15:12 keisuke
59  * change the argument and correct some errors.
60  *
61  * Revision 1.1 2001/01/16 14:54:54 keisuke
62  * Initial revision
63  *
64  *
65  * $Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_smooth.C,v 1.5 2016/12/05 16:18:21 j_novak Exp $
66  *
67  */
68 
69 // Headers C
70 #include <cstdlib>
71 #include <cmath>
72 
73 // Headers Lorene
74 #include "valeur.h"
75 
76 //********************************************************************
77 
78 namespace Lorene {
79 
80 void Valeur::smooth(int nzet, Valeur& uuva) const {
81 
82  int nucl = nzet - 1 ;
83  int nr = mg->get_nr(nucl) ;
84  int nt = mg->get_nt(nucl) ;
85  int np = mg->get_np(nucl) ;
86 
87  // Protections
88  // -----------
89  assert(etat == ETATQCQ) ;
90  assert(nzet > 0) ;
91  assert(nr == mg->get_nr(nzet)) ;
92  assert(nt == mg->get_nt(nzet)) ;
93  assert(np == mg->get_np(nzet)) ;
94 
95  Valeur pot(mg) ;
96  (*this).coef() ; // the spectral coefficients are required
97  pot = *((*this).c_cf) ;
98 
99  Tbl& ccf_nucl = *((pot.c_cf)->t[nucl]) ;
100  Tbl& ccf_shell = *((pot.c_cf)->t[nzet]) ;
101 
102 
103  // Get the values at the outer boundary of the nucleus
104  //-----------------------------------------------------
105 
106  Tbl nucl_kj(np, nt) ;
107  nucl_kj.set_etat_qcq() ;
108 
109  for (int k=0 ; k<np ; k++) {
110  for (int j=0 ; j<nt ; j++) {
111 
112  double tmp = 0. ;
113  for (int i=0 ; i<nr ; i++) {
114 
115  tmp += ccf_nucl(k, j, i) ;
116 
117  }
118  nucl_kj.set(k, j) = tmp ;
119  }
120  }
121 
122 
123  // Get the values at the inner boundary of the first shell
124  // without the last coefficient
125  //---------------------------------------------------------
126 
127  Tbl shell_kj(np, nt) ;
128  shell_kj.set_etat_qcq() ;
129 
130  for (int k=0 ; k<np ; k++) {
131  for (int j=0 ; j<nt ; j++) {
132 
133  double tmp2 = 0. ;
134  for (int i=0 ; i<nr-1 ; i++) {
135 
136  tmp2 += pow(-1., i) * ccf_shell(k, j, i) ;
137 
138  }
139  shell_kj.set(k, j) = tmp2 ;
140  }
141  }
142 
143 
144  // Set the last coefficient of the first shell
145  //---------------------------------------------
146 
147  uuva.set_etat_cf_qcq() ;
148  uuva.c_cf->set_etat_qcq() ;
149  uuva.c_cf->t[nzet]->set_etat_qcq() ;
150 
151  Mtbl_cf& uuva_cf = *(uuva.c_cf) ;
152 
153  for (int k=0 ; k<np ; k++) {
154  for (int j=0 ; j<nt ; j++) {
155 
156  uuva_cf.set(nzet, k, j, nr-1) = nucl_kj(k, j) - shell_kj(k, j) ;
157 
158  }
159  }
160 
161  uuva.coef_i() ;
162 
163 }
164 }
Mtbl_cf * c_cf
Coefficients of the spectral expansion of the function.
Definition: valeur.h:312
int get_np(int l) const
Returns the number of points in the azimuthal direction ( ) in domain no. l.
Definition: grilles.h:479
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
Lorene prototypes.
Definition: app_hor.h:67
Tbl & set(int l)
Read/write of the Tbl containing the coefficients in a given domain.
Definition: mtbl_cf.h:304
double & set(int i)
Read/write of a particular element (index i) (1D case)
Definition: tbl.h:301
void coef_i() const
Computes the physical value of *this.
Values and coefficients of a (real-value) function.
Definition: valeur.h:297
void smooth(int nzet, Valeur &uuva) const
Changes the function *this as a smooth one when there exists a discontinuity between the nucleus and ...
Definition: valeur_smooth.C:80
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Definition: tbl.C:364
const Mg3d * mg
Multi-grid Mgd3 on which this is defined.
Definition: valeur.h:302
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Definition: mtbl_cf.C:303
Cmp pow(const Cmp &, int)
Power .
Definition: cmp_math.C:351
int get_nr(int l) const
Returns the number of points in the radial direction ( ) in domain no. l.
Definition: grilles.h:469
Coefficients storage for the multi-domain spectral method.
Definition: mtbl_cf.h:196
int etat
Logical state (ETATNONDEF , ETATQCQ or ETATZERO ).
Definition: valeur.h:305
Basic array class.
Definition: tbl.h:164
int get_nt(int l) const
Returns the number of points in the co-latitude direction ( ) in domain no. l.
Definition: grilles.h:474
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