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