LORENE
prepa_helmholtz_plus.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_plus.C,v 1.6 2016/12/05 16:18:10 j_novak Exp $
27 * $Log: prepa_helmholtz_plus.C,v $
28 * Revision 1.6 2016/12/05 16:18:10 j_novak
29 * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
30 *
31 * Revision 1.5 2014/10/13 08:53:30 j_novak
32 * Lorene classes and functions now belong to the namespace Lorene.
33 *
34 * Revision 1.4 2014/10/06 15:16:10 j_novak
35 * Modified #include directives to use c++ syntax.
36 *
37 * Revision 1.3 2008/02/18 13:53:43 j_novak
38 * Removal of special indentation instructions.
39 *
40 * Revision 1.2 2004/01/15 09:15:37 p_grandclement
41 * Modification and addition of the Helmholtz operators
42 *
43 * Revision 1.1 2003/12/11 14:48:49 p_grandclement
44 * Addition of ALL (and that is a lot !) the files needed for the general elliptic solver ... UNDER DEVELOPEMENT...
45 *
46 *
47 * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/PDE/prepa_helmholtz_plus.C,v 1.6 2016/12/05 16:18:10 j_novak Exp $
48 *
49 */
50
51//fichiers includes
52#include <cstdio>
53#include <cstdlib>
54#include <cmath>
55
56#include "matrice.h"
57#include "type_parite.h"
58#include "proto.h"
59
60
61
62
63 //------------------------------------
64 // Routine pour les cas non prevus --
65 //-----------------------------------
66
67namespace Lorene {
68Matrice _prepa_helmholtz_plus_nondege_pas_prevu(const Matrice &so) {
69
70 cout << "Unknown case for prepa_helmholtz_plus_nondege" << endl ;
71 abort() ;
72 exit(-1) ;
73 return so;
74}
75
76
77 //-------------------
78 //-- R_CHEB -------
79 //--------------------
80
81Matrice _prepa_helmholtz_plus_nondege_r_cheb (const Matrice &lap) {
82
83 int n = lap.get_dim(0) ;
84 int non_dege = 2 ;
85
86 Matrice res(n-non_dege, n-non_dege) ;
87 res.set_etat_qcq() ;
88 for (int i=0 ; i<n-non_dege ; i++)
89 for (int j=0 ; j<n-non_dege ; j++)
90 res.set(i, j) = lap(i, j+non_dege) ;
91
92 res.set_band (4,4) ;
93 res.set_lu() ;
94
95 return res ;
96}
97
98
99 //-------------------
100 //-- R_CHEBP -------
101 //--------------------
102
103Matrice _prepa_helmholtz_plus_nondege_r_chebp (const Matrice &lap) {
104
105 int n = lap.get_dim(0) ;
106 int non_dege = 1 ;
107
108 Matrice res(n-non_dege, n-non_dege) ;
109 res.set_etat_qcq() ;
110 for (int i=0 ; i<n-non_dege ; i++)
111 for (int j=0 ; j<n-non_dege ; j++)
112 res.set(i, j) = lap(i, j+non_dege) ;
113
114 res.set_band (4,1) ;
115 res.set_lu() ;
116 return res ;
117}
118
119
120 //-------------------
121 //-- Fonction ----
122 //-------------------
123
124Matrice prepa_helmholtz_plus_nondege(const Matrice &ope, int base_r) {
125
126 // Routines de derivation
127 static Matrice (*prepa_helmholtz_plus_nondege[MAX_BASE])
128 (const Matrice&) ;
129 static int nap = 0 ;
130
131 // Premier appel
132 if (nap==0) {
133 nap = 1 ;
134 for (int i=0 ; i<MAX_BASE ; i++) {
135 prepa_helmholtz_plus_nondege[i] =
136 _prepa_helmholtz_plus_nondege_pas_prevu ;
137 }
138 // Les routines existantes
139 prepa_helmholtz_plus_nondege[R_CHEB >> TRA_R] =
140 _prepa_helmholtz_plus_nondege_r_cheb ;
141 prepa_helmholtz_plus_nondege[R_CHEBP >> TRA_R] =
142 _prepa_helmholtz_plus_nondege_r_chebp ;
143 }
144
145 Matrice res(prepa_helmholtz_plus_nondege[base_r](ope)) ;
146 return res ;
147}
148
149}
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 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