LORENE
map_et_deriv.C
1 /*
2  * Computations of Cmp partial derivatives for a Map_et mapping
3  */
4 
5 /*
6  * Copyright (c) 1999-2003 Eric Gourgoulhon
7  *
8  * This file is part of LORENE.
9  *
10  * LORENE is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * LORENE is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with LORENE; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23  *
24  */
25 
26 
27 
28 
29 /*
30  * $Id: map_et_deriv.C,v 1.11 2016/12/05 16:17:57 j_novak Exp $
31  * $Log: map_et_deriv.C,v $
32  * Revision 1.11 2016/12/05 16:17:57 j_novak
33  * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
34  *
35  * Revision 1.10 2014/10/13 08:53:03 j_novak
36  * Lorene classes and functions now belong to the namespace Lorene.
37  *
38  * Revision 1.9 2012/01/17 10:33:33 j_penner
39  * added a derivative with respect to the computational coordinate xi
40  *
41  * Revision 1.8 2004/06/22 08:49:58 p_grandclement
42  * Addition of everything needed for using the logarithmic mapping
43  *
44  * Revision 1.7 2004/05/07 13:19:24 j_novak
45  * Prevention of warnings
46  *
47  * Revision 1.6 2004/04/08 17:16:07 f_limousin
48  * Add comments
49  *
50  * Revision 1.5 2004/04/08 16:39:23 f_limousin
51  * Add the case dzpuis different of 0 for methods dsdr, srdsdt, srstdsdp
52  * for Scalar's.
53  *
54  * Revision 1.4 2004/01/26 16:16:17 j_novak
55  * Methods of gradient for Scalar s. The input can have any dzpuis.
56  *
57  * Revision 1.3 2003/10/20 19:45:53 e_gourgoulhon
58  * check_dzpuis in dsdt and stdsdp.
59  *
60  * Revision 1.2 2003/10/15 10:37:43 e_gourgoulhon
61  * Added new methods dsdt and stdsdp.
62  *
63  * Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon
64  * LORENE
65  *
66  * Revision 1.3 2000/02/25 09:01:28 eric
67  * Remplacement de ci.get_dzpuis() == 0 par ci.check_dzpuis(0).
68  * Suppression de l'affectation des dzpuis Mtbl/Mtnl_cf a la fin car
69  * c'est fait par Cmp::set_dzpuis.
70  *
71  * Revision 1.2 2000/01/26 13:09:52 eric
72  * Reprototypage complet des routines de derivation:
73  * le resultat est desormais suppose alloue a l'exterieur de la routine
74  * et est passe en argument (Cmp& resu), si bien que le prototypage
75  * complet devient:
76  * void DERIV(const Cmp& ci, Cmp& resu) const
77  *
78  * Revision 1.1 1999/12/17 12:59:29 eric
79  * Initial revision
80  *
81  *
82  * $Header: /cvsroot/Lorene/C++/Source/Map/map_et_deriv.C,v 1.11 2016/12/05 16:17:57 j_novak Exp $
83  *
84  */
85 
86 
87 // Header Lorene
88 #include "map.h"
89 #include "cmp.h"
90 #include "tensor.h"
91 
92  //-----------------------//
93  // d/d\xi //
94  //-----------------------//
95 
96 
97 namespace Lorene {
98 void Map_et::dsdxi(const Cmp& ci, Cmp& resu) const {
99 
100  assert (ci.get_etat() != ETATNONDEF) ;
101  assert (ci.get_mp()->get_mg() == mg) ;
102 
103  if (ci.get_etat() == ETATZERO) {
104  resu.set_etat_zero() ;
105  }
106  else {
107  assert( ci.get_etat() == ETATQCQ ) ;
108  assert( ci.check_dzpuis(0) ) ;
109 
110  (ci.va).coef() ; // (ci.va).c_cf is up to date
111 
112  resu = (ci.va).dsdx() ; // dsdx == d/d\xi
113 
114  (resu.va).base = (ci.va).dsdx().base ; // same basis as d/dxi
115 
116  int nz = mg->get_nzone() ;
117  if (mg->get_type_r(nz-1) == UNSURR) {
118  resu.set_dzpuis(2) ; // r^2 d/dr has been computed in the
119  // external domain
120  }
121 
122  }
123 
124 }
125 
126 void Map_et::dsdxi(const Scalar& uu, Scalar& resu) const {
127 
128  assert (uu.get_etat() != ETATNONDEF) ;
129  assert (uu.get_mp().get_mg() == mg) ;
130 
131  if (uu.get_etat() == ETATZERO) {
132  resu.set_etat_zero() ;
133  }
134  else {
135  assert( uu.get_etat() == ETATQCQ ) ;
136 
137  const Valeur& uuva = uu.get_spectral_va() ;
138 
139  uuva.coef() ; // (uu.va).c_cf is up to date
140 
141  int nz = mg->get_nzone() ;
142  int nzm1 = nz - 1 ;
143 
144  if ( uu.get_dzpuis() == 0 ) {
145  resu = uuva.dsdx() ; // dsdxi = d/d\xi
146 
147  if (mg->get_type_r(nzm1) == UNSURR) {
148  resu.set_dzpuis(2) ; // r^2 d/dr has been computed in the
149  // external domain
150  }
151  }
152  else {
153  assert(mg->get_type_r(nzm1) == UNSURR) ;
154 
155  int dzp = uu.get_dzpuis() ;
156 
157  resu = uuva.dsdx() ;
158  resu.annule_domain(nzm1) ; // zero in the CED
159 
160  // Special treatment in the CED
161  Valeur tmp_ced = uuva.dsdx() ;
162  Base_val sauve_base( tmp_ced.get_base() ) ;
163  tmp_ced = tmp_ced ;
164  tmp_ced.set_base(sauve_base) ; // The above operation does not
165  //change the basis
166  tmp_ced = tmp_ced.mult_x() ; // xi, Id, (xi-1)
167  tmp_ced = tmp_ced / xsr ; // xi/R, 1/R, (xi-1)/U
168 
169  tmp_ced.annule(0, nz-2) ; // only non zero in the CED
170  tmp_ced.set(nzm1) -= dzp * uuva(nzm1) ;
171 
172  // Recombination shells + CED :
173  resu.set_spectral_va() += tmp_ced ;
174 
175  resu.set_dzpuis(dzp+1) ;
176 
177  }
178 
179  resu.set_spectral_base( uuva.dsdx().get_base() ) ; // same basis as d/dxi
180 
181  }
182 
183 }
184 
185  //---------------------//
186  // d/dr //
187  //---------------------//
188 
189 
190 void Map_et::dsdr(const Cmp& ci, Cmp& resu) const {
191 
192  assert (ci.get_etat() != ETATNONDEF) ;
193  assert (ci.get_mp()->get_mg() == mg) ;
194 
195  if (ci.get_etat() == ETATZERO) {
196  resu.set_etat_zero() ;
197  }
198  else {
199  assert( ci.get_etat() == ETATQCQ ) ;
200  assert( ci.check_dzpuis(0) ) ;
201 
202  (ci.va).coef() ; // (ci.va).c_cf is up to date
203 
204  resu = (ci.va).dsdx() * dxdr ; // dxi/dR, - dxi/dU (ZEC)
205 
206  (resu.va).base = (ci.va).dsdx().base ; // same basis as d/dxi
207 
208  int nz = mg->get_nzone() ;
209  if (mg->get_type_r(nz-1) == UNSURR) {
210  resu.set_dzpuis(2) ; // r^2 d/dr has been computed in the
211  // external domain
212  }
213 
214  }
215 
216 }
217 
218 void Map_et::dsdr(const Scalar& uu, Scalar& resu) const {
219 
220  assert (uu.get_etat() != ETATNONDEF) ;
221  assert (uu.get_mp().get_mg() == mg) ;
222 
223  if (uu.get_etat() == ETATZERO) {
224  resu.set_etat_zero() ;
225  }
226  else {
227  assert( uu.get_etat() == ETATQCQ ) ;
228 
229  const Valeur& uuva = uu.get_spectral_va() ;
230 
231  uuva.coef() ; // (uu.va).c_cf is up to date
232 
233  int nz = mg->get_nzone() ;
234  int nzm1 = nz - 1 ;
235 
236  if ( uu.get_dzpuis() == 0 ) {
237  resu = uuva.dsdx() * dxdr ; // dxdr = dxi/dR, - dxi/dU (ZEC)
238 
239  if (mg->get_type_r(nzm1) == UNSURR) {
240  resu.set_dzpuis(2) ; // r^2 d/dr has been computed in the
241  // external domain
242  }
243  }
244  else {
245  assert(mg->get_type_r(nzm1) == UNSURR) ;
246 
247  int dzp = uu.get_dzpuis() ;
248 
249  resu = uuva.dsdx() * dxdr ;
250  resu.annule_domain(nzm1) ; // zero in the CED
251 
252  // Special treatment in the CED
253  Valeur tmp_ced = uuva.dsdx() ;
254  Base_val sauve_base( tmp_ced.get_base() ) ;
255  tmp_ced = tmp_ced * dxdr ;
256  tmp_ced.set_base(sauve_base) ; // The above operation does not
257  //change the basis
258  tmp_ced = tmp_ced.mult_x() ; // xi, Id, (xi-1)
259  tmp_ced = tmp_ced / xsr ; // xi/R, 1/R, (xi-1)/U
260 
261  tmp_ced.annule(0, nz-2) ; // only non zero in the CED
262  tmp_ced.set(nzm1) -= dzp * uuva(nzm1) ;
263 
264  // Recombination shells + CED :
265  resu.set_spectral_va() += tmp_ced ;
266 
267  resu.set_dzpuis(dzp+1) ;
268 
269  }
270 
271  resu.set_spectral_base( uuva.dsdx().get_base() ) ; // same basis as d/dxi
272 
273  }
274 
275 }
276 
277 void Map_et::dsdradial(const Scalar& uu, Scalar& resu) const {
278 
279  assert (uu.get_etat() != ETATNONDEF) ;
280  assert (uu.get_mp().get_mg() == mg) ;
281 
282  if (uu.get_etat() == ETATZERO) {
283  resu.set_etat_zero() ;
284  }
285  else {
286  assert( uu.get_etat() == ETATQCQ ) ;
287 
288  const Valeur& uuva = uu.get_spectral_va() ;
289 
290  uuva.coef() ; // (uu.va).c_cf is up to date
291 
292  int nz = mg->get_nzone() ;
293  int nzm1 = nz - 1 ;
294 
295  if ( uu.get_dzpuis() == 0 ) {
296  resu = uuva.dsdx() * dxdr ; // dxdr = dxi/dR, - dxi/dU (ZEC)
297 
298  if (mg->get_type_r(nzm1) == UNSURR) {
299  resu.set_dzpuis(2) ; // r^2 d/dr has been computed in the
300  // external domain
301  }
302  }
303  else {
304  assert(mg->get_type_r(nzm1) == UNSURR) ;
305 
306  int dzp = uu.get_dzpuis() ;
307 
308  resu = uuva.dsdx() * dxdr ;
309  resu.annule_domain(nzm1) ; // zero in the CED
310 
311  // Special treatment in the CED
312  Valeur tmp_ced = uuva.dsdx() ;
313  Base_val sauve_base( tmp_ced.get_base() ) ;
314  tmp_ced = tmp_ced * dxdr ;
315  tmp_ced.set_base(sauve_base) ; // The above operation does not
316  //change the basis
317  tmp_ced = tmp_ced.mult_x() ; // xi, Id, (xi-1)
318  tmp_ced = tmp_ced / xsr ; // xi/R, 1/R, (xi-1)/U
319 
320  tmp_ced.annule(0, nz-2) ; // only non zero in the CED
321  tmp_ced.set(nzm1) -= dzp * uuva(nzm1) ;
322 
323  // Recombination shells + CED :
324  resu.set_spectral_va() += tmp_ced ;
325 
326  resu.set_dzpuis(dzp+1) ;
327 
328  }
329 
330  resu.set_spectral_base( uuva.dsdx().get_base() ) ; // same basis as d/dxi
331 
332  }
333 
334 }
335 
336  //------------------------//
337  // 1/r d/dtheta //
338  //------------------------//
339 
340 void Map_et::srdsdt(const Cmp& ci, Cmp& resu) const {
341 
342  assert (ci.get_etat() != ETATNONDEF) ;
343  assert (ci.get_mp()->get_mg() == mg) ;
344 
345  if (ci.get_etat() == ETATZERO) {
346  resu.set_etat_zero() ;
347  }
348  else {
349 
350  assert( ci.get_etat() == ETATQCQ ) ;
351  assert( ci.check_dzpuis(0) ) ;
352 
353  (ci.va).coef() ; // (ci.va).c_cf is up to date
354 
355  // Computation of 1/R df/dtheta' ---> srdfdt
356  // ----------------------------
357  Valeur srdfdt = ci.va ;
358 
359  srdfdt = srdfdt.dsdt() ; // d/dtheta'
360  srdfdt = srdfdt.sx() ; // 1/xi, Id, 1/(xi-1)
361 
362  Base_val sauve_base( srdfdt.base ) ;
363 
364  srdfdt = srdfdt * xsr ; // xi/R, 1/R, (xi-1)/U
365 
366  srdfdt.base = sauve_base ; // The above operation does not change the basis
367 
368  // Computation of 1/(dR/dx) 1/R dR/dtheta' df/dx ----> adfdx
369  // ----------------------------------------------
370 
371  Valeur adfdx = ci.va ;
372 
373  adfdx = adfdx.dsdx() ; // df/dx
374 
375  sauve_base = adfdx.base ;
376  adfdx = adfdx * dxdr * srdrdt ; // 1/(dR/dx) 1/R dR/dtheta' df/dx
377  adfdx.base = sauve_base ;
378 
379  // Final result
380  // ------------
381 
382  resu = srdfdt - adfdx ;
383 
384  int nz = mg->get_nzone() ;
385  if (mg->get_type_r(nz-1) == UNSURR) {
386  resu.set_dzpuis(2) ; // r d/dtheta has been computed in
387  // the external domain
388  }
389 
390  }
391 
392 }
393 
394 void Map_et::srdsdt(const Scalar& uu, Scalar& resu) const {
395 
396  assert (uu.get_etat() != ETATNONDEF) ;
397  assert (uu.get_mp().get_mg() == mg) ;
398 
399  if (uu.get_etat() == ETATZERO) {
400  resu.set_etat_zero() ;
401  }
402  else {
403 
404  assert( uu.get_etat() == ETATQCQ ) ;
405 
406  const Valeur& uuva = uu.get_spectral_va() ;
407  uuva.coef() ; // (uu.va).c_cf is up to date
408 
409  int nz = mg->get_nzone() ;
410  int nzm1 = nz - 1 ;
411 
412  // Computation of 1/R df/dtheta' ---> srdfdt
413  // ----------------------------
414  Valeur srdfdt = uuva ;
415 
416  srdfdt = srdfdt.dsdt() ; // d/dtheta'
417 
418  srdfdt = srdfdt.sx() ; // 1/xi, Id, 1/(xi-1)
419 
420  Base_val sauve_base( srdfdt.base ) ;
421 
422  srdfdt = srdfdt * xsr ; // xi/R, 1/R, (xi-1)/U
423 
424  srdfdt.base = sauve_base ; // The above operation does not change the basis
425  // Computation of 1/(dR/dx) 1/R dR/dtheta' df/dx ----> adfdx
426  // ----------------------------------------------
427 
428  Valeur adfdx = uuva ;
429 
430  adfdx = adfdx.dsdx() ; // df/dx
431 
432  sauve_base = adfdx.base ;
433  adfdx = adfdx * dxdr * srdrdt ; // 1/(dR/dx) 1/R dR/dtheta' df/dx
434  adfdx.base = sauve_base ;
435 
436  if (uu.get_dzpuis() == 0) {
437 
438  // Final result
439  // ------------
440 
441  resu = srdfdt - adfdx ;
442 
443  //s int nz = mg->get_nzone() ;
444  if (mg->get_type_r(nz-1) == UNSURR) {
445  resu.set_dzpuis(2) ; // r^2 (1/r d/dtheta) has been computed in
446  // the external domain
447  }
448 
449  }
450 
451  else {
452  assert(mg->get_type_r(nzm1) == UNSURR) ;
453 
454  int dzp = uu.get_dzpuis() ;
455 
456  Valeur tmp = srdfdt - adfdx ;
457  tmp.annule(nzm1) ;
458 
459  // Special treatment in the CED
460  //-----------------------------
461 
462  Valeur tmp_ced = - adfdx ;
463 
464  tmp_ced.annule(0, nz-2) ; // only non zero in the CED
465 
466  tmp_ced = tmp_ced.mult_x() ; // xi, Id, (xi-1)
467  //s Base_val sauve_base( tmp_ced.get_base() ) ;
468  tmp_ced = tmp_ced / xsr ; // xi/R, 1/R, (xi-1)/U
469 
470  tmp_ced = tmp_ced + uuva.dsdt() ;
471  tmp_ced.annule(0, nz-2) ; // only non zero in the CED
472 
473  // Recombination shells + CED :
474  resu = tmp + tmp_ced ;
475 
476  resu.set_dzpuis(dzp+1) ;
477  }
478 
479  }
480 
481 }
482 
483 
484  //------------------------------------//
485  // 1/(r sin(theta)) d/dphi //
486  //------------------------------------//
487 
488 void Map_et::srstdsdp(const Cmp& ci, Cmp& resu) const {
489 
490  assert (ci.get_etat() != ETATNONDEF) ;
491  assert (ci.get_mp()->get_mg() == mg) ;
492 
493  if (ci.get_etat() == ETATZERO) {
494  resu.set_etat_zero() ;
495  }
496  else {
497 
498  assert( ci.get_etat() == ETATQCQ) ;
499  assert( ci.check_dzpuis(0) ) ;
500 
501  (ci.va).coef() ; // (ci.va).c_cf is up to date
502 
503  // Computation of 1/(R sin(theta')) df/dphi' ---> srstdfdp
504  // -----------------------------------------
505 
506  Valeur srstdfdp = ci.va ;
507 
508  srstdfdp = srstdfdp.dsdp() ; // d/dphi
509  srstdfdp = srstdfdp.ssint() ; // 1/sin(theta)
510  srstdfdp = srstdfdp.sx() ; // 1/xi, Id, 1/(xi-1)
511 
512  Base_val sauve_base( srstdfdp.base ) ;
513 
514  srstdfdp = srstdfdp * xsr ; // xi/R, 1/R, (xi-1)/U
515 
516  srstdfdp.base = sauve_base ; // The above operation does not change the basis
517 
518  // Computation of 1/(dR/dx) 1/(R sin(theta') dR/dphi' df/dx --> bdfdx
519  // --------------------------------------------------------
520  Valeur bdfdx = ci.va ;
521 
522  bdfdx = bdfdx.dsdx() ; // df/dx
523 
524  sauve_base = bdfdx.base ;
525  bdfdx = bdfdx * dxdr * srstdrdp ;
526  bdfdx.base = sauve_base ;
527 
528  // Final result
529  // ------------
530 
531  resu = srstdfdp - bdfdx ;
532 
533  int nz = mg->get_nzone() ;
534  if (mg->get_type_r(nz-1) == UNSURR) {
535  resu.set_dzpuis(2) ; // r/sin(theta) d/dphi has been
536  // computed in the external domain
537  }
538 
539  }
540 
541 }
542 
543 void Map_et::srstdsdp(const Scalar& uu, Scalar& resu) const {
544 
545  assert (uu.get_etat() != ETATNONDEF) ;
546  assert (uu.get_mp().get_mg() == mg) ;
547 
548  if (uu.get_etat() == ETATZERO) {
549  resu.set_etat_zero() ;
550  }
551  else {
552 
553  assert( uu.get_etat() == ETATQCQ ) ;
554 
555  const Valeur& uuva = uu.get_spectral_va() ;
556  uuva.coef() ; // (uu.va).c_cf is up to date
557 
558  int nz = mg->get_nzone() ;
559  int nzm1 = nz - 1 ;
560 
561  // Computation of 1/(R sin(theta')) df/dphi' ---> srstdfdp
562  // -----------------------------------------
563 
564  Valeur srstdfdp = uuva ;
565 
566  srstdfdp = srstdfdp.dsdp() ; // d/dphi
567  srstdfdp = srstdfdp.ssint() ; // 1/sin(theta)
568  srstdfdp = srstdfdp.sx() ; // 1/xi, Id, 1/(xi-1)
569 
570  Base_val sauve_base( srstdfdp.base ) ;
571 
572  srstdfdp = srstdfdp * xsr ; // xi/R, 1/R, (xi-1)/U
573 
574  srstdfdp.base = sauve_base ; // The above operation does not change the basis
575 
576  // Computation of 1/(dR/dx) 1/(R sin(theta') dR/dphi' df/dx --> bdfdx
577  // --------------------------------------------------------
578  Valeur bdfdx = uuva ;
579 
580  bdfdx = bdfdx.dsdx() ; // df/dx
581 
582  sauve_base = bdfdx.base ;
583  bdfdx = bdfdx * dxdr * srstdrdp ;
584  bdfdx.base = sauve_base ;
585 
586 
587  if (uu.get_dzpuis() == 0) {
588 
589  //Final result
590 
591  resu = srstdfdp - bdfdx ;
592 
593 
594  if (mg->get_type_r(nz-1) == UNSURR) {
595  resu.set_dzpuis(2) ; // r d/dtheta has been computed in
596  // the external domain
597  }
598  }
599 
600  else {
601  assert(mg->get_type_r(nzm1) == UNSURR) ;
602 
603  int dzp = uu.get_dzpuis() ;
604 
605  Valeur tmp = srstdfdp - bdfdx ;
606  tmp.annule(nzm1) ;
607 
608  // Special treatment in the CED
609 
610  Valeur tmp_ced = - bdfdx ;
611  tmp_ced.annule(0, nz-2) ; // only non zero in the CED
612 
613  tmp_ced = tmp_ced.mult_x() ; // xi, Id, (xi-1)
614  //s Base_val sauve_base( tmp_ced.get_base() ) ;
615  tmp_ced = tmp_ced / xsr ; // xi/R, 1/R, (xi-1)/U
616 
617  tmp_ced = tmp_ced + uuva.dsdp().ssint() ;
618  tmp_ced.annule(0, nz-2) ; // only non zero in the CED
619 
620  // Recombination shells + CED :
621  resu = tmp + tmp_ced ;
622 
623  resu.set_dzpuis(dzp+1) ;
624  }
625  }
626 }
627 
628  //------------------------//
629  // d/dtheta //
630  //------------------------//
631 
632 void Map_et::dsdt(const Scalar& ci, Scalar& resu) const {
633 
634  assert (ci.get_etat() != ETATNONDEF) ;
635  assert (ci.get_mp().get_mg() == mg) ;
636 
637  if (ci.get_etat() == ETATZERO) {
638  resu.set_etat_zero() ;
639  }
640  else {
641 
642  // The relations are true for all dzpuis
643  // assert( ci.check_dzpuis(0) ) ;
644  assert( ci.get_etat() == ETATQCQ ) ;
645 
646 
647  // Computation of df/dtheta' ---> dfdt
648  // ----------------------------
649 
650  const Valeur& dfdt = ci.get_spectral_va().dsdt() ;
651 
652 
653  // Computation of 1/(dR/dxi) dR/dtheta' df/dx ----> adfdx
654  // -------------------------------------------
655 
656  Valeur adfdx = ci.get_spectral_va().dsdx() ; // df/dx
657 
658  Base_val sauve_base = adfdx.get_base() ;
659 
660  adfdx = adfdx * dxdr * drdt ; // df/dx / (dR/dx) * dR/dtheta'
661 
662  adfdx.set_base( sauve_base ) ;
663 
664  // Final result
665  // ------------
666 
667  resu = dfdt - adfdx ;
668 
669  }
670 
671 }
672 
673  //---------------------------------//
674  // 1/sin(theta) d/dphi //
675  //---------------------------------//
676 
677 void Map_et::stdsdp(const Scalar& ci, Scalar& resu) const {
678 
679  assert (ci.get_etat() != ETATNONDEF) ;
680  assert (ci.get_mp().get_mg() == mg) ;
681 
682  if (ci.get_etat() == ETATZERO) {
683  resu.set_etat_zero() ;
684  }
685  else {
686 
687  assert( ci.get_etat() == ETATQCQ ) ;
688  // The relations are true for all dzpuis
689  // assert( ci.check_dzpuis(0) ) ;
690 
691  // Computation of 1/sin(theta) df/dphi' ---> stdfdp
692  // ----------------------------
693 
694  const Valeur& stdfdp = ci.get_spectral_va().stdsdp() ;
695 
696 
697  // Computation of 1/(dR/dxi) 1/sin(theta) dR/dphi' df/dx ----> adfdx
698  // -------------------------------------------
699 
700  Valeur adfdx = ci.get_spectral_va().dsdx() ; // df/dx
701 
702  Base_val sauve_base = adfdx.get_base() ;
703 
704  adfdx = adfdx * dxdr * stdrdp ; // df/dx / (dR/dx) * 1/sin(th) dR/dphi'
705 
706  adfdx.set_base( sauve_base ) ;
707 
708  // Final result
709  // ------------
710 
711  resu = stdfdp - adfdx ;
712 
713  }
714 
715 }
716 
717 
718 
719 }
const Map * get_mp() const
Returns the mapping.
Definition: cmp.h:901
void annule_domain(int l)
Sets the Tensor to zero in a given domain.
Definition: tensor.C:675
const Valeur & dsdt() const
Returns of *this.
Definition: valeur_dsdt.C:115
const Valeur & dsdx() const
Returns of *this.
Definition: valeur_dsdx.C:114
Component of a tensorial field *** DEPRECATED : use class Scalar instead ***.
Definition: cmp.h:446
const Cmp & dsdx() const
Returns of *this , where .
Definition: cmp_deriv.C:151
void coef() const
Computes the coeffcients of *this.
Definition: valeur_coef.C:151
virtual void set_etat_zero()
Sets the logical state to ETATZERO (zero).
Definition: scalar.C:330
virtual void dsdt(const Scalar &uu, Scalar &resu) const
Computes of a Scalar.
Definition: map_et_deriv.C:632
Lorene prototypes.
Definition: app_hor.h:67
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
Definition: map.h:783
int get_etat() const
Returns the logical state.
Definition: cmp.h:899
Tensor field of valence 0 (or component of a tensorial field).
Definition: scalar.h:393
const Valeur & dsdp() const
Returns of *this.
Definition: valeur_dsdp.C:101
virtual void srstdsdp(const Cmp &ci, Cmp &resu) const
Computes of a Cmp.
Definition: map_et_deriv.C:488
const Valeur & sx() const
Returns (r -sampling = RARE ) \ Id (r sampling = FIN ) \ (r -sampling = UNSURR ) ...
Definition: valeur_sx.C:113
virtual void dsdxi(const Cmp &ci, Cmp &resu) const
Computes of a Cmp.
Definition: map_et_deriv.C:98
const Scalar & dsdx() const
Returns of *this , where .
Definition: scalar_deriv.C:266
Values and coefficients of a (real-value) function.
Definition: valeur.h:297
int get_etat() const
Returns the logical state ETATNONDEF (undefined), ETATZERO (null) or ETATQCQ (ordinary).
Definition: scalar.h:560
void annule(int l)
Sets the Valeur to zero in a given domain.
Definition: valeur.C:747
void set(const Map *mp, Mtbl *(*construct)(const Map *))
Semi-constructor from a mapping and a method.
Definition: coord.C:137
void set_base(const Base_val &)
Sets the bases for spectral expansions (member base )
Definition: valeur.C:813
Coord srstdrdp
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Definition: map.h:1613
void set_dzpuis(int)
Modifies the dzpuis flag.
Definition: scalar.C:814
virtual void stdsdp(const Scalar &uu, Scalar &resu) const
Computes of a Scalar.
Definition: map_et_deriv.C:677
const Valeur & mult_x() const
Returns (r -sampling = RARE ) \ Id (r sampling = FIN ) \ (r -sampling = UNSURR ) ...
void set_etat_zero()
Sets the logical state to ETATZERO (zero).
Definition: cmp.C:292
Coord stdrdp
in the nucleus and in the non-compactified shells; \ in the compactified external domain (CED)...
Definition: map.h:1597
const Valeur & ssint() const
Returns of *this.
Definition: valeur_ssint.C:115
Coord dxdr
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Definition: map.h:1581
Base_val base
Bases on which the spectral expansion is performed.
Definition: valeur.h:315
int get_dzpuis() const
Returns dzpuis.
Definition: scalar.h:563
const Valeur & stdsdp() const
Returns of *this.
Definition: valeur_stdsdp.C:63
virtual void dsdr(const Cmp &ci, Cmp &resu) const
Computes of a Cmp.
Definition: map_et_deriv.C:190
int get_nzone() const
Returns the number of domains.
Definition: grilles.h:465
Coord xsr
in the nucleus; \ 1/R in the non-compactified shells; \ in the compactified outer domain...
Definition: map.h:1570
Coord drdt
in the nucleus and in the non-compactified shells; \ in the compactified external domain (CED)...
Definition: map.h:1589
virtual void dsdradial(const Scalar &uu, Scalar &resu) const
Computes of a Scalar if the description is affine and if it is logarithmic.
Definition: map_et_deriv.C:277
void set_spectral_base(const Base_val &)
Sets the spectral bases of the Valeur va
Definition: scalar.C:803
const Mg3d * mg
Pointer on the multi-grid Mgd3 on which this is defined.
Definition: map.h:694
Bases of the spectral expansions.
Definition: base_val.h:325
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: cmp.C:718
virtual void srdsdt(const Cmp &ci, Cmp &resu) const
Computes of a Cmp.
Definition: map_et_deriv.C:340
void set_dzpuis(int)
Set a value to dzpuis.
Definition: cmp.C:657
Valeur & set_spectral_va()
Returns va (read/write version)
Definition: scalar.h:610
int get_type_r(int l) const
Returns the type of sampling in the radial direction in domain no.
Definition: grilles.h:491
Coord srdrdt
in the nucleus and in the non-compactified shells; \ in the compactified outer domain.
Definition: map.h:1605
const Map & get_mp() const
Returns the mapping.
Definition: tensor.h:874
Valeur va
The numerical value of the Cmp.
Definition: cmp.h:464
const Valeur & get_spectral_va() const
Returns va (read only version)
Definition: scalar.h:607
const Base_val & get_base() const
Return the bases for spectral expansions (member base )
Definition: valeur.h:490