| 1 |
/* |
| 2 |
* Computation of 1/(sin theta) |
| 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_ssint_C[] = "$Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_ssint.C,v 1.6 2014/10/13 08:53:51 j_novak Exp $" ; |
| 33 |
|
| 34 |
/* |
| 35 |
* $Id: valeur_ssint.C,v 1.6 2014/10/13 08:53:51 j_novak Exp $ |
| 36 |
* $Log: valeur_ssint.C,v $ |
| 37 |
* Revision 1.6 2014/10/13 08:53:51 j_novak |
| 38 |
* Lorene classes and functions now belong to the namespace Lorene. |
| 39 |
* |
| 40 |
* Revision 1.5 2014/10/06 15:13:24 j_novak |
| 41 |
* Modified #include directives to use c++ syntax. |
| 42 |
* |
| 43 |
* Revision 1.4 2009/10/10 18:28:11 j_novak |
| 44 |
* New bases T_COS and T_SIN. |
| 45 |
* |
| 46 |
* Revision 1.3 2004/12/17 13:35:05 m_forot |
| 47 |
* Add the case T_LEG |
| 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.6 1999/11/30 12:45:37 eric |
| 57 |
* Valeur::base est desormais du type Base_val et non plus Base_val*. |
| 58 |
* |
| 59 |
* Revision 2.5 1999/11/23 16:18:33 eric |
| 60 |
* Reorganisation du calcul dans le cas ETATZERO. |
| 61 |
* |
| 62 |
* Revision 2.4 1999/11/19 09:31:40 eric |
| 63 |
* La valeur de retour est desormais const Valeur &. |
| 64 |
* |
| 65 |
* Revision 2.3 1999/11/16 13:32:38 novak |
| 66 |
* Ajout de la base T_COSSIN_SP |
| 67 |
* |
| 68 |
* Revision 2.2 1999/10/28 08:00:32 eric |
| 69 |
* Modif commentaires. |
| 70 |
* |
| 71 |
* Revision 2.1 1999/10/18 13:42:45 eric |
| 72 |
* Suppression de l'argument base dans les routines de derivation des mtbl_cf. |
| 73 |
* |
| 74 |
* Revision 2.0 1999/09/07 16:09:12 phil |
| 75 |
* *** empty log message *** |
| 76 |
* |
| 77 |
* Revision 1.1 1999/09/07 16:08:38 phil |
| 78 |
* Initial revision |
| 79 |
* |
| 80 |
* |
| 81 |
* $Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_ssint.C,v 1.6 2014/10/13 08:53:51 j_novak Exp $ |
| 82 |
* |
| 83 |
*/ |
| 84 |
|
| 85 |
|
| 86 |
// Headers C |
| 87 |
#include <cassert> |
| 88 |
|
| 89 |
// Headers Lorene |
| 90 |
#include "mtbl_cf.h" |
| 91 |
#include "valeur.h" |
| 92 |
|
| 93 |
// Local prototypes |
| 94 |
namespace Lorene { |
| 95 |
void _ssint_pas_prevu (Tbl*, int&) ; |
| 96 |
void _ssint_t_cos (Tbl*, int&) ; |
| 97 |
void _ssint_t_sin (Tbl*, int&) ; |
| 98 |
void _ssint_t_sin_p (Tbl*, int&) ; |
| 99 |
void _ssint_t_sin_i (Tbl*, int&) ; |
| 100 |
void _ssint_t_cos_i (Tbl*, int&) ; |
| 101 |
void _ssint_t_cos_p (Tbl*, int&) ; |
| 102 |
void _ssint_t_cossin_si (Tbl*, int&) ; |
| 103 |
void _ssint_t_cossin_ci (Tbl*, int&) ; |
| 104 |
void _ssint_t_cossin_cp (Tbl*, int&) ; |
| 105 |
void _ssint_t_cossin_sp (Tbl*, int&) ; |
| 106 |
void _ssint_t_cossin_c (Tbl*, int&) ; |
| 107 |
void _ssint_t_cossin_s (Tbl*, int&) ; |
| 108 |
|
| 109 |
// Version membre d'un Valeur |
| 110 |
// -------------------------- |
| 111 |
|
| 112 |
const Valeur& Valeur::ssint() const { |
| 113 |
|
| 114 |
// Protection |
| 115 |
assert(etat != ETATNONDEF) ; |
| 116 |
|
| 117 |
// Peut-etre rien a faire ? |
| 118 |
if (p_ssint != 0x0) { |
| 119 |
return *p_ssint ; |
| 120 |
} |
| 121 |
|
| 122 |
// ... si, il faut bosser |
| 123 |
|
| 124 |
p_ssint = new Valeur(mg) ; |
| 125 |
|
| 126 |
if (etat == ETATZERO) { |
| 127 |
p_ssint->set_etat_zero() ; |
| 128 |
} |
| 129 |
else { |
| 130 |
assert(etat == ETATQCQ) ; |
| 131 |
p_ssint->set_etat_cf_qcq() ; |
| 132 |
Mtbl_cf* cfp = p_ssint->c_cf ; // Pointeur sur le Mtbl_cf qui vient d'etre |
| 133 |
// cree par le set_etat_cf_qcq() |
| 134 |
|
| 135 |
// Initialisation de *cfp : recopie des coef. de la fonction |
| 136 |
if (c_cf == 0x0) { |
| 137 |
coef() ; |
| 138 |
} |
| 139 |
*cfp = *c_cf ; |
| 140 |
cfp->ssint() ; // calcul |
| 141 |
|
| 142 |
p_ssint->base = cfp->base ; // On remonte la base de sortie au niveau Valeur |
| 143 |
} |
| 144 |
|
| 145 |
// Termine |
| 146 |
return *p_ssint ; |
| 147 |
} |
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
// Version membre d'un Mtbl_cf |
| 152 |
// --------------------------- |
| 153 |
|
| 154 |
void Mtbl_cf::ssint() { |
| 155 |
|
| 156 |
// Routines de derivation |
| 157 |
static void (*_ssint[MAX_BASE])(Tbl *, int &) ; |
| 158 |
static int nap = 0 ; |
| 159 |
|
| 160 |
// Premier appel |
| 161 |
if (nap==0) { |
| 162 |
nap = 1 ; |
| 163 |
for (int i=0 ; i<MAX_BASE ; i++) { |
| 164 |
_ssint[i] = _ssint_pas_prevu ; |
| 165 |
} |
| 166 |
// Les routines existantes |
| 167 |
_ssint[T_COS >> TRA_T] = _ssint_t_cos ; |
| 168 |
_ssint[T_SIN >> TRA_T] = _ssint_t_sin ; |
| 169 |
_ssint[T_COS_P >> TRA_T] = _ssint_t_cos_p ; |
| 170 |
_ssint[T_COS_I >> TRA_T] = _ssint_t_cos_i ; |
| 171 |
_ssint[T_SIN_P >> TRA_T] = _ssint_t_sin_p ; |
| 172 |
_ssint[T_SIN_I >> TRA_T] = _ssint_t_sin_i ; |
| 173 |
_ssint[T_COSSIN_SI >> TRA_T] = _ssint_t_cossin_si ; |
| 174 |
_ssint[T_COSSIN_CI >> TRA_T] = _ssint_t_cossin_ci ; |
| 175 |
_ssint[T_COSSIN_CP >> TRA_T] = _ssint_t_cossin_cp ; |
| 176 |
_ssint[T_COSSIN_SP >> TRA_T] = _ssint_t_cossin_sp ; |
| 177 |
_ssint[T_COSSIN_C >> TRA_T] = _ssint_t_cossin_c ; |
| 178 |
_ssint[T_COSSIN_S >> TRA_T] = _ssint_t_cossin_s ; |
| 179 |
} |
| 180 |
|
| 181 |
//- Debut de la routine - |
| 182 |
|
| 183 |
// Protection |
| 184 |
assert(etat == ETATQCQ) ; |
| 185 |
|
| 186 |
// Boucle sur les zones |
| 187 |
for (int l=0 ; l<nzone ; l++) { |
| 188 |
int base_t = (base.b[l] & MSQ_T) >> TRA_T ; |
| 189 |
assert(t[l] != 0x0) ; |
| 190 |
_ssint[base_t](t[l], base.b[l]) ; |
| 191 |
} |
| 192 |
} |
| 193 |
} |