| 1 |
/* |
| 2 |
* Computation of d^2/dphi^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_d2sdp2_C[] = "$Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_d2sdp2.C,v 1.3 2014/10/13 08:53:49 j_novak Exp $" ; |
| 33 |
|
| 34 |
/* |
| 35 |
* $Id: valeur_d2sdp2.C,v 1.3 2014/10/13 08:53:49 j_novak Exp $ |
| 36 |
* $Log: valeur_d2sdp2.C,v $ |
| 37 |
* Revision 1.3 2014/10/13 08:53:49 j_novak |
| 38 |
* Lorene classes and functions now belong to the namespace Lorene. |
| 39 |
* |
| 40 |
* Revision 1.2 2014/10/06 15:13:23 j_novak |
| 41 |
* Modified #include directives to use c++ syntax. |
| 42 |
* |
| 43 |
* Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon |
| 44 |
* LORENE |
| 45 |
* |
| 46 |
* Revision 2.8 1999/11/30 12:43:12 eric |
| 47 |
* Valeur::base est desormais du type Base_val et non plus Base_val*. |
| 48 |
* |
| 49 |
* Revision 2.7 1999/11/23 16:15:57 eric |
| 50 |
* Reorganisation du calcul dans le cas ETATZERO. |
| 51 |
* |
| 52 |
* Revision 2.6 1999/11/19 09:29:56 eric |
| 53 |
* La valeur de retour est desormais const Valeur &. |
| 54 |
* |
| 55 |
* Revision 2.5 1999/10/28 07:58:56 eric |
| 56 |
* Modif commentaires. |
| 57 |
* |
| 58 |
* Revision 2.4 1999/10/18 13:40:38 eric |
| 59 |
* Suppression de l'argument base dans les routines de derivation des mtbl_cf. |
| 60 |
* |
| 61 |
* Revision 2.3 1999/09/07 15:47:03 phil |
| 62 |
* correction de la gestion des bases |
| 63 |
* |
| 64 |
* Revision 2.2 1999/03/01 15:07:51 eric |
| 65 |
* *** empty log message *** |
| 66 |
* |
| 67 |
* Revision 2.1 1999/02/23 11:43:58 hyc |
| 68 |
* *** empty log message *** |
| 69 |
* |
| 70 |
* Revision 2.0 1999/02/23 11:32:52 hyc |
| 71 |
* *** empty log message *** |
| 72 |
* |
| 73 |
* $Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_d2sdp2.C,v 1.3 2014/10/13 08:53:49 j_novak Exp $ |
| 74 |
* |
| 75 |
*/ |
| 76 |
|
| 77 |
// Headers C |
| 78 |
#include <cassert> |
| 79 |
|
| 80 |
// Headers Lorene |
| 81 |
#include "mtbl_cf.h" |
| 82 |
#include "valeur.h" |
| 83 |
|
| 84 |
// Prototypage temporaire |
| 85 |
namespace Lorene { |
| 86 |
void _d2sdphi2_pas_prevu(Tbl *, int &) ; |
| 87 |
void _d2sdphi2_p_cossin(Tbl *, int &) ; |
| 88 |
|
| 89 |
// Version membre d'un Valeur |
| 90 |
// -------------------------- |
| 91 |
|
| 92 |
const Valeur& Valeur::d2sdp2() const { |
| 93 |
|
| 94 |
// Protection |
| 95 |
assert(etat != ETATNONDEF) ; |
| 96 |
|
| 97 |
// Peut-etre rien a faire ? |
| 98 |
if (p_d2sdp2 != 0x0) { |
| 99 |
return *p_d2sdp2 ; |
| 100 |
} |
| 101 |
|
| 102 |
// ... si, il faut bosser |
| 103 |
|
| 104 |
p_d2sdp2 = new Valeur(mg) ; |
| 105 |
|
| 106 |
if (etat == ETATZERO) { |
| 107 |
p_d2sdp2->set_etat_zero() ; |
| 108 |
} |
| 109 |
else { |
| 110 |
assert(etat == ETATQCQ) ; |
| 111 |
p_d2sdp2->set_etat_cf_qcq() ; |
| 112 |
Mtbl_cf* cfp = p_d2sdp2->c_cf ; // Pointeur sur le Mtbl_cf qui vient d'etre |
| 113 |
// cree par le set_etat_cf_qcq() |
| 114 |
// Initialisation de *cfp : recopie des coef. de la fonction |
| 115 |
|
| 116 |
if (c_cf == 0x0) { |
| 117 |
coef() ; |
| 118 |
} |
| 119 |
*cfp = *c_cf ; |
| 120 |
|
| 121 |
cfp->d2sdp2() ; // calcul |
| 122 |
|
| 123 |
p_d2sdp2->base = cfp->base ; // On remonte la base de sortie au niveau Valeur |
| 124 |
} |
| 125 |
|
| 126 |
// Termine |
| 127 |
return *p_d2sdp2 ; |
| 128 |
} |
| 129 |
|
| 130 |
// Version membre d'un Mtbl_cf |
| 131 |
// --------------------------- |
| 132 |
void Mtbl_cf::d2sdp2() { |
| 133 |
|
| 134 |
// Routines de derivation |
| 135 |
static void (*_d2sdphi2[MAX_BASE])(Tbl *, int &) ; |
| 136 |
static int nap = 0 ; |
| 137 |
|
| 138 |
// Premier appel |
| 139 |
if (nap==0) { |
| 140 |
nap = 1 ; |
| 141 |
for (int i=0 ; i<MAX_BASE ; i++) { |
| 142 |
_d2sdphi2[i] = _d2sdphi2_pas_prevu ; |
| 143 |
} |
| 144 |
// Les routines existantes |
| 145 |
_d2sdphi2[P_COSSIN >> TRA_P] = _d2sdphi2_p_cossin ; |
| 146 |
} |
| 147 |
|
| 148 |
//- Debut de la routine - |
| 149 |
|
| 150 |
// Protection |
| 151 |
assert(etat == ETATQCQ) ; |
| 152 |
|
| 153 |
// Boucle sur les zones |
| 154 |
for (int l=0 ; l<nzone ; l++) { |
| 155 |
int base_p = (base.b[l] & MSQ_P) >> TRA_P ; |
| 156 |
assert(t[l] != 0x0) ; |
| 157 |
_d2sdphi2[base_p](t[l], base.b[l]) ; |
| 158 |
} |
| 159 |
} |
| 160 |
} |