| 1 |
/* |
| 2 |
* Methods for multiplication by cos(phi) for classes |
| 3 |
* - Valeur |
| 4 |
* - Mtbl_cf |
| 5 |
*/ |
| 6 |
|
| 7 |
/* |
| 8 |
* Copyright (c) 2000-2001 Eric Gourgoulhon |
| 9 |
* |
| 10 |
* This file is part of LORENE. |
| 11 |
* |
| 12 |
* LORENE is free software; you can redistribute it and/or modify |
| 13 |
* it under the terms of the GNU General Public License as published by |
| 14 |
* the Free Software Foundation; either version 2 of the License, or |
| 15 |
* (at your option) any later version. |
| 16 |
* |
| 17 |
* LORENE is distributed in the hope that it will be useful, |
| 18 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 |
* GNU General Public License for more details. |
| 21 |
* |
| 22 |
* You should have received a copy of the GNU General Public License |
| 23 |
* along with LORENE; if not, write to the Free Software |
| 24 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 25 |
* |
| 26 |
*/ |
| 27 |
|
| 28 |
|
| 29 |
char valeur_mult_cp_C[] = "$Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_mult_cp.C,v 1.4 2014/10/13 08:53:50 j_novak Exp $" ; |
| 30 |
|
| 31 |
/* |
| 32 |
* $Id: valeur_mult_cp.C,v 1.4 2014/10/13 08:53:50 j_novak Exp $ |
| 33 |
* $Log: valeur_mult_cp.C,v $ |
| 34 |
* Revision 1.4 2014/10/13 08:53:50 j_novak |
| 35 |
* Lorene classes and functions now belong to the namespace Lorene. |
| 36 |
* |
| 37 |
* Revision 1.3 2014/10/06 15:13:23 j_novak |
| 38 |
* Modified #include directives to use c++ syntax. |
| 39 |
* |
| 40 |
* Revision 1.2 2012/01/17 15:08:27 j_penner |
| 41 |
* using MAX_BASE_2 for the phi coordinate |
| 42 |
* |
| 43 |
* Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon |
| 44 |
* LORENE |
| 45 |
* |
| 46 |
* Revision 2.2 2000/09/18 10:15:08 eric |
| 47 |
* Ajout des bases P_COSSIN_P et P_COSSIN_I |
| 48 |
* |
| 49 |
* Revision 2.1 2000/09/11 15:03:56 eric |
| 50 |
* *** empty log message *** |
| 51 |
* |
| 52 |
* Revision 2.0 2000/09/11 13:53:52 eric |
| 53 |
* *** empty log message *** |
| 54 |
* |
| 55 |
* |
| 56 |
* $Header: /cvsroot/Lorene/C++/Source/Valeur/valeur_mult_cp.C,v 1.4 2014/10/13 08:53:50 j_novak Exp $ |
| 57 |
* |
| 58 |
*/ |
| 59 |
|
| 60 |
// Headers C |
| 61 |
#include <cassert> |
| 62 |
|
| 63 |
// Headers Lorene |
| 64 |
#include "mtbl_cf.h" |
| 65 |
#include "valeur.h" |
| 66 |
|
| 67 |
// Local prototypes |
| 68 |
namespace Lorene { |
| 69 |
void _mult_cp_pas_prevu(Tbl*, int&) ; |
| 70 |
void _mult_cp_p_cossin(Tbl*, int&) ; |
| 71 |
void _mult_cp_p_cossin_p(Tbl*, int&) ; |
| 72 |
void _mult_cp_p_cossin_i(Tbl*, int&) ; |
| 73 |
|
| 74 |
// Version membre d'un Valeur |
| 75 |
// -------------------------- |
| 76 |
|
| 77 |
const Valeur& Valeur::mult_cp() const { |
| 78 |
|
| 79 |
// Protection |
| 80 |
assert(etat != ETATNONDEF) ; |
| 81 |
|
| 82 |
// Peut-etre rien a faire ? |
| 83 |
if (p_mult_cp != 0x0) { |
| 84 |
return *p_mult_cp ; |
| 85 |
} |
| 86 |
|
| 87 |
// ... si, il faut bosser |
| 88 |
|
| 89 |
p_mult_cp = new Valeur(mg) ; |
| 90 |
|
| 91 |
if (etat == ETATZERO) { |
| 92 |
p_mult_cp->set_etat_zero() ; |
| 93 |
} |
| 94 |
else { |
| 95 |
assert(etat == ETATQCQ) ; |
| 96 |
p_mult_cp->set_etat_cf_qcq() ; |
| 97 |
Mtbl_cf* cfp = p_mult_cp->c_cf ; // Pointeur sur le Mtbl_cf qui vient d'etre |
| 98 |
// cree par le set_etat_cf_qcq() |
| 99 |
|
| 100 |
// Initialisation de *cfp : recopie des coef. de la fonction |
| 101 |
if (c_cf == 0x0) { |
| 102 |
coef() ; |
| 103 |
} |
| 104 |
*cfp = *c_cf ; |
| 105 |
|
| 106 |
cfp->mult_cp() ; // calcul |
| 107 |
|
| 108 |
p_mult_cp->base = cfp->base ; // On remonte la base de sortie au niveau Valeur |
| 109 |
} |
| 110 |
|
| 111 |
// Termine |
| 112 |
return *p_mult_cp ; |
| 113 |
} |
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
// Version membre d'un Mtbl_cf |
| 118 |
// --------------------------- |
| 119 |
|
| 120 |
void Mtbl_cf::mult_cp() { |
| 121 |
|
| 122 |
// Routines de derivation |
| 123 |
static void (*_mult_cp[MAX_BASE_2])(Tbl *, int &) ; |
| 124 |
static int nap = 0 ; |
| 125 |
|
| 126 |
// Premier appel |
| 127 |
if (nap==0) { |
| 128 |
nap = 1 ; |
| 129 |
for (int i=0 ; i<MAX_BASE_2 ; i++) { |
| 130 |
_mult_cp[i] = _mult_cp_pas_prevu ; |
| 131 |
} |
| 132 |
// Les routines existantes |
| 133 |
_mult_cp[P_COSSIN >> TRA_P] = _mult_cp_p_cossin ; |
| 134 |
_mult_cp[P_COSSIN_P >> TRA_P] = _mult_cp_p_cossin_p ; |
| 135 |
_mult_cp[P_COSSIN_I >> TRA_P] = _mult_cp_p_cossin_i ; |
| 136 |
} |
| 137 |
|
| 138 |
// Debut de la routine |
| 139 |
|
| 140 |
// Protection |
| 141 |
assert(etat == ETATQCQ) ; |
| 142 |
|
| 143 |
// Boucle sur les zones |
| 144 |
for (int l=0 ; l<nzone ; l++) { |
| 145 |
int base_p = (base.b[l] & MSQ_P) >> TRA_P ; |
| 146 |
assert(t[l] != 0x0) ; |
| 147 |
_mult_cp[base_p](t[l], base.b[l]) ; |
| 148 |
} |
| 149 |
} |
| 150 |
} |