Changeset 1196 in Sophya


Ignore:
Timestamp:
Sep 22, 2000, 12:36:46 PM (25 years ago)
Author:
ansari
Message:

Introduction de la classe HEALPix pour accrocher les methodes de
converion angle<>index
rajout en methodes inline static de ces methodes de conversion pour
SphereHEALPix<T>
+ Autre modifs cosmetiques + MAJ Makefile , Reza 21/9/2000

Location:
trunk/SophyaLib/SkyMap
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/SkyMap/HEALPixUtils.cc

    r1195 r1196  
    1313}
    1414
    15 namespace SOPHYA
    16 {
     15using namespace SOPHYA;
     16
     17//////////////////////////////////////////////////////////////////////////
     18//
     19// ------------- Classe PIXELS_XY -----------------------
     20//
     21class PIXELS_XY
     22{
     23
     24public :
     25
     26static PIXELS_XY& instance();
     27
     28NDataBlock<int_4> pix2x_;
     29NDataBlock<int_4> pix2y_;
     30NDataBlock<int_4> x2pix_;
     31NDataBlock<int_4> y2pix_;
     32
     33private :
     34
     35PIXELS_XY();
     36void mk_pix2xy();
     37void mk_xy2pix();
     38};
    1739
    1840
     
    3860}
    3961
     62// Instance unique de la classe PIXELS_XY
     63static PIXELS_XY * single = NULL;
     64
    4065PIXELS_XY& PIXELS_XY::instance()
    4166{
    42   static PIXELS_XY single;
    43   return (single);
     67  if (single == NULL) single = new PIXELS_XY ;
     68  return (*single);
    4469}
    4570
     
    128153
    129154
    130 int_4 nest2ring(int_4 nside, int_4 ipnest)
     155int_4 HEALPix::nest2ring(int_4 nside, int_4 ipnest)
    131156{
    132157  /*
     
    210235
    211236
    212 int_4 ring2nest(int_4 nside, int_4 ipring) 
     237int_4 HEALPix::ring2nest(int_4 nside, int_4 ipring) 
    213238{
    214239  /*
     
    318343}
    319344
    320 int_4 ang2pix_ring(int_4 nside, double theta, double phi) 
     345int_4 HEALPix::ang2pix_ring(int_4 nside, double theta, double phi) 
    321346{
    322347  /*
     
    393418}
    394419
    395 int_4 ang2pix_nest(int_4 nside, double theta, double phi)
     420int_4 HEALPix::ang2pix_nest(int_4 nside, double theta, double phi)
    396421{
    397422  /*
     
    489514}
    490515
    491 void pix2ang_ring(int_4 nside,int_4 ipix,double& theta,double& phi)  {
     516void HEALPix::pix2ang_ring(int_4 nside,int_4 ipix,double& theta,double& phi) 
     517{
    492518  /*
    493519    ===================================================
     
    556582}
    557583
    558 void pix2ang_nest(int_4 nside,int_4 ipix,double& theta,double& phi)  {
     584void HEALPix::pix2ang_nest(int_4 nside,int_4 ipix,double& theta,double& phi) 
     585{
    559586  /*
    560587    ==================================================
     
    644671}
    645672
    646 }
     673 
  • trunk/SophyaLib/SkyMap/HEALPixUtils.h

    r1195 r1196  
    99namespace SOPHYA {
    1010
    11 //////////////////////////////////////////////////////////////////////////
    12 //
    13 // ------------- Classe PIXELS_XY -----------------------
    14 //
    15 class PIXELS_XY
    16 {
     11  // Utility class to compute index to/from angle conversion in HEALPix
     12  // spherical map pixelisation
    1713
     14class HEALPix {
    1815public :
     16  static int_4  nest2ring(int_4 nside,int_4 ipnest) ;
     17  static int_4  ring2nest(int_4 nside,int_4 ipring) ;
    1918
    20 static PIXELS_XY& instance();
    21 
    22 NDataBlock<int_4> pix2x_;
    23 NDataBlock<int_4> pix2y_;
    24 NDataBlock<int_4> x2pix_;
    25 NDataBlock<int_4> y2pix_;
    26 
    27 private :
    28 
    29 PIXELS_XY();
    30 void mk_pix2xy();
    31 void mk_xy2pix();
     19  static int_4  ang2pix_ring(int_4 nside,double theta,double phi) ;
     20  static int_4  ang2pix_nest(int_4 nside,double theta,double phi) ;
     21  static void   pix2ang_ring(int_4 nside,int_4 ipix,double& theta,double& phi) ;
     22  static void   pix2ang_nest(int_4 nside,int_4 ipix,double& theta,double& phi) ;
    3223};
    33 
    34 
    35 int_4  nest2ring(int_4 nside,int_4 ipnest) ;
    36 int_4  ring2nest(int_4 nside,int_4 ipring) ;
    37 
    38 int_4  ang2pix_ring(int_4 nside,double theta,double phi) ;
    39 int_4  ang2pix_nest(int_4 nside,double theta,double phi) ;
    40 void pix2ang_ring(int_4 nside,int_4 ipix,double& theta,double& phi) ;
    41 void pix2ang_nest(int_4 nside,int_4 ipix,double& theta,double& phi) ;
    42 
    4324
    4425
  • trunk/SophyaLib/SkyMap/Makefile

    r1118 r1196  
    33all: $(LIB)libSkyMap.a
    44clean:
    5         rm -f $(OBJ)fiolocalmap.o $(OBJ)fiospherehealpix.o $(OBJ)fiospherethetaphi.o $(OBJ)localmap.o $(OBJ)longlat.o $(OBJ)mapoperation.o $(OBJ)skymapinit.o $(OBJ)spherehealpix.o $(OBJ)spherepos.o $(OBJ)spherethetaphi.o $(OBJ)unitvector.o $(OBJ)utilgeom.o $(OBJ)vector3d.o
     5        rm -f $(OBJ)HEALPixUtils.o $(OBJ)fiolocalmap.o $(OBJ)fiospherehealpix.o $(OBJ)fiospherethetaphi.o $(OBJ)localmap.o $(OBJ)longlat.o $(OBJ)mapoperation.o $(OBJ)skymapinit.o $(OBJ)spherehealpix.o $(OBJ)spherepos.o $(OBJ)spherethetaphi.o $(OBJ)unitvector.o $(OBJ)utilgeom.o $(OBJ)vector3d.o
    66        rm -f $(LIB)libSkyMap.a
    7 $(LIB)libSkyMap.a : $(OBJ)fiolocalmap.o $(OBJ)fiospherehealpix.o $(OBJ)fiospherethetaphi.o $(OBJ)localmap.o $(OBJ)longlat.o $(OBJ)mapoperation.o $(OBJ)skymapinit.o $(OBJ)spherehealpix.o $(OBJ)spherepos.o $(OBJ)spherethetaphi.o $(OBJ)unitvector.o $(OBJ)utilgeom.o $(OBJ)vector3d.o
     7$(LIB)libSkyMap.a : $(OBJ)HEALPixUtils.o $(OBJ)fiolocalmap.o $(OBJ)fiospherehealpix.o $(OBJ)fiospherethetaphi.o $(OBJ)localmap.o $(OBJ)longlat.o $(OBJ)mapoperation.o $(OBJ)skymapinit.o $(OBJ)spherehealpix.o $(OBJ)spherepos.o $(OBJ)spherethetaphi.o $(OBJ)unitvector.o $(OBJ)utilgeom.o $(OBJ)vector3d.o
    88        $(ARCXX) $(ARCXXFLAGS) $@ $?
    99ifeq ($(CXX),cxx)
     
    1111endif
    1212 
     13$(OBJ)HEALPixUtils.o: HEALPixUtils.cc HEALPixUtils.h \
     14 $(INC)machdefs.h \
     15 $(INC)ndatablock.h \
     16 $(INC)anydataobj.h \
     17 $(INC)tvector.h \
     18 $(INC)tmatrix.h \
     19 $(INC)tarray.h \
     20 $(INC)basarr.h \
     21 $(INC)mutyv.h \
     22 $(INC)dvlist.h \
     23 $(INC)objfio.h \
     24 $(INC)ppersist.h \
     25 $(INC)pexceptions.h \
     26 $(INC)gnumd5.h \
     27 $(INC)utilarr.h \
     28 $(INC)smathconst.h
    1329$(OBJ)fiolocalmap.o: fiolocalmap.cc fiolocalmap.h sphericalmap.h \
    1430 $(INC)smathconst.h \
     
    133149 $(INC)basarr.h \
    134150 $(INC)utilarr.h \
    135  $(INC)strutil.h
     151 $(INC)strutil.h HEALPixUtils.h
    136152$(OBJ)spherepos.o: spherepos.cc spherepos.h \
    137153 $(INC)machdefs.h \
  • trunk/SophyaLib/SkyMap/healpix.h

    r853 r1196  
    77#include "spherehealpix.h"
    88
    9 #define HEALPix SphereHEALPix
    109#define SphereGorski SphereHEALPix
    1110#define SphereHealpix SphereHEALPix
  • trunk/SophyaLib/SkyMap/objlist.list

    r941 r1196  
     1HEALPixUtils.o
    12fiolocalmap.o
    23fiospherehealpix.o
  • trunk/SophyaLib/SkyMap/spherehealpix.cc

    r1195 r1196  
    77#include "spherehealpix.h"
    88#include "strutil.h"
    9 #include "HEALPixUtils.h"
     9
    1010extern "C"
    1111{
  • trunk/SophyaLib/SkyMap/spherehealpix.h

    r1195 r1196  
    99#include "ppersist.h"
    1010
     11#include "HEALPixUtils.h"
    1112
    1213namespace SOPHYA {
     
    6364class SphereHEALPix : public SphericalMap<T>
    6465{
    65 
    66 
    67   friend class FIO_SphereHEALPix<T>;
    68   friend class FITS_SphereHEALPix<T>;
    69 
    7066public :
     67// Static Methods to ease the use of HEALPix index <> angle conversion methods
     68
     69  static inline int_4  nest2ring(int_4 nside,int_4 ipnest)
     70         { return HEALPix::nest2ring(nside, ipnest); }
     71  static inline int_4  ring2nest(int_4 nside,int_4 ipring)
     72         { return HEALPix::ring2nest(nside, ipring); }
     73  static inline int_4  ang2pix_ring(int_4 nside,double theta,double phi)
     74         { return HEALPix::ang2pix_ring(nside, theta, phi); }
     75  static inline int_4  ang2pix_nest(int_4 nside,double theta,double phi)
     76         { return HEALPix::ang2pix_nest(nside, theta, phi); }
     77  static inline void   pix2ang_ring(int_4 nside,int_4 ipix,double& theta,double& phi)
     78         { HEALPix::pix2ang_ring(nside, ipix, theta, phi); }
     79  static inline void   pix2ang_nest(int_4 nside,int_4 ipix,double& theta,double& phi)
     80         { HEALPix::pix2ang_nest(nside, ipix, theta, phi); }
    7181
    7282SphereHEALPix();
     
    217227                                                        {return Set(a);}
    218228
     229 void CloneOrShare(const SphereHEALPix<T>& a);
     230 SphereHEALPix<T>& Set(const SphereHEALPix<T>& a);
     231 SphereHEALPix<T>& CopyElt(const SphereHEALPix<T>& a);
     232
     233
     234 // friend declaration for classes which handle persistence and FITS IO
     235 friend class FIO_SphereHEALPix<T>;
     236 friend class FITS_SphereHEALPix<T>;
    219237       
    220 private :
     238protected :
    221239
    222240// ------------- méthodes internes ----------------------
     
    224242void SetThetaSlices();
    225243
    226 //int_4  nest2ring(int_4 nside,int_4 ipnest) const;
    227 //int_4  ring2nest(int_4 nside,int_4 ipring) const;
    228 
    229 //int_4  ang2pix_ring(int_4 nside,double theta,double phi) const;
    230 //int_4  ang2pix_nest(int_4 nside,double theta,double phi) const;
    231 //void pix2ang_ring(int_4 nside,int_4 ipix,double& theta,double& phi) const;
    232 //void pix2ang_nest(int_4 nside,int_4 ipix,double& theta,double& phi) const;
    233244inline void setParameters(int_4 nside, int_4 nbpixels, double solangle)
    234245  {
     
    238249  }
    239250
    240  void CloneOrShare(const SphereHEALPix<T>& a);
    241  SphereHEALPix<T>& Set(const SphereHEALPix<T>& a);
    242  SphereHEALPix<T>& CopyElt(const SphereHEALPix<T>& a);
    243 
    244251// ------------- variables internes -----------------------
    245252
  • trunk/SophyaLib/SkyMap/spherethetaphi.h

    r980 r1196  
    3434class SphereThetaPhi : public SphericalMap<T>
    3535{
    36 
    37   friend class FIO_SphereThetaPhi<T>;
    38   friend class FITS_SphereThetaPhi<T>;
    3936
    4037public :
     
    185182void print(ostream& os) const;
    186183
    187 inline  SphereThetaPhi<T>& operator = (const SphereThetaPhi<T>& a)
     184  void CloneOrShare(const SphereThetaPhi<T>& a);
     185
     186  SphereThetaPhi<T>& Set(const SphereThetaPhi<T>& a);
     187  SphereThetaPhi<T>& CopyElt(const SphereThetaPhi<T>& a);
     188
     189  inline  SphereThetaPhi<T>& operator = (const SphereThetaPhi<T>& a)
    188190                                                       {return Set(a);}
    189191
    190 
    191 private :
     192 // friend declaration for classes which handle persistence and FITS IO
     193  friend class FIO_SphereThetaPhi<T>;
     194  friend class FITS_SphereThetaPhi<T>;
     195
     196protected :
    192197
    193198// ------------- méthodes internes ----------------------         
     
    199204    NTheta_= nbThetaIndex;
    200205  }
    201 void CloneOrShare(const SphereThetaPhi<T>& a);
    202 
    203 SphereThetaPhi<T>& Set(const SphereThetaPhi<T>& a);
    204  SphereThetaPhi<T>& CopyElt(const SphereThetaPhi<T>& a);
    205206
    206207// ------------- variables internes ---------------------
Note: See TracChangeset for help on using the changeset viewer.