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
30char valeur_smooth_C[] = "$Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_smooth.C,v 1.4 2014/10/13 08:53:51 j_novak Exp $" ;
31
32/*
33 * $Id: valeur_smooth.C,v 1.4 2014/10/13 08:53:51 j_novak Exp $
34 * $Log: valeur_smooth.C,v $
35 * Revision 1.4 2014/10/13 08:53:51 j_novak
36 * Lorene classes and functions now belong to the namespace Lorene.
37 *
38 * Revision 1.3 2014/10/06 15:13:24 j_novak
39 * Modified #include directives to use c++ syntax.
40 *
41 * Revision 1.2 2002/10/16 14:37:16 j_novak
42 * Reorganization of #include instructions of standard C++, in order to
43 * use experimental version 3 of gcc.
44 *
45 * Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon
46 * LORENE
47 *
48 * Revision 1.4 2001/10/10 13:56:07 eric
49 * Modif Joachim: pow(-1,i) --> pow(-1.,i).
50 *
51 * Revision 1.3 2001/01/16 16:11:41 keisuke
52 * Correct the initialization of the summation
53 * and insert some explanations.
54 *
55 * Revision 1.2 2001/01/16 15:15:12 keisuke
56 * change the argument and correct some errors.
57 *
58 * Revision 1.1 2001/01/16 14:54:54 keisuke
59 * Initial revision
60 *
61 *
62 * $Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_smooth.C,v 1.4 2014/10/13 08:53:51 j_novak Exp $
63 *
64 */
65
66// Headers C
67#include <cstdlib>
68#include <cmath>
69
70// Headers Lorene
71#include "valeur.h"
72
73//********************************************************************
74
75namespace Lorene {
76
77void Valeur::smooth(int nzet, Valeur& uuva) const {
78
79 int nucl = nzet - 1 ;
80 int nr = mg->get_nr(nucl) ;
81 int nt = mg->get_nt(nucl) ;
82 int np = mg->get_np(nucl) ;
83
84 // Protections
85 // -----------
86 assert(etat == ETATQCQ) ;
87 assert(nzet > 0) ;
88 assert(nr == mg->get_nr(nzet)) ;
89 assert(nt == mg->get_nt(nzet)) ;
90 assert(np == mg->get_np(nzet)) ;
91
92 Valeur pot(mg) ;
93 (*this).coef() ; // the spectral coefficients are required
94 pot = *((*this).c_cf) ;
95
96 Tbl& ccf_nucl = *((pot.c_cf)->t[nucl]) ;
97 Tbl& ccf_shell = *((pot.c_cf)->t[nzet]) ;
98
99
100 // Get the values at the outer boundary of the nucleus
101 //-----------------------------------------------------
102
103 Tbl nucl_kj(np, nt) ;
104 nucl_kj.set_etat_qcq() ;
105
106 for (int k=0 ; k<np ; k++) {
107 for (int j=0 ; j<nt ; j++) {
108
109 double tmp = 0. ;
110 for (int i=0 ; i<nr ; i++) {
111
112 tmp += ccf_nucl(k, j, i) ;
113
114 }
115 nucl_kj.set(k, j) = tmp ;
116 }
117 }
118
119
120 // Get the values at the inner boundary of the first shell
121 // without the last coefficient
122 //---------------------------------------------------------
123
124 Tbl shell_kj(np, nt) ;
125 shell_kj.set_etat_qcq() ;
126
127 for (int k=0 ; k<np ; k++) {
128 for (int j=0 ; j<nt ; j++) {
129
130 double tmp2 = 0. ;
131 for (int i=0 ; i<nr-1 ; i++) {
132
133 tmp2 += pow(-1., i) * ccf_shell(k, j, i) ;
134
135 }
136 shell_kj.set(k, j) = tmp2 ;
137 }
138 }
139
140
141 // Set the last coefficient of the first shell
142 //---------------------------------------------
143
144 uuva.set_etat_cf_qcq() ;
145 uuva.c_cf->set_etat_qcq() ;
146 uuva.c_cf->t[nzet]->set_etat_qcq() ;
147
148 Mtbl_cf& uuva_cf = *(uuva.c_cf) ;
149
150 for (int k=0 ; k<np ; k++) {
151 for (int j=0 ; j<nt ; j++) {
152
153 uuva_cf.set(nzet, k, j, nr-1) = nucl_kj(k, j) - shell_kj(k, j) ;
154
155 }
156 }
157
158 uuva.coef_i() ;
159
160}
161}
Time evolution with partial storage (*** under development ***).
Definition evolution.h:371
Coefficients storage for the multi-domain spectral method.
Definition mtbl_cf.h:186
Basic array class.
Definition tbl.h:161
Values and coefficients of a (real-value) function.
Definition valeur.h:287
const Mg3d * mg
Multi-grid Mgd3 on which this is defined.
Definition valeur.h:292
int etat
Logical state (ETATNONDEF , ETATQCQ or ETATZERO ).
Definition valeur.h:295
void smooth(int nzet, Valeur &uuva) const
Changes the function *this as a smooth one when there exists a discontinuity between the nucleus and ...
Cmp pow(const Cmp &, int)
Power .
Definition cmp_math.C:348
Lorene prototypes.
Definition app_hor.h:64