[585] | 1 | #include "machdefs.h"
|
---|
| 2 | #include <stdlib.h>
|
---|
[594] | 3 | #include <math.h>
|
---|
[585] | 4 | #include <typeinfo>
|
---|
[2322] | 5 | #include <iostream>
|
---|
[585] | 6 | #include <string>
|
---|
| 7 | #include <complex>
|
---|
| 8 |
|
---|
[1224] | 9 | #include "datatype.h"
|
---|
| 10 |
|
---|
[585] | 11 | #include "nomskymapadapter.h"
|
---|
[855] | 12 | #include "skymap.h"
|
---|
[594] | 13 | #include "pitvmaad.h"
|
---|
| 14 | #include "complexios.h"
|
---|
[585] | 15 |
|
---|
[1321] | 16 | #include "fitsspherehealpix.h"
|
---|
| 17 | #include "fitslocalmap.h"
|
---|
| 18 |
|
---|
[2594] | 19 | // Valeur par defaut pour la projection MolleWeide, en dehors de la sphere
|
---|
| 20 | static double _prjmol_defval = 0.;
|
---|
| 21 | void Set_Project_Mol_DefVal(double def)
|
---|
| 22 | {
|
---|
| 23 | _prjmol_defval = def;
|
---|
| 24 | return;
|
---|
| 25 | }
|
---|
[1321] | 26 |
|
---|
[594] | 27 | // Classe array adapter pour localMap
|
---|
| 28 | template <class T>
|
---|
| 29 | class LocalMapArrAdapter : public P2DArrayAdapter {
|
---|
| 30 | public:
|
---|
| 31 | LocalMapArrAdapter(LocalMap<T>* lm, bool d=false) :
|
---|
[1164] | 32 | P2DArrayAdapter(lm->SizeX(), lm->SizeY())
|
---|
[594] | 33 | { ad = d; map = lm; }
|
---|
[585] | 34 |
|
---|
[594] | 35 | virtual ~LocalMapArrAdapter() { if (ad) delete map; }
|
---|
| 36 | virtual double Value(int ix, int iy) { return((*map)(ix, iy)); }
|
---|
| 37 |
|
---|
| 38 | protected :
|
---|
| 39 | bool ad;
|
---|
| 40 | LocalMap<T>* map;
|
---|
| 41 | };
|
---|
| 42 |
|
---|
| 43 | /* --Methode-- */
|
---|
[2343] | 44 | DECL_TEMP_SPEC /* equivalent a template <> , pour SGI-CC en particulier */
|
---|
[594] | 45 | double LocalMapArrAdapter< complex<float> >::Value(int ix, int iy)
|
---|
| 46 | {
|
---|
| 47 | double re,im;
|
---|
| 48 | re = (*map)(iy, ix).real();
|
---|
| 49 | im = (*map)(iy, ix).imag();
|
---|
| 50 | return(sqrt(re*re+im*im));
|
---|
| 51 | }
|
---|
| 52 | /* --Methode-- */
|
---|
[2343] | 53 | DECL_TEMP_SPEC /* equivalent a template <> , pour SGI-CC en particulier */
|
---|
[594] | 54 | double LocalMapArrAdapter< complex<double> >::Value(int ix, int iy)
|
---|
| 55 | {
|
---|
| 56 | double re,im;
|
---|
| 57 | re = (*map)(iy, ix).real();
|
---|
| 58 | im = (*map)(iy, ix).imag();
|
---|
| 59 | return(sqrt(re*re+im*im));
|
---|
| 60 | }
|
---|
| 61 |
|
---|
[585] | 62 | //----------------------------------------------------------------
|
---|
| 63 | // Class Adaptateur d'objet (Pour NamedObjMgr) d'objet PixelMap<T>
|
---|
| 64 | //----------------------------------------------------------------
|
---|
| 65 |
|
---|
| 66 |
|
---|
| 67 | /* --Methode-- */
|
---|
| 68 | template <class T>
|
---|
| 69 | NOMAdapter_PixelMap<T>::NOMAdapter_PixelMap(PixelMap<T> * o)
|
---|
[594] | 70 | : NObjMgrAdapter(o)
|
---|
[585] | 71 | {
|
---|
| 72 | mMap = o;
|
---|
| 73 | }
|
---|
| 74 |
|
---|
| 75 | /* --Methode-- */
|
---|
| 76 | template <class T>
|
---|
| 77 | NOMAdapter_PixelMap<T>::~NOMAdapter_PixelMap()
|
---|
| 78 | {
|
---|
| 79 | }
|
---|
| 80 |
|
---|
| 81 | /* --Methode-- */
|
---|
| 82 | template <class T>
|
---|
| 83 | NObjMgrAdapter* NOMAdapter_PixelMap<T>::Clone(AnyDataObj* o)
|
---|
| 84 | {
|
---|
| 85 | PixelMap<T>* m = dynamic_cast<PixelMap<T> *>(o);
|
---|
| 86 | if (m) return ( new NOMAdapter_PixelMap<T>(m) );
|
---|
| 87 | return ( new NObjMgrAdapter(o) );
|
---|
| 88 | }
|
---|
| 89 |
|
---|
| 90 | /* --Methode-- */
|
---|
| 91 | template <class T>
|
---|
[1165] | 92 | string NOMAdapter_PixelMap<T>::GetDataObjType()
|
---|
[585] | 93 | {
|
---|
[1165] | 94 | string type = "PixelMap< ";
|
---|
[585] | 95 | LocalMap<T>* lm = dynamic_cast< LocalMap<T> * >(mMap);
|
---|
[1165] | 96 | if (lm != NULL) type = "LocalMap< ";
|
---|
| 97 | SphereThetaPhi<T>* st = dynamic_cast< SphereThetaPhi<T> * >(mMap);
|
---|
| 98 | if (st != NULL) type = "SphereThetaPhi< ";
|
---|
| 99 | SphereHEALPix<T>* sg = dynamic_cast< SphereHEALPix<T> * >(mMap);
|
---|
| 100 | if (sg != NULL) type = "SphereHEALPix< ";
|
---|
| 101 |
|
---|
[1224] | 102 | // type += DecodeTypeIdName(typeid(T).name());
|
---|
[1237] | 103 | type += DataTypeInfo<T>::getTypeName();
|
---|
[1165] | 104 | type += " > ";
|
---|
| 105 | return(type);
|
---|
| 106 | }
|
---|
| 107 |
|
---|
| 108 | /* --Methode-- */
|
---|
| 109 | template <class T>
|
---|
[1315] | 110 | AnyDataObj* NOMAdapter_PixelMap<T>::CloneDataObj(bool share)
|
---|
[1165] | 111 | {
|
---|
| 112 | LocalMap<T>* lm = dynamic_cast< LocalMap<T> * >(mMap);
|
---|
[1315] | 113 | if (lm != NULL) return( new LocalMap<T>(*lm, share) );
|
---|
[585] | 114 | SphereThetaPhi<T>* st = dynamic_cast< SphereThetaPhi<T> * >(mMap);
|
---|
[1315] | 115 | if (st != NULL) return( new SphereThetaPhi<T>(*st, share) );
|
---|
[855] | 116 | SphereHEALPix<T>* sg = dynamic_cast< SphereHEALPix<T> * >(mMap);
|
---|
[1315] | 117 | if (sg != NULL) return( new SphereHEALPix<T>(*sg, share) );
|
---|
[585] | 118 | return(NULL);
|
---|
| 119 | }
|
---|
| 120 |
|
---|
| 121 | /* --Methode-- */
|
---|
| 122 | template <class T>
|
---|
[1321] | 123 | void NOMAdapter_PixelMap<T>::ReadFits(string const & flnm)
|
---|
| 124 | {
|
---|
| 125 | LocalMap<T>* lm = dynamic_cast< LocalMap<T> * >(mMap);
|
---|
| 126 | if (lm != NULL) {
|
---|
| 127 | FitsInFile fis(flnm);
|
---|
| 128 | fis >> (*lm);
|
---|
| 129 | return;
|
---|
| 130 | }
|
---|
| 131 | SphereHEALPix<T>* sg = dynamic_cast< SphereHEALPix<T> * >(mMap);
|
---|
| 132 | if (sg != NULL) {
|
---|
| 133 | FitsInFile fis(flnm);
|
---|
| 134 | fis >> (*sg);
|
---|
| 135 | return;
|
---|
| 136 | }
|
---|
| 137 | string s = typeid(*mMap).name();
|
---|
| 138 | cout << " NOMAdapter_PixelMap<T>::ReadFits() - Error "
|
---|
| 139 | << " Not supported for " << s << endl;
|
---|
| 140 | return;
|
---|
| 141 | }
|
---|
| 142 |
|
---|
| 143 |
|
---|
| 144 | /* --Methode-- */
|
---|
| 145 | template <class T>
|
---|
| 146 | void NOMAdapter_PixelMap<T>::SaveFits(string const & flnm)
|
---|
| 147 | {
|
---|
| 148 | LocalMap<T>* lm = dynamic_cast< LocalMap<T> * >(mMap);
|
---|
| 149 | if (lm != NULL) {
|
---|
| 150 | FitsOutFile fos(flnm);
|
---|
| 151 | fos << (*lm);
|
---|
| 152 | return;
|
---|
| 153 | }
|
---|
| 154 | SphereHEALPix<T>* sg = dynamic_cast< SphereHEALPix<T> * >(mMap);
|
---|
| 155 | if (sg != NULL) {
|
---|
| 156 | FitsOutFile fos(flnm);
|
---|
| 157 | fos << (*sg);
|
---|
| 158 | return;
|
---|
| 159 | }
|
---|
| 160 | string s = typeid(*mMap).name();
|
---|
| 161 | cout << " NOMAdapter_PixelMap<T>::SaveFits() - Error "
|
---|
| 162 | << " Not supported for " << s << endl;
|
---|
| 163 | return;
|
---|
| 164 | }
|
---|
| 165 |
|
---|
| 166 | // ---- Specialisation pour complexes -----
|
---|
[2343] | 167 | DECL_TEMP_SPEC /* equivalent a template <> , pour SGI-CC en particulier */
|
---|
[1321] | 168 | void NOMAdapter_PixelMap< complex<r_4> >::ReadFits(string const & flnm)
|
---|
| 169 | {
|
---|
| 170 | cout << " void NOMAdapter_PixelMap< complex<r_4> >::ReadFits() - Error "
|
---|
| 171 | << " Not supported (complex data type)" << endl;
|
---|
| 172 | }
|
---|
[2343] | 173 | DECL_TEMP_SPEC /* equivalent a template <> , pour SGI-CC en particulier */
|
---|
[1321] | 174 | void NOMAdapter_PixelMap< complex<r_4> >::SaveFits(string const & flnm)
|
---|
| 175 | {
|
---|
| 176 | cout << " void NOMAdapter_PixelMap< complex<r_4> >::SaveFits() - Error "
|
---|
| 177 | << " Not supported (complex data type)" << endl;
|
---|
| 178 | }
|
---|
[2343] | 179 | DECL_TEMP_SPEC /* equivalent a template <> , pour SGI-CC en particulier */
|
---|
[1321] | 180 | void NOMAdapter_PixelMap< complex<r_8> >::ReadFits(string const & flnm)
|
---|
| 181 | {
|
---|
| 182 | cout << " void NOMAdapter_PixelMap< complex<r_4> >::ReadFits() - Error "
|
---|
| 183 | << " Not supported (complex data type)" << endl;
|
---|
| 184 | }
|
---|
[2343] | 185 | DECL_TEMP_SPEC /* equivalent a template <> , pour SGI-CC en particulier */
|
---|
[1321] | 186 | void NOMAdapter_PixelMap< complex<r_8> >::SaveFits(string const & flnm)
|
---|
| 187 | {
|
---|
| 188 | cout << " void NOMAdapter_PixelMap< complex<r_8> >::SaveFits() - Error "
|
---|
| 189 | << " Not supported (complex data type)" << endl;
|
---|
| 190 | }
|
---|
| 191 |
|
---|
| 192 |
|
---|
| 193 | /* --Methode-- */
|
---|
| 194 | template <class T>
|
---|
[585] | 195 | void NOMAdapter_PixelMap<T>::SavePPF(POutPersist& pos, string const & nom)
|
---|
| 196 | {
|
---|
| 197 | LocalMap<T>* lm = dynamic_cast< LocalMap<T> * >(mMap);
|
---|
| 198 | if (lm != NULL) {
|
---|
| 199 | FIO_LocalMap<T> fio(lm);
|
---|
| 200 | fio.Write(pos, nom);
|
---|
| 201 | return;
|
---|
| 202 | }
|
---|
| 203 | SphereThetaPhi<T>* st = dynamic_cast< SphereThetaPhi<T> * >(mMap);
|
---|
| 204 | if (st != NULL) {
|
---|
| 205 | FIO_SphereThetaPhi<T> fio(st);
|
---|
| 206 | fio.Write(pos, nom);
|
---|
| 207 | return;
|
---|
| 208 | }
|
---|
[855] | 209 | SphereHEALPix<T>* sg = dynamic_cast< SphereHEALPix<T> * >(mMap);
|
---|
[585] | 210 | if (sg != NULL) {
|
---|
[855] | 211 | FIO_SphereHEALPix<T> fio(sg);
|
---|
[585] | 212 | fio.Write(pos, nom);
|
---|
| 213 | return;
|
---|
| 214 | }
|
---|
| 215 | string s = typeid(*mMap).name();
|
---|
| 216 | cout << "NOMAdapter_PixelMap<T>::SavePPF() - Error : Not supported for " << s << endl;
|
---|
| 217 | }
|
---|
| 218 |
|
---|
| 219 | /* --Methode-- */
|
---|
| 220 | template <class T>
|
---|
| 221 | void NOMAdapter_PixelMap<T>::Print(ostream& os)
|
---|
| 222 | {
|
---|
| 223 | string s = typeid(*mMap).name();
|
---|
[594] | 224 | T moy, sig;
|
---|
| 225 | MeanSig(moy, sig);
|
---|
[585] | 226 | cout << "SkyMap Type: " << s << " NbPixels= " << mMap->NbPixels() << endl;
|
---|
[594] | 227 | cout << " Mean= " << moy << " Sig2= " << sig << endl;
|
---|
[585] | 228 | }
|
---|
| 229 |
|
---|
[1553] | 230 | // -- Fonction pour convertir un X,Y en Theta-Phi sur projection MolleWeide --
|
---|
| 231 | char * _SphMollweideProj_XY2ThetaPhi(P2DArrayAdapter * aa, int ix, int iy);
|
---|
[585] | 232 |
|
---|
| 233 | /* --Methode-- */
|
---|
| 234 | template <class T>
|
---|
| 235 | P2DArrayAdapter* NOMAdapter_PixelMap<T>::Get2DArray(string &)
|
---|
| 236 | {
|
---|
[594] | 237 | LocalMap<T>* lm = dynamic_cast< LocalMap<T> * >(mMap);
|
---|
| 238 | if (lm != NULL) return(new LocalMapArrAdapter<T>(lm, false));
|
---|
| 239 | int nr = 250;
|
---|
| 240 | int nc = 500;
|
---|
| 241 | SphericalMap<T>* sm = dynamic_cast< SphericalMap<T> *>(mMap);
|
---|
| 242 | if (sm != NULL) { nr = sqrt(0.75*mMap->NbPixels()); nc = 2*nr; }
|
---|
| 243 | TMatrix<T> * mtx = new TMatrix<T>(nr, nc);
|
---|
[2594] | 244 | Project_Mol(*mtx, (T)_prjmol_defval);
|
---|
[1553] | 245 | POTMatrixAdapter<T> * potma = new POTMatrixAdapter<T>(mtx, true);
|
---|
| 246 | potma->SetInfoStringFunction(_SphMollweideProj_XY2ThetaPhi);
|
---|
| 247 | return ( potma );
|
---|
[585] | 248 | }
|
---|
| 249 |
|
---|
| 250 | /* --Methode-- */
|
---|
| 251 | template <class T>
|
---|
| 252 | NTupleInterface* NOMAdapter_PixelMap<T>::GetNTupleInterface(bool& adel)
|
---|
| 253 | {
|
---|
| 254 | adel = true;
|
---|
| 255 | return( new NTupInt_PixelMap<T>(mMap) );
|
---|
| 256 | }
|
---|
| 257 |
|
---|
[594] | 258 | /* --Methode-- */
|
---|
| 259 | template <class T>
|
---|
| 260 | void NOMAdapter_PixelMap<T>::MeanSig(T& gmoy, T& gsig)
|
---|
| 261 | {
|
---|
| 262 | gmoy=0.;
|
---|
| 263 | gsig = 0.;
|
---|
| 264 | T valok;
|
---|
| 265 | for(int k=0; k<mMap->NbPixels(); k++) {
|
---|
| 266 | valok = (*mMap)(k);
|
---|
| 267 | gmoy += valok; gsig += valok*valok;
|
---|
| 268 | }
|
---|
| 269 | gmoy /= (T)mMap->NbPixels();
|
---|
| 270 | gsig = gsig/(T)mMap->NbPixels() - gmoy*gmoy;
|
---|
[585] | 271 |
|
---|
[594] | 272 | }
|
---|
[585] | 273 |
|
---|
[594] | 274 | /* --Methode-- */
|
---|
| 275 | template <class T>
|
---|
| 276 | void NOMAdapter_PixelMap<T>::Project_Mol(TMatrix<T> & mtx, T defval)
|
---|
| 277 | {
|
---|
| 278 | r_8 xa, yd, teta,phi, facteur;
|
---|
| 279 | int_4 l,c,k;
|
---|
| 280 | int_4 nl = mtx.NRows();
|
---|
| 281 | int_4 nc = mtx.NCols();
|
---|
[815] | 282 | mtx = defval; // On met tout a defval
|
---|
[594] | 283 | // cout << " NRows= " << nl << " NCols= " << nc << endl;
|
---|
| 284 | for(l=0; l<nl; l++) {
|
---|
| 285 | yd = (r_8)(l+0.5)/(r_8)nl-0.5;
|
---|
| 286 | facteur=2.*M_PI/sin(acos((double)yd*2));
|
---|
| 287 | teta = (yd+0.5)*Pi;
|
---|
| 288 | // teta = (0.5-yd)*M_PI;
|
---|
| 289 | for(c=0; c<nc; c++) {
|
---|
[1553] | 290 | xa = (r_8)(c+0.5)/(r_8)nc-0.5;
|
---|
[594] | 291 | phi = xa*facteur+M_PI;
|
---|
| 292 | if ( (phi <= 2*M_PI) && (phi >= 0.) ) {
|
---|
| 293 | k = mMap->PixIndexSph(teta, phi);
|
---|
| 294 | mtx(l,c) = (*mMap)(k);
|
---|
| 295 | }
|
---|
| 296 | }
|
---|
| 297 | }
|
---|
| 298 | }
|
---|
| 299 |
|
---|
[1553] | 300 | static char m_buff[128];
|
---|
| 301 | char * _SphMollweideProj_XY2ThetaPhi(P2DArrayAdapter * aa, int ix, int iy)
|
---|
| 302 | {
|
---|
| 303 | r_8 xa, yd, teta,phi, facteur;
|
---|
| 304 | int_4 nl = aa->YSize();
|
---|
| 305 | int_4 nc = aa->XSize();
|
---|
| 306 | int l, c;
|
---|
| 307 | aa->IJ2xy(ix, iy, c, l);
|
---|
| 308 | yd = (r_8)(l+0.5)/(r_8)nl-0.5;
|
---|
| 309 | facteur=2.*M_PI/sin(acos((double)yd*2));
|
---|
| 310 | teta = (yd+0.5)*Pi;
|
---|
| 311 | xa = (r_8)(c+0.5)/(r_8)nc-0.5;
|
---|
| 312 | phi = xa*facteur+M_PI;
|
---|
| 313 | if ( (phi <= 2*M_PI) && (phi >= 0.) )
|
---|
[1580] | 314 | sprintf(m_buff,"(l,b=%5.1f,%5.1f)", phi*180./M_PI, 90.-teta*180./M_PI);
|
---|
[1553] | 315 | else
|
---|
[1580] | 316 | sprintf(m_buff,"(l,b=?,?)");
|
---|
[1553] | 317 |
|
---|
| 318 | return (m_buff);
|
---|
| 319 | }
|
---|
| 320 |
|
---|
[585] | 321 | // -------------------------------------------------------------
|
---|
| 322 |
|
---|
| 323 | /* --Methode-- */
|
---|
| 324 | template <class T>
|
---|
| 325 | NTupInt_PixelMap<T>::NTupInt_PixelMap(PixelMap<T>* m)
|
---|
| 326 | {
|
---|
| 327 | mMap = m;
|
---|
| 328 | }
|
---|
| 329 |
|
---|
| 330 | /* --Methode-- */
|
---|
| 331 | template <class T>
|
---|
| 332 | NTupInt_PixelMap<T>::~NTupInt_PixelMap()
|
---|
| 333 | {
|
---|
| 334 | }
|
---|
| 335 |
|
---|
| 336 | /* --Methode-- */
|
---|
| 337 | template <class T>
|
---|
| 338 | uint_4 NTupInt_PixelMap<T>::NbLines() const
|
---|
| 339 | {
|
---|
| 340 | return( mMap->NbPixels() );
|
---|
| 341 | }
|
---|
| 342 |
|
---|
| 343 | /* --Methode-- */
|
---|
| 344 | template <class T>
|
---|
| 345 | uint_4 NTupInt_PixelMap<T>::NbColumns() const
|
---|
| 346 | {
|
---|
| 347 | return(8);
|
---|
| 348 | }
|
---|
| 349 |
|
---|
| 350 | /* --Methode-- */
|
---|
| 351 | template <class T>
|
---|
| 352 | r_8* NTupInt_PixelMap<T>::GetLineD(int n) const
|
---|
| 353 | {
|
---|
| 354 | int i;
|
---|
| 355 | if ((n < 0) || (n >= (int)(mMap->NbPixels()) ))
|
---|
| 356 | for(i=0; i<8; i++) mRet[i] = 0.;
|
---|
| 357 | else {
|
---|
| 358 | double teta,phi;
|
---|
| 359 | mMap->PixThetaPhi(n, teta, phi);
|
---|
| 360 | mRet[0] = n; mRet[1] = mMap->PixVal(n);
|
---|
| 361 | mRet[2] = mRet[1]; mRet[3] = 0.;
|
---|
| 362 | mRet[4] = mRet[1]; mRet[5] = 0.;
|
---|
| 363 | mRet[6] = teta; mRet[7] = phi;
|
---|
| 364 | }
|
---|
| 365 | return(mRet);
|
---|
| 366 | }
|
---|
| 367 |
|
---|
| 368 | /* --Methode-- */
|
---|
| 369 | template <class T>
|
---|
| 370 | string NTupInt_PixelMap<T>::VarList_C(const char* nx) const
|
---|
| 371 | {
|
---|
| 372 | string nomx;
|
---|
| 373 | if (nx) nomx = nx;
|
---|
| 374 | else nomx = "_xh_";
|
---|
| 375 | string vardec = "double i,k,val,real,imag,mod,phas,teta,phi; \n";
|
---|
| 376 | vardec += "i = " + nomx + "[0]; k = " + nomx + "[0]; val = " + nomx + "[1]; \n";
|
---|
| 377 | vardec += "real = " + nomx + "[2]; imag = " + nomx + "[3]; \n";
|
---|
| 378 | vardec += "mod = " + nomx + "[4]; phas = " + nomx + "[5]; \n";
|
---|
| 379 | vardec += "teta = " + nomx + "[6]; phi = " + nomx + "[7]; \n";
|
---|
| 380 | return(vardec);
|
---|
| 381 | }
|
---|
| 382 |
|
---|
[2343] | 383 |
|
---|
| 384 | DECL_TEMP_SPEC /* equivalent a template <> , pour SGI-CC en particulier */
|
---|
[585] | 385 | r_8* NTupInt_PixelMap< complex<float> >::GetLineD(int n) const
|
---|
| 386 | {
|
---|
| 387 | int i;
|
---|
| 388 | if ((n < 0) || (n >= (int)(mMap->NbPixels()) ))
|
---|
| 389 | for(i=0; i<8; i++) mRet[i] = 0.;
|
---|
| 390 | else {
|
---|
| 391 | double teta,phi;
|
---|
| 392 | mMap->PixThetaPhi(n, teta, phi);
|
---|
| 393 | mRet[0] = n;
|
---|
| 394 | mRet[2] = mMap->PixVal(n).real(); mRet[3] = mMap->PixVal(n).imag();
|
---|
| 395 | mRet[1] = mRet[4] = sqrt(mRet[2]*mRet[2]+mRet[3]*mRet[3]);
|
---|
| 396 | mRet[5] = atan2(mRet[3], mRet[2]);
|
---|
| 397 | mRet[6] = teta; mRet[7] = phi;
|
---|
| 398 | }
|
---|
| 399 | return(mRet);
|
---|
| 400 | }
|
---|
| 401 |
|
---|
[2343] | 402 | DECL_TEMP_SPEC /* equivalent a template <> , pour SGI-CC en particulier */
|
---|
[585] | 403 | r_8* NTupInt_PixelMap< complex<double> >::GetLineD(int n) const
|
---|
| 404 | {
|
---|
| 405 | int i;
|
---|
| 406 | if ((n < 0) || (n >= (int)(mMap->NbPixels()) ))
|
---|
| 407 | for(i=0; i<8; i++) mRet[i] = 0.;
|
---|
| 408 | else {
|
---|
| 409 | double teta,phi;
|
---|
| 410 | mMap->PixThetaPhi(n, teta, phi);
|
---|
| 411 | mRet[0] = n;
|
---|
| 412 | mRet[2] = mMap->PixVal(n).real(); mRet[3] = mMap->PixVal(n).imag();
|
---|
| 413 | mRet[1] = mRet[4] = sqrt(mRet[2]*mRet[2]+mRet[3]*mRet[3]);
|
---|
| 414 | mRet[5] = atan2(mRet[3], mRet[2]);
|
---|
| 415 | mRet[6] = teta; mRet[7] = phi;
|
---|
| 416 | }
|
---|
| 417 | return(mRet);
|
---|
| 418 | }
|
---|
| 419 |
|
---|
| 420 |
|
---|
| 421 | #ifdef __CXX_PRAGMA_TEMPLATES__
|
---|
[2084] | 422 | #pragma define_template NOMAdapter_PixelMap<int_4>
|
---|
[585] | 423 | #pragma define_template NOMAdapter_PixelMap<r_4>
|
---|
| 424 | #pragma define_template NOMAdapter_PixelMap<r_8>
|
---|
| 425 | #pragma define_template NOMAdapter_PixelMap< complex<float> >
|
---|
| 426 | #pragma define_template NOMAdapter_PixelMap< complex<double> >
|
---|
[2084] | 427 | #pragma define_template NTupInt_PixelMap<int_4>
|
---|
[585] | 428 | #pragma define_template NTupInt_PixelMap<r_4>
|
---|
| 429 | #pragma define_template NTupInt_PixelMap<r_8>
|
---|
| 430 | #pragma define_template NTupInt_PixelMap< complex<float> >
|
---|
| 431 | #pragma define_template NTupInt_PixelMap< complex<double> >
|
---|
| 432 | #endif
|
---|
| 433 |
|
---|
| 434 | #if defined(ANSI_TEMPLATES)
|
---|
[2084] | 435 | template class NOMAdapter_PixelMap<int_4>;
|
---|
[585] | 436 | template class NOMAdapter_PixelMap<r_4>;
|
---|
| 437 | template class NOMAdapter_PixelMap<r_8>;
|
---|
| 438 | template class NOMAdapter_PixelMap< complex<float> >;
|
---|
| 439 | template class NOMAdapter_PixelMap< complex<double> >;
|
---|
[2084] | 440 | template class NTupInt_PixelMap<int_4>;
|
---|
[585] | 441 | template class NTupInt_PixelMap<r_4>;
|
---|
| 442 | template class NTupInt_PixelMap<r_8>;
|
---|
| 443 | template class NTupInt_PixelMap< complex<float> >;
|
---|
| 444 | template class NTupInt_PixelMap< complex<double> >;
|
---|
| 445 | #endif
|
---|