LORENE
ope_helmholtz_minus.C
1 /*
2  * Copyright (c) 2003 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 
22 
23 /*
24  * $Id: ope_helmholtz_minus.C,v 1.9 2016/12/05 16:18:11 j_novak Exp $
25  * $Log: ope_helmholtz_minus.C,v $
26  * Revision 1.9 2016/12/05 16:18:11 j_novak
27  * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
28  *
29  * Revision 1.8 2014/10/13 08:53:32 j_novak
30  * Lorene classes and functions now belong to the namespace Lorene.
31  *
32  * Revision 1.7 2014/10/06 15:13:15 j_novak
33  * Modified #include directives to use c++ syntax.
34  *
35  * Revision 1.6 2008/07/10 10:59:17 p_grandclement
36  * forgot another ones
37  *
38  * Revision 1.5 2004/08/24 09:14:45 p_grandclement
39  * Addition of some new operators, like Poisson in 2d... It now requieres the
40  * GSL library to work.
41  *
42  * Also, the way a variable change is stored by a Param_elliptic is changed and
43  * no longer uses Change_var but rather 2 Scalars. The codes using that feature
44  * will requiere some modification. (It should concern only the ones about monopoles)
45  *
46  * Revision 1.4 2004/01/15 09:15:38 p_grandclement
47  * Modification and addition of the Helmholtz operators
48  *
49  * Revision 1.3 2003/12/11 16:12:10 e_gourgoulhon
50  * Changed sqrt(2) to sqrt(double(2)).
51  *
52  * Revision 1.2 2003/12/11 15:57:27 p_grandclement
53  * include stdlib.h encore ...
54  *
55  * Revision 1.1 2003/12/11 14:48:50 p_grandclement
56  * Addition of ALL (and that is a lot !) the files needed for the general elliptic solver ... UNDER DEVELOPEMENT...
57  *
58  *
59  * $Header: /cvsroot/Lorene/C++/Source/Ope_elementary/ope_helmholtz_minus.C,v 1.9 2016/12/05 16:18:11 j_novak Exp $
60  *
61  */
62 #include <cmath>
63 #include <cstdlib>
64 
65 #include "proto.h"
66 #include "ope_elementary.h"
67 
68 // Standard constructor :
69 namespace Lorene {
70 Ope_helmholtz_minus::Ope_helmholtz_minus (int nbr, int base, int lquant,
71  double alf, double bet, double mas):
72  Ope_elementary(nbr, base, alf, bet), lq (lquant), masse (mas) {
73 }
74 
75 // Constructor by copy :
77  Ope_elementary(so), lq(so.lq), masse (so.masse) {
78 }
79 
80 // Destructor :
82 
83 // True functions :
85  if (ope_mat != 0x0)
86  delete ope_mat ;
87 
88  ope_mat = new Matrice
89  (helmholtz_minus_mat(nr, lq, alpha, beta, masse, base_r)) ;
90 }
91 
93  if (ope_mat == 0x0)
94  do_ope_mat() ;
95 
96  if (ope_cl != 0x0)
97  delete ope_cl ;
98 
99  ope_cl = new Matrice
100  (cl_helmholtz_minus(*ope_mat, base_r)) ;
101 }
102 
104  if (ope_cl == 0x0)
105  do_ope_cl() ;
106 
107  if (non_dege != 0x0)
108  delete non_dege ;
109 
110  non_dege = new Matrice
111  (prepa_helmholtz_minus_nondege(*ope_cl, base_r)) ;
112 }
113 
115 
116  if (non_dege == 0x0)
117  do_non_dege() ;
118 
119  Tbl res(solp_helmholtz_minus (*ope_mat, *non_dege, so, alpha, beta, lq, base_r));
120 
121  Tbl valeurs (val_solp (res, alpha, base_r)) ;
122  sp_plus = valeurs(0) ;
123  sp_minus = valeurs(1) ;
124  dsp_plus = valeurs(2) ;
125  dsp_minus = valeurs(3) ;
126 
127  return res ;
128 }
129 
131 
132  Tbl res (solh_helmholtz_minus (nr, lq, alpha, beta, masse, base_r)) ;
133 
134  // Un peu tricky...
135  if (res.get_ndim() == 1) {
136  Tbl val_lim (val_solp (res, alpha, base_r)) ;
137 
138  s_one_plus = val_lim(0) ;
139  s_one_minus = val_lim(1) ;
140  ds_one_plus = val_lim(2) ;
141  ds_one_minus = val_lim(3) ;
142 
143  }
144  else {
145  Tbl auxi (nr) ;
146  auxi.set_etat_qcq() ;
147  for (int i=0 ; i<nr ; i++)
148  auxi.set(i) = res(0,i) ;
149 
150  Tbl val_one (val_solp (auxi, alpha, base_r)) ;
151 
152  s_one_plus = val_one(0) ;
153  s_one_minus = val_one(1) ;
154  ds_one_plus = val_one(2) ;
155  ds_one_minus = val_one(3) ;
156 
157  for (int i=0 ; i<nr ; i++)
158  auxi.set(i) = res(1,i) ;
159 
160  Tbl val_two (val_solp (auxi, alpha, base_r)) ;
161 
162  s_two_plus = val_two(0) ;
163  s_two_minus = val_two(1) ;
164  ds_two_plus = val_two(2) ;
165  ds_two_minus = val_two(3) ;
166  }
167  return res ;
168 }
169 
170 
171 
173 
174  cout << "inc_l_quant not implemented for Helmholtz operator." << endl ;
175  abort() ;
176 }
177 }
double alpha
Parameter of the associated mapping.
virtual ~Ope_helmholtz_minus()
Destructor.
Matrice * ope_cl
Pointer on the banded-matrix of the operator.
double s_one_minus
Value of the first homogeneous solution at the inner boundary.
double ds_two_minus
Value of the derivative of the second homogeneous solution at the inner boundary. ...
double beta
Parameter of the associated mapping.
virtual void do_non_dege() const
Computes the non-degenerated matrix of the operator.
Lorene prototypes.
Definition: app_hor.h:67
Matrice * ope_mat
Pointer on the matrix representation of the operator.
double dsp_minus
Value of the derivative of the particular solution at the inner boundary.
double & set(int i)
Read/write of a particular element (index i) (1D case)
Definition: tbl.h:301
double ds_two_plus
Value of the derivative of the second homogeneous solution at the outer boundary. ...
virtual Tbl get_solp(const Tbl &so) const
Computes the particular solution, given the source so .
virtual void inc_l_quant()
Increases the quatum number l by one unit (CURRENTLY NOT IMPLEMENTED)
double sp_minus
Value of the particular solution at the inner boundary.
int base_r
Radial basis of decomposition.
double sp_plus
Value of the particular solution at the outer boundary.
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Definition: tbl.C:364
double ds_one_plus
Value of the derivative of the first homogeneous solution at the outer boundary.
int get_ndim() const
Gives the number of dimensions (ie dim.ndim)
Definition: tbl.h:420
double dsp_plus
Value of the derivative of the particular solution at the outer boundary.
Ope_helmholtz_minus(int nbr, int baser, int lq, double alf, double bet, double mas)
Standard constructor.
Matrix handling.
Definition: matrice.h:152
double s_two_minus
Value of the second homogeneous solution at the inner boundary.
double s_one_plus
Value of the first homogeneous solution at the outer boundary.
Basic class for elementary elliptic operators.
int lq
The quantum number l.
virtual void do_ope_mat() const
Computes the matrix of the operator.
virtual void do_ope_cl() const
Computes the banded-matrix of the operator.
Class for the Helmholtz operator ( ).
int nr
Number of radial points.
double ds_one_minus
Value of the derivative of the first homogeneous solution at the inner boundary.
double masse
The mass parameter m .
Basic array class.
Definition: tbl.h:164
double s_two_plus
Value of the second homogeneous solution at the outer boundary.
virtual Tbl get_solh() const
Computes the homogeneous solutions(s).
Matrice * non_dege
Pointer on the non-degenerated matrix of the operator.