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