source: Sophya/trunk/SophyaLib/Samba/spherethetaphi.cc@ 518

Last change on this file since 518 was 518, checked in by ansari, 26 years ago

Introduction de SpherePosition and SphereCoordSys, and Initiator for module Samba - Reza+I. Grivell 26/10/99

File size: 19.0 KB
Line 
1#include "spherethetaphi.h"
2#include "nbmath.h"
3#include <complex>
4#include "piocmplx.h"
5#include <iostream.h>
6
7
8//***************************************************************
9//++
10// Class SphereThetaPhi
11//
12//
13// include spherethetaphi.h nbmath.h
14//
15// Découpage de la sphère selon theta et phi, chaque
16// hémisphère étant découpé en (m-1) parallèles (l'équateur compte pour du
17// beurre), chacune des m bandes de theta ainsi définies étant découpée par
18// des méridiens équirepartis, ce découpage étant fait de sorte que tous
19// les pixels aient la même surface et soient le plus carré possible.
20// On commence par découper l'hémisphère de z positif en partant du pôle et
21// en allant vers l'équateur. Le premier pixel est la calotte polaire,
22// il est circulaire et centré sur theta=0.
23//--
24//++
25//
26// Links Parents
27//
28// SphericalMap
29//--
30//++
31//
32// Links Descendants
33//
34//
35//--
36
37/* --Methode-- */
38//++
39// Titre Constructeurs
40//--
41//++
42
43template <class T>
44SphereThetaPhi<T>::SphereThetaPhi()
45
46//--
47{
48 InitNul();
49}
50
51
52/* --Methode-- */
53
54//++
55template <class T>
56SphereThetaPhi<T>::SphereThetaPhi(int m)
57
58// Constructeur : m est le nombre de bandes en theta sur un hémisphère
59// (la calotte constituant la premiere bande).
60// pet est le nombre de pixels (pétales) de la bande en contact avec la
61// calotte polaire. Pour l'instant pet est inopérant!
62//--
63{
64 InitNul();
65 Pixelize(m);
66}
67
68template <class T>
69SphereThetaPhi<T>::SphereThetaPhi(const SphereThetaPhi<T>& s)
70{
71 if(s.mInfo_) mInfo_= new DVList(*s.mInfo_);
72 NTheta_= s.NTheta_;
73 NPix_ = s.NPix_;
74 NPhi_ = new int[NTheta_];
75 Theta_ = new double[NTheta_+1];
76 TNphi_ = new int[NTheta_+1];
77 for(int k = 0; k < NTheta_; k++)
78 {
79 NPhi_[k] = s.NPhi_[k];
80 Theta_[k]= s.Theta_[k];
81 TNphi_[k]= s.TNphi_[k];
82 }
83 Theta_[NTheta_]= s.Theta_[NTheta_];
84 TNphi_[NTheta_]= s.TNphi_[NTheta_];
85 Omega_ = s.Omega_;
86 pixels_= s.pixels_;
87}
88
89//++
90// Titre Destructeur
91//--
92//++
93template <class T>
94SphereThetaPhi<T>::~SphereThetaPhi()
95
96//--
97{
98 Clear();
99}
100
101//++
102// Titre Méthodes
103//--
104template <class T>
105void SphereThetaPhi<T>::InitNul()
106//
107// initialise à zéro les variables de classe pointeurs
108{
109 NTheta_= 0;
110 NPix_ = 0;
111 Theta_ = NULL;
112 NPhi_ = NULL;
113 TNphi_ = NULL;
114 pixels_.Reset();
115}
116
117/* --Methode-- */
118template <class T>
119void SphereThetaPhi<T>::Clear()
120
121{
122 if(Theta_) delete[] Theta_;
123 if(NPhi_ ) delete[] NPhi_;
124 if(TNphi_) delete[] TNphi_;
125 InitNul();
126}
127
128//++
129template <class T>
130void SphereThetaPhi<T>::Resize(int m)
131// re-pixelize the sphere
132//--
133{
134 Clear();
135 Pixelize(m);
136}
137
138/* --Methode-- */
139//++
140template <class T>
141int SphereThetaPhi<T>::NbPixels() const
142
143// Retourne le nombre de pixels du découpage
144//--
145{
146 return(NPix_);
147}
148
149/* --Methode-- */
150//++
151template <class T>
152T& SphereThetaPhi<T>::PixVal(int k)
153
154// Retourne la valeur du contenu du pixel d'indice k
155//--
156{
157 if((k < 0) || (k >= NPix_))
158 {
159 //THROW(out_of_range("SphereThetaPhi::PIxVal Pixel index out of range"));
160 cout << " SphereThetaPhi::PIxVal : exceptions a mettre en place" <<endl;
161 THROW(rangeCheckErr);
162 }
163 return pixels_(k);
164}
165
166//++
167template <class T>
168T const& SphereThetaPhi<T>::PixVal(int k) const
169
170// Retourne la valeur du contenu du pixel d'indice k
171//--
172{
173 if((k < 0) || (k >= NPix_))
174 {
175 cout << " SphereThetaPhi::PIxVal : exceptions a mettre en place" <<endl;
176 //THROW(out_of_range("SphereThetaPhi::PIxVal Pixel index out of range"));
177 throw "SphereThetaPhi::PIxVal Pixel index out of range";
178 }
179 return *(pixels_.Data()+k);
180}
181
182/* --Methode-- */
183//++
184template <class T>
185bool SphereThetaPhi<T>::ContainsSph(double theta, double phi) const
186//--
187{
188 return(true);
189}
190
191/* --Methode-- */
192//++
193template <class T>
194int SphereThetaPhi<T>::PixIndexSph(double theta, double phi) const
195
196// Retourne l'indice du pixel vers lequel pointe une direction définie par
197// ses coordonnées sphériques
198//--
199{
200 double dphi;
201 int i,j,k;
202 bool fgzn = false;
203
204 if((theta > Pi) || (theta < 0.)) return(-1);
205 if((phi < 0.) || (phi > DeuxPi)) return(-1);
206 if(theta > Pi*0.5) {fgzn = true; theta = Pi-theta;}
207
208 // La bande d'indice kt est limitée par les valeurs de theta contenues dans
209 // Theta_[kt] et Theta_[kt+1]
210 for( i=1; i< NTheta_; i++ )
211 if( theta < Theta_[i] ) break;
212
213 dphi= DeuxPi/(double)NPhi_[i-1];
214
215 if (fgzn) k= NPix_-TNphi_[i]+(int)(phi/dphi);
216 else k= TNphi_[i-1]+(int)(phi/dphi);
217 return(k);
218}
219
220/* --Methode-- */
221//++
222template <class T>
223void SphereThetaPhi<T>::PixThetaPhi(int k,double& theta,double& phi) const
224
225// Retourne les coordonnées (theta,phi) du milieu du pixel d'indice k
226//--
227{
228 int i;
229 bool fgzn = false;
230
231 if((k < 0) || (k >= NPix_)) {theta = -99999.; phi = -99999.; return; }
232 if( k >= NPix_/2) {fgzn = true; k = NPix_-1-k;}
233
234 // recupère l'indice i de la tranche qui contient le pixel k
235 for( i=0; i< NTheta_; i++ )
236 if( k < TNphi_[i+1] ) break;
237
238 // angle theta
239 theta= 0.5*(Theta_[i]+Theta_[i+1]);
240 if (fgzn) theta= Pi-theta;
241
242 // angle phi
243 k -= TNphi_[i];
244 phi= DeuxPi/(double)NPhi_[i]*(double)(k+.5);
245 if (fgzn) phi= DeuxPi-phi;
246}
247
248//++
249template <class T>
250double SphereThetaPhi<T>::PixSolAngle(int dummy) const
251
252// Pixel Solid angle (steradians)
253// All the pixels have the same solid angle. The dummy argument is
254// for compatibility with eventual pixelizations which would not
255// fulfil this requirement.
256//--
257{
258 return Omega_;
259}
260
261/* --Methode-- */
262//++
263template <class T>
264void SphereThetaPhi<T>::Limits(int k,double& tetMin,double& tetMax,double& phiMin,double& phiMax)
265
266// Retourne les valeurs de theta et phi limitant le pixel d'indice k
267//--
268 {
269 int j;
270 double dphi;
271 bool fgzn= false;
272
273 if((k < 0) || (k >= NPix_)) {
274 tetMin= -99999.;
275 phiMin= -99999.;
276 tetMax= -99999.;
277 phiMax= -99999.;
278 return;
279 }
280
281 // si on se trouve dans l'hémisphère Sud
282 if(k >= NPix_/2) {
283 fgzn= true;
284 k= NPix_-1-k;
285 }
286
287 // on recupere l'indice i de la tranche qui contient le pixel k
288 int i;
289 for( i=0; i< NTheta_; i++ )
290 if(k < TNphi_[i+1]) break;
291
292 // valeurs limites de theta dans l'hemisphere Nord
293 tetMin= Theta_[i];
294 tetMax= Theta_[i+1];
295 // valeurs limites de theta dans l'hemisphere Sud
296 if (fgzn) {
297 tetMin= Pi-Theta_[i+1];
298 tetMax= Pi-Theta_[i];
299 }
300
301 // pixel correspondant dans l'hemisphere Nord
302 if (fgzn) k= TNphi_[i+1]-k+TNphi_[i]-1;
303
304 // indice j de discretisation ( phi= j*dphi )
305 j= k-TNphi_[i];
306 dphi= DeuxPi/(double)NPhi_[i];
307
308 // valeurs limites de phi
309 phiMin= dphi*(double)(j);
310 phiMax= dphi*(double)(j+1);
311 return;
312}
313
314/* --Methode-- */
315//++
316template <class T>
317int SphereThetaPhi<T>::NbThetaSlices() const
318
319// Retourne le nombre de tranches en theta sur la sphere
320//--
321{
322 int nbslices;
323 nbslices= 2*NTheta_;
324 return(nbslices);
325}
326
327/* --Methode-- */
328//++
329template <class T>
330int SphereThetaPhi<T>::NPhi(int kt) const
331
332// Retourne le nombre de pixels en phi de la tranche kt
333//--
334{
335 int nbpix;
336 // verification
337 if((kt < 0) || (kt >= 2*NTheta_)) return(-1);
338
339 // si on se trouve dans l'hemisphere Sud
340 if(kt >= NTheta_) {
341 kt= 2*NTheta_-1-kt;
342 }
343
344 // nombre de pixels
345 nbpix= NPhi_[kt];
346 return(nbpix);
347}
348
349
350/* --Methode-- */
351//++
352template <class T>
353void SphereThetaPhi<T>::Theta(int kt,double& tetMin,double& tetMax)
354
355// Retourne les valeurs de theta limitant la tranche kt
356//--
357{
358 bool fgzn= false;
359 // verification
360 if( (kt< 0) || (kt>= 2*NTheta_) ) {
361 tetMin= -99999.;
362 tetMax= -99999.;
363 return;
364 }
365
366 // si on se trouve dans l'hemisphere Sud
367 if( kt >= NTheta_ ) {
368 fgzn= true;
369 kt= 2*NTheta_-1-kt;
370 }
371
372 // valeurs limites de theta dans l'hemisphere Nord
373 tetMin= Theta_[kt];
374 tetMax= Theta_[kt+1];
375 // valeurs limites de theta dans l'hemisphere Sud
376 if (fgzn) {
377 tetMin= Pi-Theta_[kt+1];
378 tetMax= Pi-Theta_[kt];
379 }
380}
381
382/* --Methode-- */
383//++
384template <class T>
385void SphereThetaPhi<T>::Phi(int kt,int jp,double& phiMin,double& phiMax)
386
387// Retourne les valeurs de phi limitant le pixel jp de la tranche kt
388//--
389{
390 // verification
391 if((kt < 0) || (kt >= 2*NTheta_)) {
392 phiMin= -99999.;
393 phiMax= -99999.;
394 return;
395 }
396
397 // si on se trouve dans l'hemisphere Sud
398 if(kt >= NTheta_) kt= 2*NTheta_-1-kt;
399
400 // verifie si la tranche kt contient au moins jp pixels
401 if( (jp< 0) || (jp >= NPhi_[kt]) ) {
402 phiMin= -88888.;
403 phiMax= -88888.;
404 return;
405 }
406
407 double dphi= DeuxPi/(double)NPhi_[kt];
408 phiMin= dphi*(double)(jp);
409 phiMax= dphi*(double)(jp+1);
410 return;
411}
412
413/* --Methode-- */
414//++
415template <class T>
416int SphereThetaPhi<T>::Index(int kt,int jp) const
417
418// Retourne l'indice du pixel d'indice jp dans la tranche kt
419//--
420{
421 int k;
422 bool fgzn= false;
423
424 // si on se trouve dans l'hemisphere Sud
425 if(kt >= NTheta_) {
426 fgzn= true;
427 kt= 2*NTheta_-1-kt;
428 }
429
430 // si la tranche kt contient au moins i pixels
431 if( (jp>=0) && (jp<NPhi_[kt]) )
432 {
433 // dans l'hemisphere Sud
434 if (fgzn) k= NPix_-TNphi_[kt+1]+jp;
435 // dans l'hemisphere Nord
436 else k= TNphi_[kt]+jp;
437 }
438 else
439 {
440 k= 9999;
441 printf("\n la tranche %d ne contient pas un pixel de rang %d",kt,jp);
442 }
443 return(k);
444}
445
446/* --Methode-- */
447//++
448template <class T>
449void SphereThetaPhi<T>::ThetaPhiIndex(int k,int& kt,int& jp)
450
451// Retourne les indices kt et jp du pixel d'indice k
452//--
453{
454 bool fgzn= false;
455 // si on se trouve dans l'hemisphere Sud
456 if(k >= NPix_/2)
457 {
458 fgzn= true;
459 k= NPix_-1-k;
460 }
461
462 // on recupere l'indice kt de la tranche qui contient le pixel k
463 int i;
464 for(i = 0; i < NTheta_; i++)
465 if(k < TNphi_[i+1]) break;
466
467 // indice kt de tranche
468 if (fgzn) kt= 2*NTheta_-1-i;
469 else kt= i;
470
471 // indice jp de pixel
472 if (fgzn) jp= TNphi_[i+1]-k-1;
473 else jp= k-TNphi_[i];
474}
475//++
476template <class T>
477void SphereThetaPhi<T>::Pixelize(int m)
478
479// effectue le découpage en pixels (m et pet ont la même signification
480// que pour le constructeur)
481//
482// Chaque bande de theta sera découpée en partant de phi=0 ...
483// L'autre hémisphère est parcourue dans le même sens en phi et de
484// l'équateur vers le pôle (le pixel qui suit le dernier de la bande la plus
485// proche de l'équateur a z>0 est celui de plus petit phi de la bande la
486// plus proche de l'equateur a z<0).
487//--
488{
489 int ntotpix,i,j;
490
491 // Decodage et controle des arguments d'appel :
492 // au moins 2 et au plus 16384 bandes d'un hemisphere en theta
493 if (m < 2) m = 2;
494 if (m > 16384) m = 16384;
495
496 // On memorise les arguments d'appel
497 NTheta_ = m;
498
499 // On commence par decouper l'hemisphere z>0.
500 // Creation des vecteurs contenant :
501 // Les valeurs limites de theta (une valeur de plus que le nombre de bandes...)
502 Theta_= new double[m+1];
503
504 // Le nombre de pixels en phi de chacune des bandes en theta
505 NPhi_ = new int[m];
506
507 // Le nombre/Deuxpi total des pixels contenus dans les bandes de z superieur a une
508 // bande donnee (mTPphi[m] contient le nombre de pixels total de l'hemisphere)
509 TNphi_= new int[m+1];
510
511 // Calcul du nombre total de pixels dans chaque bande pour optimiser
512 // le rapport largeur/hauteur des pixels
513
514 //calotte polaire
515 TNphi_[0]= 0;
516 NPhi_[0] = 1;
517
518 //bandes jusqu'a l'equateur
519 for(j = 1; j < m; j++)
520 {
521 TNphi_[j]= TNphi_[j-1]+NPhi_[j-1];
522 NPhi_[j] = (int)(.5+4.*(double)(m-.5)*sin(Pi*(double)j/(double)(2.*m-1.))) ;
523 }
524
525 // Nombre total de pixels sur l'hemisphere
526 ntotpix = TNphi_[m-1]+NPhi_[m-1];
527 TNphi_[m]= ntotpix;
528 // et sur la sphere entiere
529 NPix_= 2*ntotpix;
530
531 // Creation et initialisation du vecteur des contenus des pixels
532 pixels_.ReSize(NPix_);
533 pixels_.Reset();
534
535 // Determination des limites des bandes en theta :
536 // omeg est l'angle solide couvert par chaque pixel,
537 // une bande donnee kt couvre un angle solide NPhi_[kt]*omeg
538 // egal a 2* Pi*(cos Theta_[kt]-cos Theta_[kt+1]). De meme, l'angle solide
539 //de la
540 // calotte allant du pole a la limite haute de la bande kt vaut
541 // 2* Pi*(1.-cos Theta_[kt+1])= TNphi_[kt]*omeg...
542
543 double omeg2pi= 1./(double)ntotpix;
544 Omega_ = omeg2pi*DeuxPi;
545
546 for(j=0; j <= m; j++)
547 {
548 Theta_[j]= acos(1.-(double)TNphi_[j]*omeg2pi);
549 }
550}
551
552//++
553template <class T>
554void SphereThetaPhi<T>::GetThetaSlice(int index,double& theta, TVector<double>& phi, TVector<T>& value) const
555
556// Retourne, pour la tranche en theta d'indice 'index' le theta
557// correspondant, un vecteur (Peida) contenant les phi des pixels de
558// la tranche, un vecteur (Peida) contenant les valeurs de pixel
559// correspondantes
560//--
561
562{
563 cout << "entree GetThetaSlice, couche no " << index << endl;
564
565 if(index < 0 || index > NbThetaSlices())
566 {
567 // THROW(out_of_range("SphereThetaPhi::PIxVal Pixel index out of range"));
568 cout << " SphereThetaPhi::GetThetaSlice : exceptions a mettre en place" <<endl;
569 THROW(rangeCheckErr);
570 }
571
572 int iring= Index(index,0);
573 int bid = this->NPhi(index);
574 int lring = bid;
575 cout << " iring= " << iring << " lring= " << lring << endl;
576
577 phi.ReSize(lring);
578 value.ReSize(lring);
579 double Te= 0.;
580 double Fi= 0.;
581 for(int kk = 0; kk < lring; kk++)
582 {
583 PixThetaPhi(kk+iring,Te,Fi);
584 phi(kk)= Fi;
585 value(kk)= PixVal(kk+iring);
586 }
587 theta= Te;
588}
589
590template <class T>
591void SphereThetaPhi<T>::setmNPhi(int* array, int m)
592 //remplit le tableau contenant le nombre de pixels en phi de chacune des bandes en theta
593 //--
594{
595 NPhi_= new int[m];
596 for(int k = 0; k < m; k++) NPhi_[k]= array[k];
597}
598
599template <class T>
600void SphereThetaPhi<T>::setmTNphi(int* array, int m)
601 //remplit le tableau contenant le nombre/Deuxpi total des pixels contenus dans les bandes
602 //--
603{
604 TNphi_= new int[m];
605 for(int k = 0; k < m; k++) TNphi_[k]= array[k];
606}
607
608template <class T>
609void SphereThetaPhi<T>::setmTheta(double* array, int m)
610 //remplit le tableau contenant les valeurs limites de theta
611 //--
612{
613 Theta_= new double[m];
614 for(int k = 0; k < m; k++) Theta_[k]= array[k];
615}
616
617template <class T>
618void SphereThetaPhi<T>::setDataBlock(T* data, int m)
619 // remplit le vecteur des contenus des pixels
620{
621 pixels_.FillFrom(m,data);
622}
623
624template <class T>
625void SphereThetaPhi<T>::print(ostream& os) const
626{
627 if(mInfo_) os << " DVList Info= " << *mInfo_ << endl;
628 //
629 os << " NTheta_= " << NTheta_ << endl;
630 os << " NPix_ = " << NPix_ << endl;
631 os << " Omega_ = " << Omega_ << endl;
632
633 os << " contenu de NPhi_ : ";
634 int i;
635 for(i=0; i < NTheta_; i++)
636 {
637 if(i%5 == 0) os << endl;
638 os << NPhi_[i] <<", ";
639 }
640 os << endl;
641
642 os << " contenu de Theta_ : ";
643 for(i=0; i < NTheta_+1; i++)
644 {
645 if(i%5 == 0) os << endl;
646 os << Theta_[i] <<", ";
647 }
648 os << endl;
649
650 os << " contenu de TNphi_ : ";
651 for(i=0; i < NTheta_+1; i++)
652 {
653 if(i%5 == 0) os << endl;
654 os << TNphi_[i] <<", ";
655 }
656 os << endl;
657
658 os << " contenu de pixels : ";
659 for(i=0; i < NPix_; i++)
660 {
661 if(i%5 == 0) os << endl;
662 os << pixels_(i) <<", ";
663 }
664 os << endl;
665}
666
667///////////////////////////////////////////////////////////
668// --------------------------------------------------------
669// Les objets delegues pour la gestion de persistance
670// --------------------------------------------------------
671//////////////////////////////////////////////////////////
672
673template <class T>
674FIO_SphereThetaPhi<T>::FIO_SphereThetaPhi()
675{
676 dobj= new SphereThetaPhi<T>;
677 ownobj= true;
678}
679
680template <class T>
681FIO_SphereThetaPhi<T>::FIO_SphereThetaPhi(string const& filename)
682{
683 dobj= new SphereThetaPhi<T>;
684 ownobj= true;
685 Read(filename);
686}
687
688template <class T>
689FIO_SphereThetaPhi<T>::FIO_SphereThetaPhi(const SphereThetaPhi<T>& obj)
690{
691 dobj= new SphereThetaPhi<T>(obj);
692 ownobj= true;
693}
694
695template <class T>
696FIO_SphereThetaPhi<T>::FIO_SphereThetaPhi(SphereThetaPhi<T>* obj)
697{
698 dobj= obj;
699 ownobj= false;
700}
701
702template <class T>
703FIO_SphereThetaPhi<T>::~FIO_SphereThetaPhi()
704{
705 if (ownobj && dobj) delete dobj;
706}
707
708template <class T>
709AnyDataObj* FIO_SphereThetaPhi<T>::DataObj()
710{
711 return(dobj);
712}
713
714template <class T>
715void FIO_SphereThetaPhi<T>::ReadSelf(PInPersist& is)
716{
717 cout << " FIO_SphereThetaPhi:: ReadSelf " << endl;
718
719 if(dobj == NULL)
720 {
721 dobj= new SphereThetaPhi<T>;
722 }
723
724// Let's Read the SphereCoordSys object -- ATTENTIOn - $CHECK$
725 SphereCoordSys* cs = dynamic_cast<SphereCoordSys*>(is.ReadObject());
726 dobj->SetCoordSys(cs);
727
728 // Pour savoir s'il y avait un DVList Info associe
729 char strg[256];
730 is.GetLine(strg, 255);
731 bool hadinfo= false;
732 if(strncmp(strg+strlen(strg)-7, "HasInfo", 7) == 0) hadinfo= true;
733 if(hadinfo)
734 { // Lecture eventuelle du DVList Info
735 is >> dobj->Info();
736 }
737
738 int mNTheta;
739 is.GetI4(mNTheta);
740 dobj->setSizeIndex(mNTheta);
741
742 int mNPix;
743 is.GetI4(mNPix);
744 dobj->setNbPixels(mNPix);
745
746 double mOmeg;
747 is.GetR8(mOmeg);
748 dobj->setPixSolAngle(mOmeg);
749
750 int* mNphi= new int[mNTheta];
751 is.GetI4s(mNphi, mNTheta);
752 dobj->setmNPhi(mNphi, mNTheta);
753 delete [] mNphi;
754
755 int* mTNphi= new int[mNTheta+1];
756 is.GetI4s(mTNphi, mNTheta+1);
757 dobj->setmTNphi(mTNphi, mNTheta+1);
758 delete [] mTNphi;
759
760 double* mTheta= new double[mNTheta+1];
761 is.GetR8s(mTheta, mNTheta+1);
762 dobj->setmTheta(mTheta, mNTheta+1);
763 delete [] mTheta;
764
765 T* mPixels= new T[mNPix];
766 PIOSReadArray(is, mPixels, mNPix);
767 dobj->setDataBlock(mPixels, mNPix);
768 delete [] mPixels;
769}
770
771template <class T>
772void FIO_SphereThetaPhi<T>::WriteSelf(POutPersist& os) const
773{
774 cout << " FIO_SphereThetaPhi:: WriteSelf " << endl;
775
776 if(dobj == NULL)
777 {
778 cout << " WriteSelf:: dobj= null " << endl;
779 return;
780 }
781
782// Let's write the SphereCoordSys object
783 dobj->GetCoordSys()->Write(os);
784
785 char strg[256];
786 int mNTheta= dobj->SizeIndex();
787 int mNPix = dobj->NbPixels();
788
789 if(dobj->ptrInfo())
790 {
791 sprintf(strg,"SphereThetaPhi: NSlices=%6d NPix=%9d HasInfo",mNTheta,mNPix);
792 os.PutLine(strg);
793 os << dobj->Info();
794 }
795 else
796 {
797 sprintf(strg,"SphereThetaPhi: NSlices=%6d NPix=%9d ",mNTheta,mNPix);
798 os.PutLine(strg);
799 }
800
801 os.PutI4(mNTheta);
802 os.PutI4(mNPix);
803 os.PutR8(dobj->PixSolAngle(0));
804 os.PutI4s(dobj->getmNPhi() , mNTheta);
805 os.PutI4s(dobj->getmTNphi(), mNTheta+1);
806 os.PutR8s(dobj->getmTheta(), mNTheta+1);
807 //os.Put((dobj->getDataBlock())->Data(), mNPix);
808 PIOSWriteArray(os,(dobj->getDataBlock())->Data(), mNPix);
809}
810
811#ifdef __CXX_PRAGMA_TEMPLATES__
812#pragma define_template SphereThetaPhi<double>
813#pragma define_template SphereThetaPhi<float>
814#pragma define_template SphereThetaPhi< complex<float> >
815#pragma define_template SphereThetaPhi< complex<double> >
816#pragma define_template FIO_SphereThetaPhi<double>
817#pragma define_template FIO_SphereThetaPhi<float>
818#pragma define_template FIO_SphereThetaPhi< complex<float> >
819#pragma define_template FIO_SphereThetaPhi< complex<double> >
820#endif
821#if defined(ANSI_TEMPLATES) || defined(GNU_TEMPLATES)
822template class SphereThetaPhi<double>;
823template class SphereThetaPhi<float>;
824template class SphereThetaPhi< complex<float> >;
825template class SphereThetaPhi< complex<double> >;
826template class FIO_SphereThetaPhi<double>;
827template class FIO_SphereThetaPhi<float>;
828template class FIO_SphereThetaPhi< complex<float> >;
829template class FIO_SphereThetaPhi< complex<double> >;
830#endif
Note: See TracBrowser for help on using the repository browser.