LORENE
ope_helmholtz_minus_pseudo_1d_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_pseudo_1d_non_dege.C,v 1.4 2016/12/05 16:18:12 j_novak Exp $
25  * $Header: /cvsroot/Lorene/C++/Source/Ope_elementary/Ope_helmholtz_minus_pseudo_1d/ope_helmholtz_minus_pseudo_1d_non_dege.C,v 1.4 2016/12/05 16:18:12 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_pseudo_1d_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  //-- R_CHEBU -----
50  //-------------------
51 Matrice _helmholtz_minus_pseudo_1d_non_dege_r_chebu_deux (const Matrice&) ;
52 
53 Matrice _helmholtz_minus_pseudo_1d_non_dege_r_chebu (const Matrice &lap, int puis) {
54 
55  switch (puis) {
56  case 2 :
57  return _helmholtz_minus_pseudo_1d_non_dege_r_chebu_deux (lap) ;
58  default :
59  abort() ;
60  exit(-1) ;
61  return Matrice(0, 0) ;
62  }
63 }
64 
65 
66 // Cas dzpuis = 2 ;
67 Matrice _helmholtz_minus_pseudo_1d_non_dege_r_chebu_deux (const Matrice &lap) {
68 
69  int n = lap.get_dim(0) ;
70 
71  Matrice res(n-1, n-1) ;
72  res.set_etat_qcq() ;
73  for (int i=0 ;i<n-1 ; i++)
74  for (int j=0 ; j<n-1 ; j++)
75  res.set(i, j) = lap(i, j+1) ;
76  res.set_band(5, 3) ;
77  res.set_lu() ;
78 
79  return res ;
80 }
81 
82 
84  if (ope_cl == 0x0)
85  do_ope_cl() ;
86 
87  if (non_dege != 0x0)
88  delete non_dege ;
89 
90  // Routines de derivation
91  static Matrice (*helmholtz_minus_pseudo_1d_non_dege[MAX_BASE])(const Matrice&, int);
92  static int nap = 0 ;
93 
94  // Premier appel
95  if (nap==0) {
96  nap = 1 ;
97  for (int i=0 ; i<MAX_BASE ; i++) {
98  helmholtz_minus_pseudo_1d_non_dege[i] = _helmholtz_minus_pseudo_1d_non_dege_pas_prevu ;
99  }
100  // Les routines existantes
101  helmholtz_minus_pseudo_1d_non_dege[R_CHEBU >> TRA_R] =
102  _helmholtz_minus_pseudo_1d_non_dege_r_chebu ;
103  }
104  non_dege = new Matrice(helmholtz_minus_pseudo_1d_non_dege[base_r](*ope_cl, dzpuis)) ;
105 }
106 }
int dzpuis
the associated dzpuis, if in the compactified domain.
virtual void do_ope_cl() const
Computes the banded-matrix of the operator.
Matrice * ope_cl
Pointer on the banded-matrix of the operator.
Lorene prototypes.
Definition: app_hor.h:67
virtual void do_non_dege() const
Computes the non-degenerated matrix of the operator.
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
Matrix handling.
Definition: matrice.h:152
int get_dim(int i) const
Returns the dimension of the matrix.
Definition: matrice.C:263
#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.