Changeset 473 in Sophya


Ignore:
Timestamp:
Oct 18, 1999, 4:37:44 PM (26 years ago)
Author:
ansari
Message:

modifs francois : passage en double etc. 18-OCT-99

Location:
trunk/SophyaLib/Samba
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/Samba/localmap.cc

    r470 r473  
    8989//++
    9090template<class T>
    91 LocalMap<T>::LocalMap(int_4 nx, int_4 ny) : nSzX_(nx), nSzY_(ny)
     91LocalMap<T>::LocalMap(int nx, int ny) : nSzX_(nx), nSzY_(ny)
    9292//
    9393// Constructeur
     
    155155//++
    156156template<class T>
    157 void LocalMap<T>::ReSize(int_4 nx, int_4 ny)
     157void LocalMap<T>::ReSize(int nx, int ny)
    158158//
    159159// Redimensionne l'espace de stokage des pixels
     
    175175//++
    176176template<class T>
    177 int_4 LocalMap<T>::NbPixels() const
     177int LocalMap<T>::NbPixels() const
    178178//
    179179//    Retourne le nombre de pixels du découpage
     
    185185//++
    186186template<class T>
    187 T& LocalMap<T>::PixVal(int_4 k)
     187T& LocalMap<T>::PixVal(int k)
    188188//
    189189//    Retourne la valeur du contenu du pixel d'indice k
     
    203203
    204204template<class T>
    205 T const& LocalMap<T>::PixVal(int_4 k) const
     205T const& LocalMap<T>::PixVal(int k) const
    206206//
    207207//    Retourne la valeur du contenu du pixel d'indice k
     
    220220//++
    221221template<class T>
    222 int_4 LocalMap<T>::PixIndexSph(float theta, float phi) const
     222int LocalMap<T>::PixIndexSph(double theta,double phi) const
    223223//
    224224//    Retourne l'indice du pixel vers lequel pointe une direction définie par
     
    234234
    235235  // theta et phi en coordonnees relatives (on se ramene a une situation par rapport au plan de reference)
    236   float theta_aux=theta;
    237   float phi_aux=phi;
     236  double theta_aux= theta;
     237  double phi_aux  = phi;
    238238  UserToReference(theta_aux, phi_aux);
    239239
    240240  // coordonnees dans le plan local en unites de pixels
    241   float x,y;
    242   AngleProjToPix(theta_aux, phi_aux, x, y);
    243 
    244   float xmin= -x0_-0.5;
    245   float xmax= xmin+nSzX_;
    246   if((x >  xmax) || (x < xmin)) return(-1);
    247   float xcurrent= xmin;
     241  double x,y;
     242  AngleProjToPix(theta_aux,phi_aux, x, y);
     243
     244  double xmin= -x0_-0.5;
     245  double xmax= xmin+nSzX_;
     246  if((x > xmax) || (x < xmin)) return(-1);
     247  double xcurrent= xmin;
    248248  for(i = 0; i < nSzX_; i++ )
    249249    {
     
    251251      if( x < xcurrent ) break;
    252252    }
    253   float ymin= -y0_-0.5;
    254   float ymax= ymin+nSzY_;
     253  double ymin= -y0_-0.5;
     254  double ymax= ymin+nSzY_;
    255255  if((y >  ymax) || (y < ymin)) return(-1);
    256   float ycurrent= ymin;
     256  double ycurrent= ymin;
    257257  for(j = 0; j < nSzY_; j++ )
    258258    {
     
    265265//++
    266266template<class T>
    267 void LocalMap<T>::PixThetaPhi(int_4 k, float& theta, float& phi) const
     267void LocalMap<T>::PixThetaPhi(int k,double& theta,double& phi) const
    268268//
    269269//    Retourne les coordonnées (theta,phi) du milieu du pixel d'indice k
     
    279279  Getij(k,i,j);
    280280
    281   float X= float(i-x0_);
    282   float Y= float(j-y0_);
     281  double X= double(i-x0_);
     282  double Y= double(j-y0_);
    283283  // situation de ce pixel dans le plan de reference
    284   float x= X*cos_angle_-Y*sin_angle_;
    285   float y= X*sin_angle_+Y* cos_angle_;
     284  double x= X*cos_angle_-Y*sin_angle_;
     285  double y= X*sin_angle_+Y* cos_angle_;
    286286  // projection sur la sphere
    287287  PixProjToAngle(x, y, theta, phi);
     
    292292//++
    293293template<class T>
    294 r_8 LocalMap<T>::PixSolAngle(int_4 k) const
     294double LocalMap<T>::PixSolAngle(int k) const
    295295//
    296296// Pixel Solid angle  (steradians)
     
    301301  int i,j;
    302302  Getij(k,i,j);
    303   float X= float(i-x0_);
    304   float Y= float(j-y0_);
    305   float XR= X+float(i)*0.5;
    306   float XL= X-float(i)*0.5;
    307   float YU= Y+float(j)*0.5;
    308   float YL= Y-float(j)*0.5;
     303  double X= double(i-x0_);
     304  double Y= double(j-y0_);
     305  double XR= X+double(i)*0.5;
     306  double XL= X-double(i)*0.5;
     307  double YU= Y+double(j)*0.5;
     308  double YL= Y-double(j)*0.5;
     309
    309310  // situation  dans le plan de reference
    310   float x0= XL*cos_angle_-YL*sin_angle_;
    311   float y0= XL*sin_angle_+YL*cos_angle_;
    312   float xa= XR*cos_angle_-YL*sin_angle_;
    313   float ya= XR*sin_angle_+YL*cos_angle_;
    314   float xb= XL*cos_angle_-YU*sin_angle_;
    315   float yb= XL*sin_angle_+YU*cos_angle_;
     311  double x0= XL*cos_angle_-YL*sin_angle_;
     312  double y0= XL*sin_angle_+YL*cos_angle_;
     313  double xa= XR*cos_angle_-YL*sin_angle_;
     314  double ya= XR*sin_angle_+YL*cos_angle_;
     315  double xb= XL*cos_angle_-YU*sin_angle_;
     316  double yb= XL*sin_angle_+YU*cos_angle_;
     317
    316318  // projection sur la sphere
    317   float tet0,phi0,teta,phia,tetb,phib;
    318   PixProjToAngle(x0, y0, tet0, phi0);
    319   PixProjToAngle(xa, ya, teta, phia);
    320   PixProjToAngle(xb, yb, tetb, phib);
     319  double thet0,phi0,theta,phia,thetb,phib;
     320  PixProjToAngle(x0, y0, thet0, phi0);
     321  PixProjToAngle(xa, ya, theta, phia);
     322  PixProjToAngle(xb, yb, thetb, phib);
     323
    321324  // angle solide
    322   float sol= fabs((xa-x0)*(yb-y0)-(xb-x0)*(ya-y0));
    323   return r_8(sol);
    324 }
    325 
    326 //++
    327 template<class T>
    328 void  LocalMap<T>::SetOrigin(float theta0, float phi0, float angle)
     325  double sol= fabs((xa-x0)*(yb-y0)-(xb-x0)*(ya-y0));
     326  return sol;
     327}
     328
     329//++
     330template<class T>
     331void LocalMap<T>::SetOrigin(double theta0,double phi0,double angle)
    329332//
    330333// Fixe la repere de reference ( angles en degres)
    331334//--
    332335{
    333   theta0_= (double)theta0;
    334   phi0_  = (double)phi0;
    335   angle_ = (double)angle;
     336  theta0_= theta0;
     337  phi0_  = phi0;
     338  angle_ = angle;
    336339  x0_= nSzX_/2;
    337340  y0_= nSzY_/2;
    338   cos_angle_= cosdf(angle);
    339   sin_angle_= sindf(angle);
     341  cos_angle_= cos(angle*Pi/180.);
     342  sin_angle_= sin(angle*Pi/180.);
    340343  originFlag_= true;
    341344  cout << " LocalMap:: set origin 1 done" << endl;
     
    344347//++
    345348template<class T>
    346 void  LocalMap<T>::SetOrigin(float theta0, float phi0, int_4 x0, int_4 y0, float angle)
     349void LocalMap<T>::SetOrigin(double theta0,double phi0,int x0,int y0,double angle)
    347350//
    348351// Fixe le repere de reference (angles en degres) 
    349352//--
    350353{
    351   theta0_= (double)theta0;
    352   phi0_  = (double)phi0;
    353   angle_ = (double)angle;
     354  theta0_= theta0;
     355  phi0_  = phi0;
     356  angle_ = angle;
    354357  x0_= x0;
    355358  y0_= y0;
    356   cos_angle_= cosdf(angle);
    357   sin_angle_= sindf(angle);
     359  cos_angle_= cos(angle*Pi/180.);
     360  sin_angle_= sin(angle*Pi/180.);
    358361  originFlag_= true;
    359362  cout << " LocalMap:: set origin 2 done" << endl;
     
    362365//++
    363366template<class T>
    364 void LocalMap<T>::SetSize(float angleX, float angleY)
     367void LocalMap<T>::SetSize(double angleX,double angleY)
    365368//
    366369// Fixe l'extension de la carte (angles en degres)
    367370//--
    368371{
    369   angleX_= (double)angleX;
    370   angleY_= (double)angleY;
    371 
    372   //tgAngleX_= T(tan(angleX*Pi/360.));
    373   //tgAngleY_= T(tan(angleY*Pi/360.));
    374 
     372  angleX_= angleX;
     373  angleY_= angleY;
    375374
    376375  // tangente de la moitie de l'ouverture angulaire totale
    377   tgAngleX_= tand(0.5*angleX_);
    378   tgAngleY_= tand(0.5*angleY_);
     376  tgAngleX_= tan(0.5*angleX_*Pi/180.);
     377  tgAngleY_= tan(0.5*angleY_*Pi/180.);
    379378
    380379  extensFlag_= true;
     
    391390  for(int m = 0; m < nPix_; m++)
    392391    {
    393       float theta,phi;
     392      double theta,phi;
    394393      PixThetaPhi(m,theta,phi);
    395394      sphere(theta,phi)= pixels_(m);
     
    400399//++
    401400template<class T>
    402 void LocalMap<T>::Getij(int k, int& i, int& j) const
     401void LocalMap<T>::Getij(int k,int& i,int& j) const
    403402//
    404403//--
     
    411410//++
    412411template<class T>
    413 void  LocalMap<T>::ReferenceToUser(float &theta, float &phi) const
     412void  LocalMap<T>::ReferenceToUser(double& theta,double& phi) const
    414413//
    415414// --     
    416415{
    417   if(theta > (r_4)Pi || theta < 0.  || phi < 0. || phi >= 2*(r_4)Pi)
    418     {
    419       //cout << " LocalMap::ReferenceToUser : exceptions  a mettre en place" <<endl;
    420       //    THROW(out_of_range("LocalMap::PIxVal Pixel index out of range"));
     416  if(theta > Pi || theta < 0. || phi < 0. || phi >= 2*Pi)
     417    {
    421418      throw "LocalMap::ReferenceToUser (theta,phi) out of range";
    422419    }
    423420
    424   //cout << " ReferenceToUser entree, t= " << theta << " phi= " << phi << endl;
    425   theta= (r_4)theta0_*Pi/180.+theta-(r_4)Pi*0.5;
     421  theta= theta0_*Pi/180.+theta-Pi*0.5;
    426422  if(theta < 0.)
    427423    {
    428424      theta= -theta;
    429       phi += (r_4)Pi;
     425      phi += Pi;
    430426    }
    431427  else
    432428    {
    433       if(theta > (r_4)Pi)
     429      if(theta > Pi)
    434430        {
    435           theta= 2.*(r_4)Pi-theta;
    436           phi += (r_4)Pi;
     431          theta= 2.*Pi-theta;
     432          phi += Pi;
    437433        }
    438434    }
    439435
    440   phi= (r_4)phi0_*Pi/180.+phi;
    441   while(phi >= 2.*(r_4)Pi) phi-=2.*(r_4)Pi;
    442 
    443   if(theta > (r_4)Pi || theta < 0.  || phi < 0. || phi >= 2*(r_4)Pi)
     436  phi= phi0_*Pi/180.+phi;
     437  while(phi >= 2.*Pi) phi-= 2.*Pi;
     438
     439  if(theta > Pi || theta < 0. || phi < 0. || phi >= 2*Pi)
    444440    {
    445441      cout <<  " LocalMap::ReferenceToUser : erreur bizarre dans le transfert a la carte utilisateur " << endl;
     
    447443      exit(0);
    448444    }
    449   //cout << " ReferenceToUser sortie, t= " << theta << " phi= " << phi << endl;
    450 }
    451 
    452 //++
    453 template<class T>
    454 void  LocalMap<T>::UserToReference(float &theta, float &phi) const
     445}
     446
     447//++
     448template<class T>
     449void  LocalMap<T>::UserToReference(double& theta,double& phi) const
    455450//
    456451// --     
    457452{
    458   if(theta > (r_4)Pi || theta < 0.  || phi<0. || phi >= 2*(r_4)Pi )
    459     {
    460       cout << " LocalMap::UserToReference : exceptions a mettre en place" <<endl;
    461       //    THROW(out_of_range("LocalMap::PIxVal Pixel index out of range"));
     453  if(theta > Pi || theta < 0. || phi < 0. || phi >= 2*Pi)
     454    {
     455      cout<<" LocalMap::UserToReference: exceptions a mettre en place" <<endl;
     456      // THROW(out_of_range("LocalMap::PIxVal Pixel index out of range"));
    462457      throw "LocalMap::UserToReference (theta,phi) out of range";
    463458    }
    464459
    465   float phi1=phi-(r_4)phi0_*Pi/180.;
    466   if(phi1 < 0.) phi1+=2.*(r_4)Pi;
    467 
    468   float theta1= theta-(r_4)theta0_*Pi/180.+(r_4)Pi*0.5;
     460  double phi1= phi-phi0_*Pi/180.;
     461  if(phi1 < 0.) phi1+= 2.*Pi;
     462
     463  double theta1= theta-theta0_*Pi/180.+Pi*0.5;
    469464  if(theta1 < 0.)
    470465    {
    471466      theta= -theta1;
    472       phi1+= (r_4)Pi;
     467      phi1+= Pi;
    473468    }
    474469  else
    475470    {
    476       if(theta1 > (r_4)Pi)
     471      if(theta1 > Pi)
    477472        {
    478           theta= 2.*(r_4)Pi-theta1;
    479           phi1+= (r_4)Pi;
     473          theta= 2.*Pi-theta1;
     474          phi1+= Pi;
    480475        }
    481476    }
    482477
    483   while(phi1 >= 2.*(r_4)Pi) phi1-=2.*(r_4)Pi;
     478  while(phi1 >= 2.*Pi) phi1-= 2.*Pi;
    484479  phi= phi1;
    485   if(theta > (r_4)Pi || theta < 0.  || phi < 0. || phi >= 2*(r_4)Pi )
     480  if(theta > Pi || theta < 0. || phi < 0. || phi >= 2*Pi)
    486481    {
    487482      cout <<  " LocalMap::UserToReference : erreur bizarre dans le transfert a la carte de reference " << endl;
     
    493488//++
    494489template<class T>
    495 void LocalMap<T>::PixProjToAngle(float x, float y, float& theta, float& phi) const
    496 //
    497 // (x,y) representent les coordonnees en unites de pixels d'un point DANS  LE PLAN DE REFERENCE.
     490void LocalMap<T>::PixProjToAngle(double x,double y,double& theta,double& phi) const
     491//
     492// (x,y) representent les coordonnees en unites de pixels d'un point DANS LE PLAN DE REFERENCE.
    498493// On recupere (theta,phi) par rapport au repere "absolu" theta=pi/2 et phi=0.
    499494//--
    500495{
    501   theta= (r_4)Pi*0.5-atan(2*y*tgAngleY_/(float)nSzY_);
    502   phi= atan2(2*x*tgAngleX_,(float)nSzX_);
     496  theta= Pi*0.5-atan(2.*y*tgAngleY_/(double)nSzY_);
     497  phi= atan2(2.*x*tgAngleX_,(double)nSzX_);
    503498  if(phi < 0.) phi += DeuxPi;
    504499}
     
    506501//++
    507502template<class T>
    508 void LocalMap<T>::AngleProjToPix(float theta, float phi, float& x, float& y) const
     503void LocalMap<T>::AngleProjToPix(double theta,double phi,double& x,double& y) const
    509504//
    510505// (theta,phi) par rapport au repere "absolu" theta=pi/2,phi=0. On recupere
     
    512507//--
    513508{
    514   if(phi >= (r_4)Pi) phi-= DeuxPi;
     509  if(phi >= Pi) phi-= DeuxPi;
    515510  //  y=0.5*mSzY_*cot(theta)/tgAngleY_;  $CHECK-REZA-04/99$
    516511  y= 0.5*nSzY_/tan(theta)/tgAngleY_;  // ? cot = 1/tan ? 
     
    606601    }
    607602
    608   int_4 nSzX;
     603  int nSzX;
    609604  is.GetI4(nSzX);
    610605  dobj->setSize_x(nSzX);
    611606
    612   int_4 nSzY;
     607  int nSzY;
    613608  is.GetI4(nSzY);
    614609  dobj->setSize_y(nSzY);
    615610
    616   int_4 nPix;
     611  int nPix;
    617612  is.GetI4(nPix);
    618613  dobj->setNbPixels(nPix);
     
    624619    {
    625620      cout<<" ReadSelf:: local mapping"<<endl;
    626       int_4 x0, y0;
    627       float theta, phi, angle;
     621      int x0, y0;
     622      double theta, phi, angle;
    628623      is.GetI4(x0);
    629624      is.GetI4(y0);
    630       is.GetR4(theta);
    631       is.GetR4(phi);
    632       is.GetR4(angle);
     625      is.GetR8(theta);
     626      is.GetR8(phi);
     627      is.GetR8(angle);
    633628      dobj->SetOrigin(theta, phi, x0, y0, angle);
    634629
    635       float angleX, angleY;
    636       is.GetR4(angleX);
    637       is.GetR4(angleY);
     630      double angleX, angleY;
     631      is.GetR8(angleX);
     632      is.GetR8(angleY);
    638633      dobj->SetSize(angleX, angleY);
    639634    }
     
    657652
    658653  char strg[256];
    659   int_4 nSzX= dobj->Size_x();
    660   int_4 nSzY= dobj->Size_y();
    661   int_4 nPix= dobj->NbPixels();
     654  int nSzX= dobj->Size_x();
     655  int nSzY= dobj->Size_y();
     656  int nPix= dobj->NbPixels();
    662657 
    663658  if(dobj->ptrInfo())
     
    681676      string ss("local mapping is done");
    682677      os.PutStr(ss);
    683       int_4 x0, y0;
    684       float theta, phi, angle;
     678      int x0, y0;
     679      double theta, phi, angle;
    685680      dobj->Origin(theta, phi, x0, y0, angle);
    686681      os.PutI4(x0);
    687682      os.PutI4(y0);
    688       os.PutR4(theta);
    689       os.PutR4(phi);
    690       os.PutR4(angle);
    691 
    692       float angleX, angleY;
     683      os.PutR8(theta);
     684      os.PutR8(phi);
     685      os.PutR8(angle);
     686
     687      double angleX, angleY;
    693688      dobj->Aperture(angleX, angleY);
    694       os.PutR4(angleX);
    695       os.PutR4(angleY);
     689      os.PutR8(angleX);
     690      os.PutR8(angleY);
    696691    }
    697692  else
  • trunk/SophyaLib/Samba/localmap.h

    r470 r473  
    4242
    4343LocalMap();
    44 LocalMap(int_4 nx, int_4 ny);
     44LocalMap(int nx, int ny);
    4545LocalMap(const LocalMap<T>& lm);
    4646virtual ~LocalMap();
     
    4848// ---------- Overloading of () to access pixel number k ----
    4949
    50 inline T& operator()(int_4 k) {return(PixVal(k));}
    51 inline T const& operator()(int_4 k) const {return(PixVal(k));}
     50inline T& operator()(int k) {return(PixVal(k));}
     51inline T const& operator()(int k) const {return(PixVal(k));}
    5252inline T& operator()(int ix, int iy) {return PixVal(iy*nSzX_+ix);};
    5353inline T const& operator()(int ix, int iy) const {return PixVal(iy*nSzX_+ix);};
     
    5656
    5757/* return/set the number of pixels */
    58 virtual int_4 NbPixels() const;
    59 inline void setNbPixels(int_4 n) {nPix_= n;}
     58virtual int NbPixels() const;
     59inline void setNbPixels(int n) {nPix_= n;}
    6060 
    6161/* return the value of pixel number k */
    62 virtual T& PixVal(int_4 k);
    63 virtual T const& PixVal(int_4 k) const;
     62virtual T& PixVal(int k);
     63virtual T const& PixVal(int k) const;
    6464
    6565/* return the index of pixel at (theta,phi) */
    66 virtual int_4 PixIndexSph(float theta, float phi) const;
     66virtual int PixIndexSph(double theta,double phi) const;
    6767   
    6868/* return the spherical coordinates of center of pixel number k */
    69 virtual void PixThetaPhi(int_4 k, float& theta, float& phi) const;
     69virtual void PixThetaPhi(int k,double& theta,double& phi) const;
    7070
    7171/* return the Pixel Solid angle  (steradians) */
    72 virtual r_8 PixSolAngle(int_4 k) const;
     72virtual double PixSolAngle(int k) const;
    7373
    7474// ---------- Specific methods ------------------------------
    7575
    76 void ReSize(int_4 nx, int_4 ny);
     76void ReSize(int nx, int ny);
    7777
    7878inline virtual char* TypeOfMap() const {return "LOCAL";};
    7979 
    8080/* Origin (with angle between x axis and phi axis, in degrees)  x0,y0  the default: middle of map*/
    81 virtual void SetOrigin(float theta=90., float phi=0., float angle=0.);
    82 virtual void SetOrigin(float theta,float phi,int_4 x0,int_4 y0,float angle=0.);
     81virtual void SetOrigin(double theta=90.,double phi=0.,double angle=0.);
     82virtual void SetOrigin(double theta,double phi,int x0,int y0,double angle=0.);
    8383
    8484/* Pixel size (degres) */
    85 virtual void SetSize(float angleX, float angleY);
     85virtual void SetSize(double angleX,double angleY);
    8686
    8787/* Check to see if the local mapping is done */
     
    9595 
    9696/* provides a integer characterizing the pixelization refinement  (here : number of pixels) */
    97 inline virtual int_4 SizeIndex() const {return(nPix_);}
    98 inline int_4 Size_x() const {return nSzX_;}
    99 inline void setSize_x(int_4 n) {nSzX_= n;}
    100 inline int_4 Size_y() const {return nSzY_;}
    101 inline void setSize_y(int_4 n) {nSzY_= n;}
     97inline virtual int SizeIndex() const {return(nPix_);}
     98inline int Size_x() const {return nSzX_;}
     99inline void setSize_x(int n) {nSzX_= n;}
     100inline int Size_y() const {return nSzY_;}
     101inline void setSize_y(int n) {nSzY_= n;}
    102102
    103 inline void Origin(float& theta, float& phi,int& x0, int& y0, float& angle) const {theta= (float)theta0_; phi= (float)phi0_; x0= x0_; y0= y0_;angle= (float)angle_;}
     103inline void Origin(double& theta,double& phi,int& x0,int& y0,double& angle) const {theta= theta0_; phi= phi0_; x0= x0_; y0= y0_;angle= angle_;}
    104104
    105 inline void Aperture(float& anglex, float& angley) const {anglex= (float)angleX_; angley= (float)angleY_;}
     105inline void Aperture(double& anglex,double& angley) const {anglex= angleX_; angley= angleY_;}
    106106
    107107/* retourne le pointeur vers/remplit  le vecteur des contenus des pixels */
    108108inline const NDataBlock<T>* getDataBlock() const {return (&pixels_);}
    109 inline void setDataBlock(T* data, int_4 n) {pixels_.FillFrom(n,data);}
     109inline void setDataBlock(T* data, int n) {pixels_.FillFrom(n,data);}
    110110
    111111/* impression */
     
    117117
    118118void InitNul();
    119 void Getij(int k, int& i, int& j) const;
    120 void ReferenceToUser(float &theta, float &phi) const;
    121 void UserToReference(float &theta, float &phi) const;
    122 void PixProjToAngle(float x, float y,float &theta, float &phi) const;
    123 void AngleProjToPix(float theta, float phi, float& x, float& y) const;
     119void Getij(int k,int& i,int& j) const;
     120void ReferenceToUser(double& theta,double& phi) const;
     121void UserToReference(double& theta,double& phi) const;
     122void PixProjToAngle(double x,double y,double& theta,double& phi) const;
     123void AngleProjToPix(double theta,double phi,double& x,double& y) const;
    124124
    125125// ---------- Variables internes ----------------------------
    126126
    127 int_4 nSzX_;
    128 int_4 nSzY_;
    129 int_4 nPix_;
     127int nSzX_;
     128int nSzY_;
     129int nPix_;
    130130bool originFlag_;
    131131bool extensFlag_;
    132 int_4 x0_;
    133 int_4 y0_;
    134 r_8 theta0_;
    135 r_8 phi0_;
    136 r_8 angle_;
    137 r_4 cos_angle_;
    138 r_4 sin_angle_;
    139 r_8 angleX_;
    140 r_8 angleY_;
    141 r_8 tgAngleX_;
    142 r_8 tgAngleY_;
     132int x0_;
     133int y0_;
     134double theta0_;
     135double phi0_;
     136double angle_;
     137double cos_angle_;
     138double sin_angle_;
     139double angleX_;
     140double angleY_;
     141double tgAngleX_;
     142double tgAngleY_;
    143143NDataBlock<T> pixels_;
    144144};
  • trunk/SophyaLib/Samba/pixelmap.h

    r470 r473  
    2525 
    2626// Number of pixels
    27 virtual int_4 NbPixels() const=0;
     27virtual int NbPixels() const=0;
    2828   
    2929// Value of pixel number k
    30 virtual T& PixVal(int_4 k)=0;
    31 virtual T const& PixVal(int_4 k) const=0;
     30virtual T& PixVal(int k)=0;
     31virtual T const& PixVal(int k) const=0;
    3232   
    3333// Index of pixel at (theta,phi)
    34 virtual int_4 PixIndexSph(float theta, float phi) const=0;
     34virtual int PixIndexSph(double theta, double phi) const=0;
    3535
    3636// Value of pixel number at (theta,phi)
    37 virtual T& PixValSph(float theta, float phi)
     37virtual T& PixValSph(double theta, double phi)
    3838                           {return PixVal(PixIndexSph(theta,phi));}
    39 virtual T const& PixValSph(float theta, float phi) const
     39virtual T const& PixValSph(double theta, double phi) const
    4040                           {return PixVal(PixIndexSph(theta,phi));}
    4141
    4242// Spherical coordinates of center of pixel number k
    43 virtual void PixThetaPhi(int_4 k, float& theta, float& phi) const=0;
     43virtual void PixThetaPhi(int k, double& theta, double& phi) const=0;
    4444
    4545// provides a integer characterizing the pixelization refinement
    4646// (depending of the type of the map)             
    47 virtual int_4 SizeIndex() const=0;
     47virtual int SizeIndex() const=0;
    4848virtual char* TypeOfMap() const =0;
    4949
    5050// Pixel  (steradians)
    51 virtual r_8 PixSolAngle(int_4 k) const =0;
     51virtual double PixSolAngle(int k) const =0;
    5252
    5353// Overloading of () to access pixel number k.
    54 inline T& operator()(int_4 k) {return(PixVal(k));}
    55 inline T const& operator()(int_4 k) const {return(PixVal(k));}
     54inline T& operator()(int k) {return(PixVal(k));}
     55inline T const& operator()(int k) const {return(PixVal(k));}
    5656
    57 // Note : no overloading of (float,float) to access pixel (theta,phi).
    58 // overloading of (float,float) in SphericalMap
     57// Note : no overloading of (double,double) to access pixel (theta,phi).
     58// overloading of (double,double) in SphericalMap
    5959// overloading of (int,int)     in CartesianMap
    6060
  • trunk/SophyaLib/Samba/spheregorski.cc

    r470 r473  
    1 //
    21#include "spheregorski.h"
    32#include "strutil.h"
     
    1413extern "C"
    1514{
    16 void anafast_(int&, int&, int&,double&,float*,float*,float*,float*,float*,float*,float*);
    17 void synfast_(int&, int&, int&,int&, float&,float*,float*,float*,double*, double*,double*,double*,double*,float*);
     15void anafast_(int&,int&,int&,double&,float*,float*,float*,float*,float*,float*,float*);
     16void synfast_(int&,int&,int&,int&,float&,float*,float*,float*,double*,double*,double*,double*,double*,float*);
    1817}
    1918
    2019//*******************************************************************
    2120// Class PIXELS_XY
    22 //  Construction des tableaux necessaires a la traduction des indices RING en
    23 //  indices NESTED (ou l'inverse)
     21// Construction des tableaux necessaires a la traduction des indices RING en
     22// indices NESTED (ou l'inverse)
    2423//*******************************************************************
    2524
     
    5756    c     one breaks up the pixel number by even and odd bits
    5857    ==================================================
    59     */
     58  */
    6059  // tranlated from FORTRAN (Gorski) to C, by B. Revenu, revised Guy Le Meur
    6160  //  (16/12/98)
     
    101100    c     ix + iy in {0, 128**2 -1}
    102101    =================================================
    103     */
     102  */
    104103  // tranlated from FORTRAN (Gorski) to C, by B. Revenu, revised Guy Le Meur
    105104  //  (16/12/98)
     
    196195//++
    197196template<class T>
    198 SphereGorski<T>::SphereGorski(int_4 m)
     197SphereGorski<T>::SphereGorski(int m)
    199198
    200199//    Constructeur : m est la variable nside de l'algorithme de Gorski
     
    211210    }
    212211  // verifier que m est une puissance de deux
    213   int_4 x=m;
     212  int x= m;
    214213  while(x%2 == 0) x/=2;
    215214  if(x != 1)
     
    261260//++
    262261template<class T>
    263 void SphereGorski<T>::Resize(int_4 m)
     262void SphereGorski<T>::Resize(int m)
    264263
    265264//    m est la variable nside de l'algorithme de Gorski
     
    273272  }
    274273  // verifier que m est une puissance de deux
    275   int_4 x=m;
     274  int x= m;
    276275  while (x%2==0) x/=2;
    277276  if(x != 1)
     
    285284
    286285template<class T>
    287 void  SphereGorski<T>::Pixelize( int_4 m)
     286void  SphereGorski<T>::Pixelize( int m)
    288287
    289288//    prépare la pixelisation Gorski (m a la même signification
     
    294293{
    295294  // On memorise les arguments d'appel
    296   nSide_ = m; 
     295  nSide_= m; 
    297296
    298297  // Nombre total de pixels sur la sphere entiere
    299   nPix_=12*nSide_*nSide_;
     298  nPix_= 12*nSide_*nSide_;
    300299
    301300  // pour le moment les tableaux qui suivent seront ranges dans l'ordre
     
    310309
    311310  // solid angle per pixel   
    312   omeg_= 4*Pi/nPix_;
     311  omeg_= 4.0*Pi/nPix_;
    313312}
    314313
     
    335334//++
    336335template<class T>
    337 int_4 SphereGorski<T>::NbPixels() const
     336int SphereGorski<T>::NbPixels() const
    338337
    339338//    Retourne le nombre de pixels du découpage
     
    345344//++
    346345template<class T>
    347 int_4 SphereGorski<T>::NbThetaSlices() const
     346int SphereGorski<T>::NbThetaSlices() const
    348347
    349348//    Retourne le nombre de tranches en theta sur la sphere
    350349//--
    351350{
    352   return int_4(4*nSide_-1);
    353 }
    354 
    355 //++
    356 template<class T>
    357 void  SphereGorski<T>::GetThetaSlice(int_4 index, r_4& theta, TVector<float>& phi, TVector<T>& value) const
     351  return int(4*nSide_-1);
     352}
     353
     354//++
     355template<class T>
     356void SphereGorski<T>::GetThetaSlice(int index,double& theta,TVector<double>& phi,TVector<T>& value) const
    358357
    359358//    Retourne, pour la tranche en theta d'indice 'index' le theta
     
    372371    }
    373372
    374   int_4 iring= 0;
     373  int iring= 0;
    375374  int lring  = 0;
    376375  if(index < nSide_-1)
     
    393392  phi.ReSize(lring);
    394393  value.ReSize(lring);
    395   float TH=0.;
    396   float F =0.;
     394  double TH= 0.;
     395  double FI= 0.;
    397396  for(int kk = 0; kk < lring;kk++)
    398397    {
    399       PixThetaPhi(kk+iring,TH,F);
    400       phi(kk)= F;
     398      PixThetaPhi(kk+iring,TH,FI);
     399      phi(kk)= FI;
    401400      value(kk)= PixVal(kk+iring);
    402401    }
     
    407406//++
    408407template<class T>
    409 T& SphereGorski<T>::PixVal(int_4 k)
     408T& SphereGorski<T>::PixVal(int k)
    410409
    411410//    Retourne la valeur du contenu du pixel d'indice "RING" k
     
    424423//++
    425424template<class T>
    426 T const& SphereGorski<T>::PixVal(int_4 k) const
     425T const& SphereGorski<T>::PixVal(int k) const
    427426
    428427//    Retourne la valeur du contenu du pixel d'indice "RING" k
     
    440439//++
    441440template<class T>
    442 T& SphereGorski<T>::PixValNest(int_4 k)
     441T& SphereGorski<T>::PixValNest(int k)
    443442
    444443//    Retourne la valeur du contenu du pixel d'indice "NESTED" k
     
    456455
    457456template<class T>
    458 T const& SphereGorski<T>::PixValNest(int_4 k) const
     457T const& SphereGorski<T>::PixValNest(int k) const
    459458
    460459//    Retourne la valeur du contenu du pixel d'indice "NESTED" k
     
    467466      THROW(rangeCheckErr);
    468467  }
    469   int_4 pix= nest2ring(nSide_,k);
     468  int pix= nest2ring(nSide_,k);
    470469  return *(pixels_.Data()+pix);
    471470}
     
    474473//++
    475474template<class T>
    476 int_4 SphereGorski<T>::PixIndexSph(r_4 theta, r_4 phi) const
     475int SphereGorski<T>::PixIndexSph(double theta,double phi) const
    477476
    478477//    Retourne l'indice "RING" du pixel vers lequel pointe une direction
     
    480479//--
    481480{
    482   return ang2pix_ring(nSide_,double(theta),double(phi));
    483 }
    484 
    485 //++
    486 template<class T>
    487 int_4 SphereGorski<T>::PixIndexSphNest(r_4 theta, r_4 phi) const
     481  return ang2pix_ring(nSide_,theta,phi);
     482}
     483
     484//++
     485template<class T>
     486int SphereGorski<T>::PixIndexSphNest(double theta,double phi) const
    488487
    489488//    Retourne l'indice NESTED" du pixel vers lequel pointe une direction
     
    491490//--
    492491{
    493   return ang2pix_nest(nSide_,double(theta),double(phi));
     492  return ang2pix_nest(nSide_,theta,phi);
    494493}
    495494
     
    498497//++
    499498template<class T>
    500 void SphereGorski<T>::PixThetaPhi(int_4 k, r_4& teta, r_4& phi) const
    501 
    502 //    Retourne les coordonnées (teta,phi) du milieu du pixel d'indice "RING" k
    503 //--
    504 {
    505   double t;
    506   double p;
    507   pix2ang_ring(nSide_,k, t, p);
    508   teta= (r_4)t;
    509   phi = (r_4)p;
    510 }
    511 
    512 //++
    513 template<class T>
    514 r_8 SphereGorski<T>::PixSolAngle(int_4 dummy) const
     499void SphereGorski<T>::PixThetaPhi(int k,double& theta,double& phi) const
     500
     501//   Retourne les coordonnées (theta,phi) du milieu du pixel d'indice "RING" k
     502//--
     503{
     504  pix2ang_ring(nSide_,k,theta,phi);
     505}
     506
     507//++
     508template<class T>
     509double SphereGorski<T>::PixSolAngle(int dummy) const
    515510//    Pixel Solid angle  (steradians)
    516511//    All the pixels have the same solid angle. The dummy argument is
     
    524519//++
    525520template<class T>
    526 void SphereGorski<T>::PixThetaPhiNest(int_4 k, float& teta, float& phi) const
    527 
    528 //    Retourne les coordonnées (teta,phi) du milieu du pixel d'indice
     521void SphereGorski<T>::PixThetaPhiNest(int k,double& theta,double& phi) const
     522
     523//    Retourne les coordonnées (theta,phi) du milieu du pixel d'indice
    529524//    NESTED k
    530525//--
    531526{   
    532   double t;
    533   double p;
    534   pix2ang_nest(nSide_, k, t, p);
    535   teta= (r_4)t;
    536   phi = (r_4)p;
    537 }
    538 
    539 //++
    540 template<class T>
    541 int_4 SphereGorski<T>::NestToRing(int_4 k) const
     527  pix2ang_nest(nSide_,k,theta,phi);
     528}
     529
     530//++
     531template<class T>
     532int SphereGorski<T>::NestToRing(int k) const
    542533
    543534//    conversion d'index NESTD en un index RING
     
    550541//++
    551542template<class T>
    552 int_4 SphereGorski<T>::RingToNest(int_4 k) const
     543int SphereGorski<T>::RingToNest(int k) const
    553544//
    554545//    conversion d'index RING en un index NESTED
     
    687678
    688679template<class T>
    689 int SphereGorski<T>::nest2ring(int nside, int ipnest) const {
     680int SphereGorski<T>::nest2ring(int nside, int ipnest) const
     681{
    690682  /*
    691683    ====================================================
     
    694686    c     conversion from NESTED to RING pixel number
    695687    ====================================================
    696     */
     688  */
    697689  // tranlated from FORTRAN (Gorski) to C, by B. Revenu, revised Guy Le Meur
    698690  //  (16/12/98)
     
    776768    c     conversion from RING to NESTED pixel number
    777769    ==================================================
    778     */
     770  */
    779771  // tranlated from FORTRAN (Gorski) to C, by B. Revenu, revised Guy Le Meur
    780772  //  (16/12/98)
     
    884876    c     corresponding to angles theta and phi
    885877    c==================================================
    886     */
     878  */
    887879  // tranlated from FORTRAN (Gorski) to C, by B. Revenu, revised Guy Le Meur
    888880  //  (16/12/98)
     
    968960    c     for every resolution
    969961    ==================================================
    970     */
     962  */
    971963  // tranlated from FORTRAN (Gorski) to C, by B. Revenu, revised Guy Le Meur
    972964  //  (16/12/98)
     
    1004996    ifp = jp / ns_max;//  ! in {0,4}
    1005997    ifm = jm / ns_max;
    1006     if( ifp==ifm ) face_num = (int)fmod(ifp,4) + 4; //then          ! faces 4 to 7
     998    if( ifp==ifm ) face_num = (int)fmod(ifp,4) + 4; //then  ! faces 4 to 7
    1007999    else if( ifp<ifm ) face_num = (int)fmod(ifp,4); // (half-)faces 0 to 3
    10081000    else face_num = (int)fmod(ifm,4) + 8;//! (half-)faces 8 to 11
     
    10531045    c     for a parameter nside
    10541046    ===================================================
    1055     */
     1047  */
    10561048  // tranlated from FORTRAN (Gorski) to C, by B. Revenu, revised Guy Le Meur
    10571049  //  (16/12/98)
     
    11231115    c     for a parameter nside
    11241116    ==================================================
    1125     */
     1117  */
    11261118  // tranlated from FORTRAN (Gorski) to C, by B. Revenu, revised Guy Le Meur
    11271119  //  (16/12/98)
     
    12271219
    12281220template<class T>
    1229 void SphereGorski<T>::getParafast(int_4& nlmax,int_4& nmmax,int_4& iseed,float& fwhm,float& quadr,float& cut) const
     1221void SphereGorski<T>::getParafast(int& nlmax,int& nmmax,int& iseed,float& fwhm,float& quadr,float& cut) const
    12301222{
    12311223  nlmax= nlmax_;
     
    12381230
    12391231template<class T>
    1240 void SphereGorski<T>::setParafast(int_4 nlmax,int_4 nmmax,int_4 iseed,float fwhm,float quadr,float cut,char* filename)
     1232void SphereGorski<T>::setParafast(int nlmax,int nmmax,int iseed,float fwhm,float quadr,float cut,char* filename)
    12411233{
    12421234  nlmax_= nlmax;
     
    13481340    }
    13491341
    1350   int_4 nSide;
     1342  int nSide;
    13511343  is.GetI4(nSide);
    13521344  dobj->setSizeIndex(nSide);
    13531345
    1354   int_4 nPix;
     1346  int nPix;
    13551347  is.GetI4(nPix);
    13561348  dobj->setNbPixels(nPix);
    13571349
    1358   r_8 Omega;
     1350  double Omega;
    13591351  is.GetR8(Omega);
    13601352  dobj->setPixSolAngle(Omega);
     
    13651357  delete [] pixels;
    13661358
    1367   int_4 nlmax,nmmax,iseed;
     1359  int nlmax,nmmax,iseed;
    13681360  is.GetI4(nlmax);
    13691361  is.GetI4(nmmax);
     
    13931385
    13941386  char strg[256];
    1395   int_4 nSide= dobj->SizeIndex();
    1396   int_4 nPix = dobj->NbPixels();
     1387  int nSide= dobj->SizeIndex();
     1388  int nPix = dobj->NbPixels();
    13971389 
    13981390  if(dobj->ptrInfo())
     
    14141406  PIOSWriteArray(os,(dobj->getDataBlock())->Data(), nPix);
    14151407
    1416   int_4 nlmax,nmmax,iseed;
     1408  int nlmax,nmmax,iseed;
    14171409  float fwhm,quadr,cut;
    14181410  dobj->getParafast(nlmax,nmmax,iseed,fwhm,quadr,cut);
  • trunk/SophyaLib/Samba/spheregorski.h

    r470 r473  
    3232
    3333SphereGorski();
    34 SphereGorski(int_4 m);
     34SphereGorski(int m);
    3535SphereGorski(const SphereGorski<T>& s);
    3636virtual ~SphereGorski();
     
    3939
    4040/* Nombre de pixels du decoupage */
    41 virtual int_4 NbPixels() const;
    42 inline void setNbPixels(int_4 n) {nPix_= n;}
     41virtual int NbPixels() const;
     42inline void setNbPixels(int n) {nPix_= n;}
    4343
    4444/* Valeur du contenu du pixel d'indice "RING" k  */
    45 virtual T& PixVal(int_4 k);
    46 virtual T const& PixVal(int_4 k) const;
     45virtual T& PixVal(int k);
     46virtual T const& PixVal(int k) const;
    4747
    4848/* Nombre de tranches en theta */
    49 int_4 NbThetaSlices() const;
    50 void GetThetaSlice(int_4 index,r_4& theta,TVector<float>& phi,TVector<T>& value) const;
     49int NbThetaSlices() const;
     50void GetThetaSlice(int index,double& theta,TVector<double>& phi,TVector<T>& value) const;
    5151
    5252/* Indice "RING" du pixel vers lequel pointe une direction definie par
    5353ses  coordonnees spheriques */                                   
    54 virtual int_4 PixIndexSph(float theta, float phi) const;
     54virtual int PixIndexSph(double theta,double phi) const;
    5555
    5656/* Coordonnees spheriques du milieu du pixel d'indice "RING" k   */
    57 virtual void PixThetaPhi(int_4 k, float& teta, float& phi) const;
     57virtual void PixThetaPhi(int k,double& theta,double& phi) const;
    5858
    5959/* Pixel Solid angle  (steradians) */
    60 virtual r_8 PixSolAngle(int_4 dummy) const;
    61 inline void setPixSolAngle(r_8 x) {omeg_= x;}
     60virtual double PixSolAngle(int dummy) const;
     61inline void setPixSolAngle(double x) {omeg_= x;}
    6262
    6363// --------------- Specific methods
    6464
    65 virtual void Resize(int_4 m);
     65virtual void Resize(int m);
    6666
    6767inline virtual char* TypeOfMap() const {return "RING";};
    6868
    69 /* Valeur du contenu du pixel d'indice "NEST" k                                 */
    70 virtual T& PixValNest(int_4 k);
    71 virtual T const& PixValNest(int_4 k) const;
     69/* Valeur du contenu du pixel d'indice "NEST" k */
     70virtual T& PixValNest(int k);
     71virtual T const& PixValNest(int k) const;
    7272
    7373/* Indice "NEST" du pixel vers lequel pointe une direction definie par
    7474ses  coordonnees spheriques */                                   
    75 virtual int_4 PixIndexSphNest(float theta, float phi) const;
     75virtual int PixIndexSphNest(double theta,double phi) const;
    7676
    7777/* Coordonnees spheriques du milieu du pixel d'indice "NEST" k       */
    78 virtual void PixThetaPhiNest(int_4 k, float& teta, float& phi) const;
     78virtual void PixThetaPhiNest(int k,double& theta,double& phi) const;
    7979
    8080/* algorithme de pixelisation */
    81 void Pixelize(int_4);
     81void Pixelize(int);
    8282
    8383/* convertit index nested en ring  */
    84 int_4 NestToRing(int_4 ) const;
     84int NestToRing(int) const;
    8585
    8686/* convertit index ring en nested" */
    87 int_4 RingToNest(int_4 ) const;
     87int RingToNest(int) const;
    8888
    89 /*    analyse en harmoniques spheriques des valeurs des pixels de la
     89/* analyse en harmoniques spheriques des valeurs des pixels de la
    9090   sphere : appel du module anafast (Gorski-Hivon) */
    9191//void anharm(int, float, float*);
     
    9797
    9898/* retourne/fixe la valeur du parametre Gorski */
    99 inline virtual int_4 SizeIndex() const {return(nSide_);}
    100 inline void setSizeIndex(int_4 n) {nSide_= n;}
     99inline virtual int SizeIndex() const {return(nSide_);}
     100inline void setSizeIndex(int n) {nSide_= n;}
    101101
    102102/* retourne les pointeurs /remplit les tableaux */
    103103inline const NDataBlock<T>* getDataBlock() const { return (&pixels_); }
    104 inline void setDataBlock(T* data, int_4 m) { pixels_.FillFrom(m,data); }
     104inline void setDataBlock(T* data,int m) { pixels_.FillFrom(m,data); }
    105105
    106106/* retourne/fixe les parametres des modules anafast et synfast */
    107 void getParafast(int_4& nlmax,int_4& nmmax,int_4& iseed,float& fwhm,float& quadr,float& cut) const;
    108 void setParafast(int_4 nlmax,int_4 nmmax,int_4 iseed,float fwhm,float quadr,float cut,char* filename);
     107void getParafast(int& nlmax,int& nmmax,int& iseed,float& fwhm,float& quadr,float& cut) const;
     108void setParafast(int nlmax,int nmmax,int iseed,float fwhm,float quadr,float cut,char* filename);
    109109
    110110/* retourne/fixe le nom du fichier qui contient le spectre de puissance */
     
    119119void InitNul();
    120120
    121 int  nest2ring(int nside, int ipnest) const;
    122 int  ring2nest(int nside, int ipring) const;
     121int  nest2ring(int nside,int ipnest) const;
     122int  ring2nest(int nside,int ipring) const;
    123123
    124 int  ang2pix_ring(int nside, double theta, double phi) const;
    125 int  ang2pix_nest(int nside, double theta, double phi) const;
    126 void pix2ang_ring(int nside, int ipix, double& theta,  double& phi) const;
    127 void pix2ang_nest(int nside, int ipix, double& theta, double& phi) const;
     124int  ang2pix_ring(int nside,double theta,double phi) const;
     125int  ang2pix_nest(int nside,double theta,double phi) const;
     126void pix2ang_ring(int nside,int ipix,double& theta,double& phi) const;
     127void pix2ang_nest(int nside,int ipix,double& theta,double& phi) const;
    128128
    129129// ------------- variables internes -----------------------
    130 int_4 nSide_;
    131 int_4 nPix_;
    132 r_8 omeg_;
     130int nSide_;
     131int nPix_;
     132double omeg_;
    133133
    134134NDataBlock<T> pixels_;
  • trunk/SophyaLib/Samba/spherethetaphi.cc

    r470 r473  
    8787//++
    8888template <class T>
    89 SphereThetaPhi<T>::SphereThetaPhi(int_4 m)
     89SphereThetaPhi<T>::SphereThetaPhi(int m)
    9090
    9191//    Constructeur : m est le nombre de bandes en theta sur un hémisphère
     
    105105  NTheta_= s.NTheta_;
    106106  NPix_  = s.NPix_;
    107   NPhi_  = new int_4[NTheta_];
    108   Theta_ = new r_4[NTheta_+1];
    109   TNphi_ = new int_4[NTheta_+1];
     107  NPhi_  = new int[NTheta_];
     108  Theta_ = new double[NTheta_+1];
     109  TNphi_ = new int[NTheta_+1];
    110110  for(int k = 0; k < NTheta_; k++)
    111111    {
     
    161161//++
    162162template <class T>
    163 void SphereThetaPhi<T>::Resize(int_4 m)
     163void SphereThetaPhi<T>::Resize(int m)
    164164//   re-pixelize the sphere
    165165//--
     
    172172//++
    173173template <class T>
    174 int_4 SphereThetaPhi<T>::NbPixels() const
     174int SphereThetaPhi<T>::NbPixels() const
    175175
    176176//    Retourne le nombre de pixels du découpage
     
    183183//++
    184184template <class T>
    185 T& SphereThetaPhi<T>::PixVal(int_4 k)
     185T& SphereThetaPhi<T>::PixVal(int k)
    186186
    187187//    Retourne la valeur du contenu du pixel d'indice k
     
    190190  if((k < 0) || (k >= NPix_))
    191191    {
    192       //  THROW(out_of_range("SphereThetaPhi::PIxVal Pixel index out of range"));
     192      //THROW(out_of_range("SphereThetaPhi::PIxVal Pixel index out of range"));
     193      cout << " SphereThetaPhi::PIxVal : exceptions a mettre en place" <<endl;
     194      THROW(rangeCheckErr);
     195    }
     196  return pixels_(k);
     197}
     198
     199//++
     200template <class T>
     201T const& SphereThetaPhi<T>::PixVal(int k) const
     202
     203//    Retourne la valeur du contenu du pixel d'indice k
     204//--
     205{
     206  if((k < 0) || (k >= NPix_))
     207    {
    193208      cout << " SphereThetaPhi::PIxVal : exceptions  a mettre en place" <<endl;
    194       THROW(rangeCheckErr);
    195     }
    196   return pixels_(k);
    197 }
    198 
    199 //++
    200 template <class T>
    201 T const& SphereThetaPhi<T>::PixVal(int_4 k) const
    202 
    203 //    Retourne la valeur du contenu du pixel d'indice k
    204 //--
    205 {
    206   if((k < 0) || (k >= NPix_))
    207     {
    208       cout << " SphereThetaPhi::PIxVal : exceptions  a mettre en place" <<endl;
    209       //    THROW(out_of_range("SphereThetaPhi::PIxVal Pixel index out of range"));
     209      //THROW(out_of_range("SphereThetaPhi::PIxVal Pixel index out of range"));
    210210      throw "SphereThetaPhi::PIxVal Pixel index out of range";
    211211    }
     
    216216//++
    217217template <class T>
    218 int_4 SphereThetaPhi<T>::PixIndexSph(r_4 theta, r_4 phi) const
    219 
    220 //    Retourne l'indice du pixel vers lequel pointe une direction définie par
     218int SphereThetaPhi<T>::PixIndexSph(double theta, double phi) const
     219
     220//  Retourne l'indice du pixel vers lequel pointe une direction définie par
    221221//    ses coordonnées sphériques
    222222//--
    223223{
    224   r_4 dphi;
    225   int_4 i,j,k;
     224  double dphi;
     225  int i,j,k;
    226226  bool fgzn = false;
    227227
    228   if( (theta > (r_4)Pi) || (theta < 0. ) ) return(-1);
    229   if( (phi < 0.) || (phi > DeuxPi) ) return(-1);
    230   if( theta > (r_4)Pi*0.5)  { fgzn = true;  theta = Pi-theta; }
     228  if((theta > Pi) || (theta < 0.)) return(-1);
     229  if((phi < 0.) || (phi > DeuxPi)) return(-1);
     230  if(theta > Pi*0.5) {fgzn = true; theta = Pi-theta;}
    231231 
    232232  // La bande d'indice kt est limitée par les valeurs de theta contenues dans
     
    235235    if( theta < Theta_[i] ) break;
    236236 
    237   dphi= (r_4)DeuxPi/(r_4)NPhi_[i-1];
    238  
    239   if (fgzn)  k= NPix_-TNphi_[i]+(int_4)(phi/dphi);
    240   else k= TNphi_[i-1]+(int_4)(phi/dphi);
     237  dphi= DeuxPi/(double)NPhi_[i-1];
     238 
     239  if (fgzn)  k= NPix_-TNphi_[i]+(int)(phi/dphi);
     240  else k= TNphi_[i-1]+(int)(phi/dphi);
    241241  return(k);
    242242}
     
    245245//++
    246246template <class T>
    247 void SphereThetaPhi<T>::PixThetaPhi(int_4 k, r_4& theta, r_4& phi) const
     247void SphereThetaPhi<T>::PixThetaPhi(int k,double& theta,double& phi) const
    248248
    249249//    Retourne les coordonnées (theta,phi) du milieu du pixel d'indice k
    250250//--
    251251{
    252   int_4 i;
     252  int i;
    253253  bool fgzn = false;
    254254 
    255   if( (k < 0) || (k >= NPix_) ) {theta = -99999.; phi = -99999.; return; }
    256   if( k >= NPix_/2)  {fgzn = true;  k = NPix_-1-k; }
     255  if((k < 0) || (k >= NPix_)) {theta = -99999.; phi = -99999.; return; }
     256  if( k >= NPix_/2)  {fgzn = true; k = NPix_-1-k;}
    257257
    258258  // recupère l'indice i de la tranche qui contient le pixel k
     
    266266  // angle phi
    267267  k -= TNphi_[i];
    268   phi= (r_4)DeuxPi/(r_4)NPhi_[i]*(r_4)(k+.5);
     268  phi= DeuxPi/(double)NPhi_[i]*(double)(k+.5);
    269269  if (fgzn) phi= DeuxPi-phi;
    270270}
     
    272272//++
    273273template <class T>
    274 r_8  SphereThetaPhi<T>::PixSolAngle(int_4 dummy) const
     274double SphereThetaPhi<T>::PixSolAngle(int dummy) const
    275275
    276276//    Pixel Solid angle  (steradians)
     
    286286//++
    287287template <class T>
    288 void SphereThetaPhi<T>::Limits(int_4 k, r_4& tetMin, r_4& tetMax, r_4& phiMin, r_4& phiMax)
     288void SphereThetaPhi<T>::Limits(int k,double& tetMin,double& tetMax,double& phiMin,double& phiMax)
    289289
    290290//    Retourne les valeurs de theta et phi limitant le pixel d'indice k
    291291//--
    292292  {
    293   int_4 j;
    294   r_4 dphi;
     293  int j;
     294  double dphi;
    295295  bool fgzn= false;
    296296 
    297   if( (k< 0) || (k >= NPix_) ) {
     297  if((k < 0) || (k >= NPix_)) {
    298298    tetMin= -99999.;
    299299    phiMin= -99999.; 
     
    304304 
    305305  // si on se trouve dans l'hémisphère Sud
    306   if( k >= NPix_/2 ) {
     306  if(k >= NPix_/2) {
    307307    fgzn= true;
    308308    k= NPix_-1-k;
     
    312312  int i;
    313313  for( i=0; i< NTheta_; i++ )
    314     if( k< TNphi_[i+1] ) break;
     314    if(k < TNphi_[i+1]) break;
    315315 
    316316  // valeurs limites de theta dans l'hemisphere Nord
     
    328328  // indice j de discretisation ( phi= j*dphi )
    329329  j= k-TNphi_[i];
    330   dphi= (r_4)DeuxPi/(r_4)NPhi_[i];
     330  dphi= DeuxPi/(double)NPhi_[i];
    331331 
    332332  // valeurs limites de phi
    333   phiMin= dphi*(r_4)(j);
    334   phiMax= dphi*(r_4)(j+1);
     333  phiMin= dphi*(double)(j);
     334  phiMax= dphi*(double)(j+1);
    335335  return;
    336336}
     
    339339//++
    340340template <class T>
    341 int_4 SphereThetaPhi<T>::NbThetaSlices() const
     341int SphereThetaPhi<T>::NbThetaSlices() const
    342342
    343343//    Retourne le nombre de tranches en theta sur la sphere
    344344//--
    345345{
    346   int_4 nbslices;
     346  int nbslices;
    347347  nbslices= 2*NTheta_;
    348348  return(nbslices);
     
    352352//++
    353353template <class T>
    354 int_4 SphereThetaPhi<T>::NPhi(int_4 kt) const
     354int SphereThetaPhi<T>::NPhi(int kt) const
    355355
    356356//    Retourne le nombre de pixels en phi de la tranche kt
    357357//--
    358358{
    359   int_4 nbpix; 
     359  int nbpix; 
    360360  // verification
    361   if( (kt< 0) || (kt>= 2*NTheta_) ) return(-1);
     361  if((kt < 0) || (kt >= 2*NTheta_)) return(-1);
    362362 
    363363  // si on se trouve dans l'hemisphere Sud
    364   if( kt >= NTheta_ ) {
     364  if(kt >= NTheta_) {
    365365    kt= 2*NTheta_-1-kt;
    366366  }
     
    375375//++
    376376template <class T>
    377 void SphereThetaPhi<T>::Theta(int_4 kt,r_4& tetMin,r_4& tetMax)
     377void SphereThetaPhi<T>::Theta(int kt,double& tetMin,double& tetMax)
    378378
    379379//    Retourne les valeurs de theta limitant la tranche kt
     
    407407//++
    408408template <class T>
    409 void SphereThetaPhi<T>::Phi(int_4 kt,int_4 jp,r_4& phiMin,r_4& phiMax)
     409void SphereThetaPhi<T>::Phi(int kt,int jp,double& phiMin,double& phiMax)
    410410
    411411//    Retourne les valeurs de phi limitant le pixel jp de la tranche kt
     
    413413{
    414414  // verification
    415   if( (kt< 0) || (kt>= 2*NTheta_) ) {
     415  if((kt < 0) || (kt >= 2*NTheta_)) {
    416416    phiMin= -99999.;
    417417    phiMax= -99999.;
     
    420420 
    421421  // si on se trouve dans l'hemisphere Sud
    422   if( kt >= NTheta_ ) kt= 2*NTheta_-1-kt;
     422  if(kt >= NTheta_) kt= 2*NTheta_-1-kt;
    423423 
    424424  // verifie si la tranche kt contient au moins jp pixels
     
    429429  }
    430430 
    431   r_4 dphi= (r_4)DeuxPi/(r_4)NPhi_[kt];
    432   phiMin= dphi*(r_4)(jp);
    433   phiMax= dphi*(r_4)(jp+1);
     431  double dphi= DeuxPi/(double)NPhi_[kt];
     432  phiMin= dphi*(double)(jp);
     433  phiMax= dphi*(double)(jp+1);
    434434  return;
    435435}
     
    438438//++
    439439template <class T>
    440 int_4 SphereThetaPhi<T>::Index(int_4 kt,int_4 jp) const
     440int SphereThetaPhi<T>::Index(int kt,int jp) const
    441441
    442442//    Retourne l'indice du pixel d'indice jp dans la tranche kt
    443443//--
    444444{
    445   int_4 k;
     445  int k;
    446446  bool fgzn= false;
    447447 
    448448  // si on se trouve dans l'hemisphere Sud
    449   if( kt >= NTheta_ ) {
     449  if(kt >= NTheta_) {
    450450    fgzn= true;
    451451    kt= 2*NTheta_-1-kt;
     
    471471//++
    472472template <class T>
    473 void SphereThetaPhi<T>::ThetaPhiIndex(int_4 k,int_4& kt,int_4& jp)
     473void SphereThetaPhi<T>::ThetaPhiIndex(int k,int& kt,int& jp)
    474474
    475475//    Retourne les indices kt et jp du pixel d'indice k
     
    478478  bool fgzn= false; 
    479479  // si on se trouve dans l'hemisphere Sud
    480   if( k >= NPix_/2 ) {
    481     fgzn= true;
    482     k= NPix_-1-k;
    483   }
     480  if(k >= NPix_/2)
     481    {
     482      fgzn= true;
     483      k= NPix_-1-k;
     484    }
    484485 
    485486  // on recupere l'indice kt de la tranche qui contient le pixel k
    486487  int i;
    487   for( i=0; i< NTheta_; i++ )
    488     if( k< TNphi_[i+1] ) break;
     488  for(i = 0; i < NTheta_; i++)
     489    if(k < TNphi_[i+1]) break;
    489490 
    490491  // indice  kt de tranche
     
    494495  // indice jp de pixel
    495496  if (fgzn) jp= TNphi_[i+1]-k-1;
    496   else jp= k-TNphi_[i];
    497  
    498 }
    499 //++
    500 template <class T>
    501 void  SphereThetaPhi<T>::Pixelize( int_4 m)
     497  else jp= k-TNphi_[i]; 
     498}
     499//++
     500template <class T>
     501void  SphereThetaPhi<T>::Pixelize(int m)
    502502
    503503//    effectue le découpage en pixels (m et pet ont la même signification
     
    511511//--
    512512{
    513   int_4 ntotpix,i,j;
     513  int ntotpix,i,j;
    514514 
    515515  // Decodage et controle des arguments d'appel :
     
    524524  // Creation des vecteurs contenant :
    525525  // Les valeurs limites de theta (une valeur de plus que le nombre de bandes...)
    526   Theta_= new r_4[m+1];
     526  Theta_= new double[m+1];
    527527 
    528528  // Le nombre de pixels en phi de chacune des bandes en theta
    529   NPhi_ = new int_4[m];
     529  NPhi_ = new int[m];
    530530 
    531531  // Le nombre/Deuxpi total des pixels contenus dans les bandes de z superieur a une
    532532  // bande donnee (mTPphi[m] contient le nombre de pixels total de l'hemisphere)
    533   TNphi_= new int_4[m+1];
     533  TNphi_= new int[m+1];
    534534 
    535535  // Calcul du nombre total de pixels dans chaque bande pour optimiser
     
    544544    {
    545545      TNphi_[j]= TNphi_[j-1]+NPhi_[j-1];
    546       NPhi_[j] = (int_4)(.5+4.*(double)(m-.5)*sin(Pi*(double)j/(double)(2.*m-1.))) ;
     546      NPhi_[j] = (int)(.5+4.*(double)(m-.5)*sin(Pi*(double)j/(double)(2.*m-1.))) ;
    547547    }
    548548 
     
    576576//++
    577577template <class T>
    578 void  SphereThetaPhi<T>::GetThetaSlice(int_4 index, r_4& theta, TVector<float>& phi, TVector<T>& value) const
     578void SphereThetaPhi<T>::GetThetaSlice(int index,double& theta, TVector<double>& phi, TVector<T>& value) const
    579579
    580580//    Retourne, pour la tranche en theta d'indice 'index' le theta
     
    594594    }
    595595
    596   int_4 iring= Index(index,0);
    597   int_4 bid  = this->NPhi(index);
     596  int iring= Index(index,0);
     597  int bid  = this->NPhi(index);
    598598  int lring  = bid;
    599599  cout << " iring= " << iring << " lring= " << lring << endl;
     
    601601  phi.ReSize(lring);
    602602  value.ReSize(lring);
    603   float Te= 0.;
    604   float Fi= 0.;
     603  double Te= 0.;
     604  double Fi= 0.;
    605605  for(int kk = 0; kk < lring; kk++)
    606606    {
     
    613613
    614614template <class T>
    615 void SphereThetaPhi<T>::setmNPhi(int_4* array, int_4 m)
    616   //remplit  le tableau contenant le nombre de pixels en phi de chacune des bandes en theta
     615void SphereThetaPhi<T>::setmNPhi(int* array, int m)
     616  //remplit le tableau contenant le nombre de pixels en phi de chacune des bandes en theta
    617617  //--
    618618{
    619   NPhi_= new int_4[m];
     619  NPhi_= new int[m];
    620620  for(int k = 0; k < m; k++) NPhi_[k]= array[k];
    621621}
    622622
    623623template <class T>
    624 void SphereThetaPhi<T>::setmTNphi(int_4* array, int_4 m)
     624void SphereThetaPhi<T>::setmTNphi(int* array, int m)
    625625  //remplit  le tableau contenant le nombre/Deuxpi total des pixels contenus dans les bandes
    626626  //--
    627627{
    628   TNphi_= new int_4[m];
     628  TNphi_= new int[m];
    629629  for(int k = 0; k < m; k++) TNphi_[k]= array[k];
    630630}
    631631
    632632template <class T>
    633 void SphereThetaPhi<T>::setmTheta(r_4* array, int_4 m)
     633void SphereThetaPhi<T>::setmTheta(double* array, int m)
    634634  //remplit  le tableau contenant les valeurs limites de theta
    635635  //--
    636636{
    637   Theta_= new r_4[m];
     637  Theta_= new double[m];
    638638  for(int k = 0; k < m; k++) Theta_[k]= array[k];
    639639}
    640640
    641641template <class T>
    642 void SphereThetaPhi<T>::setDataBlock(T* data, int_4 m)
     642void SphereThetaPhi<T>::setDataBlock(T* data, int m)
    643643  // remplit  le vecteur des contenus des pixels
    644644{
     
    755755    }
    756756
    757   int_4 mNTheta;
     757  int mNTheta;
    758758  is.GetI4(mNTheta); 
    759759  dobj->setSizeIndex(mNTheta);
    760760
    761   int_4 mNPix;
     761  int mNPix;
    762762  is.GetI4(mNPix);
    763763  dobj->setNbPixels(mNPix);
    764764
    765   r_8 mOmeg;
     765  double mOmeg;
    766766  is.GetR8(mOmeg);
    767767  dobj->setPixSolAngle(mOmeg);
    768768
    769   int_4* mNphi= new int_4[mNTheta];
     769  int* mNphi= new int[mNTheta];
    770770  is.GetI4s(mNphi, mNTheta);
    771771  dobj->setmNPhi(mNphi, mNTheta);
    772772  delete [] mNphi;
    773773
    774   int_4* mTNphi= new int_4[mNTheta+1];
     774  int* mTNphi= new int[mNTheta+1];
    775775  is.GetI4s(mTNphi, mNTheta+1);
    776776  dobj->setmTNphi(mTNphi, mNTheta+1);
    777777  delete [] mTNphi;
    778778
    779   r_4* mTheta= new r_4[mNTheta+1];
    780   is.GetR4s(mTheta, mNTheta+1);
     779  double* mTheta= new double[mNTheta+1];
     780  is.GetR8s(mTheta, mNTheta+1);
    781781  dobj->setmTheta(mTheta, mNTheta+1);
    782782  delete [] mTheta;
    783783
    784784  T* mPixels= new T[mNPix];
    785   //is.Get(mPixels, mNPix);
    786785  PIOSReadArray(is, mPixels, mNPix);
    787786  dobj->setDataBlock(mPixels, mNPix);
     
    801800
    802801  char strg[256];
    803   int_4 mNTheta= dobj->SizeIndex();
    804   int_4 mNPix  = dobj->NbPixels();
     802  int mNTheta= dobj->SizeIndex();
     803  int mNPix  = dobj->NbPixels();
    805804 
    806805  if(dobj->ptrInfo())
     
    821820  os.PutI4s(dobj->getmNPhi() , mNTheta);
    822821  os.PutI4s(dobj->getmTNphi(), mNTheta+1);
    823   os.PutR4s(dobj->getmTheta(), mNTheta+1);
     822  os.PutR8s(dobj->getmTheta(), mNTheta+1);
    824823  //os.Put((dobj->getDataBlock())->Data(), mNPix);
    825824  PIOSWriteArray(os,(dobj->getDataBlock())->Data(), mNPix);
  • trunk/SophyaLib/Samba/spherethetaphi.h

    r470 r473  
    1818
    1919SphereThetaPhi();
    20 SphereThetaPhi(int_4 m);
     20SphereThetaPhi(int m);
    2121SphereThetaPhi(char* flnm);
    2222SphereThetaPhi(const SphereThetaPhi<T>& s);
     
    2626
    2727/* retourne/fixe le nombre de pixels */
    28 virtual int_4 NbPixels() const;
    29 inline void setNbPixels(int_4 nbpix) { NPix_= nbpix; }
     28virtual int NbPixels() const;
     29inline void setNbPixels(int nbpix) { NPix_= nbpix; }
    3030
    3131/* retourne la valeur du pixel d'indice k */
    32 virtual T&       PixVal(int_4 k);
    33 virtual T const& PixVal(int_4 k) const;
     32virtual T&       PixVal(int k);
     33virtual T const& PixVal(int k) const;
    3434
    3535/* retourne l'indice du pixel a (theta,phi) */
    36 virtual int_4 PixIndexSph(float theta, float phi) const;
     36virtual int PixIndexSph(double theta, double phi) const;
    3737
    3838/* retourne les coordonnees Spheriques du centre du pixel d'indice k */
    39 virtual void PixThetaPhi(int_4 k, float& theta, float& phi) const;
     39virtual void PixThetaPhi(int k, double& theta, double& phi) const;
    4040
    4141/* retourne/fixe l'angle Solide de Pixel   (steradians) */
    42 virtual r_8 PixSolAngle(int_4 dummy) const;
    43 inline void setPixSolAngle(r_8 omega) { Omega_= omega; }
     42virtual double PixSolAngle(int dummy) const;
     43inline void setPixSolAngle(double omega) { Omega_= omega; }
    4444 
    4545/* retourne/fixe la valeur du parametre de decoupage m */
    46 inline virtual int_4 SizeIndex() const { return( NTheta_); }
    47 inline void setSizeIndex(int_4 nbindex) { NTheta_= nbindex; }
     46inline virtual int SizeIndex() const { return( NTheta_); }
     47inline void setSizeIndex(int nbindex) { NTheta_= nbindex; }
    4848
    4949// ------------- Specific methods  ----------------------
    5050
    51 virtual void Resize(int_4 m);
     51virtual void Resize(int m);
    5252
    5353inline virtual char* TypeOfMap() const {return "TETAFI";};
    5454
    55 /* Valeurs de theta des paralleles et phi des meridiens limitant  le pixel d'indice k */
    56 virtual void Limits(int_4 k,float& tet1,float& tet2,float& phi1,float& phi2);
     55/* Valeurs de theta des paralleles et phi des meridiens limitant le pixel d'indice k */
     56virtual void Limits(int k,double& th1,double& th2,double& phi1,double& phi2);
    5757
    5858/* Nombre de tranches en theta */
    59 int_4 NbThetaSlices() const;
     59int NbThetaSlices() const;
    6060
    6161/* Nombre de pixels en phi de la tranche d'indice kt */
    62 int_4 NPhi(int_4 kt) const;
     62int NPhi(int kt) const;
    6363
    6464/* Renvoie dans t1,t2 les valeurs respectives de theta min et theta max  */
    6565/* de la tranche d'indice kt  */
    66 void Theta(int_4 kt, float& t1, float& t2);
     66void Theta(int kt, double& t1, double& t2);
    6767
    6868/* Renvoie dans p1,p2 les valeurs phimin et phimax du pixel d'indice jp  */
    6969/* dans la tranche d'indice kt  */
    70 void Phi(int_4 kt, int_4 jp, float& p1, float& p2);
     70void Phi(int kt, int jp, double& p1, double& p2);
    7171
    7272/* Renvoie l'indice k du pixel d'indice jp dans la tranche d'indice kt   */
    73 int_4 Index(int_4 kt, int_4 jp) const;
     73int Index(int kt, int jp) const;
    7474
    7575/* Indice kt de la tranche et indice jp du pixel d'indice k  */
    76 void ThetaPhiIndex(int_4 k,int_4& kt,int_4& jp);
     76void ThetaPhiIndex(int k,int& kt,int& jp);
    7777
    78 void Pixelize(int_4);
     78void Pixelize(int);
    7979
    80 void GetThetaSlice(int_4 index,r_4& theta,TVector<float>& phi,TVector<T>& value) const;
     80void GetThetaSlice(int index,double& theta,TVector<double>& phi,TVector<T>& value) const;
    8181
    8282/*retourne le tableau contenant le nombre de pixels en phi de chacune des bandes en theta */
    83 inline const int_4* getmNPhi() const { return(NPhi_); }
    84 void setmNPhi(int_4* array, int_4 m);
     83inline const int* getmNPhi() const { return(NPhi_); }
     84void setmNPhi(int* array, int m);
    8585
    8686/* retourne/remplit le tableau contenant le nombre/Deuxpi total des pixels contenus dans les bandes */
    87 inline const int_4* getmTNphi() const { return(TNphi_); }
    88 void setmTNphi(int_4* array, int_4 m);
     87inline const int* getmTNphi() const { return(TNphi_); }
     88void setmTNphi(int* array, int m);
    8989
    9090/* retourne/remplit le tableau contenant les valeurs limites de theta */
    91 inline const r_4* getmTheta() const { return(Theta_); }
    92 void setmTheta(r_4* array, int_4 m);
     91inline const double* getmTheta() const { return(Theta_); }
     92void setmTheta(double* array, int m);
    9393
    9494/* retourne le pointeur vers/remplit  le vecteur des contenus des pixels */
    9595inline const NDataBlock<T>* getDataBlock() const { return (&pixels_); }
    96 void setDataBlock(T* data, int_4 m);
     96void setDataBlock(T* data, int m);
    9797
    9898/* impression */
     
    106106
    107107// ------------- variables internes ---------------------
    108 int_4 NTheta_;
    109 int_4 NPix_;
    110 r_8 Omega_;
    111 int_4* NPhi_;
    112 int_4* TNphi_;
    113 r_4* Theta_;
     108int NTheta_;
     109int NPix_;
     110double Omega_;
     111int* NPhi_;
     112int* TNphi_;
     113double* Theta_;
    114114NDataBlock<T> pixels_;
    115115};
  • trunk/SophyaLib/Samba/sphericalmap.h

    r470 r473  
    2727
    2828// Overloading of () to access pixel number k.
    29 inline T& operator()(int_4 k) {return(PixVal(k));}
    30 inline T  const& operator()(int_4 k) const {return(PixVal(k));}
    31 inline T& operator()(float theta,float phi) {return(PixValSph(theta,phi));};
    32 inline T  const& operator()(float theta,float phi) const {return(PixValSph(theta,phi));};
     29inline T& operator()(int k) {return(PixVal(k));}
     30inline T  const& operator()(int k) const {return(PixVal(k));}
     31inline T& operator()(double theta,double phi) {return(PixValSph(theta,phi));};
     32inline T  const& operator()(double theta,double phi) const {return(PixValSph(theta,phi));};
    3333
    3434// index characterizing the size pixelization : m for SphereThetaPhi
    3535// nside for Gorski sphere...
    36 virtual void Resize(int_4 m)=0;
    37 virtual int_4 NbThetaSlices() const=0;
    38 virtual void GetThetaSlice(int_4 index, r_4& theta, TVector<float>& phi, TVector<T>& value) const=0;
     36virtual void Resize(int m)=0;
     37virtual int NbThetaSlices() const=0;
     38virtual void GetThetaSlice(int index,double& theta, TVector<double>& phi, TVector<T>& value) const=0;
    3939};
    4040#endif
Note: See TracChangeset for help on using the changeset viewer.