LORENE
scalar_import.C
1 /*
2  * Member function of the Scalar class for initiating a Scalar from
3  * a Scalar defined on another mapping.
4  */
5 
6 /*
7  * Copyright (c) 2003 Eric Gourgoulhon & Jerome Novak
8  * Copyright (c) 1999-2001 Eric Gourgoulhon (Cmp version)
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 scalar_import_C[] = "$Header: /cvsroot/Lorene/C++/Source/Tensor/Scalar/scalar_import.C,v 1.5 2014/10/13 08:53:46 j_novak Exp $" ;
30 
31 /*
32  * $Id: scalar_import.C,v 1.5 2014/10/13 08:53:46 j_novak Exp $
33  * $Log: scalar_import.C,v $
34  * Revision 1.5 2014/10/13 08:53:46 j_novak
35  * Lorene classes and functions now belong to the namespace Lorene.
36  *
37  * Revision 1.4 2014/10/06 15:16:15 j_novak
38  * Modified #include directives to use c++ syntax.
39  *
40  * Revision 1.3 2003/10/10 15:57:29 j_novak
41  * Added the state one (ETATUN) to the class Scalar
42  *
43  * Revision 1.2 2003/10/01 13:04:44 e_gourgoulhon
44  * The method Tensor::get_mp() returns now a reference (and not
45  * a pointer) onto a mapping.
46  *
47  * Revision 1.1 2003/09/25 09:07:05 j_novak
48  * Added the functions for importing from another mapping (to be tested).
49  *
50  *
51  * $Header: /cvsroot/Lorene/C++/Source/Tensor/Scalar/scalar_import.C,v 1.5 2014/10/13 08:53:46 j_novak Exp $
52  *
53  */
54 
55 // Headers C
56 #include <cmath>
57 
58 // Headers Lorene
59 #include "tensor.h"
60 #include "param.h"
61 #include "nbr_spx.h"
62 
63  //-------------------------------//
64  // Importation in all domains //
65  //-------------------------------//
66 
67 namespace Lorene {
68 void Scalar::import(const Scalar& ci) {
69 
70  int nz = mp->get_mg()->get_nzone() ;
71 
72  import(nz, ci) ;
73 
74 }
75 
76  //--------------------------------------//
77  // Importation in inner domains only //
78  //--------------------------------------//
79 
80 void Scalar::import(int nzet, const Scalar& cm_d) {
81 
82  const Map* mp_d = &(cm_d.get_mp()) ; // Departure mapping
83 
84  // Trivial case : mappings identical !
85  // -----------------------------------
86 
87  if (mp_d == mp) {
88  *this = cm_d ;
89  return ;
90  }
91 
92  // Relative orientation of the two mappings
93  // ----------------------------------------
94 
95  int align_rel = (mp->get_bvect_cart()).get_align()
96  * (mp_d->get_bvect_cart()).get_align() ;
97 
98  switch (align_rel) {
99 
100  case 1 : { // the two mappings have aligned Cartesian axis
101  import_align(nzet, cm_d) ;
102  break ;
103  }
104 
105  case -1 : { // the two mappings have anti-aligned Cartesian axis
106  import_anti(nzet, cm_d) ;
107  break ;
108  }
109 
110  case 0 : { // general case
111  import_gal(nzet, cm_d) ;
112  break ;
113  }
114 
115  default : {
116  cout << "Scalar::import : unexpected value of align_rel : "
117  << align_rel << endl ;
118  abort() ;
119  break ;
120  }
121 
122  }
123 
124 }
125 
126  //--------------------------------------//
127  // General case (axis not aligned) //
128  //--------------------------------------//
129 
130 
131 void Scalar::import_gal(int nzet, const Scalar& cm_d) {
132 
133  const Map* mp_d = &(cm_d.get_mp()) ; // Departure mapping
134 
135  // Trivial case : mappings identical !
136  // -----------------------------------
137 
138  if (mp_d == mp) {
139  *this = cm_d ;
140  return ;
141  }
142 
143  // Another trivial case : null Scalar
144  // -------------------------------
145 
146  if (cm_d.get_etat() == ETATZERO) {
147  set_etat_zero() ;
148  return ;
149  }
150 
151  if (cm_d.get_etat() == ETATUN) {
152  set_etat_one() ;
153  return ;
154  }
155 
156  // Protections
157  // -----------
158 
159  assert(cm_d.get_etat() != ETATNONDEF) ;
160 
161  if (cm_d.get_dzpuis() != 0) {
162  cout <<
163  "Scalar::import : the dzpuis of the Scalar to be imported must be zero !"
164  << endl ;
165  abort() ;
166  }
167 
168 
169  const Mg3d* mg_a = mp->get_mg() ;
170  int nz_a = mg_a->get_nzone() ;
171  assert(nzet <= nz_a) ;
172 
173 
174  // General case :
175  // -------------
176  assert(cm_d.get_etat() == ETATQCQ) ;
177  const Valeur& va_d = cm_d.get_spectral_va() ;
178  va_d.coef() ; // The coefficients are required
179 
180 
181  // Preparations for storing the result in *this
182  // --------------------------------------------
183  del_t() ; // delete all previously computed derived quantities
184 
185  set_etat_qcq() ; // Set the state to ETATQCQ
186 
187  va.set_etat_c_qcq() ; // Allocates the memory for the Mtbl va.c
188  // if it does not exist already
189  va.c->set_etat_qcq() ; // Allocates the memory for the Tbl's in each
190  // domain if they do not exist already
191 
192 
193  // Absolute coordinates of the origin of the Departure mapping
194  double xo_d = mp_d->get_ori_x() ;
195  double yo_d = mp_d->get_ori_y() ;
196  double zo_d = mp_d->get_ori_z() ;
197 
198  // Orientation relative to the Absolute frame of the Departure mapping
199  double rot_phi_d = mp_d->get_rot_phi() ;
200 
201  // Orientation relative to the Absolute frame of the Arrival mapping
202  double rot_phi_a = mp->get_rot_phi() ;
203 
204  // r, theta, phi, X, Y and Z on the Arrival mapping
205  // update of the corresponding Coord's if necessary
206 
207  if ( (mp->r).c == 0x0 ) (mp->r).fait() ;
208  if ( (mp->tet).c == 0x0 ) (mp->tet).fait() ;
209  if ( (mp->phi).c == 0x0 ) (mp->phi).fait() ;
210  if ( (mp->xa).c == 0x0 ) (mp->xa).fait() ;
211  if ( (mp->ya).c == 0x0 ) (mp->ya).fait() ;
212  if ( (mp->za).c == 0x0 ) (mp->za).fait() ;
213 
214  const Mtbl* mr_a = (mp->r).c ;
215  const Mtbl* mtet_a = (mp->tet).c ;
216  const Mtbl* mphi_a = (mp->phi).c ;
217  const Mtbl* mxa_a = (mp->xa).c ;
218  const Mtbl* mya_a = (mp->ya).c ;
219  const Mtbl* mza_a = (mp->za).c ;
220 
221  Param par_precis ; // Required precision in the method Map::val_lx
222  int nitermax = 100 ; // Maximum number of iteration in the secant method
223  int niter ;
224  double precis = 1e-15 ; // Absolute precision in the secant method
225  par_precis.add_int(nitermax) ;
226  par_precis.add_int_mod(niter) ;
227  par_precis.add_double(precis) ;
228 
229 
230  // Loop of the Arrival domains where the computation is to be performed
231  // --------------------------------------------------------------------
232 
233  for (int l=0; l < nzet; l++) {
234 
235  int nr = mg_a->get_nr(l) ;
236  int nt = mg_a->get_nt(l) ;
237  int np = mg_a->get_np(l) ;
238 
239 
240  const double* pr_a = mr_a->t[l]->t ; // Pointer on the values of r
241  const double* ptet_a = mtet_a->t[l]->t ; // Pointer on the values of theta
242  const double* pphi_a = mphi_a->t[l]->t ; // Pointer on the values of phi
243  const double* pxa_a = mxa_a->t[l]->t ; // Pointer on the values of X
244  const double* pya_a = mya_a->t[l]->t ; // Pointer on the values of Y
245  const double* pza_a = mza_a->t[l]->t ; // Pointer on the values of Z
246 
247  (va.c->t[l])->set_etat_qcq() ; // Allocates the array of double to
248  // store the result
249  double* ptx = (va.c->t[l])->t ; // Pointer on the allocated array
250 
251 
252  // Loop on all the grid points in the considered arrival domain:
253 
254  for (int k=0 ; k<np ; k++) {
255  for (int j=0 ; j<nt ; j++) {
256  for (int i=0 ; i<nr ; i++) {
257 
258  double r = *pr_a ;
259  double rd, tetd, phid ;
260  if (r == __infinity) {
261  rd = r ;
262  tetd = *ptet_a ;
263  phid = *pphi_a + rot_phi_a - rot_phi_d ;
264  if (phid < 0) phid += 2*M_PI ;
265  }
266  else {
267  // Coordinates in a Cartesian frame centered on
268  // the Departure mapping and whose axes are
269  // parallel to those of the Absolue Frame
270  double xd = *pxa_a - xo_d ;
271  double yd = *pya_a - yo_d ;
272  double zd = *pza_a - zo_d ;
273 
274  // Spherical coordinates on the Departure mapping
275  double rhod2 = xd*xd + yd*yd ;
276  double rhod = sqrt( rhod2 ) ;
277  rd = sqrt(rhod2 + zd*zd) ;
278  tetd = atan2(rhod, zd) ;
279  phid = atan2(yd, xd) - rot_phi_d ; // (rotation)
280  if (phid < 0) phid += 2*M_PI ;
281  }
282 
283 
284  // NB: to increase the efficiency, the method Scalar::val_point
285  // is not invoked; the method Mtbl_cf::val_point is
286  // called directly instead.
287 
288  // Value of the grid coordinates (l,xi) corresponding to
289  // (rd,tetd,phid) :
290 
291  int ld ; // domain index
292  double xxd ; // radial coordinate xi in [0,1] or [-1,1]
293  mp_d->val_lx(rd, tetd, phid, par_precis, ld, xxd) ;
294 
295  // Value of the Departure Scalar at the obtained point:
296  *ptx = va_d.c_cf->val_point(ld, xxd, tetd, phid) ;
297 
298  // Next point :
299  ptx++ ;
300  pr_a++ ;
301  ptet_a++ ;
302  pphi_a++ ;
303  pxa_a++ ;
304  pya_a++ ;
305  pza_a++ ;
306 
307  }
308  }
309  }
310 
311 
312  } // End of the loop on the Arrival domains
313 
314  // In the remaining domains, *this is set to zero:
315  // ----------------------------------------------
316 
317  if (nzet < nz_a) {
318  annule(nzet, nz_a - 1) ;
319  }
320 
321  // Treatment of dzpuis
322  // -------------------
323 
324 
325  set_dzpuis(0) ;
326 
327 }
328 
329 
330  //-----------------------------------------//
331  // Case of Cartesian axis anti-aligned //
332  //-----------------------------------------//
333 
334 
335 void Scalar::import_anti(int nzet, const Scalar& cm_d) {
336 
337  // Trivial case : null Scalar
338  // ------------------------
339 
340  if (cm_d.get_etat() == ETATZERO) {
341  set_etat_zero() ;
342  return ;
343  }
344 
345  if (cm_d.get_etat() == ETATUN) {
346  set_etat_one() ;
347  return ;
348  }
349 
350  const Map* mp_d = &(cm_d.get_mp()) ; // Departure mapping
351 
352  // Protections
353  // -----------
354  int align = (mp->get_bvect_cart()).get_align() ;
355 
356  assert( align * (mp_d->get_bvect_cart()).get_align() == -1 ) ;
357 
358  assert(cm_d.get_etat() == ETATQCQ) ;
359 
360  if (cm_d.get_dzpuis() != 0) {
361  cout <<
362  "Scalar::import : the dzpuis of the Scalar to be imported must be zero !"
363  << endl ;
364  abort() ;
365  }
366 
367 
368  const Mg3d* mg_a = mp->get_mg() ;
369  int nz_a = mg_a->get_nzone() ;
370  assert(nzet <= nz_a) ;
371 
372  const Valeur& va_d = cm_d.get_spectral_va() ;
373  va_d.coef() ; // The coefficients are required
374 
375 
376  // Preparations for storing the result in *this
377  // --------------------------------------------
378  del_t() ; // delete all previously computed derived quantities
379 
380  set_etat_qcq() ; // Set the state to ETATQCQ
381 
382  va.set_etat_c_qcq() ; // Allocates the memory for the Mtbl va.c
383  // if it does not exist already
384  va.c->set_etat_qcq() ; // Allocates the memory for the Tbl's in each
385  // domain if they do not exist already
386 
387 
388  // Departure (x,y,z) coordinates of the origin of the Arrival mapping :
389 
390  double xx_a, yy_a, zz_a ;
391  if (align == 1) {
392  xx_a = mp_d->get_ori_x() - mp->get_ori_x() ;
393  yy_a = mp_d->get_ori_y() - mp->get_ori_y() ;
394  }
395  else {
396  xx_a = mp->get_ori_x() - mp_d->get_ori_x() ;
397  yy_a = mp->get_ori_y() - mp_d->get_ori_y() ;
398  }
399  zz_a = mp->get_ori_z() - mp_d->get_ori_z() ;
400 
401 
402  // r, theta, phi, x, y and z on the Arrival mapping
403  // update of the corresponding Coord's if necessary
404 
405  if ( (mp->r).c == 0x0 ) (mp->r).fait() ;
406  if ( (mp->tet).c == 0x0 ) (mp->tet).fait() ;
407  if ( (mp->phi).c == 0x0 ) (mp->phi).fait() ;
408  if ( (mp->x).c == 0x0 ) (mp->x).fait() ;
409  if ( (mp->y).c == 0x0 ) (mp->y).fait() ;
410  if ( (mp->z).c == 0x0 ) (mp->z).fait() ;
411 
412  const Mtbl* mr_a = (mp->r).c ;
413  const Mtbl* mtet_a = (mp->tet).c ;
414  const Mtbl* mphi_a = (mp->phi).c ;
415  const Mtbl* mx_a = (mp->x).c ;
416  const Mtbl* my_a = (mp->y).c ;
417  const Mtbl* mz_a = (mp->z).c ;
418 
419  Param par_precis ; // Required precision in the method Map::val_lx
420  int nitermax = 100 ; // Maximum number of iteration in the secant method
421  int niter ;
422  double precis = 1e-15 ; // Absolute precision in the secant method
423  par_precis.add_int(nitermax) ;
424  par_precis.add_int_mod(niter) ;
425  par_precis.add_double(precis) ;
426 
427 
428  // Loop of the Arrival domains where the computation is to be performed
429  // --------------------------------------------------------------------
430 
431  for (int l=0; l < nzet; l++) {
432 
433  int nr = mg_a->get_nr(l) ;
434  int nt = mg_a->get_nt(l) ;
435  int np = mg_a->get_np(l) ;
436 
437 
438  const double* pr_a = mr_a->t[l]->t ; // Pointer on the values of r
439  const double* ptet_a = mtet_a->t[l]->t ; // Pointer on the values of theta
440  const double* pphi_a = mphi_a->t[l]->t ; // Pointer on the values of phi
441  const double* px_a = mx_a->t[l]->t ; // Pointer on the values of X
442  const double* py_a = my_a->t[l]->t ; // Pointer on the values of Y
443  const double* pz_a = mz_a->t[l]->t ; // Pointer on the values of Z
444 
445  (va.c->t[l])->set_etat_qcq() ; // Allocates the array of double to
446  // store the result
447  double* ptx = (va.c->t[l])->t ; // Pointer on the allocated array
448 
449 
450  // Loop on all the grid points in the considered arrival domain:
451 
452  for (int k=0 ; k<np ; k++) {
453  for (int j=0 ; j<nt ; j++) {
454  for (int i=0 ; i<nr ; i++) {
455 
456  double r = *pr_a ;
457  double rd, tetd, phid ;
458  if (r == __infinity) {
459  rd = r ;
460  tetd = *ptet_a ;
461  phid = *pphi_a + M_PI ;
462  if (phid < 0) phid += 2*M_PI ;
463  }
464  else {
465 
466  // Cartesian coordinates on the Departure mapping
467  double xd = - *px_a + xx_a ;
468  double yd = - *py_a + yy_a ;
469  double zd = *pz_a + zz_a ;
470 
471  // Spherical coordinates on the Departure mapping
472  double rhod2 = xd*xd + yd*yd ;
473  double rhod = sqrt( rhod2 ) ;
474  rd = sqrt(rhod2 + zd*zd) ;
475  tetd = atan2(rhod, zd) ;
476  phid = atan2(yd, xd) ;
477  if (phid < 0) phid += 2*M_PI ;
478  }
479 
480 
481  // NB: to increase the efficiency, the method Scalar::val_point
482  // is not invoked; the method Mtbl_cf::val_point is
483  // called directly instead.
484 
485  // Value of the grid coordinates (l,xi) corresponding to
486  // (rd,tetd,phid) :
487 
488  int ld ; // domain index
489  double xxd ; // radial coordinate xi in [0,1] or [-1,1]
490  mp_d->val_lx(rd, tetd, phid, par_precis, ld, xxd) ;
491 
492  // Value of the Departure Scalar at the obtained point:
493  *ptx = va_d.c_cf->val_point(ld, xxd, tetd, phid) ;
494 
495  // Next point :
496  ptx++ ;
497  pr_a++ ;
498  ptet_a++ ;
499  pphi_a++ ;
500  px_a++ ;
501  py_a++ ;
502  pz_a++ ;
503 
504  }
505  }
506  }
507 
508 
509  } // End of the loop on the Arrival domains
510 
511  // In the remaining domains, *this is set to zero:
512  // ----------------------------------------------
513 
514  if (nzet < nz_a) {
515  annule(nzet, nz_a - 1) ;
516  }
517 
518  // Treatment of dzpuis
519  // -------------------
520 
521 
522  set_dzpuis(0) ;
523 
524 }
525 
526 
527  //-------------------------------------//
528  // Case of aligned Cartesian axis //
529  //-------------------------------------//
530 
531 
532 void Scalar::import_align(int nzet, const Scalar& cm_d) {
533 
534  // Trivial case : null Scalar
535  // ------------------------
536 
537  if (cm_d.get_etat() == ETATZERO) {
538  set_etat_zero() ;
539  return ;
540  }
541  if (cm_d.get_etat() == ETATUN) {
542  set_etat_one() ;
543  return ;
544  }
545 
546  const Map* mp_d = &(cm_d.get_mp()) ; // Departure mapping
547 
548  // Protections
549  // -----------
550  int align = (mp->get_bvect_cart()).get_align() ;
551 
552  assert( align * (mp_d->get_bvect_cart()).get_align() == 1 ) ;
553 
554  assert(cm_d.get_etat() == ETATQCQ) ;
555 
556  if (cm_d.get_dzpuis() != 0) {
557  cout <<
558  "Scalar::import : the dzpuis of the Scalar to be imported must be zero !"
559  << endl ;
560  abort() ;
561  }
562 
563 
564  const Mg3d* mg_a = mp->get_mg() ;
565  int nz_a = mg_a->get_nzone() ;
566  assert(nzet <= nz_a) ;
567 
568  const Valeur& va_d = cm_d.get_spectral_va() ;
569  va_d.coef() ; // The coefficients are required
570 
571 
572  // Preparations for storing the result in *this
573  // --------------------------------------------
574  del_t() ; // delete all previously computed derived quantities
575 
576  set_etat_qcq() ; // Set the state to ETATQCQ
577 
578  va.set_etat_c_qcq() ; // Allocates the memory for the Mtbl va.c
579  // if it does not exist already
580  va.c->set_etat_qcq() ; // Allocates the memory for the Tbl's in each
581  // domain if they do not exist already
582 
583 
584  // Departure (x,y,z) coordinates of the origin of the Arrival mapping :
585 
586  double xx_a, yy_a, zz_a ;
587  if (align == 1) {
588  xx_a = mp->get_ori_x() - mp_d->get_ori_x() ;
589  yy_a = mp->get_ori_y() - mp_d->get_ori_y() ;
590  }
591  else {
592  xx_a = mp_d->get_ori_x() - mp->get_ori_x() ;
593  yy_a = mp_d->get_ori_y() - mp->get_ori_y() ;
594  }
595  zz_a = mp->get_ori_z() - mp_d->get_ori_z() ;
596 
597 
598  // r, theta, phi, x, y and z on the Arrival mapping
599  // update of the corresponding Coord's if necessary
600 
601  if ( (mp->r).c == 0x0 ) (mp->r).fait() ;
602  if ( (mp->tet).c == 0x0 ) (mp->tet).fait() ;
603  if ( (mp->phi).c == 0x0 ) (mp->phi).fait() ;
604  if ( (mp->x).c == 0x0 ) (mp->x).fait() ;
605  if ( (mp->y).c == 0x0 ) (mp->y).fait() ;
606  if ( (mp->z).c == 0x0 ) (mp->z).fait() ;
607 
608  const Mtbl* mr_a = (mp->r).c ;
609  const Mtbl* mtet_a = (mp->tet).c ;
610  const Mtbl* mphi_a = (mp->phi).c ;
611  const Mtbl* mx_a = (mp->x).c ;
612  const Mtbl* my_a = (mp->y).c ;
613  const Mtbl* mz_a = (mp->z).c ;
614 
615  Param par_precis ; // Required precision in the method Map::val_lx
616  int nitermax = 100 ; // Maximum number of iteration in the secant method
617  int niter ;
618  double precis = 1e-15 ; // Absolute precision in the secant method
619  par_precis.add_int(nitermax) ;
620  par_precis.add_int_mod(niter) ;
621  par_precis.add_double(precis) ;
622 
623 
624  // Loop of the Arrival domains where the computation is to be performed
625  // --------------------------------------------------------------------
626 
627  for (int l=0; l < nzet; l++) {
628 
629  int nr = mg_a->get_nr(l) ;
630  int nt = mg_a->get_nt(l) ;
631  int np = mg_a->get_np(l) ;
632 
633 
634  const double* pr_a = mr_a->t[l]->t ; // Pointer on the values of r
635  const double* ptet_a = mtet_a->t[l]->t ; // Pointer on the values of theta
636  const double* pphi_a = mphi_a->t[l]->t ; // Pointer on the values of phi
637  const double* px_a = mx_a->t[l]->t ; // Pointer on the values of X
638  const double* py_a = my_a->t[l]->t ; // Pointer on the values of Y
639  const double* pz_a = mz_a->t[l]->t ; // Pointer on the values of Z
640 
641  (va.c->t[l])->set_etat_qcq() ; // Allocates the array of double to
642  // store the result
643  double* ptx = (va.c->t[l])->t ; // Pointer on the allocated array
644 
645 
646  // Loop on all the grid points in the considered arrival domain:
647 
648  for (int k=0 ; k<np ; k++) {
649  for (int j=0 ; j<nt ; j++) {
650  for (int i=0 ; i<nr ; i++) {
651 
652  double r = *pr_a ;
653  double rd, tetd, phid ;
654  if (r == __infinity) {
655  rd = r ;
656  tetd = *ptet_a ;
657  phid = *pphi_a ;
658  }
659  else {
660 
661  // Cartesian coordinates on the Departure mapping
662  double xd = *px_a + xx_a ;
663  double yd = *py_a + yy_a ;
664  double zd = *pz_a + zz_a ;
665 
666  // Spherical coordinates on the Departure mapping
667  double rhod2 = xd*xd + yd*yd ;
668  double rhod = sqrt( rhod2 ) ;
669  rd = sqrt(rhod2 + zd*zd) ;
670  tetd = atan2(rhod, zd) ;
671  phid = atan2(yd, xd) ;
672  if (phid < 0) phid += 2*M_PI ;
673  }
674 
675 
676  // NB: to increase the efficiency, the method Scalar::val_point
677  // is not invoked; the method Mtbl_cf::val_point is
678  // called directly instead.
679 
680  // Value of the grid coordinates (l,xi) corresponding to
681  // (rd,tetd,phid) :
682 
683  int ld ; // domain index
684  double xxd ; // radial coordinate xi in [0,1] or [-1,1]
685  mp_d->val_lx(rd, tetd, phid, par_precis, ld, xxd) ;
686 
687  // Value of the Departure Scalar at the obtained point:
688  *ptx = va_d.c_cf->val_point(ld, xxd, tetd, phid) ;
689 
690  // Next point :
691  ptx++ ;
692  pr_a++ ;
693  ptet_a++ ;
694  pphi_a++ ;
695  px_a++ ;
696  py_a++ ;
697  pz_a++ ;
698 
699  }
700  }
701  }
702 
703 
704  } // End of the loop on the Arrival domains
705 
706  // In the remaining domains, *this is set to zero:
707  // ----------------------------------------------
708 
709  if (nzet < nz_a) {
710  annule(nzet, nz_a - 1) ;
711  }
712 
713  // Treatment of dzpuis
714  // -------------------
715 
716 
717  set_dzpuis(0) ;
718 
719 }
720 }
Base class for coordinate mappings.
Definition: map.h:670
double get_ori_z() const
Returns the z coordinate of the origin.
Definition: map.h:772
Coord y
y coordinate centered on the grid
Definition: map.h:727
Coord ya
Absolute y coordinate.
Definition: map.h:731
Coord r
r coordinate centered on the grid
Definition: map.h:718
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
Definition: map.h:765
double get_ori_y() const
Returns the y coordinate of the origin.
Definition: map.h:770
Coord za
Absolute z coordinate.
Definition: map.h:732
Coord tet
coordinate centered on the grid
Definition: map.h:719
virtual void val_lx(double rr, double theta, double pphi, int &l, double &xi) const =0
Computes the domain index l and the value of corresponding to a point given by its physical coordina...
Coord z
z coordinate centered on the grid
Definition: map.h:728
double get_ori_x() const
Returns the x coordinate of the origin.
Definition: map.h:768
Coord x
x coordinate centered on the grid
Definition: map.h:726
Coord phi
coordinate centered on the grid
Definition: map.h:720
double get_rot_phi() const
Returns the angle between the x –axis and X –axis.
Definition: map.h:775
const Base_vect_cart & get_bvect_cart() const
Returns the Cartesian basis associated with the coordinates (x,y,z) of the mapping,...
Definition: map.h:791
Coord xa
Absolute x coordinate.
Definition: map.h:730
Multi-domain grid.
Definition: grilles.h:273
int get_np(int l) const
Returns the number of points in the azimuthal direction ( ) in domain no. l.
Definition: grilles.h:462
int get_nt(int l) const
Returns the number of points in the co-latitude direction ( ) in domain no. l.
Definition: grilles.h:457
int get_nzone() const
Returns the number of domains.
Definition: grilles.h:448
int get_nr(int l) const
Returns the number of points in the radial direction ( ) in domain no. l.
Definition: grilles.h:452
double val_point(int l, double x, double theta, double phi) const
Computes the value of the field represented by *this at an arbitrary point, by means of the spectral ...
Multi-domain array.
Definition: mtbl.h:118
Tbl ** t
Array (size nzone ) of pointers on the Tbl 's.
Definition: mtbl.h:132
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Definition: mtbl.C:299
Parameter storage.
Definition: param.h:125
void add_double(const double &x, int position=0)
Adds the the address of a new double to the list.
Definition: param.C:315
void add_int_mod(int &n, int position=0)
Adds the address of a new modifiable int to the list.
Definition: param.C:385
void add_int(const int &n, int position=0)
Adds the address of a new int to the list.
Definition: param.C:246
Tensor field of valence 0 (or component of a tensorial field).
Definition: scalar.h:387
void set_etat_one()
Sets the logical state to ETATUN (one).
Definition: scalar.C:334
void import_align(int nzet, const Scalar &ci)
Assignment to another Scalar defined on a different mapping, when the two mappings have aligned Carte...
int get_dzpuis() const
Returns dzpuis.
Definition: scalar.h:557
virtual void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Definition: scalar.C:353
void import_gal(int nzet, const Scalar &ci)
Assignment to another Scalar defined on a different mapping, when the two mappings do not have a part...
virtual void set_etat_zero()
Sets the logical state to ETATZERO (zero).
Definition: scalar.C:324
virtual void annule(int l_min, int l_max)
Sets the Scalar to zero in several domains.
Definition: scalar.C:391
void del_t()
Logical destructor.
Definition: scalar.C:279
int get_etat() const
Returns the logical state ETATNONDEF (undefined), ETATZERO (null) or ETATQCQ (ordinary).
Definition: scalar.h:554
void set_dzpuis(int)
Modifies the dzpuis flag.
Definition: scalar.C:808
const Valeur & get_spectral_va() const
Returns va (read only version)
Definition: scalar.h:601
friend Scalar sqrt(const Scalar &)
Square root.
Definition: scalar_math.C:263
Valeur va
The numerical value of the Scalar
Definition: scalar.h:405
void import_anti(int nzet, const Scalar &ci)
Assignment to another Scalar defined on a different mapping, when the two mappings have anti-aligned ...
void import(const Scalar &ci)
Assignment to another Scalar defined on a different mapping.
Definition: scalar_import.C:68
double * t
The array of double.
Definition: tbl.h:173
Values and coefficients of a (real-value) function.
Definition: valeur.h:287
void set_etat_c_qcq()
Sets the logical state to ETATQCQ (ordinary state) for values in the configuration space (Mtbl c ).
Definition: valeur.C:701
Mtbl * c
Values of the function at the points of the multi-grid
Definition: valeur.h:299
Mtbl_cf * c_cf
Coefficients of the spectral expansion of the function.
Definition: valeur.h:302
void coef() const
Computes the coeffcients of *this.
Definition: valeur_coef.C:148
const Map & get_mp() const
Returns the mapping.
Definition: tensor.h:861
const Map *const mp
Mapping on which the numerical values at the grid points are defined.
Definition: tensor.h:295
Lorene prototypes.
Definition: app_hor.h:64