Changeset 2082 in Sophya


Ignore:
Timestamp:
Jul 3, 2002, 3:29:50 PM (23 years ago)
Author:
ansari
Message:

Modifs HEALPixUtils.cc concernant la transformation des fmod() en operateur % et les floor() en div entier, + instanciation ecriture spherehealpix et autres cartes en int_4 (PPF et FITS) - Reza 3/7/2002

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaExt/FitsIOServer/fitsspherehealpix.cc

    r1703 r2082  
    3737FITS_SphereHEALPix<T>::FITS_SphereHEALPix(const SphereHEALPix<T>& obj)
    3838{
    39    dobj_= new SphereHEALPix<T>(obj);
     39  dobj_= new SphereHEALPix<T>(obj);
    4040  ownobj_= true;
    4141}
     
    111111  string Type;
    112112  if (typeid(T) == typeid(r_8) ) Type+='D';
    113   else
    114     if (typeid(T) == typeid(r_4) )  Type+='E';
     113  else if (typeid(T) == typeid(r_4) )  Type+='E';
     114    else if (typeid(T) == typeid(int_4) )  Type+='J';
    115115    else
    116116      {
    117         cout <<  " type de la sphere= " <<  typeid(T).name() << endl;
    118         throw IOExc("FITS_SphereHEALPix:: unknown type");
     117        cout <<  "FITS_SphereHEALPix<T>::WriteToFits()- Unsupported data type ("
     118             <<  typeid(T).name() << ") throwing IOExc " << endl;
     119        throw IOExc("FITS_SphereHEALPix<T>::WriteToFits() unsupported data type");
    119120      }
    120121  vector<int> dummy;
  • trunk/SophyaExt/FitsIOServer/fitsspherethetaphi.cc

    r1752 r2082  
    111111  string Type;
    112112  if (typeid(T) == typeid(r_8) ) Type+='D';
    113   else
    114     if (typeid(T) == typeid(r_4) )  Type+='E';
     113  else if (typeid(T) == typeid(r_4) )  Type+='E';
     114  else if (typeid(T) == typeid(int_4) )  Type+='J';
    115115    else
    116116      {
    117         cout <<  " type de la sphere= " <<  typeid(T).name() << endl;
    118         throw IOExc("FITS_SphereThetaPhi:: unknown type");
     117        cout <<  "FITS_SphereThetaPhi<T>::WriteToFits - Unsupported data type ("
     118             <<  typeid(T).name() << ") throwing IOExc " << endl;
     119        throw IOExc("FITS_SphereThetaPhi<T>::WriteToFits() unsupported data type");
    119120      }
    120121
  • trunk/SophyaLib/SkyMap/HEALPixUtils.cc

    r1954 r2082  
    142142      else
    143143        {
    144           ID = (int)fmod(J,2);
     144          ID = J%2;  //RzModFloor (int)fmod(J,2);
    145145          J  = J/2;
    146146          K  = IP*ID+K;
     
    232232  if( jp<1 )   jp = jp + nl4;
    233233 
    234   int aux=n_before + jp - 1;
     234  //RzDel int aux=n_before + jp - 1;
    235235  return (n_before + jp - 1);// ! in {0, npix-1}
    236236}
     
    295295   
    296296    ip    = ipring1 - ncap - 1;
    297     irn   = (int)floor( ip / nl4 ) + nside;//               ! counted from North pole
    298     iphi  = (int)fmod(ip,nl4) + 1;
    299    
    300     kshift  = (int)fmod(irn+nside,2);//  ! 1 if irn+nside is odd, 0 otherwise
     297    irn   = ip / nl4 + nside; //RzModFloor (int)floor( ip / nl4 ) + nside;   ! counted from North pole
     298    iphi  = ip%nl4 + 1;  //RzModFloor (int)fmod(ip,nl4) + 1;
     299   
     300    kshift  = (irn+nside)%2; //RzModFloor (int)fmod(irn+nside,2);  ! 1 if irn+nside is odd, 0 otherwise
    301301    nr = nside;
    302302    ire =  irn - nside + 1;// ! in {1, 2*nside +1}
     
    305305    ifp = (iphi - irm/2 + nside -1) / nside;
    306306    if( ifp==ifm ) {//then          ! faces 4 to 7
    307       face_num = (int)fmod(ifp,4) + 4;
     307      face_num = ifp%4+4; // RzModFloor (int)fmod(ifp,4) + 4;
    308308    }
    309309    else if( ifp + 1==ifm ) {//then ! (half-)faces 0 to 3
     
    338338  iy = -(ipt + irt ) / 2;
    339339 
    340   ix_low = (int)fmod(ix,128);
     340  ix_low = ix%128; //RzModFloor (int)fmod(ix,128);
    341341  ix_hi  = ix/128;
    342   iy_low = (int)fmod(iy,128);
     342  iy_low = iy%128; //RzModFloor (int)fmod(iy,128);
    343343  iy_hi  = iy/128;
    344344  ipf=(PXY.x2pix_(ix_hi)+PXY.y2pix_(iy_hi))*(128*128)+(PXY.x2pix_(ix_low)+PXY.y2pix_(iy_low));
     
    397397    ir = nside + 1 + jp - jm;// ! in {1,2n+1} (ring number counted from z=2/3)
    398398    kshift = 0;
    399     if (fmod(ir,2)==0.) kshift = 1;// ! kshift=1 if ir even, 0 otherwise
    400    
    401     ip = (int)floor( ( jp+jm - nside + kshift + 1 ) / 2 ) + 1;// ! in {1,4n}
     399    //RzModFloor if (fmod(ir,2)==0.) kshift = 1; ! kshift=1 if ir even, 0 otherwise
     400    if ((ir%2)==0) kshift = 1;// ! kshift=1 if ir even, 0 otherwise
     401   
     402    //RzModFloor ip = (int)floor( ( jp+jm - nside + kshift + 1 ) / 2 ) + 1; ! in {1,4n}
     403    ip = ( jp+jm - nside + kshift + 1 )/2  + 1; 
    402404    if( ip>nl4 ) ip = ip - nl4;
    403405   
     
    477479    ifp = jp / ns_max;//  ! in {0,4}
    478480    ifm = jm / ns_max;
    479     if( ifp==ifm ) face_num = (int)fmod(ifp,4) + 4; //then  ! faces 4 to 7
    480     else if( ifp<ifm ) face_num = (int)fmod(ifp,4); // (half-)faces 0 to 3
    481     else face_num = (int)fmod(ifm,4) + 8;//! (half-)faces 8 to 11
    482    
    483     ix = (int)fmod(jm, ns_max);
    484     iy = ns_max - (int)fmod(jp, ns_max) - 1;
     481    if( ifp==ifm ) face_num = (ifp%4)+4; //RzModFloor (int)fmod(ifp,4) + 4; then  ! faces 4 to 7
     482    else if( ifp<ifm ) face_num = ifp%4; //RzModFloor (int)fmod(ifp,4); (half-)faces 0 to 3
     483    else face_num = (ifm%4) + 8; //RzModFloor (int)fmod(ifm,4) + 8;! (half-)faces 8 to 11
     484   
     485    ix = jm%ns_max; //RzModFloor (int)fmod(jm, ns_max);
     486    iy = ns_max - (jp%ns_max) - 1;//RzModFloor  ns_max - (int)fmod(jp, ns_max) - 1;
    485487  }
    486488  else { //! polar region, za > 2/3
     
    510512  }
    511513 
    512   ix_low = (int)fmod(ix,128);
     514  ix_low = (ix%128); //RzModFloor (int)fmod(ix,128);
    513515  ix_hi  =     ix/128;
    514   iy_low = (int)fmod(iy,128);
     516  iy_low = (iy%128); //RzModFloor ((int)fmod(iy,128);
    515517  iy_hi  =     iy/128;
    516518  ipf= (PXY.x2pix_(ix_hi)+PXY.y2pix_(iy_hi))*(128*128)+(PXY.x2pix_(ix_low)+PXY.y2pix_(iy_low));
     
    571573   
    572574    ip    = ipix1 - ncap - 1;
    573     iring = (int)floor( ip / nl4 ) + nside;// ! counted from North pole
     575    iring = ip/nl4  + nside; //RzModFloor (int)floor( ip / nl4 ) + nside; ! counted from North pole
    574576    iphi  = ip%nl4 + 1;
    575577   
     
    639641 
    640642  face_num = ipix/npface;//  ! face number in {0,11}
    641   ipf = (int)fmod(ipix,npface);//  ! pixel number in the face {0,npface-1}
     643  ipf = ipix%npface; //RzModFloor (int)fmod(ipix,npface);  ! pixel number in the face {0,npface-1}
    642644 
    643645  //c     finds the x,y on the face (starting from the lowest corner)
    644646  //c     from the pixel number
    645   ip_low = (int)fmod(ipf,1024);//       ! content of the last 10 bits
     647  ip_low = ipf%1024; //RzModFloor  (int)fmod(ipf,1024);      ! content of the last 10 bits
    646648  ip_trunc =   ipf/1024 ;//       ! truncation of the last 10 bits
    647   ip_med = (int)fmod(ip_trunc,1024);//  ! content of the next 10 bits
     649  ip_med = ip_trunc%1024;  //RzModFloor  (int)fmod(ip_trunc,1024);  ! content of the next 10 bits
    648650  ip_hi  =     ip_trunc/1024   ;//! content of the high weight 10 bits
    649651 
     
    660662  nr = nside;//                  ! equatorial region (the most frequent)
    661663  z  = (2*nside-jr)*fact2;
    662   kshift = (int)fmod(jr - nside, 2);
     664  kshift = (jr-nside) % 2; //RzModFloor (int)fmod(jr - nside, 2);
    663665  if( jr<nside ) { //then     ! north pole region
    664666    nr = jr;
  • trunk/SophyaLib/SkyMap/fiospherehealpix.cc

    r1955 r2082  
    163163
    164164#ifdef __CXX_PRAGMA_TEMPLATES__
     165#pragma define_template FIO_SphereHEALPix<int_4>
    165166#pragma define_template FIO_SphereHEALPix<r_8>
    166167#pragma define_template FIO_SphereHEALPix<r_4>
     
    169170#endif
    170171#if defined(ANSI_TEMPLATES) || defined(GNU_TEMPLATES)
     172template class FIO_SphereHEALPix<int_4>;
    171173template class FIO_SphereHEALPix<r_8>;
    172174template class FIO_SphereHEALPix<r_4>;
  • trunk/SophyaLib/SkyMap/skymapinit.cc

    r1371 r2082  
    3131//   Enregistrement des classes PPersist du module SkyMap
    3232 
     33  // ---------- Les SphereThetaPhi ---------
     34
    3335  PPRegister(FIO_SphereCoordSys);
    3436  DObjRegister(FIO_SphereCoordSys, SphereCoordSys);
     37
     38  PPRegister(FIO_SphereThetaPhi<int_4>);
     39  DObjRegister(FIO_SphereThetaPhi<int_4>, SphereThetaPhi<int_4>);
    3540
    3641  PPRegister(FIO_SphereThetaPhi<r_4>);
     
    4651  DObjRegister(FIO_SphereThetaPhi< complex<r_8> >, SphereThetaPhi< complex<r_8> >);
    4752
     53
     54  // ---------- Les SphereHEALPix ---------
     55
     56  PPRegister(FIO_SphereHEALPix<int_4>); 
     57  DObjRegister(FIO_SphereHEALPix<int_4>, SphereHEALPix<int_4>);
     58
    4859  PPRegister(FIO_SphereHEALPix<r_4>); 
    4960  DObjRegister(FIO_SphereHEALPix<r_4>, SphereHEALPix<r_4>);
     
    5768  PPRegister(FIO_SphereHEALPix< complex<r_8> >);
    5869  DObjRegister(FIO_SphereHEALPix< complex<r_8> >, SphereHEALPix< complex<r_8> >);
     70
     71  // ------------ Les LocalMap ---------
     72  PPRegister(FIO_LocalMap<int_4>);
     73  DObjRegister(FIO_LocalMap<int_4>, LocalMap<int_4>);
    5974
    6075  PPRegister(FIO_LocalMap<r_4>);
  • trunk/SophyaLib/SkyMap/spherethetaphi.cc

    r1624 r2082  
    832832
    833833#ifdef __CXX_PRAGMA_TEMPLATES__
     834#pragma define_template SphereThetaPhi<int_4>
    834835#pragma define_template SphereThetaPhi<r_8>
    835836#pragma define_template SphereThetaPhi<r_4>
     
    838839#endif
    839840#if defined(ANSI_TEMPLATES) || defined(GNU_TEMPLATES)
     841template class SphereThetaPhi<int_4>;
    840842template class SphereThetaPhi<r_8>;
    841843template class SphereThetaPhi<r_4>;
Note: See TracChangeset for help on using the changeset viewer.