| 1 |
/* |
| 2 |
* Computation of d^2/dx^2 |
| 3 |
* |
| 4 |
* for: |
| 5 |
* - Valeur |
| 6 |
* - Mtbl_cf |
| 7 |
*/ |
| 8 |
|
| 9 |
/* |
| 10 |
* Copyright (c) 1999-2000 Jean-Alain Marck |
| 11 |
* Copyright (c) 1999-2001 Eric Gourgoulhon |
| 12 |
* |
| 13 |
* This file is part of LORENE. |
| 14 |
* |
| 15 |
* LORENE is free software; you can redistribute it and/or modify |
| 16 |
* it under the terms of the GNU General Public License as published by |
| 17 |
* the Free Software Foundation; either version 2 of the License, or |
| 18 |
* (at your option) any later version. |
| 19 |
* |
| 20 |
* LORENE is distributed in the hope that it will be useful, |
| 21 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 22 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 23 |
* GNU General Public License for more details. |
| 24 |
* |
| 25 |
* You should have received a copy of the GNU General Public License |
| 26 |
* along with LORENE; if not, write to the Free Software |
| 27 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 28 |
* |
| 29 |
*/ |
| 30 |
|
| 31 |
|
| 32 |
char valeur_d2sdx2_C[] = "$Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_d2sdx2.C,v 1.6 2014/10/13 08:53:49 j_novak Exp $" ; |
| 33 |
|
| 34 |
/* |
| 35 |
* $Id: valeur_d2sdx2.C,v 1.6 2014/10/13 08:53:49 j_novak Exp $ |
| 36 |
* $Log: valeur_d2sdx2.C,v $ |
| 37 |
* Revision 1.6 2014/10/13 08:53:49 j_novak |
| 38 |
* Lorene classes and functions now belong to the namespace Lorene. |
| 39 |
* |
| 40 |
* Revision 1.5 2014/10/06 15:13:23 j_novak |
| 41 |
* Modified #include directives to use c++ syntax. |
| 42 |
* |
| 43 |
* Revision 1.4 2013/06/14 15:54:07 j_novak |
| 44 |
* Inclusion of Legendre bases. |
| 45 |
* |
| 46 |
* Revision 1.3 2008/08/27 08:52:55 jl_cornou |
| 47 |
* Added Jacobi(0,2) polynomials case |
| 48 |
* |
| 49 |
* Revision 1.2 2004/11/23 15:17:19 m_forot |
| 50 |
* Added the bases for the cases without any equatorial symmetry |
| 51 |
* (T_COSSIN_C, T_COSSIN_S, T_LEG, R_CHEBPI_P, R_CHEBPI_I). |
| 52 |
* |
| 53 |
* Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon |
| 54 |
* LORENE |
| 55 |
* |
| 56 |
* Revision 2.9 2000/08/16 10:46:03 eric |
| 57 |
* Suppression de Mtbl_cf::dzpuis. |
| 58 |
* |
| 59 |
* Revision 2.8 1999/11/30 12:43:41 eric |
| 60 |
* Valeur::base est desormais du type Base_val et non plus Base_val*. |
| 61 |
* |
| 62 |
* Revision 2.7 1999/11/23 16:16:32 eric |
| 63 |
* Reorganisation du calcul dans le cas ETATZERO. |
| 64 |
* |
| 65 |
* Revision 2.6 1999/11/19 09:30:38 eric |
| 66 |
* La valeur de retour est desormais const Valeur &. |
| 67 |
* |
| 68 |
* Revision 2.5 1999/10/28 07:59:29 eric |
| 69 |
* Modif commentaires. |
| 70 |
* |
| 71 |
* Revision 2.4 1999/10/18 13:41:11 eric |
| 72 |
* Suppression de l'argument base dans les routines de derivation des mtbl_cf. |
| 73 |
* |
| 74 |
* Revision 2.3 1999/09/07 15:43:08 phil |
| 75 |
* coreection bases |
| 76 |
* |
| 77 |
* Revision 2.2 1999/03/01 15:08:40 eric |
| 78 |
* *** empty log message *** |
| 79 |
* |
| 80 |
* Revision 2.1 1999/02/23 10:39:02 hyc |
| 81 |
* *** empty log message *** |
| 82 |
* |
| 83 |
* |
| 84 |
* $Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_d2sdx2.C,v 1.6 2014/10/13 08:53:49 j_novak Exp $ |
| 85 |
* |
| 86 |
*/ |
| 87 |
|
| 88 |
// Headers C |
| 89 |
#include <cassert> |
| 90 |
|
| 91 |
// Headers Lorene |
| 92 |
#include "mtbl_cf.h" |
| 93 |
#include "valeur.h" |
| 94 |
|
| 95 |
// Prototypage temporaire |
| 96 |
namespace Lorene { |
| 97 |
void _d2sdx2_pas_prevu(Tbl *, int &) ; |
| 98 |
void _d2sdx2_r_cheb(Tbl *, int &) ; |
| 99 |
void _d2sdx2_r_chebu_0(Tbl *, int &) ; |
| 100 |
void _d2sdx2_r_chebp(Tbl *, int &) ; |
| 101 |
void _d2sdx2_r_chebi(Tbl *, int &) ; |
| 102 |
void _d2sdx2_r_chebpim_p(Tbl *, int &) ; |
| 103 |
void _d2sdx2_r_chebpim_i(Tbl *, int &) ; |
| 104 |
void _d2sdx2_r_chebpi_p(Tbl *, int &) ; |
| 105 |
void _d2sdx2_r_chebpi_i(Tbl *, int &) ; |
| 106 |
void _d2sdx2_r_leg(Tbl *, int &) ; |
| 107 |
void _d2sdx2_r_legp(Tbl *, int &) ; |
| 108 |
void _d2sdx2_r_legi(Tbl *, int &) ; |
| 109 |
void _d2sdx2_r_jaco02(Tbl *, int &) ; |
| 110 |
|
| 111 |
// Version membre d'un Valeur |
| 112 |
// -------------------------- |
| 113 |
|
| 114 |
const Valeur& Valeur::d2sdx2() const { |
| 115 |
|
| 116 |
// Protection |
| 117 |
assert(etat != ETATNONDEF) ; |
| 118 |
|
| 119 |
// Peut-etre rien a faire ? |
| 120 |
if (p_d2sdx2 != 0x0) { |
| 121 |
return *p_d2sdx2 ; |
| 122 |
} |
| 123 |
|
| 124 |
// ... si, il faut bosser |
| 125 |
|
| 126 |
p_d2sdx2 = new Valeur(mg) ; |
| 127 |
|
| 128 |
if (etat == ETATZERO) { |
| 129 |
p_d2sdx2->set_etat_zero() ; |
| 130 |
} |
| 131 |
else { |
| 132 |
assert(etat == ETATQCQ) ; |
| 133 |
p_d2sdx2->set_etat_cf_qcq() ; |
| 134 |
Mtbl_cf* cfp = p_d2sdx2->c_cf ; // Pointeur sur le Mtbl_cf qui vient d'etre |
| 135 |
// cree par le set_etat_cf_qcq() |
| 136 |
|
| 137 |
// Initialisation de *cfp : recopie des coef. de la fonction |
| 138 |
if (c_cf == 0x0) { |
| 139 |
coef() ; |
| 140 |
} |
| 141 |
*cfp = *c_cf ; |
| 142 |
|
| 143 |
cfp->d2sdx2() ; // calcul |
| 144 |
|
| 145 |
p_d2sdx2->base = cfp->base ; // On remonte la base de sortie au niveau Valeur |
| 146 |
} |
| 147 |
|
| 148 |
// Termine |
| 149 |
return *p_d2sdx2 ; |
| 150 |
} |
| 151 |
|
| 152 |
// Version membre d'un Mtbl_cf |
| 153 |
// --------------------------- |
| 154 |
|
| 155 |
void Mtbl_cf::d2sdx2() { |
| 156 |
|
| 157 |
// Routines de derivation |
| 158 |
static void (*_d2sdx2[MAX_BASE])(Tbl *, int &) ; |
| 159 |
static int nap = 0 ; |
| 160 |
|
| 161 |
// Premier appel |
| 162 |
if (nap==0) { |
| 163 |
nap = 1 ; |
| 164 |
for (int i=0 ; i<MAX_BASE ; i++) { |
| 165 |
_d2sdx2[i] = _d2sdx2_pas_prevu ; |
| 166 |
} |
| 167 |
// Les routines existantes |
| 168 |
_d2sdx2[R_CHEB >> TRA_R] = _d2sdx2_r_cheb ; |
| 169 |
_d2sdx2[R_CHEBU >> TRA_R] = _d2sdx2_r_chebu_0 ; |
| 170 |
_d2sdx2[R_CHEBP >> TRA_R] = _d2sdx2_r_chebp ; |
| 171 |
_d2sdx2[R_CHEBI >> TRA_R] = _d2sdx2_r_chebi ; |
| 172 |
_d2sdx2[R_CHEBPIM_P >> TRA_R] = _d2sdx2_r_chebpim_p ; |
| 173 |
_d2sdx2[R_CHEBPIM_I >> TRA_R] = _d2sdx2_r_chebpim_i ; |
| 174 |
_d2sdx2[R_CHEBPI_P >> TRA_R] = _d2sdx2_r_chebpi_p ; |
| 175 |
_d2sdx2[R_CHEBPI_I >> TRA_R] = _d2sdx2_r_chebpi_i ; |
| 176 |
_d2sdx2[R_LEG >> TRA_R] = _d2sdx2_r_leg ; |
| 177 |
_d2sdx2[R_LEGP >> TRA_R] = _d2sdx2_r_legp ; |
| 178 |
_d2sdx2[R_LEGI >> TRA_R] = _d2sdx2_r_legi ; |
| 179 |
_d2sdx2[R_JACO02 >> TRA_R] = _d2sdx2_r_jaco02 ; |
| 180 |
} |
| 181 |
|
| 182 |
//- Debut de la routine - |
| 183 |
|
| 184 |
// Protection |
| 185 |
assert(etat == ETATQCQ) ; |
| 186 |
|
| 187 |
// Boucle sur les zones |
| 188 |
for (int l=0 ; l<nzone ; l++) { |
| 189 |
int base_r = (base.b[l] & MSQ_R) >> TRA_R ; |
| 190 |
assert(t[l] != 0x0) ; |
| 191 |
_d2sdx2[base_r](t[l], base.b[l]) ; |
| 192 |
} |
| 193 |
} |
| 194 |
} |