LORENE
ope_vorton_mat.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_vorton_mat.C,v 1.5 2016/12/05 16:18:13 j_novak Exp $
25  * $Header: /cvsroot/Lorene/C++/Source/Ope_elementary/Ope_vorton/ope_vorton_mat.C,v 1.5 2016/12/05 16:18:13 j_novak Exp $
26  *
27  */
28 #include <cmath>
29 #include <cstdlib>
30 
31 #include "proto.h"
32 #include "ope_elementary.h"
33 #include "diff.h"
34 
35 
36  //-----------------------------------
37  // Routine pour les cas non prevus --
38  //-----------------------------------
39 
40 namespace Lorene {
41 Matrice _vorton_mat_pas_prevu(int, double, double, int, int) {
42  cout << "Vorton : base not implemented..." << endl ;
43  abort() ;
44  exit(-1) ;
45  Matrice res(1, 1) ;
46  return res;
47 }
48  //-------------------------
49  //-- CAS R_CHEBU -----
50  //------------------------
51 
52 Matrice _vorton_mat_r_chebu_trois (int n, int lq) {
53 
54 
55  Diff_xdsdx2 xdd(R_CHEBU, n) ;
56  Diff_dsdx d(R_CHEBU, n) ;
57  Diff_sx sx(R_CHEBU, n) ;
58 
59  return (xdd+2*d-lq*(lq+1)*sx) ;
60 }
61 
62 Matrice _vorton_mat_r_chebu (int n, double, double, int lq, int dz) {
63  Matrice res(n, n) ;
64  res.set_etat_qcq() ;
65  switch (dz) {
66  case 3 :
67  res = _vorton_mat_r_chebu_trois (n, lq) ;
68  break ;
69  default :
70  abort() ;
71  exit(-1) ;
72  }
73  return res ;
74 }
75 
76 
77 
78  //-------------------------
79  //-- CAS R_CHEB -----
80  //------------------------
81 
82 Matrice _vorton_mat_r_cheb (int n, double alpha, double beta, int lq, int) {
83  Diff_dsdx2 d2(R_CHEB, n) ;
84  Diff_xdsdx2 xd2(R_CHEB, n) ;
85  Diff_x2dsdx2 x2d2(R_CHEB, n) ;
86  Diff_dsdx d1(R_CHEB, n) ;
87  Diff_xdsdx xd1(R_CHEB, n) ;
88  Diff_id id(R_CHEB, n) ;
89 
90  double echelle = beta/alpha ;
91  return (x2d2 + (2*echelle)*xd2 + (echelle*echelle)*d2 - (lq*(lq+1))*id) ;
92 }
93 
94 void Ope_vorton::do_ope_mat() const {
95  if (ope_mat != 0x0)
96  delete ope_mat ;
97 
98  // Routines de derivation
99  static Matrice (*vorton_mat[MAX_BASE])(int, double, double, int, int);
100  static int nap = 0 ;
101 
102  // Premier appel
103  if (nap==0) {
104  nap = 1 ;
105  for (int i=0 ; i<MAX_BASE ; i++) {
106  vorton_mat[i] = _vorton_mat_pas_prevu ;
107  }
108  // Les routines existantes
109  vorton_mat[R_CHEB >> TRA_R] = _vorton_mat_r_cheb ;
110  vorton_mat[R_CHEBU >> TRA_R] = _vorton_mat_r_chebu ;
111  }
112  ope_mat = new Matrice(vorton_mat[base_r](nr, alpha, beta, l_quant, dzpuis)) ;
113 }
114 }
double alpha
Parameter of the associated mapping.
int l_quant
quantum number
double beta
Parameter of the associated mapping.
Lorene prototypes.
Definition: app_hor.h:67
Matrice * ope_mat
Pointer on the matrix representation of the operator.
int dzpuis
the associated dzpuis, if in the compactified domain.
int base_r
Radial basis of decomposition.
#define TRA_R
Translation en R, used for a bitwise shift (in hex)
Definition: type_parite.h:158
virtual void do_ope_mat() const
Computes the matrix of the operator.
Matrix handling.
Definition: matrice.h:152
int nr
Number of radial points.
#define R_CHEBU
base de Chebychev ordinaire (fin), dev. en 1/r
Definition: type_parite.h:180
#define MAX_BASE
Nombre max. de bases differentes.
Definition: type_parite.h:144
#define R_CHEB
base de Chebychev ordinaire (fin)
Definition: type_parite.h:166