LORENE
ope_poisson_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
21char ope_poisson_pseudo_1d_non_dege_C[] = "$Header: /cvsroot/Lorene/C++/Source/Ope_elementary/Ope_poisson_pseudo_1d/ope_poisson_pseudo_1d_non_dege.C,v 1.3 2014/10/13 08:53:35 j_novak Exp $" ;
22
23/*
24 * $Id: ope_poisson_pseudo_1d_non_dege.C,v 1.3 2014/10/13 08:53:35 j_novak Exp $
25 * $Header: /cvsroot/Lorene/C++/Source/Ope_elementary/Ope_poisson_pseudo_1d/ope_poisson_pseudo_1d_non_dege.C,v 1.3 2014/10/13 08:53:35 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
39namespace Lorene {
40Matrice _poisson_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 //-------------------
50 //-- R_CHEB -------
51 //--------------------
52
53Matrice _poisson_pseudo_1d_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(2, 2) ;
65 res.set_lu() ;
66
67 return res ;
68}
69
70
71
72
73 //------------------
74 //-- R_CHEBP ----
75 //------------------
76
77Matrice _poisson_pseudo_1d_non_dege_r_chebp (const Matrice &lap, int l) {
78
79 int n = lap.get_dim(0) ;
80 assert (div(l, 2).rem == 0) ;
81
82
83 if (l==0) {
84 Matrice res(n-1, n-1) ;
85 res.set_etat_qcq() ;
86 for (int i=0 ; i<n-1 ; i++)
87 for (int j=0 ; j<n-1 ; j++)
88 res.set(i, j) = lap(i, j+1) ;
89 res.set_band(3, 0) ;
90 res.set_lu() ;
91
92 return res ;
93 }
94 else {
95 Matrice res(n-2, n-2) ;
96 res.set_etat_qcq() ;
97 for (int i=0 ;i<n-2 ; i++)
98 for (int j=0 ; j<n-2 ; j++)
99 res.set(i, j) = lap(i, j+2) ;
100
101 res.set_band(2, 1) ;
102 res.set_lu() ;
103
104 return res ;
105 }
106}
107
108
109 //-------------------
110 //-- R_CHEBI -----
111 //-------------------
112
113Matrice _poisson_pseudo_1d_non_dege_r_chebi (const Matrice &lap, int l) {
114
115 int n = lap.get_dim(0) ;
116
117 assert (div(l, 2).rem == 1) ;
118
119 if (l==1) {
120 Matrice res(n-1, n-1) ;
121 res.set_etat_qcq() ;
122 for (int i=0 ; i<n-1 ; i++)
123 for (int j=0 ; j<n-1 ; j++)
124 res.set(i, j) = lap(i, j+1) ;
125 res.set_band(3, 0) ;
126 res.set_lu() ;
127
128 return res ;
129 }
130 else {
131 Matrice res(n-2, n-2) ;
132 res.set_etat_qcq() ;
133 for (int i=0 ;i<n-2 ; i++)
134 for (int j=0 ; j<n-2 ; j++)
135 res.set(i, j) = lap(i, j+2) ;
136
137 res.set_band(2, 1) ;
138 res.set_lu() ;
139
140 return res ;
141 }
142}
143
144
146 if (ope_cl == 0x0)
147 do_ope_cl() ;
148
149 if (non_dege != 0x0)
150 delete non_dege ;
151
152 // Routines de derivation
154 static int nap = 0 ;
155
156 // Premier appel
157 if (nap==0) {
158 nap = 1 ;
159 for (int i=0 ; i<MAX_BASE ; i++) {
160 poisson_pseudo_1d_non_dege[i] = _poisson_pseudo_1d_non_dege_pas_prevu ;
161 }
162 // Les routines existantes
164 _poisson_pseudo_1d_non_dege_r_cheb ;
166 _poisson_pseudo_1d_non_dege_r_chebp ;
168 _poisson_pseudo_1d_non_dege_r_chebi ;
169 }
171}
172}
Time evolution with partial storage (*** under development ***).
Definition evolution.h:371
Matrix handling.
Definition matrice.h:152
int get_dim(int i) const
Returns the dimension of the matrix.
Definition matrice.C:260
int base_r
Radial basis of decomposition.
Matrice * ope_cl
Pointer on the banded-matrix of the operator.
Matrice * non_dege
Pointer on the non-degenerated matrix of the operator.
virtual void do_ope_cl() const
Computes the banded-matrix of the operator.
virtual void do_non_dege() const
Computes the non-degenerated matrix of the operator.
#define MAX_BASE
Nombre max. de bases differentes.
#define R_CHEBI
base de Cheb. impaire (rare) seulement
#define TRA_R
Translation en R, used for a bitwise shift (in hex)
#define R_CHEB
base de Chebychev ordinaire (fin)
#define R_CHEBP
base de Cheb. paire (rare) seulement
Lorene prototypes.
Definition app_hor.h:64