LORENE
map_radial_comp_rtp.C
1/*
2 * Copyright (c) 2000-2001 Philippe Grandclement
3 *
4 * This file is part of LORENE.
5 *
6 * LORENE is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * LORENE is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with LORENE; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 */
21
22
23
24
25/*
26 * $Id: map_radial_comp_rtp.C,v 1.6 2016/12/05 16:17:58 j_novak Exp $
27 * $Log: map_radial_comp_rtp.C,v $
28 * Revision 1.6 2016/12/05 16:17:58 j_novak
29 * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
30 *
31 * Revision 1.5 2014/10/13 08:53:06 j_novak
32 * Lorene classes and functions now belong to the namespace Lorene.
33 *
34 * Revision 1.4 2014/10/06 15:13:13 j_novak
35 * Modified #include directives to use c++ syntax.
36 *
37 * Revision 1.3 2005/09/15 15:51:25 j_novak
38 * The "rotation" (change of triad) methods take now Scalars as default
39 * arguments.
40 *
41 * Revision 1.2 2003/06/20 14:46:17 f_limousin
42 * Les assert sur le mapping sont realise a partir du mapping meme et non a partir du pointeur sur ce mapping
43 *
44 * Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon
45 * LORENE
46 *
47 * Revision 1.1 2000/09/19 15:25:50 phil
48 * Initial revision
49 *
50 *
51 * $Header: /cvsroot/Lorene/C++/Source/Map/map_radial_comp_rtp.C,v 1.6 2016/12/05 16:17:58 j_novak Exp $
52 *
53 */
54
55
56// Headers C
57#include <cassert>
58
59// Headers Lorene
60#include "tensor.h"
61#include "cmp.h"
62
63
64 //------------------------------------//
65 // r component //
66 //------------------------------------//
67namespace Lorene {
68void Map_radial::comp_r_from_cartesian(const Cmp& v_x, const Cmp& v_y,
69 const Cmp& v_z, Cmp& v_r) const {
70 Scalar resu = v_r ;
71 comp_r_from_cartesian(Scalar(v_x), Scalar(v_y), Scalar(v_z), resu) ;
72 v_r = resu ;
73}
74
75void Map_radial::comp_r_from_cartesian(const Scalar& v_x, const Scalar& v_y,
76 const Scalar& v_z, Scalar& v_r) const {
77
78
79 // Protections
80 // -----------
81 assert(v_x.get_etat() != ETATNONDEF) ;
82 assert(v_y.get_etat() != ETATNONDEF) ;
83 assert(v_z.get_etat() != ETATNONDEF) ;
84
85 assert(v_x.get_mp() == *this) ;
86 assert(v_y.get_mp() == *this) ;
87 assert(v_z.get_mp() == *this) ;
88
89 int dzp ;
90 if ( v_x.dz_nonzero() ) {
91 dzp = v_x.get_dzpuis() ;
92 }
93 else{
94 if ( v_y.dz_nonzero() ) {
95 dzp = v_y.get_dzpuis() ;
96 }
97 else{
98 dzp = v_z.get_dzpuis() ;
99 }
100 }
101
102 assert( v_x.check_dzpuis(dzp) ) ;
103 assert( v_y.check_dzpuis(dzp) ) ;
104 assert( v_z.check_dzpuis(dzp) ) ;
105
106 // Computation
107 // -----------
108 const Valeur& w_x = v_x.get_spectral_va() ;
109 const Valeur& w_y = v_y.get_spectral_va() ;
110 const Valeur& w_z = v_z.get_spectral_va() ;
111
112 Valeur tmp = w_x.mult_cp() + w_y.mult_sp() ;
113
114 v_r = tmp.mult_st() + w_z.mult_ct() ;
115
116 v_r.set_dzpuis(dzp) ;
117
118}
119
120
121 //------------------------------------//
122 // Theta component //
123 //------------------------------------//
124void Map_radial::comp_t_from_cartesian(const Cmp& v_x, const Cmp& v_y,
125 const Cmp& v_z, Cmp& v_t) const {
126 Scalar resu = v_t ;
127 comp_t_from_cartesian( Scalar(v_x), Scalar(v_y), Scalar(v_z), resu ) ;
128 v_t = resu ;
129}
130
132 const Scalar& v_z, Scalar& v_t) const {
133
134
135 // Protections
136 // -----------
137 assert(v_x.get_etat() != ETATNONDEF) ;
138 assert(v_y.get_etat() != ETATNONDEF) ;
139 assert(v_z.get_etat() != ETATNONDEF) ;
140
141 assert(v_x.get_mp() == *this) ;
142 assert(v_y.get_mp() == *this) ;
143 assert(v_z.get_mp() == *this) ;
144
145 int dzp ;
146 if ( v_x.dz_nonzero() ) {
147 dzp = v_x.get_dzpuis() ;
148 }
149 else{
150 if ( v_y.dz_nonzero() ) {
151 dzp = v_y.get_dzpuis() ;
152 }
153 else{
154 dzp = v_z.get_dzpuis() ;
155 }
156 }
157
158 assert( v_x.check_dzpuis(dzp) ) ;
159 assert( v_y.check_dzpuis(dzp) ) ;
160 assert( v_z.check_dzpuis(dzp) ) ;
161
162 // Computation
163 // -----------
164 const Valeur& w_x = v_x.get_spectral_va() ;
165 const Valeur& w_y = v_y.get_spectral_va() ;
166 const Valeur& w_z = v_z.get_spectral_va() ;
167
168 Valeur tmp = w_x.mult_cp() + w_y.mult_sp() ;
169
170 v_t = tmp.mult_ct() - w_z.mult_st() ;
171
172 v_t.set_dzpuis(dzp) ;
173
174}
175
176 //------------------------------------//
177 // Phi component //
178 //------------------------------------//
179void Map_radial::comp_p_from_cartesian(const Cmp& v_x, const Cmp& v_y,
180 Cmp& v_p) const {
181 Scalar resu = v_p ;
182 comp_p_from_cartesian(Scalar(v_x), Scalar(v_y), resu) ;
183 v_p = resu ;
184}
185
187 Scalar& v_p) const {
188
189
190 // Protections
191 // -----------
192 assert(v_x.get_etat() != ETATNONDEF) ;
193 assert(v_y.get_etat() != ETATNONDEF) ;
194
195 assert(v_x.get_mp() == *this) ;
196 assert(v_y.get_mp() == *this) ;
197
198 int dzp ;
199 if ( v_x.dz_nonzero() ) {
200 dzp = v_x.get_dzpuis() ;
201 }
202 else{
203 dzp = v_y.get_dzpuis() ;
204 }
205
206 assert( v_x.check_dzpuis(dzp) ) ;
207 assert( v_y.check_dzpuis(dzp) ) ;
208
209 // Computation
210 // -----------
211 const Valeur& w_x = v_x.get_spectral_va() ;
212 const Valeur& w_y = v_y.get_spectral_va() ;
213
214 v_p = - w_x.mult_sp() + w_y.mult_cp() ;
215
216 v_p.set_dzpuis(dzp) ;
217
218}
219
220
221}
Component of a tensorial field *** DEPRECATED : use class Scalar instead ***.
Definition cmp.h:446
virtual void comp_r_from_cartesian(const Scalar &v_x, const Scalar &v_y, const Scalar &v_z, Scalar &v_r) const
Computes the Spherical r component (with respect to bvect_spher ) of a vector given by its cartesian ...
virtual void comp_p_from_cartesian(const Scalar &v_x, const Scalar &v_y, Scalar &v_p) const
Computes the Spherical component (with respect to bvect_spher ) of a vector given by its cartesian c...
virtual void comp_t_from_cartesian(const Scalar &v_x, const Scalar &v_y, const Scalar &v_z, Scalar &v_t) const
Computes the Spherical component (with respect to bvect_spher ) of a vector given by its cartesian c...
Tensor field of valence 0 (or component of a tensorial field).
Definition scalar.h:393
int get_dzpuis() const
Returns dzpuis.
Definition scalar.h:563
bool dz_nonzero() const
Returns true if the last domain is compactified and *this is not zero in this domain.
Definition scalar.C:820
bool check_dzpuis(int dzi) const
Returns false if the last domain is compactified and *this is not zero in this domain and dzpuis is n...
Definition scalar.C:879
const Valeur & get_spectral_va() const
Returns va (read only version).
Definition scalar.h:607
int get_etat() const
Returns the logical state ETATNONDEF (undefined), ETATZERO (null) or ETATQCQ (ordinary).
Definition scalar.h:560
void set_dzpuis(int)
Modifies the dzpuis flag.
Definition scalar.C:814
Values and coefficients of a (real-value) function.
Definition valeur.h:297
const Valeur & mult_ct() const
Returns applied to *this.
const Valeur & mult_st() const
Returns applied to *this.
const Valeur & mult_cp() const
Returns applied to *this.
const Valeur & mult_sp() const
Returns applied to *this.
const Map & get_mp() const
Returns the mapping.
Definition tensor.h:874
Lorene prototypes.
Definition app_hor.h:67