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