| [2615] | 1 | #include "sopnamsp.h" | 
|---|
| [2610] | 2 | #include "sphereecp.h" | 
|---|
|  | 3 | #include <math.h> | 
|---|
|  | 4 |  | 
|---|
| [2808] | 5 | /*! | 
|---|
|  | 6 | \class SOPHYA::SphereECP | 
|---|
|  | 7 | \ingroup SkyMap | 
|---|
|  | 8 | \brief Spherical maps in Equatorial Cylindrical Projection | 
|---|
|  | 9 |  | 
|---|
|  | 10 | Class implementing spherical maps, with a pixelisation | 
|---|
|  | 11 | corresponding to the an Equatorial Cylindrical Projection. | 
|---|
|  | 12 | Pixel size varie from equator to poles. The sphere is divided | 
|---|
|  | 13 | into a number of slices along the parallels. Each slice is subdivided | 
|---|
|  | 14 | into the same number of pixels. | 
|---|
|  | 15 | This class provides the possibility to have partial coverage. | 
|---|
|  | 16 | Can be used for the following types: <br> | 
|---|
|  | 17 | <tt> int_4 , r_4 , r_8 , complex<r_4> , complex<r_8> </tt> | 
|---|
|  | 18 | */ | 
|---|
|  | 19 |  | 
|---|
| [2610] | 20 | namespace SOPHYA { | 
|---|
|  | 21 |  | 
|---|
| [2808] | 22 | //! Default constructor | 
|---|
| [2610] | 23 | template <class T> | 
|---|
|  | 24 | SphereECP<T>::SphereECP() | 
|---|
|  | 25 | : _pixels() | 
|---|
|  | 26 | { | 
|---|
|  | 27 | _partial = false; | 
|---|
|  | 28 | _theta1 = 0.; | 
|---|
|  | 29 | _theta2 = M_PI; | 
|---|
|  | 30 | _phi1 = 0.; | 
|---|
|  | 31 | _phi2 = 2*M_PI; | 
|---|
|  | 32 | _outofmapidx = -99; | 
|---|
| [2621] | 33 | _outofmapnphi = 0; | 
|---|
|  | 34 | _outofmapntet = 0; | 
|---|
| [2610] | 35 | _outofmappix = 0; | 
|---|
|  | 36 | _outofmapval = 0; | 
|---|
|  | 37 | _dtheta = 0.; | 
|---|
|  | 38 | _dphi = 0.; | 
|---|
|  | 39 | } | 
|---|
|  | 40 |  | 
|---|
| [2808] | 41 | /*! | 
|---|
|  | 42 | \brief  Constructor with the pixelisation parameter m | 
|---|
|  | 43 |  | 
|---|
|  | 44 | Complete coverage. | 
|---|
|  | 45 | The sphere is divided into \b m slices in theta (0..pi). each slice is divided | 
|---|
|  | 46 | into \b 2m pixels (along phi) | 
|---|
|  | 47 | */ | 
|---|
| [2610] | 48 | template <class T> | 
|---|
|  | 49 | SphereECP<T>::SphereECP(int m) | 
|---|
|  | 50 | : _pixels(2*m,m,0,0,0,true) | 
|---|
|  | 51 | { | 
|---|
|  | 52 | _partial = false; | 
|---|
|  | 53 | _theta1 = 0.; | 
|---|
|  | 54 | _theta2 = M_PI; | 
|---|
|  | 55 | _phi1 = 0.; | 
|---|
|  | 56 | _phi2 = 2*M_PI; | 
|---|
|  | 57 | _outofmapidx = -99; | 
|---|
| [2621] | 58 | _outofmapnphi = 0; | 
|---|
|  | 59 | _outofmapntet = 0; | 
|---|
| [2610] | 60 | _outofmappix = 0; | 
|---|
|  | 61 | _outofmapval = 0; | 
|---|
|  | 62 | _dtheta = _dphi = M_PI/m; | 
|---|
|  | 63 | } | 
|---|
|  | 64 |  | 
|---|
| [2808] | 65 | /*! | 
|---|
|  | 66 | Complete coverage. | 
|---|
|  | 67 | \b ntet slices in theta (0..pi) and \b nphi pixels (along phi) for | 
|---|
|  | 68 | each slice in theta | 
|---|
|  | 69 | */ | 
|---|
| [2610] | 70 | template <class T> | 
|---|
|  | 71 | SphereECP<T>::SphereECP(int ntet, int nphi) | 
|---|
|  | 72 | : _pixels(nphi,ntet,0,0,0,true) | 
|---|
|  | 73 | { | 
|---|
|  | 74 | _partial = false; | 
|---|
|  | 75 | _theta1 = 0.; | 
|---|
|  | 76 | _theta2 = M_PI; | 
|---|
|  | 77 | _phi1 = 0.; | 
|---|
|  | 78 | _phi2 = 2*M_PI; | 
|---|
|  | 79 | _outofmapidx = -99; | 
|---|
| [2621] | 80 | _outofmapnphi = 0; | 
|---|
|  | 81 | _outofmapntet = 0; | 
|---|
| [2610] | 82 | _outofmappix = 0; | 
|---|
|  | 83 | _outofmapval = 0; | 
|---|
|  | 84 | _dtheta = M_PI/ntet; | 
|---|
|  | 85 | _dphi = 2*M_PI/nphi; | 
|---|
|  | 86 | } | 
|---|
|  | 87 |  | 
|---|
| [2808] | 88 | /*! | 
|---|
|  | 89 | Partial coverage : | 
|---|
|  | 90 | \b ntet slices in theta , in the range (tet1 .. tet2) and \b nphi pixels (along phi) for | 
|---|
|  | 91 | each slice in theta in the range (phi1 .. phi2) | 
|---|
|  | 92 | */ | 
|---|
| [2610] | 93 | template <class T> | 
|---|
|  | 94 | SphereECP<T>::SphereECP(r_8 tet1, r_8 tet2, int ntet, r_8 phi1, r_8 phi2, int nphi) | 
|---|
|  | 95 | : _pixels(nphi,ntet,0,0,0,true) | 
|---|
|  | 96 | { | 
|---|
|  | 97 | if( (tet1 > M_PI) || (tet1 < 0.) || (tet2 > M_PI) || (tet2 < 0.) || | 
|---|
|  | 98 | (phi1 < 0.) || (phi1 > 2*M_PI) || (phi1 < 0.) || (phi1 > 2*M_PI) || | 
|---|
|  | 99 | (tet2 <= tet1) || (phi2 <= phi1) ) | 
|---|
|  | 100 | throw  ParmError("SphereECP::SphereECP() Bad range for theta/phi limits"); | 
|---|
|  | 101 |  | 
|---|
|  | 102 | _partial = true; | 
|---|
|  | 103 | _theta1 = tet1; | 
|---|
|  | 104 | _theta2 = tet2; | 
|---|
|  | 105 | _phi1 = phi1; | 
|---|
|  | 106 | _phi2 = phi2; | 
|---|
|  | 107 | _outofmapidx = _pixels.Size()+659; | 
|---|
| [2621] | 108 | // Reza, 23 sep 2004 | 
|---|
|  | 109 | // pour des cartes partielles, et des pixels sur la sphere, mais | 
|---|
|  | 110 | // en dehors de la couverture, on code le numero de tranche en theta, | 
|---|
|  | 111 | // compte a partir de theta=0,phi=0 +  _outofmapidx | 
|---|
|  | 112 | // theta -> idx =  _outofmapidx + theta/_dtheta*_outofmapnphi +  _outofmapntet | 
|---|
|  | 113 | _outofmapntet = 0; | 
|---|
| [2610] | 114 | _outofmappix = 0; | 
|---|
|  | 115 | _outofmapval = 0; | 
|---|
|  | 116 | _dtheta = (_theta2-_theta1)/ntet; | 
|---|
|  | 117 | _dphi = (_phi2-_phi1)/nphi; | 
|---|
| [2621] | 118 |  | 
|---|
|  | 119 | _outofmapntet = M_PI/_dtheta; | 
|---|
|  | 120 | _outofmapnphi = 2*M_PI/_dphi; | 
|---|
| [2610] | 121 | } | 
|---|
|  | 122 |  | 
|---|
| [2808] | 123 | //! Copy constructor - shares the pixel data if \b share=true | 
|---|
| [2610] | 124 | template <class T> | 
|---|
|  | 125 | SphereECP<T>::SphereECP(const SphereECP<T>& a, bool share) | 
|---|
|  | 126 | : _pixels(a._pixels, share) | 
|---|
|  | 127 | { | 
|---|
|  | 128 | _partial = a._partial; | 
|---|
|  | 129 | _theta1 = a._theta1; | 
|---|
|  | 130 | _theta2 = a._theta2; | 
|---|
|  | 131 | _phi1 = a._phi1; | 
|---|
|  | 132 | _phi2 = a._phi2; | 
|---|
|  | 133 | _outofmapidx = a._outofmapidx; | 
|---|
| [2621] | 134 | _outofmapnphi = a._outofmapnphi; | 
|---|
|  | 135 | _outofmapntet = a._outofmapntet; | 
|---|
| [2610] | 136 | _outofmappix = a._outofmappix; | 
|---|
|  | 137 | _outofmapval = a._outofmapval; | 
|---|
|  | 138 | _dtheta = a._dtheta; | 
|---|
|  | 139 | _dphi = a._dphi; | 
|---|
|  | 140 | } | 
|---|
|  | 141 |  | 
|---|
| [2808] | 142 | //! Copy constructor - shares the pixel data | 
|---|
| [2610] | 143 | template <class T> | 
|---|
|  | 144 | SphereECP<T>::SphereECP(const SphereECP<T>& a) | 
|---|
|  | 145 | : _pixels(a._pixels) | 
|---|
|  | 146 | { | 
|---|
|  | 147 | _partial = a._partial; | 
|---|
|  | 148 | _theta1 = a._theta1; | 
|---|
|  | 149 | _theta2 = a._theta2; | 
|---|
|  | 150 | _phi1 = a._phi1; | 
|---|
|  | 151 | _phi2 = a._phi2; | 
|---|
|  | 152 | _outofmapidx = a._outofmapidx; | 
|---|
| [2621] | 153 | _outofmapnphi = a._outofmapnphi; | 
|---|
|  | 154 | _outofmapntet = a._outofmapntet; | 
|---|
| [2610] | 155 | _outofmappix = a._outofmappix; | 
|---|
|  | 156 | _outofmapval = a._outofmapval; | 
|---|
|  | 157 | _dtheta = a._dtheta; | 
|---|
|  | 158 | _dphi = a._dphi; | 
|---|
|  | 159 | } | 
|---|
|  | 160 |  | 
|---|
|  | 161 | template <class T> | 
|---|
|  | 162 | SphereECP<T>::~SphereECP() | 
|---|
|  | 163 | { | 
|---|
|  | 164 | } | 
|---|
|  | 165 |  | 
|---|
|  | 166 | template <class T> | 
|---|
|  | 167 | string SphereECP<T>::TypeOfMap() const | 
|---|
|  | 168 | { | 
|---|
| [2990] | 169 | return string("ECP"); | 
|---|
| [2610] | 170 | } | 
|---|
|  | 171 |  | 
|---|
|  | 172 | template <class T> | 
|---|
|  | 173 | void SphereECP<T>::SetTemp(bool temp) const | 
|---|
|  | 174 | { | 
|---|
|  | 175 | _pixels.SetTemp(temp); | 
|---|
|  | 176 | } | 
|---|
|  | 177 |  | 
|---|
|  | 178 | template <class T> | 
|---|
|  | 179 | int_4 SphereECP<T>::NbPixels() const | 
|---|
|  | 180 | { | 
|---|
|  | 181 | return _pixels.Size(); | 
|---|
|  | 182 | } | 
|---|
|  | 183 |  | 
|---|
|  | 184 | template <class T> | 
|---|
|  | 185 | T& SphereECP<T>::PixVal(int_4 k) | 
|---|
|  | 186 | { | 
|---|
| [2621] | 187 | // On pourrait etre plus strict en demandant aussi k<_outofmapidx+_outofmapnphi*_outofmapntet (Reza 23/09/04) | 
|---|
|  | 188 | if ((_partial) && (k>=_outofmapidx))   return _outofmappix; | 
|---|
| [2610] | 189 | if((k < 0) || (k >= _pixels.Size()) ) | 
|---|
|  | 190 | throw RangeCheckError("SphereECP::PIxVal() Pixel index out of range"); | 
|---|
|  | 191 | return _pixels.DataBlock()(k); | 
|---|
|  | 192 | } | 
|---|
|  | 193 |  | 
|---|
|  | 194 | template <class T> | 
|---|
|  | 195 | T const& SphereECP<T>::PixVal(int_4 k)  const | 
|---|
|  | 196 | { | 
|---|
| [2621] | 197 | // On pourrait etre plus strict en demandant aussi k<_outofmapidx+_outofmapnphi*_outofmapntet (Reza 23/09/04) | 
|---|
|  | 198 | if ((_partial) && (k>=_outofmapidx))   return _outofmapval; | 
|---|
| [2610] | 199 | if((k < 0) || (k >= _pixels.Size()) ) | 
|---|
|  | 200 | throw RangeCheckError("SphereECP::PIxVal() Pixel index out of range"); | 
|---|
|  | 201 | //  return _pixels.DataBlock()(k); | 
|---|
|  | 202 | return _pixels.Data()[k]; | 
|---|
|  | 203 | } | 
|---|
|  | 204 |  | 
|---|
|  | 205 | template <class T> | 
|---|
|  | 206 | bool  SphereECP<T>::ContainsSph(double theta, double phi) const | 
|---|
|  | 207 | { | 
|---|
|  | 208 | if (_partial) { | 
|---|
|  | 209 | if ( (theta >= _theta1) && (theta <= _theta2) && | 
|---|
|  | 210 | (phi >= _phi1) && (phi <= _phi2) )  return true; | 
|---|
|  | 211 | else return false; | 
|---|
|  | 212 | } | 
|---|
|  | 213 | else return false; | 
|---|
|  | 214 | } | 
|---|
|  | 215 |  | 
|---|
|  | 216 | template <class T> | 
|---|
|  | 217 | int_4  SphereECP<T>::PixIndexSph(double theta, double phi) const | 
|---|
|  | 218 | { | 
|---|
|  | 219 | if((theta > M_PI) || (theta < 0.)) return(-1); | 
|---|
|  | 220 | if((phi < 0.) || (phi > 2*M_PI)) return(-1); | 
|---|
|  | 221 | if (_partial) { | 
|---|
|  | 222 | if ( (theta < _theta1) || (theta > _theta2) || | 
|---|
| [2621] | 223 | (phi < _phi1) || (phi > _phi2) )  return _outofmapidx+theta/_dtheta*_outofmapnphi+phi/_dphi; | 
|---|
| [2610] | 224 | } | 
|---|
|  | 225 | int_4 it = (theta-_theta1)/_dtheta; | 
|---|
|  | 226 | int_4 jp = (phi-_phi1)/_dphi; | 
|---|
|  | 227 | return (it*_pixels.SizeX()+jp); | 
|---|
|  | 228 | } | 
|---|
|  | 229 |  | 
|---|
|  | 230 | template <class T> | 
|---|
|  | 231 | void  SphereECP<T>::PixThetaPhi(int_4 k, double& theta, double& phi) const | 
|---|
|  | 232 | { | 
|---|
| [2621] | 233 | if ((_partial) && (k>=_outofmapidx)) { | 
|---|
|  | 234 | theta = (((k-_outofmapidx) / _outofmapnphi)+0.5)*_dtheta; | 
|---|
|  | 235 | phi = (((k-_outofmapidx) % _outofmapnphi)+0.5)*_dphi;; | 
|---|
| [2610] | 236 | return; | 
|---|
|  | 237 | } | 
|---|
|  | 238 | if((k < 0) || (k >= _pixels.Size()) ) | 
|---|
|  | 239 | throw RangeCheckError("SphereECP::PixThetaPhi() Pixel index out of range"); | 
|---|
|  | 240 |  | 
|---|
|  | 241 | int_4 it = k / _pixels.SizeX(); | 
|---|
|  | 242 | int_4 jp = k % _pixels.SizeX(); | 
|---|
| [2621] | 243 | theta = _theta1+(it+0.5)*_dtheta; | 
|---|
|  | 244 | phi = _phi1*(jp+0.5)*_dphi; | 
|---|
| [2610] | 245 | return; | 
|---|
|  | 246 | } | 
|---|
|  | 247 |  | 
|---|
|  | 248 | template <class T> | 
|---|
|  | 249 | T  SphereECP<T>::SetPixels(T v) | 
|---|
|  | 250 | { | 
|---|
|  | 251 | _pixels = v; | 
|---|
|  | 252 | return v; | 
|---|
|  | 253 | } | 
|---|
|  | 254 |  | 
|---|
|  | 255 | template <class T> | 
|---|
|  | 256 | double  SphereECP<T>::PixSolAngle(int_4 k) const | 
|---|
|  | 257 | { | 
|---|
| [2621] | 258 | if ((_partial) && (k>=_outofmapidx)) { | 
|---|
|  | 259 | double theta = (((k-_outofmapidx) / _outofmapnphi)+0.5)*_dtheta; | 
|---|
|  | 260 | return (_dtheta*_dphi*sin(theta)); | 
|---|
|  | 261 | } | 
|---|
|  | 262 | if((k < 0) || (k >= _pixels.Size()) ) | 
|---|
|  | 263 | throw RangeCheckError("SphereECP::PixSolAngle(int_4 k) Pixel index out of range"); | 
|---|
|  | 264 |  | 
|---|
| [2610] | 265 | int_4 it = k / _pixels.SizeX(); | 
|---|
|  | 266 | double theta = _theta1+it*_dtheta; | 
|---|
|  | 267 | return (_dtheta*_dphi*sin(theta)); | 
|---|
|  | 268 | } | 
|---|
|  | 269 |  | 
|---|
|  | 270 | template <class T> | 
|---|
|  | 271 | int_4  SphereECP<T>::SizeIndex() const | 
|---|
|  | 272 | { | 
|---|
|  | 273 | return _pixels.SizeY(); | 
|---|
|  | 274 | } | 
|---|
|  | 275 |  | 
|---|
|  | 276 | template <class T> | 
|---|
|  | 277 | void  SphereECP<T>::Resize(int_4 m) | 
|---|
|  | 278 | { | 
|---|
|  | 279 | if ( (m <= 0) || ( m == _pixels.SizeY()) ) { | 
|---|
|  | 280 | cout << " SphereECP<T>::Resize(int_4 " << m << ") m<0 ou m=NTheta - Ne fait rien " << endl; | 
|---|
|  | 281 | return; | 
|---|
|  | 282 | } | 
|---|
|  | 283 | int mphi = m; | 
|---|
|  | 284 | if (_pixels.Size() > 0)  mphi = m*_pixels.SizeX()/_pixels.SizeY(); | 
|---|
|  | 285 | cout << " SphereECP<T>::Resize(" << m | 
|---|
|  | 286 | << ") -> _pixels.Resize(" << mphi << "," << m << ")" << endl; | 
|---|
|  | 287 | sa_size_t sz[5] = {0,0,0,0,0}; | 
|---|
|  | 288 | sz[0] = mphi;  sz[1] = m; | 
|---|
|  | 289 | _pixels.ReSize(2,sz); | 
|---|
|  | 290 | _outofmapidx = _pixels.Size()+659; | 
|---|
|  | 291 | _dtheta = (_theta2-_theta1)/m; | 
|---|
|  | 292 | _dphi = (_phi2-_phi1)/mphi; | 
|---|
| [2621] | 293 |  | 
|---|
|  | 294 | _outofmapntet = M_PI/_dtheta; | 
|---|
|  | 295 | _outofmapnphi = 2*M_PI/_dphi; | 
|---|
| [2610] | 296 | return; | 
|---|
|  | 297 | } | 
|---|
|  | 298 |  | 
|---|
|  | 299 | template <class T> | 
|---|
|  | 300 | uint_4  SphereECP<T>::NbThetaSlices() const | 
|---|
|  | 301 | { | 
|---|
|  | 302 | return _pixels.SizeY(); | 
|---|
|  | 303 | } | 
|---|
|  | 304 |  | 
|---|
|  | 305 | template <class T> | 
|---|
| [2968] | 306 | r_8  SphereECP<T>::ThetaOfSlice(int_4 index) const | 
|---|
|  | 307 | { | 
|---|
|  | 308 | if( (index < 0) || (index >= _pixels.SizeY()) ) | 
|---|
|  | 309 | throw RangeCheckError("SphereECP::ThetaOfSlice() theta index out of range"); | 
|---|
|  | 310 | return (_theta1 + (index+0.5)*_dtheta); | 
|---|
|  | 311 |  | 
|---|
|  | 312 | } | 
|---|
|  | 313 |  | 
|---|
|  | 314 | template <class T> | 
|---|
| [2610] | 315 | void  SphereECP<T>::GetThetaSlice(int_4 index,r_8& theta, | 
|---|
|  | 316 | TVector<r_8>& phi, TVector<T>& value) const | 
|---|
|  | 317 | { | 
|---|
|  | 318 | if( (index < 0) || (index >= _pixels.SizeY()) ) | 
|---|
| [2968] | 319 | throw RangeCheckError("SphereECP::GetThetaSlice() index out of range"); | 
|---|
| [2610] | 320 |  | 
|---|
| [2621] | 321 | theta = _theta1 + (index+0.5)*_dtheta; | 
|---|
| [2610] | 322 | int_4 nphit = 2.*M_PI/_dphi; | 
|---|
|  | 323 | phi.ReSize(nphit); | 
|---|
|  | 324 | value.ReSize(nphit); | 
|---|
|  | 325 | int_4 ioff = _phi1/_dphi; | 
|---|
|  | 326 | int_4 i; | 
|---|
|  | 327 | for(i=0; i<ioff; i++) { | 
|---|
| [2621] | 328 | phi(i) = _phi1 + (i-ioff+0.5)*_dphi; | 
|---|
| [2610] | 329 | value(i) = _outofmapval; | 
|---|
|  | 330 | } | 
|---|
|  | 331 | for(i=ioff; i<ioff+_pixels.SizeX(); i++) { | 
|---|
| [2621] | 332 | phi(i) = _phi1 + (i-ioff+0.5)*_dphi; | 
|---|
| [2610] | 333 | value(i) = _pixels(i-ioff,index,0); | 
|---|
|  | 334 | } | 
|---|
|  | 335 | for(i=ioff+_pixels.SizeX(); i<nphit; i++) { | 
|---|
| [2621] | 336 | phi(i) = _phi1 + (i-ioff+0.5)*_dphi; | 
|---|
| [2610] | 337 | value(i) = _outofmapval; | 
|---|
|  | 338 | } | 
|---|
|  | 339 | return; | 
|---|
|  | 340 | } | 
|---|
|  | 341 |  | 
|---|
|  | 342 | template <class T> | 
|---|
|  | 343 | void  SphereECP<T>::GetThetaSlice(int_4 index, r_8& theta, r_8& phi0, | 
|---|
|  | 344 | TVector<int_4>& pixidx, TVector<T>& value) const | 
|---|
|  | 345 | { | 
|---|
|  | 346 | if( (index < 0) || (index >= _pixels.SizeY()) ) | 
|---|
| [2968] | 347 | throw RangeCheckError("SphereECP::GetThetaSlice() index out of range"); | 
|---|
| [2610] | 348 |  | 
|---|
| [2621] | 349 | theta = _theta1 + (index+0.5)*_dtheta; | 
|---|
| [2610] | 350 | int_4 ioff = _phi1/_dphi; | 
|---|
| [2621] | 351 | phi0 = _phi1 - (ioff-0.5)*_dphi; | 
|---|
| [2610] | 352 |  | 
|---|
|  | 353 | int_4 nphit = 2.*M_PI/_dphi; | 
|---|
|  | 354 | pixidx.ReSize(nphit); | 
|---|
|  | 355 | value.ReSize(nphit); | 
|---|
|  | 356 |  | 
|---|
|  | 357 | int_4 i; | 
|---|
|  | 358 | for(i=0; i<ioff; i++) { | 
|---|
| [2621] | 359 | pixidx(i) = _outofmapidx+theta/_dtheta*_outofmapnphi+phi0/_dphi+i; | 
|---|
| [2610] | 360 | value(i) = _outofmapval; | 
|---|
|  | 361 | } | 
|---|
|  | 362 | for(i=ioff; i<ioff+_pixels.SizeX(); i++) { | 
|---|
|  | 363 | pixidx(i) = index*_pixels.SizeX()+(i-ioff); | 
|---|
|  | 364 | value(i) = _pixels(i-ioff,index,0); | 
|---|
|  | 365 | } | 
|---|
|  | 366 | for(i=ioff+_pixels.SizeX(); i<nphit; i++) { | 
|---|
| [2621] | 367 | pixidx(i) = _outofmapidx+theta/_dtheta*_outofmapnphi+phi0/_dphi+i; | 
|---|
| [2610] | 368 | value(i) = _outofmapval; | 
|---|
|  | 369 | } | 
|---|
|  | 370 | return; | 
|---|
|  | 371 |  | 
|---|
|  | 372 | } | 
|---|
|  | 373 |  | 
|---|
|  | 374 | template <class T> | 
|---|
| [2990] | 375 | T*  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(); | 
|---|
|  | 382 | } | 
|---|
|  | 383 |  | 
|---|
|  | 384 | template <class T> | 
|---|
| [2973] | 385 | void  SphereECP<T>::Show(ostream& os) const | 
|---|
| [2610] | 386 | { | 
|---|
| [2995] | 387 | PixelMap<T>::Show(os); | 
|---|
| [2610] | 388 | if (_partial) | 
|---|
|  | 389 | os << "SphereECP<T>::Print() - Partial ECP Map NPhi=" << _pixels.SizeX() | 
|---|
| [2620] | 390 | << " x NTheta= " <<  _pixels.SizeY() << " SolidAngle=" << PixSolAngle() << "\n" | 
|---|
| [2610] | 391 | << "ThetaLimits= " << _theta1 << " .. " << _theta2 | 
|---|
|  | 392 | << "  PhiLimits= " << _phi1 << " .. " << _phi2 << endl; | 
|---|
|  | 393 | else | 
|---|
|  | 394 | os << "SphereECP<T>::Print() - Full ECP Map NPhi=" << _pixels.SizeX() | 
|---|
|  | 395 | << " x NTheta= " <<  _pixels.SizeY() << " SolidAngle=" << PixSolAngle() << endl; | 
|---|
| [2973] | 396 | } | 
|---|
|  | 397 |  | 
|---|
|  | 398 | template <class T> | 
|---|
|  | 399 | void  SphereECP<T>::Print(ostream& os) const | 
|---|
|  | 400 | { | 
|---|
|  | 401 | Show(os); | 
|---|
| [2610] | 402 | os << _pixels; | 
|---|
|  | 403 | } | 
|---|
|  | 404 |  | 
|---|
|  | 405 | template <class T> | 
|---|
|  | 406 | SphereECP<T>&  SphereECP<T>::Set(const SphereECP<T>& a) | 
|---|
|  | 407 | { | 
|---|
|  | 408 | _pixels.Set(a._pixels); | 
|---|
|  | 409 | _partial = a._partial; | 
|---|
|  | 410 | _theta1 = a._theta1; | 
|---|
|  | 411 | _theta2 = a._theta2; | 
|---|
|  | 412 | _phi1 = a._phi1; | 
|---|
|  | 413 | _phi2 = a._phi2; | 
|---|
|  | 414 | _outofmapidx = a._outofmapidx; | 
|---|
| [2621] | 415 | _outofmapnphi = a._outofmapnphi; | 
|---|
|  | 416 | _outofmapntet = a._outofmapntet; | 
|---|
| [2610] | 417 | _outofmappix = a._outofmappix; | 
|---|
|  | 418 | _outofmapval = a._outofmapval; | 
|---|
|  | 419 | _dtheta = a._dtheta; | 
|---|
|  | 420 | _dphi = a._dphi; | 
|---|
|  | 421 | return *this ; | 
|---|
|  | 422 | } | 
|---|
|  | 423 |  | 
|---|
|  | 424 | template <class T> | 
|---|
|  | 425 | SphereECP<T>&  SphereECP<T>::SetCst(T x) | 
|---|
|  | 426 | { | 
|---|
|  | 427 | _pixels.SetCst(x); | 
|---|
|  | 428 | return *this ; | 
|---|
|  | 429 | } | 
|---|
|  | 430 |  | 
|---|
|  | 431 | template <class T> | 
|---|
|  | 432 | SphereECP<T>&  SphereECP<T>::AddCst(T x) | 
|---|
|  | 433 | { | 
|---|
|  | 434 | _pixels += x; | 
|---|
|  | 435 | return *this ; | 
|---|
|  | 436 | } | 
|---|
|  | 437 |  | 
|---|
|  | 438 | template <class T> | 
|---|
|  | 439 | SphereECP<T>&  SphereECP<T>::MulCst(T x) | 
|---|
|  | 440 | { | 
|---|
|  | 441 | _pixels *= x; | 
|---|
|  | 442 | return *this ; | 
|---|
|  | 443 | } | 
|---|
|  | 444 |  | 
|---|
|  | 445 |  | 
|---|
|  | 446 |  | 
|---|
| [2882] | 447 | }// Fin du namespace | 
|---|
| [2610] | 448 |  | 
|---|
|  | 449 |  | 
|---|
|  | 450 | #ifdef __CXX_PRAGMA_TEMPLATES__ | 
|---|
|  | 451 | #pragma define_template SphereECP<int_4> | 
|---|
|  | 452 | #pragma define_template SphereECP<r_4> | 
|---|
|  | 453 | #pragma define_template SphereECP<r_8> | 
|---|
|  | 454 | #pragma define_template SphereECP< complex<r_4> > | 
|---|
|  | 455 | #pragma define_template SphereECP< complex<r_8> > | 
|---|
|  | 456 | #endif | 
|---|
|  | 457 | #if defined(ANSI_TEMPLATES) || defined(GNU_TEMPLATES) | 
|---|
| [2869] | 458 | namespace SOPHYA { | 
|---|
| [2610] | 459 | template class SphereECP<int_4>; | 
|---|
|  | 460 | template class SphereECP<r_4>; | 
|---|
|  | 461 | template class SphereECP<r_8>; | 
|---|
|  | 462 | template class SphereECP< complex<r_4> >; | 
|---|
|  | 463 | template class SphereECP< complex<r_8> >; | 
|---|
| [2869] | 464 | } | 
|---|
| [2610] | 465 | #endif | 
|---|
|  | 466 |  | 
|---|