LORENE
prepa_helmholtz_minus.C
1/*
2 * Copyright (c) 1999-2001 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 as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * LORENE is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with LORENE; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 */
21
22
23
24
25/*
26 * $Id: prepa_helmholtz_minus.C,v 1.9 2016/12/05 16:18:10 j_novak Exp $
27 * $Log: prepa_helmholtz_minus.C,v $
28 * Revision 1.9 2016/12/05 16:18:10 j_novak
29 * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
30 *
31 * Revision 1.8 2014/10/13 08:53:30 j_novak
32 * Lorene classes and functions now belong to the namespace Lorene.
33 *
34 * Revision 1.7 2014/10/06 15:16:10 j_novak
35 * Modified #include directives to use c++ syntax.
36 *
37 * Revision 1.6 2008/07/09 06:51:58 p_grandclement
38 * some corrections to helmholtz minus in the nucleus
39 *
40 * Revision 1.5 2008/07/08 11:45:28 p_grandclement
41 * Add helmholtz_minus in the nucleus
42 *
43 * Revision 1.4 2008/02/18 13:53:43 j_novak
44 * Removal of special indentation instructions.
45 *
46 * Revision 1.3 2004/08/24 09:14:44 p_grandclement
47 * Addition of some new operators, like Poisson in 2d... It now requieres the
48 * GSL library to work.
49 *
50 * Also, the way a variable change is stored by a Param_elliptic is changed and
51 * no longer uses Change_var but rather 2 Scalars. The codes using that feature
52 * will requiere some modification. (It should concern only the ones about monopoles)
53 *
54 * Revision 1.2 2004/01/15 09:15:37 p_grandclement
55 * Modification and addition of the Helmholtz operators
56 *
57 * Revision 1.1 2003/12/11 14:48:49 p_grandclement
58 * Addition of ALL (and that is a lot !) the files needed for the general elliptic solver ... UNDER DEVELOPEMENT...
59 *
60 *
61 * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/PDE/prepa_helmholtz_minus.C,v 1.9 2016/12/05 16:18:10 j_novak Exp $
62 *
63 */
64
65//fichiers includes
66#include <cstdio>
67#include <cstdlib>
68#include <cmath>
69
70#include "matrice.h"
71#include "type_parite.h"
72#include "proto.h"
73
74
75
76
77 //------------------------------------
78 // Routine pour les cas non prevus --
79 //-----------------------------------
80
81namespace Lorene {
82Matrice _prepa_helmholtz_minus_nondege_pas_prevu(const Matrice &so) {
83
84 cout << "Unknown case for prepa_helmholtz_minus_nondege" << endl ;
85 abort() ;
86 exit(-1) ;
87 return so;
88}
89
90 //-------------------
91 //-- R_CHEB -------
92 //--------------------
93
94Matrice _prepa_helmholtz_minus_nondege_r_cheb (const Matrice &lap) {
95
96 int n = lap.get_dim(0) ;
97 int non_dege = 2 ;
98
99 Matrice res(n-non_dege, n-non_dege) ;
100 res.set_etat_qcq() ;
101 for (int i=0 ; i<n-non_dege ; i++)
102 for (int j=0 ; j<n-non_dege ; j++)
103 res.set(i, j) = lap(i, j+non_dege) ;
104
105 res.set_band (4,4) ;
106 res.set_lu() ;
107 return res ;
108}
109
110 //-------------------
111 //-- R_CHEBU -------
112 //--------------------
113Matrice _prepa_helmholtz_minus_nondege_r_chebu (const Matrice &lap) {
114
115 int n = lap.get_dim(0) ;
116 int non_dege = 1 ;
117
118 Matrice res(n-non_dege, n-non_dege) ;
119 res.set_etat_qcq() ;
120 for (int i=0 ; i<n-non_dege ; i++)
121 for (int j=0 ; j<n-non_dege ; j++)
122 res.set(i, j) = lap(i, j+non_dege) ;
123
124 res.set_band (5,3) ;
125 res.set_lu() ;
126 return res ;
127}
128 //-------------------
129 //-- R_CHEBP -------
130 //--------------------
131Matrice _prepa_helmholtz_minus_nondege_r_chebp (const Matrice &lap) {
132
133 int n = lap.get_dim(0) ;
134 int non_dege = 1 ;
135
136 Matrice res(n-non_dege, n-non_dege) ;
137 res.set_etat_qcq() ;
138 for (int i=0 ; i<n-non_dege ; i++)
139 for (int j=0 ; j<n-non_dege ; j++)
140 res.set(i, j) = lap(i, j+non_dege) ;
141
142 res.set_band (4,2) ;
143 res.set_lu() ;
144 return res ;
145}
146 //-------------------
147 //-- R_CHEBI -------
148 //--------------------
149Matrice _prepa_helmholtz_minus_nondege_r_chebi (const Matrice &lap) {
150
151 int n = lap.get_dim(0) ;
152 int non_dege = 1 ;
153
154 Matrice res(n-non_dege, n-non_dege) ;
155 res.set_etat_qcq() ;
156 for (int i=0 ; i<n-non_dege ; i++)
157 for (int j=0 ; j<n-non_dege ; j++)
158 res.set(i, j) = lap(i, j+non_dege) ;
159
160 res.set_band (4,2) ;
161 res.set_lu() ;
162 return res ;
163}
164
165 //-------------------
166 //-- Fonction ----
167 //-------------------
168
169Matrice prepa_helmholtz_minus_nondege(const Matrice &ope, int base_r) {
170
171 // Routines de derivation
172 static Matrice (*prepa_helmholtz_minus_nondege[MAX_BASE])
173 (const Matrice&) ;
174 static int nap = 0 ;
175
176 // Premier appel
177 if (nap==0) {
178 nap = 1 ;
179 for (int i=0 ; i<MAX_BASE ; i++) {
180 prepa_helmholtz_minus_nondege[i] =
181 _prepa_helmholtz_minus_nondege_pas_prevu ;
182 }
183 // Les routines existantes
184 prepa_helmholtz_minus_nondege[R_CHEB >> TRA_R] =
185 _prepa_helmholtz_minus_nondege_r_cheb ;
186 prepa_helmholtz_minus_nondege[R_CHEBU >> TRA_R] =
187 _prepa_helmholtz_minus_nondege_r_chebu ;
188 prepa_helmholtz_minus_nondege[R_CHEBP >> TRA_R] =
189 _prepa_helmholtz_minus_nondege_r_chebp ;
190 prepa_helmholtz_minus_nondege[R_CHEBI >> TRA_R] =
191 _prepa_helmholtz_minus_nondege_r_chebi ;
192 }
193
194 Matrice res(prepa_helmholtz_minus_nondege[base_r](ope)) ;
195 return res ;
196}
197
198}
Matrix handling.
Definition matrice.h:152
int get_dim(int i) const
Returns the dimension of the matrix.
Definition matrice.C:263
#define MAX_BASE
Nombre max. de bases differentes.
#define R_CHEBU
base de Chebychev ordinaire (fin), dev. en 1/r
#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:67