LORENE
ope_helmholtz_minus_2d_non_dege.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 
22 
23 /*
24  * $Id: ope_helmholtz_minus_2d_non_dege.C,v 1.4 2016/12/05 16:18:11 j_novak Exp $
25  * $Header: /cvsroot/Lorene/C++/Source/Ope_elementary/Ope_helmholtz_minus_2d/ope_helmholtz_minus_2d_non_dege.C,v 1.4 2016/12/05 16:18:11 j_novak Exp $
26  *
27  */
28 #include <cmath>
29 #include <cstdlib>
30 
31 #include "proto.h"
32 #include "ope_elementary.h"
33 
34 
35  //------------------------------------
36  // Routine pour les cas non prevus --
37  //-----------------------------------
38 
39 namespace Lorene {
40 Matrice _helmholtz_minus_2d_non_dege_pas_prevu(const Matrice &lap, int) {
41  cout << "Construction non degeneree pas prevue..." << endl ;
42  abort() ;
43  exit(-1) ;
44  return lap ;
45 }
46 
47 
48 
49  //-------------------
50  //-- R_CHEB -------
51  //--------------------
52 
53 Matrice _helmholtz_minus_2d_non_dege_r_cheb (const Matrice &lap, int) {
54 
55 
56  int n = lap.get_dim(0) ;
57 
58  Matrice res(n-2, n-2) ;
59  res.set_etat_qcq() ;
60  for (int i=0 ; i<n-2 ; i++)
61  for (int j=0 ; j<n-2 ; j++)
62  res.set(i, j) = lap(i, j+2) ;
63 
64  res.set_band(4, 4) ;
65  res.set_lu() ;
66 
67  return res ;
68 }
69 
70 
71  //-------------------
72  //-- R_CHEBU -----
73  //-------------------
74 Matrice _helmholtz_minus_2d_non_dege_r_chebu_deux (const Matrice&) ;
75 
76 Matrice _helmholtz_minus_2d_non_dege_r_chebu (const Matrice &lap, int puis) {
77 
78  switch (puis) {
79  case 2 :
80  return _helmholtz_minus_2d_non_dege_r_chebu_deux (lap) ;
81  default :
82  abort() ;
83  exit(-1) ;
84  return Matrice(0, 0) ;
85  }
86 }
87 
88 
89 // Cas dzpuis = 2 ;
90 Matrice _helmholtz_minus_2d_non_dege_r_chebu_deux (const Matrice &lap) {
91 
92  int n = lap.get_dim(0) ;
93 
94  Matrice res(n-1, n-1) ;
95  res.set_etat_qcq() ;
96  for (int i=0 ;i<n-1 ; i++)
97  for (int j=0 ; j<n-1 ; j++)
98  res.set(i, j) = lap(i, j+1) ;
99  res.set_band(5, 3) ;
100  res.set_lu() ;
101 
102  return res ;
103 }
104 
105 
107  if (ope_cl == 0x0)
108  do_ope_cl() ;
109 
110  if (non_dege != 0x0)
111  delete non_dege ;
112 
113  // Routines de derivation
114  static Matrice (*helmholtz_minus_2d_non_dege[MAX_BASE])(const Matrice&, int);
115  static int nap = 0 ;
116 
117  // Premier appel
118  if (nap==0) {
119  nap = 1 ;
120  for (int i=0 ; i<MAX_BASE ; i++) {
121  helmholtz_minus_2d_non_dege[i] = _helmholtz_minus_2d_non_dege_pas_prevu ;
122  }
123  // Les routines existantes
124  helmholtz_minus_2d_non_dege[R_CHEB >> TRA_R] = _helmholtz_minus_2d_non_dege_r_cheb ;
125  helmholtz_minus_2d_non_dege[R_CHEBU >> TRA_R] = _helmholtz_minus_2d_non_dege_r_chebu ;
126  }
127  non_dege = new Matrice(helmholtz_minus_2d_non_dege[base_r](*ope_cl, dzpuis)) ;
128 }
129 }
Matrice * ope_cl
Pointer on the banded-matrix of the operator.
virtual void do_ope_cl() const
Computes the banded-matrix of the operator.
Lorene prototypes.
Definition: app_hor.h:67
int base_r
Radial basis of decomposition.
virtual void do_non_dege() const
Computes the non-degenerated matrix of the operator.
#define TRA_R
Translation en R, used for a bitwise shift (in hex)
Definition: type_parite.h:158
Matrix handling.
Definition: matrice.h:152
int get_dim(int i) const
Returns the dimension of the matrix.
Definition: matrice.C:263
int dzpuis
the associated dzpuis, if in the compactified domain.
#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
Matrice * non_dege
Pointer on the non-degenerated matrix of the operator.
#define R_CHEB
base de Chebychev ordinaire (fin)
Definition: type_parite.h:166