LORENE
param_elliptic_pseudo_1d.C
1 /*
2  * Copyright (c) 2004 Philippe Grandclement
3  *
4  * This file is part of LORENE.
5  *
6  * LORENE is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2
8  * as published by the Free Software Foundation.
9  *
10  * LORENE is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with LORENE; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  */
20 
21 char param_elliptic_pseudo_1d_C[] = "$Header: /cvsroot/Lorene/C++/Source/Param_elliptic/param_elliptic_pseudo_1d.C,v 1.3 2014/10/13 08:53:37 j_novak Exp $" ;
22 
23 /*
24  * $Id: param_elliptic_pseudo_1d.C,v 1.3 2014/10/13 08:53:37 j_novak Exp $
25  * $Log: param_elliptic_pseudo_1d.C,v $
26  * Revision 1.3 2014/10/13 08:53:37 j_novak
27  * Lorene classes and functions now belong to the namespace Lorene.
28  *
29  * Revision 1.2 2014/10/06 15:13:15 j_novak
30  * Modified #include directives to use c++ syntax.
31  *
32  * Revision 1.1 2004/08/24 09:14:49 p_grandclement
33  * Addition of some new operators, like Poisson in 2d... It now requieres the
34  * GSL library to work.
35  *
36  * Also, the way a variable change is stored by a Param_elliptic is changed and
37  * no longer uses Change_var but rather 2 Scalars. The codes using that feature
38  * will requiere some modification. (It should concern only the ones about monopoles)
39  *
40  *
41  * $Header: /cvsroot/Lorene/C++/Source/Param_elliptic/param_elliptic_pseudo_1d.C,v 1.3 2014/10/13 08:53:37 j_novak Exp $
42  *
43  */
44 
45 #include "headcpp.h"
46 
47 #include <cmath>
48 #include <cstdlib>
49 
50 #include "param_elliptic.h"
51 #include "base_val.h"
52 #include "map.h"
53 #include "ope_elementary.h"
54 #include "change_var.h"
55 #include "scalar.h"
56 
57 
58 namespace Lorene {
60 
61  if (type_map != MAP_AFF) {
62  cout << "set_poisson_pseudo_1d only defined for an affine mapping..." << endl ;
63  abort() ;
64  }
65  else {
66 
67  int nz = get_mp().get_mg()->get_nzone() ;
68 
69  int nr ;
70  double alpha, beta ;
71  int m_quant, l_quant, base_r_1d ;
72 
73  int conte = 0 ;
74  for (int l=0 ; l<nz ; l++) {
75 
76  nr = get_mp().get_mg()->get_nr(l) ;
77  alpha = get_alpha (l) ;
78  beta = get_beta (l) ;
79 
80  for (int k=0 ; k<get_mp().get_mg()->get_np(l)+1 ; k++)
81  for (int j=0 ; j<get_mp().get_mg()->get_nt(l) ; j++) {
82  if (operateurs[conte] != 0x0)
83  delete operateurs[conte] ;
84  source.get_spectral_va().base.give_quant_numbers(l, k, j, m_quant, l_quant, base_r_1d) ;
85  if ((k!=1) && (l!=nz-1))
86  operateurs[conte] = new Ope_poisson_pseudo_1d (nr, base_r_1d, alpha, beta, l_quant) ;
87  else
88  operateurs[conte] = 0x0 ;
89  conte ++ ;
90  }
91  }
92  }
93 }
94 
95 void Param_elliptic::set_helmholtz_minus_pseudo_1d(int zone, double masse, Scalar& source) {
96 
97  int dzpuis = source.get_dzpuis() ;
98  assert (masse > 0) ;
99 
100  if (type_map != MAP_AFF) {
101  cout << "set_helmholtz_minus_pseudo_1d only defined for an affine mapping..." << endl ;
102  abort() ;
103  }
104  else {
105 
106  int nz = get_mp().get_mg()->get_nzone() ;
107  if (zone == nz-1)
108  source.check_dzpuis(2) ;
109  int nr ;
110  double alpha, beta ;
111  int m_quant, l_quant, base_r_1d ;
112 
113  int conte = 0 ;
114  for (int l=0 ; l<nz ; l++) {
115 
116  nr = get_mp().get_mg()->get_nr(l) ;
117  alpha = get_alpha (l) ;
118  beta = get_beta (l) ;
119 
120  for (int k=0 ; k<get_mp().get_mg()->get_np(l)+1 ; k++)
121  for (int j=0 ; j<get_mp().get_mg()->get_nt(l) ; j++) {
122  if (l==zone) {
123  if (operateurs[conte] != 0x0)
124  delete operateurs[conte] ;
126  (l, k, j, m_quant, l_quant, base_r_1d) ;
127  operateurs[conte] = new Ope_helmholtz_minus_pseudo_1d (nr, base_r_1d,
128  alpha, beta, l_quant, masse, dzpuis) ;
129  }
130  conte ++ ;
131  }
132  }
133  }
134 }
135 
136 }
int get_np(int l) const
Returns the number of points in the azimuthal direction ( ) in domain no. l.
Definition: grilles.h:462
void give_quant_numbers(int, int, int, int &, int &, int &) const
Computes the various quantum numbers and 1d radial base.
Lorene prototypes.
Definition: app_hor.h:64
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
Definition: map.h:765
Tensor field of valence 0 (or component of a tensorial field).
Definition: scalar.h:387
Class for the operator of the modified Helmholtz equation in pseudo-1d.
Base_val base
Bases on which the spectral expansion is performed.
Definition: valeur.h:305
int get_dzpuis() const
Returns dzpuis.
Definition: scalar.h:557
int type_map
Type of mapping either MAP_AFF or MAP_LOG.
const Map_radial & get_mp() const
Returns the mapping.
int get_nzone() const
Returns the number of domains.
Definition: grilles.h:448
Class for the operator of the Poisson equation in pseudo 1d.
Ope_elementary ** operateurs
Array on the elementary operators.
int get_nr(int l) const
Returns the number of points in the radial direction ( ) in domain no. l.
Definition: grilles.h:452
void set_poisson_pseudo_1d(Scalar &so)
Set the operator to everywhere but in the compactified domain.
int get_nt(int l) const
Returns the number of points in the co-latitude direction ( ) in domain no. l.
Definition: grilles.h:457
bool check_dzpuis(int dzi) const
Returns false if the last domain is compactified and *this is not zero in this domain and dzpuis is n...
Definition: scalar.C:873
void set_helmholtz_minus_pseudo_1d(int zone, double mas, Scalar &so)
Set the operator to in one domain.
const Valeur & get_spectral_va() const
Returns va (read only version)
Definition: scalar.h:601