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