Changeset 2198 in Sophya for trunk/SophyaLib/SkyMap/localmap.cc
- Timestamp:
- Sep 24, 2002, 4:05:46 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/SkyMap/localmap.cc
r2052 r2198 65 65 } 66 66 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 72 must be followed by calling the methodsa setSize() and setOrigin() in order the object become usable 73 74 */ 75 76 template<class T> 77 LocalMap<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 67 87 //! full constructor of the local map 68 88 /*! … … 82 102 { 83 103 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); 88 109 SetSize(angleX, angleY); 89 110 SetOrigin(theta0, phi0, x0, y0, angle); … … 107 128 { 108 129 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 */ 143 template<class T> 144 LocalMap<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 */ 157 template<class T> 158 LocalMap<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 167 template<class T> 168 LocalMap<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 */ 176 template<class T> 177 void 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 109 183 nSzX_ = nx; 110 184 nSzY_ = ny; 111 185 nPix_= nx*ny; 112 186 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; 168 188 } 169 189 … … 285 305 int_4 i,j; 286 306 307 if (! LocalMap_isDone()) initializationError(); 287 308 double csTheta = cos(theta); 288 309 double snTheta = sin(theta); … … 296 317 if ( denom == 0.) 297 318 { 298 throw PException("LocalMap::PixIndexSph : vector radius parallel to map plane ");299 319 } 300 320 double lambda = 1./denom; … … 428 448 void LocalMap<T>::PixToSphereC(int_4 ip, int_4 it, double& XP, double& YP, double& ZP) const 429 449 { 450 if (! LocalMap_isDone()) initializationError(); 430 451 double X= double(ip-x0_)* deltaPhi_; 431 452 double Y= double(it-y0_)*deltaTheta_; … … 466 487 void LocalMap<T>::SetOrigin(double theta0,double phi0,int_4 x0,int_4 y0,double angle) 467 488 { 468 // if (originFlag_)469 // {470 // throw PException("LocalMap::SetOrigin : redefining origin is not allowed at the moment ");471 // }472 489 473 490 if ( theta0 < 0. || theta0 > 180. || phi0 < 0. || phi0 > 360. || angle < -90. || angle > 90.) … … 483 500 cosAngle_= cos(angle_); 484 501 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; 485 508 } 486 509 … … 510 533 { 511 534 cout << " calcul matrice de passage " << endl; 535 if (! LocalMap_isDone()) initializationError(); 512 536 TMatrix<double> passage(3,3); 513 537 double cos_th_axeZ; … … 578 602 void LocalMap<T>::SetSize(double angleX,double angleY) 579 603 { 604 if (!pixelSized_) initializationError(); 605 580 606 if ( angleX <= 0. || angleX > 180. || angleY <= 0. || angleY > 180.) 581 607 { … … 589 615 deltaPhi_ = angleX*Pi/(180.*nSzX_); 590 616 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; 592 623 593 624 } … … 624 655 //-- 625 656 { 657 658 pixelSized_ = false; 659 angleSized_ = false; 660 originSet_ = false; 661 626 662 nSzX_ = 0; 627 663 nSzY_ = 0; … … 635 671 636 672 673 637 674 nPix_ = 0; 638 675 … … 699 736 { 700 737 738 pixelSized_ = lm.pixelSized_; 739 angleSized_ = lm.angleSized_; 740 originSet_ = lm.originSet_ ; 741 742 701 743 nSzX_ = lm.nSzX_; 702 744 nSzY_ = lm.nSzY_; … … 721 763 deltaTheta_ = lm.deltaTheta_; 722 764 } 765 766 template<class T> 767 void 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 723 778 724 779 // ...... Operations de calcul ......
Note:
See TracChangeset
for help on using the changeset viewer.