Changeset 2198 in Sophya for trunk/SophyaLib/SkyMap/localmap.cc


Ignore:
Timestamp:
Sep 24, 2002, 4:05:46 PM (23 years ago)
Author:
lemeur
Message:

toilette d'ete

File:
1 edited

Legend:

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

    r2052 r2198  
    6565}
    6666
     67//! partial constructor of the local map
     68/*!
     69  \param nx : number of pixels in x direction
     70  \param ny : number of pixels in y direction
     71
     72must be followed by calling the methodsa setSize() and setOrigin() in order the object become usable
     73
     74 */
     75
     76template<class T>
     77LocalMap<T>::LocalMap(int_4 nx, int_4 ny) 
     78{
     79  InitNul();
     80  ReSize(nx, ny);
     81  //  nSzX_ = nx;
     82  //  nSzY_ = ny;
     83  //  nPix_= nx*ny;
     84  //  pixels_.ReSize(ny,nx);
     85}
     86
    6787//! full constructor of the local map
    6888/*!
     
    82102{
    83103  InitNul();
    84   nSzX_ = nx;
    85   nSzY_ = ny;
    86   nPix_= nx*ny;
    87   pixels_.ReSize(ny,nx);
     104  //  nSzX_ = nx;
     105  // nSzY_ = ny;
     106  // nPix_= nx*ny;
     107  // pixels_.ReSize(ny,nx);
     108  ReSize(nx, ny);
    88109  SetSize(angleX, angleY);
    89110  SetOrigin(theta0, phi0, x0, y0, angle);
     
    107128{
    108129  InitNul();
     130  //  nSzX_ = nx;
     131  //  nSzY_ = ny;
     132  // nPix_= nx*ny;
     133  //  pixels_.ReSize(ny,nx);
     134  ReSize(nx, ny);
     135  SetSize(angleX, angleY);
     136  SetOrigin(theta0, phi0, angle);
     137}
     138
     139//! copy constructor
     140/*!
     141  \param share : if true, share data. If false copy data
     142 */
     143template<class T>
     144LocalMap<T>::LocalMap(const LocalMap<T>& lm, bool share)
     145  : pixels_(lm.pixels_, share)
     146{
     147
     148  if(lm.mInfo_) mInfo_= new DVList(*lm.mInfo_);
     149  recopierVariablesSimples(lm);
     150}
     151
     152//! copy constructor
     153/*!
     154  \warning datas are \b SHARED with \b lm.
     155  \sa TMatrix::TMatrix(const TMatrix<T>&)
     156*/
     157template<class T>
     158LocalMap<T>::LocalMap(const LocalMap<T>& lm)
     159  : pixels_(lm.pixels_)
     160
     161{
     162
     163  if(lm.mInfo_) mInfo_= new DVList(*lm.mInfo_);
     164  recopierVariablesSimples(lm);
     165}
     166
     167template<class T>
     168LocalMap<T>::~LocalMap() {;}
     169
     170
     171
     172/*!  \fn void SOPHYA::LocalMap::ReSize(int_4 nx, int_4 ny)
     173
     174  Resize storage area for pixels
     175*/
     176template<class T>
     177void LocalMap<T>::ReSize(int_4 nx, int_4 ny)
     178{
     179    // angles par pixel,  en radians
     180  deltaPhi_   *=  nSzX_/nx;   
     181  deltaTheta_ *=  nSzY_/ny;
     182
    109183  nSzX_ = nx;
    110184  nSzY_ = ny;
    111185  nPix_= nx*ny;
    112186  pixels_.ReSize(ny,nx);
    113   cout << " tableau pixels initialise " << endl;
    114   SetSize(angleX, angleY);
    115   cout << " fin du setsize " << endl;
    116   SetOrigin(theta0, phi0, angle);
    117   cout << " fin du set oorigine " << endl;
    118 }
    119 
    120 //! copy constructor
    121 /*!
    122   \param share : if true, share data. If false copy data
    123  */
    124 template<class T>
    125 LocalMap<T>::LocalMap(const LocalMap<T>& lm, bool share)
    126   : pixels_(lm.pixels_, share)
    127 {
    128 
    129   if(lm.mInfo_) mInfo_= new DVList(*lm.mInfo_);
    130   recopierVariablesSimples(lm);
    131 }
    132 
    133 //! copy constructor
    134 /*!
    135   \warning datas are \b SHARED with \b lm.
    136   \sa TMatrix::TMatrix(const TMatrix<T>&)
    137 */
    138 template<class T>
    139 LocalMap<T>::LocalMap(const LocalMap<T>& lm)
    140   : pixels_(lm.pixels_)
    141 
    142 {
    143 
    144   if(lm.mInfo_) mInfo_= new DVList(*lm.mInfo_);
    145   recopierVariablesSimples(lm);
    146 }
    147 
    148 template<class T>
    149 LocalMap<T>::~LocalMap() {;}
    150 
    151 
    152 
    153 /*!  \fn void SOPHYA::LocalMap::ReSize(int_4 nx, int_4 ny)
    154 
    155   Resize storage area for pixels
    156 */
    157 template<class T>
    158 void LocalMap<T>::ReSize(int_4 nx, int_4 ny)
    159 {
    160     // angles par pixel,  en radians
    161   deltaPhi_   *=  nSzX_/nx;   
    162   deltaTheta_ *=  nSzY_/ny;
    163 
    164   nSzX_ = nx;
    165   nSzY_ = ny;
    166   nPix_= nx*ny;
    167   pixels_.ReSize(ny,nx);
     187  pixelSized_ = true;
    168188}
    169189
     
    285305  int_4 i,j;
    286306
     307  if (! LocalMap_isDone()) initializationError();
    287308  double csTheta = cos(theta);
    288309  double snTheta = sin(theta);
     
    296317  if ( denom == 0.)
    297318    {
    298       throw PException("LocalMap::PixIndexSph : vector radius parallel to map plane ");
    299319    }
    300320  double lambda = 1./denom;
     
    428448void LocalMap<T>::PixToSphereC(int_4 ip, int_4 it, double& XP, double& YP, double& ZP) const
    429449{
     450  if (! LocalMap_isDone()) initializationError();
    430451  double X= double(ip-x0_)* deltaPhi_;
    431452  double Y= double(it-y0_)*deltaTheta_;
     
    466487void LocalMap<T>::SetOrigin(double theta0,double phi0,int_4 x0,int_4 y0,double angle)
    467488{
    468   // if (originFlag_)
    469   //   {
    470   //     throw PException("LocalMap::SetOrigin : redefining origin is not allowed at the moment ");
    471   //  }
    472489
    473490  if ( theta0 < 0. || theta0 > 180. || phi0 < 0. || phi0 > 360. || angle < -90. || angle > 90.)
     
    483500  cosAngle_= cos(angle_);
    484501  sinAngle_= sin(angle_);
     502
     503   if (originSet_)
     504     {
     505       cout << " WARNING:  LocalMap<T>::SetOrigin() : reset origine of a local map which had already an origin " << endl;
     506     }
     507   originSet_ = true;
    485508}
    486509
     
    510533{
    511534  cout << " calcul matrice de passage " << endl;
     535  if (! LocalMap_isDone()) initializationError();
    512536  TMatrix<double> passage(3,3);
    513537  double cos_th_axeZ;
     
    578602void LocalMap<T>::SetSize(double angleX,double angleY)
    579603{
     604  if (!pixelSized_) initializationError();
     605
    580606  if ( angleX <= 0. || angleX > 180. || angleY <= 0. || angleY > 180.)
    581607    {
     
    589615  deltaPhi_   = angleX*Pi/(180.*nSzX_);
    590616  deltaTheta_ = angleY*Pi/(180.*nSzY_);
    591 
     617 
     618  if (angleSized_)
     619     {
     620       cout << " WARNING LocalMap::SetSize  ; angle resizing of an already sized local map " << endl;
     621     }
     622  angleSized_  = true;
    592623
    593624}
     
    624655//--
    625656{
     657
     658  pixelSized_  = false;
     659  angleSized_  = false;
     660  originSet_ = false;
     661
    626662  nSzX_ = 0;
    627663  nSzY_ = 0;
     
    635671
    636672
     673
    637674  nPix_ = 0;
    638675
     
    699736{
    700737
     738  pixelSized_ = lm.pixelSized_;
     739  angleSized_ = lm.angleSized_;
     740  originSet_  = lm.originSet_ ;
     741
     742
    701743  nSzX_ = lm.nSzX_;
    702744  nSzY_ = lm.nSzY_;
     
    721763  deltaTheta_ = lm.deltaTheta_;
    722764}
     765
     766template<class T>
     767void LocalMap<T>::initializationError() const
     768{
     769  cout << endl;
     770  if (!pixelSized_) cout << " LocalMap::initializationError() ; pixel sizing is missing " << endl;
     771  if (!angleSized_ ) cout << " LocalMap::initializationError() ; angle sizing is missing " << endl;
     772  if (!originSet_ ) cout << " LocalMap::initializationError() ; origin of map is not set " << endl;
     773      throw PException("LocalMap::initializationError() : bad initialization of the local map ");
     774
     775
     776}
     777
    723778
    724779//   ...... Operations de calcul  ......
Note: See TracChangeset for help on using the changeset viewer.