LORENE
scalar_raccord.C
1 /*
2  * Copyright (c) 2003 Eric Gourgoulhon & Jerome Novak
3  *
4  * Copyright (c) 2000-2001 Philippe Grandclement (for preceding Cmp version)
5  *
6  * This file is part of LORENE.
7  *
8  * LORENE is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * LORENE is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with LORENE; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21  *
22  */
23 
24 
25 
26 
27 /*
28  * $Id: scalar_raccord.C,v 1.5 2016/12/05 16:18:19 j_novak Exp $
29  * $Log: scalar_raccord.C,v $
30  * Revision 1.5 2016/12/05 16:18:19 j_novak
31  * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
32  *
33  * Revision 1.4 2014/10/13 08:53:47 j_novak
34  * Lorene classes and functions now belong to the namespace Lorene.
35  *
36  * Revision 1.3 2014/10/06 15:16:16 j_novak
37  * Modified #include directives to use c++ syntax.
38  *
39  * Revision 1.2 2003/10/01 13:04:44 e_gourgoulhon
40  * The method Tensor::get_mp() returns now a reference (and not
41  * a pointer) onto a mapping.
42  *
43  * Revision 1.1 2003/09/25 08:58:10 e_gourgoulhon
44  * First version.
45  *
46  *
47  * $Header: /cvsroot/Lorene/C++/Source/Tensor/Scalar/scalar_raccord.C,v 1.5 2016/12/05 16:18:19 j_novak Exp $
48  *
49  */
50 
51 //standard
52 #include <cstdlib>
53 
54 // LORENE
55 #include "tensor.h"
56 #include "proto.h"
57 #include "matrice.h"
58 
59 namespace Lorene {
60 Matrice matrice_raccord_pair (int cont, double alpha_kernel) ;
61 Matrice matrice_raccord_impair (int cont, double alpha_kernel) ;
62 Tbl sec_membre_raccord (Tbl coef, int cont, double alpha_shell) ;
63 Tbl regularise (Tbl coef, int nr, int base_r) ;
64 
65 void Scalar::raccord (int aux) {
66 
67  assert (etat != ETATNONDEF) ;
68 
69  assert (aux >=0) ;
70  int cont = aux+1 ;
71 
72  const Map_af* mapping = dynamic_cast<const Map_af*>( mp ) ;
73 
74  if (mapping == 0x0) {
75  cout <<
76  "Scalar::raccord : The mapping does not belong to the class Map_af !"
77  << endl ;
78  abort() ;
79  }
80 
81  assert (mapping->get_mg()->get_type_r(1) == FIN) ;
82  assert (mapping->get_mg()->get_type_r(0) == RARE) ;
83 
84  // On passe en Ylm et vire tout dans la zone interne...
85  va.coef() ;
86  va.ylm() ;
88  va.c_cf->t[0]->annule_hard() ;
89 
90  // Confort :
91  int nz = mapping->get_mg()->get_nzone() ;
92  int nbrer_kernel = mapping->get_mg()->get_nr(0) ;
93  int nbrer_shell = mapping->get_mg()->get_nr(1) ;
94 
95  int nbret_kernel = mapping->get_mg()->get_nt(0) ;
96  int nbret_shell = mapping->get_mg()->get_nt(1) ;
97 
98  int nbrep_kernel = mapping->get_mg()->get_np(0) ;
99  int nbrep_shell = mapping->get_mg()->get_np(1) ;
100 
101  double alpha_kernel = mapping->get_alpha()[0] ;
102  double alpha_shell = mapping->get_alpha()[1] ;
103 
104  int base_r, m_quant, l_quant ;
105 
106  for (int k=0 ; k<nbrep_kernel+1 ; k++)
107  for (int j=0 ; j<nbret_kernel ; j++)
108  if (nullite_plm(j, nbret_kernel, k,nbrep_kernel, va.base) == 1)
109  if (nullite_plm(j, nbret_shell, k, nbrep_shell, va.base) == 1)
110  {
111  // calcul des nombres quantiques :
112  donne_lm(nz, 0, j, k, va.base, m_quant, l_quant, base_r) ;
113  assert ((base_r == R_CHEBP) || (base_r == R_CHEBI)) ;
114 
115  Matrice systeme(cont, cont) ;
116 
117  Tbl facteur (nbrer_kernel) ;
118  facteur.annule_hard() ;
119  for (int i=0 ; i<nbrer_shell ; i++)
120  if (i<nbrer_kernel)
121  facteur.set(i) = (*va.c_cf)(1, k, j, i) ;
122 
123  Tbl sec_membre (sec_membre_raccord (facteur, cont, alpha_shell)) ;
124 
125  if (base_r == R_CHEBP)
126  systeme = matrice_raccord_pair (cont, alpha_kernel) ;
127  else
128  systeme = matrice_raccord_impair (cont, alpha_kernel) ;
129 
130  Tbl soluce (systeme.inverse(sec_membre)) ;
131  Tbl regulier (nbrer_kernel) ;
132 
133  if (l_quant == 0)
134  for (int i=0 ; i<cont ; i++)
135  va.c_cf->set(0, k, j, i) = soluce(i) ;
136  else {
137  if (l_quant %2 == 0)
138  regulier = regularise (soluce, nbrer_kernel, R_CHEBP) ;
139  else
140  regulier = regularise (soluce, nbrer_kernel, R_CHEBI) ;
141 
142  for (int i=0 ; i<nbrer_kernel ; i++)
143  va.c_cf->set(0, k, j, i) = regulier(i) ;
144  }
145  }
146  va.ylm_i() ;
147 }
148 }
Mtbl_cf * c_cf
Coefficients of the spectral expansion of the function.
Definition: valeur.h:312
const double * get_alpha() const
Returns the pointer on the array alpha.
Definition: map_af.C:607
void ylm_i()
Inverse of ylm()
Definition: valeur_ylm_i.C:134
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
void coef() const
Computes the coeffcients of *this.
Definition: valeur_coef.C:151
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
Tbl inverse(const Tbl &sec_membre) const
Solves the linear system represented by the matrix.
Definition: matrice.C:427
void ylm()
Computes the coefficients of *this.
Definition: valeur_ylm.C:141
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
Definition: map.h:783
double & set(int i)
Read/write of a particular element (index i) (1D case)
Definition: tbl.h:301
void raccord(int n)
Performs the matching of the nucleus with respect to the first shell.
#define R_CHEBI
base de Cheb. impaire (rare) seulement
Definition: type_parite.h:170
#define R_CHEBP
base de Cheb. paire (rare) seulement
Definition: type_parite.h:168
Matrix handling.
Definition: matrice.h:152
Base_val base
Bases on which the spectral expansion is performed.
Definition: valeur.h:315
int get_nzone() const
Returns the number of domains.
Definition: grilles.h:465
Valeur va
The numerical value of the Scalar.
Definition: scalar.h:411
int get_nr(int l) const
Returns the number of points in the radial direction ( ) in domain no. l.
Definition: grilles.h:469
Affine radial mapping.
Definition: map.h:2048
int etat
The logical state ETATNONDEF (undefined), ETATZERO (null), ETATUN (one), or ETATQCQ (ordinary)...
Definition: scalar.h:402
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
int get_type_r(int l) const
Returns the type of sampling in the radial direction in domain no.
Definition: grilles.h:491
const Map *const mp
Mapping on which the numerical values at the grid points are defined.
Definition: tensor.h:301
void annule_hard()
Sets the Tbl to zero in a hard way.
Definition: tbl.C:375
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