LORENE
op_d2sdphi2.C
1/*
2 * Copyright (c) 1999-2000 Jean-Alain Marck
3 * Copyright (c) 1999-2001 Eric Gourgoulhon
4 *
5 * This file is part of LORENE.
6 *
7 * LORENE is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * LORENE is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with LORENE; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 */
22
23
24
25
26/*
27 * Ensemble des routines de base de derivation seconde par rapport a Phi
28 * (Utilisation interne)
29 *
30 * void _d2sdphi2_XXXX(Tbl * t, int & b)
31 * t pointeur sur le Tbl d'entree-sortie
32 * b base spectrale
33 *
34 */
35
36/*
37 * $Id: op_d2sdphi2.C,v 1.4 2016/12/05 16:18:07 j_novak Exp $
38 * $Log: op_d2sdphi2.C,v $
39 * Revision 1.4 2016/12/05 16:18:07 j_novak
40 * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
41 *
42 * Revision 1.3 2014/10/13 08:53:24 j_novak
43 * Lorene classes and functions now belong to the namespace Lorene.
44 *
45 * Revision 1.2 2006/03/10 12:45:38 j_novak
46 * Use of C++-style cast.
47 *
48 * Revision 1.1.1.1 2001/11/20 15:19:29 e_gourgoulhon
49 * LORENE
50 *
51 * Revision 2.4 2000/10/04 10:14:52 eric
52 * Ajout d' abort() dans le cas non prevu.
53 * ./
54 *
55 * Revision 2.3 2000/02/24 16:40:19 eric
56 * Initialisation a zero du tableau xo avant le calcul.
57 *
58 * Revision 2.2 1999/11/15 16:37:33 eric
59 * Tbl::dim est desormais un Dim_tbl et non plus un Dim_tbl*.
60 *
61 * Revision 2.1 1999/03/01 15:05:37 eric
62 * *** empty log message ***
63 *
64 * Revision 2.0 1999/02/23 11:40:34 hyc
65 * *** empty log message ***
66 *
67 *
68 *
69 * $Header: /cvsroot/Lorene/C++/Source/Non_class_members/Operators/op_d2sdphi2.C,v 1.4 2016/12/05 16:18:07 j_novak Exp $
70 *
71 */
72
73// Headers Lorene
74#include "tbl.h"
75
76// Routine pour les cas non prevus
77//--------------------------------
78namespace Lorene {
79void _d2sdphi2_pas_prevu(Tbl* , int & b) {
80 cout << "Unknown phi basis in Mtbl_cf::d2sdp2() !" << endl ;
81 cout << " basis: " << hex << b << endl ;
82 abort() ;
83}
84
85// cas P_COSSIN
86//-------------
87void _d2sdphi2_p_cossin(Tbl* tb, int & )
88{
89
90 // Peut-etre rien a faire ?
91 if (tb->get_etat() == ETATZERO) {
92 return ;
93 }
94
95 // Protection
96 assert(tb->get_etat() == ETATQCQ) ;
97
98 // Pour le confort
99 int nr = (tb->dim).dim[0] ; // Nombre
100 int nt = (tb->dim).dim[1] ; // de points
101 int np = (tb->dim).dim[2] ; // physiques REELS
102 np = np - 2 ; // Nombre de points physiques
103
104 // Variables statiques
105 static double* cx = 0 ;
106 static int np_pre =0 ;
107
108 // Test sur np pour initialisation eventuelle
109 if (np > np_pre) {
110 np_pre = np ;
111 cx = reinterpret_cast<double*>(realloc(cx, (np+2) * sizeof(double))) ;
112 for (int i=0 ; i<np+2 ; i++) {
113 cx[i] = - (i/2) * (i/2) ;
114 }
115 }
116
117 // pt. sur le tableau de double resultat
118 double* xo = new double[(tb->dim).taille] ;
119
120 // Initialisation a zero :
121 for (int i=0; i<(tb->dim).taille; i++) {
122 xo[i] = 0 ;
123 }
124
125 // On y va...
126 double* xi = tb->t ;
127 double* xci = xi ; // Pointeurs
128 double* xco = xo ; // courants
129
130 // k = 0
131 for (int j=0 ; j<nt ; j++) {
132 for (int i=0 ; i<nr ; i++ ) {
133 *xco = cx[0] * (*xci) ;
134 xci++ ;
135 xco++ ;
136 } // Fin de la boucle sur r
137 } // Fin de la boucle sur theta
138
139 // k = 1
140 xci += nr*nt ;
141 xco += nr*nt ;
142
143 // k >= 2
144 for (int k=2 ; k<np+1 ; k++) {
145 for (int j=0 ; j<nt ; j++) {
146 for (int i=0 ; i<nr ; i++ ) {
147 *xco = cx[k] * (*xci) ;
148 xci++ ;
149 xco++ ;
150 } // Fin de la boucle sur r
151 } // Fin de la boucle sur theta
152 } // Fin de la boucle sur phi
153
154 // On remet les choses la ou il faut
155 delete [] tb->t ;
156 tb->t = xo ;
157
158 // base de developpement
159 // inchangee
160}
161
162}
Basic array class.
Definition tbl.h:161
Lorene prototypes.
Definition app_hor.h:67