LORENE
cmp.C
1 /*
2  * Methods of class Cmp
3  *
4  * (see file cmp.h for documentation)
5  *
6  */
7 
8 /*
9  * Copyright (c) 1999-2000 Jean-Alain Marck
10  * Copyright (c) 1999-2001 Eric Gourgoulhon
11  * Copyright (c) 1999-2001 Philippe Grandclement
12  *
13  * This file is part of LORENE.
14  *
15  * LORENE is free software; you can redistribute it and/or modify
16  * it under the terms of the GNU General Public License as published by
17  * the Free Software Foundation; either version 2 of the License, or
18  * (at your option) any later version.
19  *
20  * LORENE is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23  * GNU General Public License for more details.
24  *
25  * You should have received a copy of the GNU General Public License
26  * along with LORENE; if not, write to the Free Software
27  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28  *
29  */
30 
31 
32 
33 
34 
35 /*
36  * $Id: cmp.C,v 1.11 2016/12/05 16:17:48 j_novak Exp $
37  * $Log: cmp.C,v $
38  * Revision 1.11 2016/12/05 16:17:48 j_novak
39  * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
40  *
41  * Revision 1.10 2014/10/13 08:52:46 j_novak
42  * Lorene classes and functions now belong to the namespace Lorene.
43  *
44  * Revision 1.9 2014/10/06 15:13:03 j_novak
45  * Modified #include directives to use c++ syntax.
46  *
47  * Revision 1.8 2004/10/11 15:09:01 j_novak
48  * The radial manipulation functions take Scalar as arguments, instead of Cmp.
49  * Added a conversion operator from Scalar to Cmp.
50  * The Cmp radial manipulation function make conversion to Scalar, call to the
51  * Map_radial version with a Scalar argument and back.
52  *
53  * Revision 1.7 2003/10/16 21:39:02 e_gourgoulhon
54  * Treated the case ETATUN in the constructor from Scalar.
55  *
56  * Revision 1.6 2003/10/01 15:49:33 e_gourgoulhon
57  * Method Scalar::get_mp() now returns a reference onto a mapping.
58  *
59  * Revision 1.5 2003/09/24 20:54:24 e_gourgoulhon
60  * Added constructor by conversion of a Scalar.
61  *
62  * Revision 1.4 2003/08/26 09:46:10 j_novak
63  * Added the method multipole_spectrum
64  *
65  * Revision 1.3 2002/10/16 14:36:33 j_novak
66  * Reorganization of #include instructions of standard C++, in order to
67  * use experimental version 3 of gcc.
68  *
69  * Revision 1.2 2001/12/04 21:27:53 e_gourgoulhon
70  *
71  * All writing/reading to a binary file are now performed according to
72  * the big endian convention, whatever the system is big endian or
73  * small endian, thanks to the functions fwrite_be and fread_be
74  *
75  * Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon
76  * LORENE
77  *
78  * Revision 2.36 2000/09/13 12:11:56 eric
79  * Ajout de la fonction allocate_all().
80  *
81  * Revision 2.35 2000/09/06 09:45:23 keisuke
82  * Ajout de l'appel a del_deriv() dans set_etat_qcq() pour le cas
83  * ou etat est deja ETATQCQ.
84  *
85  * Revision 2.34 2000/08/16 10:43:30 eric
86  * Suppression de Mtbl_cf::dzpuis.
87  *
88  * Revision 2.33 2000/08/16 10:30:41 eric
89  * Suppression de Mtbl::dzpuis.
90  *
91  * Revision 2.32 2000/03/07 16:52:58 eric
92  * Modif dz_nonzero() : cas etat=ETATQCQ et va.etat=ETATZERO.
93  *
94  * Revision 2.31 2000/01/28 16:09:21 eric
95  * Ajout des fonctions dz_nonzero et check_dzpuis.
96  *
97  * Revision 2.30 1999/12/22 16:44:28 eric
98  * set_etat_zero() : remplacement de l'appel a del_t() par
99  * 1/ va.set_etat_zero() ;
100  * 2/ del_deriv() ;
101  *
102  * Revision 2.29 1999/12/10 15:59:14 eric
103  * Changement de la place de del_deriv() dans l'affectation
104  * (pour permettre l'affectation a des membres derives).
105  * Annulation des membres derives.
106  * dans la fonction annule(int,int).
107  *
108  * Revision 2.28 1999/12/09 10:50:01 eric
109  * Ajout du membre p_integ.
110  *
111  * Revision 2.27 1999/12/07 14:53:32 eric
112  * Changement ordre des arguments (phi,theta,r) --> (r,theta,phi)
113  * dans la routine val_point.
114  *
115  * Revision 2.26 1999/12/06 16:47:11 eric
116  * Ajout de la fonction val_point.
117  *
118  * Revision 2.25 1999/11/30 16:30:23 eric
119  * *** empty log message ***
120  *
121  * Revision 2.24 1999/11/30 16:26:39 eric
122  * Ajout (provisoire) de l'affectation des dzpuis des Mtbl et Mtbl_cf
123  * dans set_dzpuis.
124  *
125  * Revision 2.23 1999/11/29 15:14:48 phil
126  * *** empty log message ***
127  *
128  * Revision 2.22 1999/11/29 12:56:49 eric
129  * Introduction des membres p_lap, ind_lap.
130  *
131  * Revision 2.21 1999/11/26 14:23:17 eric
132  * Ajout du membre dzpuis et des fonctions de manipulation associees.
133  *
134  * Revision 2.20 1999/11/25 16:27:45 eric
135  * Reorganisation complete du calcul et stokage des derivees partielles.
136  *
137  * Revision 2.19 1999/11/23 16:21:02 eric
138  * Suppression du membre statique Cmp_Zero.
139  * Suppression du constructeur par defaut.
140  *
141  * Revision 2.18 1999/11/22 16:34:56 eric
142  * Ajout du constructeur prive sans argument pour Cmp_Zero.
143  *
144  * Revision 2.17 1999/11/22 15:41:57 eric
145  * Ajout de la fonction annule(int l).
146  *
147  * Revision 2.16 1999/10/29 08:14:59 eric
148  * Ajout de assert( mpi.get_mg() == &mgi ) dans le constructeur
149  * par lecture de fichier.
150  *
151  * Revision 2.15 1999/10/28 09:39:00 eric
152  * Ajout de la fonction affiche_seuil.
153  *
154  * Revision 2.14 1999/10/28 09:01:56 eric
155  * Constructeur par lecture de fichier.
156  * Ajout de la fonction annule(int, int).
157  *
158  * Revision 2.13 1999/10/27 15:38:52 eric
159  * Suppression du membre c.
160  *
161  * Revision 2.12 1999/10/27 09:51:46 eric
162  * *** empty log message ***
163  *
164  * Revision 2.11 1999/10/27 08:45:31 eric
165  * Introduction du membre Valeur va.
166  * Le pointeur Valeur* c est desormais un membre prive constant qui pointe
167  *
168  * sur va.
169  *
170  * Revision 2.10 1999/10/22 08:14:32 eric
171  * Depoussierage.
172  *
173  * Revision 2.9 1999/10/18 16:08:15 phil
174  * Correction de set_etat_qcq
175  * Evite les memory leak
176  *
177  * Revision 2.8 1999/10/18 15:07:58 eric
178  * La fonction membre Valeur::annule() est rebaptisee Valeur::annule_hard().
179  *
180  * Revision 2.7 1999/04/09 13:38:58 phil
181  * *** empty log message ***
182  *
183  * Revision 2.6 1999/04/09 13:10:09 phil
184  * ajout de cmp = valeur
185  *
186  * Revision 2.5 1999/03/03 11:16:24 hyc
187  * *** empty log message ***
188  *
189  *
190  * $Header: /cvsroot/Lorene/C++/Source/Cmp/cmp.C,v 1.11 2016/12/05 16:17:48 j_novak Exp $
191  *
192  */
193 
194 // headers C
195 #include <cassert>
196 #include <cstdlib>
197 #include <cmath>
198 
199 // headers Lorene
200 #include "cmp.h"
201 #include "type_parite.h"
202 #include "utilitaires.h"
203 #include "proto.h"
204 
205  //---------------//
206  // Constructeurs //
207  //---------------//
208 
209 
210 namespace Lorene {
211 Cmp::Cmp(const Map& mpi) : mp(&mpi), etat(ETATNONDEF), dzpuis(0),
212  va(mpi.get_mg()) {
213 
214  set_der_0x0() ;
215 
216 }
217 
218 Cmp::Cmp(const Map* mpi) : mp(mpi), etat(ETATNONDEF), dzpuis(0),
219  va(mpi->get_mg()) {
220 
221  set_der_0x0() ;
222 
223 }
224 
225 
226 // Copy constructor
227 // ----------------
228 Cmp::Cmp(const Cmp& ci) : mp(ci.mp), etat(ci.etat), dzpuis(ci.dzpuis),
229  va(ci.va) {
230 
231  set_der_0x0() ; // On ne recopie pas les derivees
232 
233 }
234 
235 // From file
236 // ---------
237 Cmp::Cmp(const Map& mpi, const Mg3d& mgi, FILE* fd) : mp(&mpi), va(mgi, fd) {
238 
239  assert( mpi.get_mg() == &mgi ) ;
240 
241  fread_be(&etat, sizeof(int), 1, fd) ; // L'etat
242  fread_be(&dzpuis, sizeof(int), 1, fd) ; // dzpuis
243 
244  set_der_0x0() ; // Les derivees sont initialisees a zero
245 
246 }
247 
248  //--------------//
249  // Destructeur //
250  //--------------//
251 
252 // Destructeur
254  del_t() ;
255 }
256 
257  //-----------------------//
258  // Gestion de la memoire //
259  //-----------------------//
260 
261 // Destructeur logique
262 void Cmp::del_t() {
263  va.del_t() ;
264  del_deriv() ;
265  etat = ETATNONDEF ;
266 }
267 
269  delete p_dsdr ; p_dsdr = 0x0 ;
270  delete p_srdsdt ; p_srdsdt = 0x0 ;
271  delete p_srstdsdp ; p_srstdsdp = 0x0 ;
272  delete p_dsdx ; p_dsdx = 0x0 ;
273  delete p_dsdy ; p_dsdy = 0x0 ;
274  delete p_dsdz ; p_dsdz = 0x0 ;
275  delete p_lap ; p_lap = 0x0 ;
276  delete p_integ ; p_integ = 0x0 ;
277 }
278 
280  p_dsdr = 0x0 ;
281  p_srdsdt = 0x0 ;
282  p_srstdsdp = 0x0 ;
283  p_dsdx = 0x0 ;
284  p_dsdy = 0x0 ;
285  p_dsdz = 0x0 ;
286  p_lap = 0x0 ;
287  ind_lap = - 1 ;
288  p_integ = 0x0 ;
289 }
290 
291 // ETATZERO
293  if (etat == ETATZERO) return ;
294  del_deriv() ;
295  va.set_etat_zero() ;
296  etat = ETATZERO ;
297 }
298 
299 // ETATNONDEF
301  if (etat == ETATNONDEF) return ;
302  del_t() ;
303  etat = ETATNONDEF ;
304 }
305 
306 // ETATQCQ
308 
309  if (etat == ETATQCQ) {
310  del_deriv() ;
311  return ;
312  }
313 
314  // Protection
315  assert( (etat == ETATZERO) || (etat == ETATNONDEF) ) ; // sinon...
316 
317  del_t() ;
318 
319  // Termine
320  etat = ETATQCQ ;
321 }
322 
323 
324 // Allocates everything
325 // --------------------
327 
328  set_etat_qcq() ;
329  va.set_etat_c_qcq() ; // allocation in configuration space
330  Mtbl* mt = va.c ;
331  mt->set_etat_qcq() ;
332  for (int l=0; l<mt->get_nzone(); l++) {
333  mt->t[l]->set_etat_qcq() ;
334  }
335 
336 }
337 
338 
339 
340 // ZERO hard
342 
343  va.annule_hard() ;
344  del_deriv() ;
345  etat = ETATQCQ ;
346 }
347 
348 // Sets the Cmp to zero in a given domain
349 // --------------------------------------
350 
351 void Cmp::annule(int l) {
352 
353  annule(l, l) ;
354 }
355 
356 
357 // Sets the Cmp to zero in several domains
358 // ---------------------------------------
359 
360 void Cmp::annule(int l_min, int l_max) {
361 
362  // Cas particulier: annulation globale :
363  if ( (l_min == 0) && (l_max == va.mg->get_nzone()-1) ) {
364  set_etat_zero() ;
365  return ;
366  }
367 
368  assert( etat != ETATNONDEF ) ;
369 
370  if ( etat == ETATZERO ) {
371  return ; // rien n'a faire si c'est deja zero
372  }
373  else {
374  assert( etat == ETATQCQ ) ; // sinon...
375 
376  va.annule(l_min, l_max) ; // Annule la Valeur
377 
378  // Annulation des membres derives
379  if (p_dsdr != 0x0) p_dsdr->annule(l_min, l_max) ;
380  if (p_srdsdt != 0x0) p_srdsdt->annule(l_min, l_max) ;
381  if (p_srstdsdp != 0x0) p_srstdsdp->annule(l_min, l_max) ;
382  if (p_dsdx != 0x0) p_dsdx->annule(l_min, l_max) ;
383  if (p_dsdy != 0x0) p_dsdy->annule(l_min, l_max) ;
384  if (p_dsdz != 0x0) p_dsdz->annule(l_min, l_max) ;
385  if (p_lap != 0x0) p_lap->annule(l_min, l_max) ;
386  if (p_integ != 0x0) delete p_integ ;
387  }
388 
389 }
390 
391 
392 
393 
394 
395  //------------//
396  // Assignment //
397  //------------//
398 
399 // From Cmp
400 // --------
401 void Cmp::operator=(const Cmp& ci) {
402 
403  assert(&ci != this) ; // pour eviter l'auto-affectation
404 
405  // Menage general de la Valeur, mais pas des quantites derivees !
406  va.del_t() ;
407 
408  // Les elements fixes
409  mp = ci.mp ;
410  dzpuis = ci.dzpuis ;
411 
412  // La valeur eventuelle
413  switch(ci.etat) {
414  case ETATNONDEF: {
415  set_etat_nondef() ;
416  break ; // valeur par defaut
417  }
418 
419  case ETATZERO: {
420  set_etat_zero() ;
421  break ;
422  }
423 
424  case ETATQCQ: {
425  set_etat_qcq() ;
426  va = ci.va ;
427 
428  // On detruit les quantites derivees (seulement lorsque tout est fini !)
429  del_deriv() ;
430 
431  break ;
432  }
433 
434  default: {
435  cout << "Unkwown state in Cmp::operator=(const Cmp&) !"
436  << endl ;
437  abort() ;
438  break ;
439  }
440  }
441 
442 }
443 
444 // From Valeur
445 // -----------
446 void Cmp::operator=(const Valeur& vi) {
447 
448  // Traitement de l'auto-affectation :
449  if (&vi == &va) {
450  return ;
451  }
452 
453  // Protection
454  assert(vi.get_etat() != ETATNONDEF) ;
455 
456  // Menage general de la Valeur, mais pas des quantites derivees !
457  va.del_t() ;
458 
459 
460  // La valeure eventuelle
461  switch(vi.get_etat()) {
462 
463  case ETATZERO: {
464  set_etat_zero() ;
465  break ;
466  }
467 
468  case ETATQCQ: {
469  set_etat_qcq() ;
470  va = vi ;
471 
472  // On detruit les quantites derivees (seulement lorsque tout est fini !)
473  del_deriv() ;
474 
475  break ;
476  }
477 
478  default: {
479  cout << "Unkwown state in Cmp::operator=(const Valeur&) !" << endl ;
480  abort() ;
481  break ;
482  }
483  }
484 
485 }
486 
487 // From Mtbl
488 // ---------
489 void Cmp::operator=(const Mtbl& mi) {
490 
491  // Protection
492  assert(mi.get_etat() != ETATNONDEF) ;
493 
494  assert(&mi != va.c) ; // pour eviter l'auto-affectation
495 
496 
497  // Menage general de la Valeur, mais pas des quantites derivees !
498  va.del_t() ;
499 
500  // La valeure eventuelle
501  switch(mi.get_etat()) {
502  case ETATZERO: {
503  set_etat_zero() ;
504  break ;
505  }
506 
507  case ETATQCQ: {
508  set_etat_qcq() ;
509  va = mi ;
510 
511  // On detruit les quantites derivees (seulement lorsque tout est fini !)
512  del_deriv() ;
513 
514  break ;
515  }
516 
517  default: {
518  cout << "Unkwown state in Cmp::operator=(const Mtbl&) !" << endl ;
519  abort() ;
520  break ;
521  }
522  }
523 
524 
525 }
526 
527 // From double
528 // -----------
529 void Cmp::operator=(double x) {
530 
531  if (x == double(0)) {
532  set_etat_zero() ;
533  }
534  else {
535  set_etat_qcq() ;
536  del_deriv() ;
537  va = x ;
538  }
539 
540  dzpuis = 0 ;
541 }
542 
543 // From int
544 // --------
545 void Cmp::operator=(int n) {
546 
547  if (n == 0) {
548  set_etat_zero() ;
549  }
550  else {
551  set_etat_qcq() ;
552  del_deriv() ;
553  va = n ;
554  }
555 
556  dzpuis = 0 ;
557 
558 }
559 
560  //------------//
561  // Sauvegarde //
562  //------------//
563 
564 void Cmp::sauve(FILE* fd) const {
565 
566  va.sauve(fd) ; // la valeur (en premier pour la construction
567  // lors de la lecture du fichier)
568 
569  fwrite_be(&etat, sizeof(int), 1, fd) ; // l'etat
570  fwrite_be(&dzpuis, sizeof(int), 1, fd) ; // dzpuis
571 
572 }
573 
574  //------------//
575  // Impression //
576  //------------//
577 
578 // Operator <<
579 // -----------
580 ostream& operator<<(ostream& o, const Cmp& ci) {
581 
582  switch(ci.etat) {
583  case ETATNONDEF: {
584  o << "*** Cmp in UNDEFINED STATE" ;
585  break ;
586  }
587 
588  case ETATZERO: {
589  o << "*** Cmp IDENTICALLY ZERO" ;
590  break ;
591  }
592 
593  case ETATQCQ: {
594  o << "*** Cmp : " << endl ;
595  o << " dzpuis = " << ci.get_dzpuis() << endl ;
596  o << ci.va << endl ;
597  break ;
598  }
599 
600  default: {
601  cout << "operator<<(ostream&, const Cmp&) : unknown state !"
602  << endl ;
603  abort() ;
604  break ;
605  }
606  }
607 
608  // Termine
609  return o ;
610 }
611 
612 // affiche_seuil
613 //---------------
614 
615 void Cmp::affiche_seuil(ostream& ost, int type, int precis,
616  double seuil) const {
617  ost << "*** Cmp " << endl ;
618 
619  // Cas particuliers
620  //-----------------
621 
622  if (etat == ETATNONDEF) {
623  ost << " state: UNDEFINED" << endl ;
624  return ;
625  }
626 
627  if (etat == ETATZERO) {
628  ost << " state: ZERO" << endl ;
629  return ;
630  }
631 
632  // Cas general : on affiche la Valeur
633  //------------
634 
635  ost << " dzpuis = " << dzpuis << endl ;
636  va.affiche_seuil(ost, type, precis, seuil) ;
637 
638 }
639 
640 
641 
642 
643  //------------------------------------//
644  // Spectral bases of the Valeur va //
645  //------------------------------------//
646 
648 
649  va.std_base_scal() ;
650 
651 }
652 
653  //--------------------------//
654  // dzpuis manipulations //
655  //--------------------------//
656 
657 void Cmp::set_dzpuis(int dzi) {
658 
659  dzpuis = dzi ;
660 
661 }
662 
663 bool Cmp::dz_nonzero() const {
664 
665  assert(etat != ETATNONDEF) ;
666 
667  const Mg3d* mg = mp->get_mg() ;
668 
669  int nzm1 = mg->get_nzone() - 1;
670  if (mg->get_type_r(nzm1) != UNSURR) {
671  return false ;
672  }
673 
674  if (etat == ETATZERO) {
675  return false ;
676  }
677 
678  assert(etat == ETATQCQ) ;
679 
680  if (va.etat == ETATZERO) {
681  return false ;
682  }
683 
684  assert(va.etat == ETATQCQ) ;
685 
686  if (va.c != 0x0) {
687  if ( (va.c)->get_etat() == ETATZERO ) {
688  return false ;
689  }
690 
691  assert( (va.c)->get_etat() == ETATQCQ ) ;
692  if ( (va.c)->t[nzm1]->get_etat() == ETATZERO ) {
693  return false ;
694  }
695  else {
696  assert( (va.c)->t[nzm1]->get_etat() == ETATQCQ ) ;
697  return true ;
698  }
699  }
700  else{
701  assert(va.c_cf != 0x0) ;
702  if ( (va.c_cf)->get_etat() == ETATZERO ) {
703  return false ;
704  }
705  assert( (va.c_cf)->get_etat() == ETATQCQ ) ;
706  if ( (va.c_cf)->t[nzm1]->get_etat() == ETATZERO ) {
707  return false ;
708  }
709  else {
710  assert( (va.c_cf)->t[nzm1]->get_etat() == ETATQCQ ) ;
711  return true ;
712  }
713 
714  }
715 
716 }
717 
718 bool Cmp::check_dzpuis(int dzi) const {
719 
720  if (dz_nonzero()) { // the check must be done
721  return (dzpuis == dzi) ;
722  }
723  else{
724  return true ;
725  }
726 
727 }
728 
729 
730 
731  //-----------------------------------------------//
732  // Value at an arbitrary point //
733  //-----------------------------------------------//
734 
735 double Cmp::val_point(double r, double theta, double phi) const {
736 
737  assert(etat != ETATNONDEF) ;
738 
739  if (etat == ETATZERO) {
740  return double(0) ;
741  }
742 
743  assert(etat == ETATQCQ) ;
744 
745  // 1/ Search for the domain and the grid coordinates (xi,theta',phi')
746  // which corresponds to the point (r,theta,phi)
747 
748  int l ;
749  double xi ;
750 
751  mp->val_lx(r, theta, phi, l, xi) ; // call of val_lx with default
752  // accuracy parameters
753 
754  // 2/ Call to the Valeur version
755 
756  return va.val_point(l, xi, theta, phi) ;
757 
758 }
759 
760 
761  //-------------------------------------//
762  // Multipolar spectrum //
763  //-------------------------------------//
764 
766  assert (etat != ETATNONDEF) ;
767 
768  const Mg3d* mg = mp->get_mg() ;
769  int nzone = mg->get_nzone() ;
770  int lmax = 0 ;
771 
772  for (int lz=0; lz<nzone; lz++)
773  lmax = (lmax < 2*mg->get_nt(lz) - 1 ? 2*mg->get_nt(lz) - 1 : lmax) ;
774 
775  Tbl resu(nzone, lmax) ;
776  if (etat == ETATZERO) {
777  resu.set_etat_zero() ;
778  return resu ;
779  }
780 
781  assert(etat == ETATQCQ) ;
782 
783  va.coef() ;
784  va.ylm() ;
785  resu.annule_hard() ;
786  const Base_val& base = va.c_cf->base ;
787  int m_quant, l_quant, base_r ;
788  for (int lz=0; lz<nzone; lz++)
789  for (int k=0 ; k<mg->get_np(lz) ; k++)
790  for (int j=0 ; j<mg->get_nt(lz) ; j++) {
791  if (nullite_plm(j, mg->get_nt(lz), k, mg->get_np(lz), base) == 1)
792  {
793  // quantic numbers and spectral bases
794  donne_lm(nzone, lz, j, k, base, m_quant, l_quant, base_r) ;
795  for (int i=0; i<mg->get_nr(lz); i++) resu.set(lz, l_quant)
796  += fabs((*va.c_cf)(0, k, j, i)) ;
797  }
798  }
799 
800  return resu ;
801 }
802 
803 }
void del_t()
Logical destructor.
Definition: cmp.C:262
Cmp * p_dsdy
Pointer on of *this , where .
Definition: cmp.h:484
Mtbl_cf * c_cf
Coefficients of the spectral expansion of the function.
Definition: valeur.h:312
Component of a tensorial field *** DEPRECATED : use class Scalar instead ***.
Definition: cmp.h:446
void operator=(const Cmp &a)
Assignment to another Cmp defined on the same mapping.
Definition: cmp.C:401
int ind_lap
Power of r by which the last computed Laplacian has been multiplied in the external compactified doma...
Definition: cmp.h:498
int get_np(int l) const
Returns the number of points in the azimuthal direction ( ) in domain no. l.
Definition: grilles.h:479
void coef() const
Computes the coeffcients of *this.
Definition: valeur_coef.C:151
void annule(int l)
Sets the Cmp to zero in a given domain.
Definition: cmp.C:351
void set_etat_zero()
Sets the logical state to ETATZERO (zero).
Definition: valeur.C:692
Multi-domain array.
Definition: mtbl.h:118
void set_der_0x0()
Sets the pointers for derivatives to 0x0.
Definition: cmp.C:279
Lorene prototypes.
Definition: app_hor.h:67
void ylm()
Computes the coefficients of *this.
Definition: valeur_ylm.C:141
void annule_hard()
Sets the Valeur to zero in a hard way.
Definition: valeur.C:726
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
Definition: map.h:777
double & set(int i)
Read/write of a particular element (index i) (1D case)
Definition: tbl.h:301
int etat
Logical state (ETATNONDEF , ETATQCQ or ETATZERO ).
Definition: cmp.h:454
Base class for coordinate mappings.
Definition: map.h:682
void del_deriv()
Logical destructor of the derivatives.
Definition: cmp.C:268
void annule_hard()
Sets the Cmp to zero in a hard way.
Definition: cmp.C:341
Values and coefficients of a (real-value) function.
Definition: valeur.h:297
Tbl * p_integ
Pointer on the space integral of *this (values in each domain)
Definition: cmp.h:503
void annule(int l)
Sets the Valeur to zero in a given domain.
Definition: valeur.C:747
void std_base_scal()
Sets the bases for spectral expansions (member base ) to the standard ones for a scalar.
Definition: valeur.C:827
Cmp * p_lap
Pointer on the Laplacian of *this.
Definition: cmp.h:493
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Definition: tbl.C:364
int get_etat() const
Gives the logical state.
Definition: mtbl.h:277
int get_etat() const
Returns the logical state.
Definition: valeur.h:760
const Mg3d * mg
Multi-grid Mgd3 on which this is defined.
Definition: valeur.h:302
void set_etat_zero()
Sets the logical state to ETATZERO (zero).
Definition: cmp.C:292
int get_nzone() const
Gives the number of zones (domains)
Definition: mtbl.h:280
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 ...
Definition: valeur.C:885
Cmp * p_srstdsdp
Pointer on of *this.
Definition: cmp.h:474
Tbl multipole_spectrum()
Gives the spectrum in terms of multipolar modes l .
Definition: cmp.C:765
void sauve(FILE *) const
Save in a file.
Definition: valeur.C:478
void del_t()
Logical destructor.
Definition: valeur.C:629
int dzpuis
Power of r by which the quantity represented by this must be divided in the external compactified zo...
Definition: cmp.h:461
Mtbl * c
Values of the function at the points of the multi-grid.
Definition: valeur.h:309
bool dz_nonzero() const
Returns true if the last domain is compactified and *this is not zero in this domain.
Definition: cmp.C:663
void affiche_seuil(ostream &ostr, int type=0, int precision=4, double threshold=1.e-7) const
Prints only the values greater than a given threshold.
Definition: valeur.C:561
~Cmp()
Destructor.
Definition: cmp.C:253
int get_nzone() const
Returns the number of domains.
Definition: grilles.h:465
int fwrite_be(const int *aa, int size, int nb, FILE *fich)
Writes integer(s) into a binary file according to the big endian convention.
Definition: fwrite_be.C:73
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Definition: cmp.C:307
void set_etat_qcq()
Sets the logical state to ETATQCQ (ordinary state).
Definition: mtbl.C:302
void affiche_seuil(ostream &ostr, int type=0, int precision=4, double threshold=1.e-7) const
Prints only the values greater than a given threshold.
Definition: cmp.C:615
void set_etat_zero()
Sets the logical state to ETATZERO (zero).
Definition: tbl.C:350
void std_base_scal()
Sets the spectral bases of the Valeur va to the standard ones for a scalar.
Definition: cmp.C:647
int fread_be(int *aa, int size, int nb, FILE *fich)
Reads integer(s) from a binary file according to the big endian convention.
Definition: fread_be.C:72
int get_nr(int l) const
Returns the number of points in the radial direction ( ) in domain no. l.
Definition: grilles.h:469
void allocate_all()
Sets the logical state to ETATQCQ (ordinary state) and performs the memory allocation of all the elem...
Definition: cmp.C:326
Multi-domain grid.
Definition: grilles.h:279
Bases of the spectral expansions.
Definition: base_val.h:325
const Map * mp
Reference mapping.
Definition: cmp.h:451
int get_dzpuis() const
Returns dzpuis.
Definition: cmp.h:903
Cmp * p_srdsdt
Pointer on of *this.
Definition: cmp.h:472
void set_etat_nondef()
Sets the logical state to ETATNONDEF (undefined).
Definition: cmp.C:300
Cmp * p_dsdz
Pointer on of *this , where .
Definition: cmp.h:489
Cmp * p_dsdr
Pointer on of *this.
Definition: cmp.h:470
Cmp(const Map &map)
Constructor from mapping.
Definition: cmp.C:211
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
void set_etat_c_qcq()
Sets the logical state to ETATQCQ (ordinary state) for values in the configuration space (Mtbl c )...
Definition: valeur.C:704
Base_val base
Bases of the spectral expansions.
Definition: mtbl_cf.h:210
int etat
Logical state (ETATNONDEF , ETATQCQ or ETATZERO ).
Definition: valeur.h:305
void set_dzpuis(int)
Set a value to dzpuis.
Definition: cmp.C:657
Basic array class.
Definition: tbl.h:164
int get_nt(int l) const
Returns the number of points in the co-latitude direction ( ) in domain no. l.
Definition: grilles.h:474
void sauve(FILE *) const
Save in a file.
Definition: cmp.C:564
int get_type_r(int l) const
Returns the type of sampling in the radial direction in domain no.
Definition: grilles.h:491
Tbl ** t
Array (size nzone ) of pointers on the Tbl &#39;s.
Definition: mtbl.h:132
Cmp * p_dsdx
Pointer on of *this , where .
Definition: cmp.h:479
void annule_hard()
Sets the Tbl to zero in a hard way.
Definition: tbl.C:375
Valeur va
The numerical value of the Cmp.
Definition: cmp.h:464
double val_point(double r, double theta, double phi) const
Computes the value of the field represented by *this at an arbitrary point , by means of the spectral...
Definition: cmp.C:735
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...