Changeset 2990 in Sophya


Ignore:
Timestamp:
Jun 23, 2006, 12:35:17 PM (19 years ago)
Author:
ansari
Message:

Ajouts methode GetThetaSliceDataPtr() dans SphericalMap, SphereThetaPhi SphereHEALPix SphereECP pour optimisation calcul transforme Ylm + passage TypeOfMap TETAFI->ECP pour SphereECP , Reza 23/6/2006

Location:
trunk/SophyaLib/SkyMap
Files:
7 edited

Legend:

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

    r2987 r2990  
    167167string SphereECP<T>::TypeOfMap() const
    168168{
    169   return string("TETAFI");
     169  return string("ECP");
    170170}
    171171
     
    370370  return;
    371371
     372}
     373
     374template <class T>
     375T*  SphereECP<T>::GetThetaSliceDataPtr(int_4 index)
     376{
     377  if( (index < 0) || (index >= _pixels.SizeY()) ) 
     378    throw RangeCheckError("SphereECP::GetThetaSliceDataPtr() index out of range");
     379  int_4 ioff = _phi1/_dphi;
     380  if (ioff != 0) return NULL;
     381  return _pixels.Data() + index*_pixels.SizeX();
    372382}
    373383
  • trunk/SophyaLib/SkyMap/sphereecp.h

    r2985 r2990  
    109109  virtual void          GetThetaSlice(int_4 sliceIndex, r_8& theta, r_8& phi0,
    110110                                      TVector<int_4>& pixelIndices,TVector<T>& value) const ;
     111  virtual T*            GetThetaSliceDataPtr(int_4 index);
    111112
    112113  // Valeur de pixel hors carte
  • trunk/SophyaLib/SkyMap/spherehealpix.cc

    r2987 r2990  
    340340void SphereHEALPix<T>::GetThetaSlice(int_4 index,r_8& theta,TVector<r_8>& phi,TVector<T>& value) const
    341341{
    342   if (index<0 || index >= NbThetaSlices())  {
    343       cout << " SphereHEALPix::GetThetaSlice : Pixel index out of range" <<endl;
    344       throw RangeCheckError(" SphereHEALPix::GetThetaSlice()  index out of range");
    345   }
     342  if (index<0 || index >= NbThetaSlices())
     343    throw RangeCheckError(" SphereHEALPix::GetThetaSlice()  index out of range");
    346344
    347345  int_4 iring= sliceBeginIndex_(index);
     
    388386
    389387template<class T>
    390 void SphereHEALPix<T>::GetThetaSlice(int_4 sliceIndex,r_8& theta, r_8& phi0, TVector<int_4>& pixelIndices,TVector<T>& value) const
     388void SphereHEALPix<T>::GetThetaSlice(int_4 sliceIndex,r_8& theta, r_8& phi0,
     389                                     TVector<int_4>& pixelIndices,TVector<T>& value) const
    391390
    392391{
    393392
    394393  if (sliceIndex<0 || sliceIndex >= NbThetaSlices())
    395     {
    396       cout << " SphereHEALPix::GetThetaSlice : Pixel index out of range" <<endl;
    397       throw RangeCheckError(" SphereHEALPix::GetThetaSlice : Pixel index out of range");
    398     }
     394    throw RangeCheckError(" SphereHEALPix::GetThetaSlice() index out of range");
    399395  int_4 iring= sliceBeginIndex_(sliceIndex);
    400396  int_4 lring  =  sliceLenght_(sliceIndex);
     
    417413    PixThetaPhi(ring2nest(nSide_,iring), theta, phi0);   
    418414  }
     415}
     416
     417//! return a pointer to the specified slice pixel data in RING ordering, NULL in NESTED
     418template<class T>
     419T* SphereHEALPix<T>::GetThetaSliceDataPtr(int_4 sliceIndex)
     420
     421{
     422  if (sliceIndex<0 || sliceIndex >= NbThetaSlices())
     423    throw RangeCheckError(" SphereHEALPix::GetThetaSliceDataPtr(): index out of range");
     424  if (fgring_)
     425    return pixels_.Begin()+sliceBeginIndex_(sliceIndex);
     426  else return NULL;
    419427}
    420428
  • trunk/SophyaLib/SkyMap/spherehealpix.h

    r2985 r2990  
    9191virtual void GetThetaSlice(int_4 index,r_8& theta,TVector<r_8>& phi,TVector<T>& value) const;
    9292virtual void GetThetaSlice(int_4 sliceIndex,r_8& theta, r_8& phi0, TVector<int_4>& pixelIndices,TVector<T>& value) const ;
     93virtual T*   GetThetaSliceDataPtr(int_4 sliceIndex);
    9394
    9495virtual bool ContainsSph(double theta, double phi) const;
  • trunk/SophyaLib/SkyMap/spherethetaphi.cc

    r2987 r2990  
    192192  NPix_  = a.NPix_;
    193193  Omega_ = a.Omega_;
    194   int k;
     194  int_4 k;
    195195  for (k=0; k< NPix_; k++) pixels_(k) = a.pixels_(k);
    196196  for (k=0; k< a.NPhi_.Size(); k++) NPhi_(k) = a.NPhi_(k);
     
    246246{
    247247  double dphi;
    248   int i,k;
     248  int_4 i,k;
    249249  bool fgzn = false;
    250250
     
    270270void SphereThetaPhi<T>::PixThetaPhi(int_4 k,double& theta,double& phi) const
    271271{
    272   int i;
     272  int_4 i;
    273273  bool fgzn = false;
    274274 
     
    316316void SphereThetaPhi<T>::Limits(int_4 k,double& tetMin,double& tetMax,double& phiMin,double& phiMax)
    317317  {
    318   int j;
     318  int_4 j;
    319319  double dphi;
    320320  bool fgzn= false;
     
    335335 
    336336  // on recupere l'indice i de la tranche qui contient le pixel k
    337   int i;
     337  int_4 i;
    338338  for( i=0; i< NTheta_; i++ )
    339339    if(k < TNphi_(i+1)) break;
     
    378378int_4 SphereThetaPhi<T>::NPhi(int_4 kt) const
    379379{
    380   int nbpix; 
     380  int_4 nbpix; 
    381381  // verification
    382382  if((kt < 0) || (kt >= 2*NTheta_)) return(-1);
     
    455455int_4 SphereThetaPhi<T>::Index(int_4 kt,int_4 jp) const
    456456{
    457   int k;
     457  int_4 k;
    458458  bool fgzn= false;
    459459 
     
    494494 
    495495  // on recupere l'indice kt de la tranche qui contient le pixel k
    496   int i;
     496  int_4 i;
    497497  for(i = 0; i < NTheta_; i++)
    498498    if(k < TNphi_(i+1)) break;
     
    523523//--
    524524{
    525   int ntotpix,j;
     525  int_4 ntotpix,j;
    526526 
    527527  // Decodage et controle des arguments d'appel :
     
    634634   
    635635
    636   int iring= Index(index,0);
    637   int lring  = NPhi(index);
     636  int_4 iring= Index(index,0);
     637  int_4 lring  = NPhi(index);
    638638
    639639  phi.ReSize(lring);
     
    643643  PixThetaPhi(iring,Te,Fi);
    644644  double DFi = DeuxPi/(double)NPhi(index);
    645   for(int kk = 0; kk < lring; kk++)   {
     645  for(int_4 kk = 0; kk < lring; kk++)   {
    646646    value(kk)= pixels_(kk+iring);
    647647    phi(kk)= Fi;
     
    668668    throw RangeCheckError("SphereThetaPhi::GetThetaSlice(idx...)  idx out of range");
    669669
    670   int iring= Index(index,0);
    671   int lring  = NPhi(index);
     670  int_4 iring= Index(index,0);
     671  int_4 lring  = NPhi(index);
    672672
    673673  pixelIndices.ReSize(lring);
     
    675675  double Te= 0.;
    676676  double Fi= 0.;
    677   for(int kk = 0; kk < lring; kk++)  {
     677  for(int_4 kk = 0; kk < lring; kk++)  {
    678678    pixelIndices(kk)=kk+iring ;
    679679    value(kk)= pixels_(kk+iring);
     
    682682}
    683683
    684 
     684//! return a pointer to the specified slice pixel data
     685template <class T>
     686T* SphereThetaPhi<T>::GetThetaSliceDataPtr(int_4 index)
     687{
     688  if(index < 0 || index >= NbThetaSlices())
     689    throw RangeCheckError("SphereThetaPhi::GetThetaSliceDataPtr(idx)  idx out of range");
     690  return pixels_.Begin()+Index(index,0);
     691}
    685692
    686693
     
    694701
    695702  os << "... NPhi_ Values : ";
    696   int i;
     703  int_4 i;
    697704  for(i=0; i < NTheta_; i++)
    698705    {
  • trunk/SophyaLib/SkyMap/spherethetaphi.h

    r2985 r2990  
    132132virtual void GetThetaSlice(int_4 index,r_8& theta,TVector<r_8>& phi,TVector<T>& value) const;
    133133virtual void GetThetaSlice(int_4 index, r_8& theta, r_8& phi0,TVector<int_4>& pixelIndices, TVector<T>& value) const ;
     134virtual T*   GetThetaSliceDataPtr(int_4 sliceIndex);
    134135
    135136
  • trunk/SophyaLib/SkyMap/sphericalmap.h

    r2973 r2990  
    6060virtual void GetThetaSlice(int_4 index,r_8& theta, TVector<r_8>& phi, TVector<T>& value) const=0;
    6161virtual void GetThetaSlice(int_4 sliceIndex, r_8& theta, r_8& phi0, TVector<int_4>& pixelIndices,TVector<T>& value) const=0 ;
     62/*!
     63  If possible return a pointer to the slice pixel data. return NULL otherwise
     64*/
     65virtual T*   GetThetaSliceDataPtr(int_4 sliceIndex) { return NULL; }
    6266};
    6367
Note: See TracChangeset for help on using the changeset viewer.