| 1 | #include "sopnamsp.h"
 | 
|---|
| 2 | #include "machdefs.h"
 | 
|---|
| 3 | #include <stdlib.h>
 | 
|---|
| 4 | #include <math.h>
 | 
|---|
| 5 | #include <typeinfo>
 | 
|---|
| 6 | #include <iostream>
 | 
|---|
| 7 | #include <string>
 | 
|---|
| 8 | #include <complex>
 | 
|---|
| 9 | 
 | 
|---|
| 10 | #include "datatype.h"
 | 
|---|
| 11 | 
 | 
|---|
| 12 | #include "nomskymapadapter.h"
 | 
|---|
| 13 | #include "skymap.h"
 | 
|---|
| 14 | #include "pitvmaad.h"
 | 
|---|
| 15 | #include "complexios.h"
 | 
|---|
| 16 | 
 | 
|---|
| 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 | }
 | 
|---|
| 24 | 
 | 
|---|
| 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) :
 | 
|---|
| 30 |                     P2DArrayAdapter(lm->SizeX(), lm->SizeY())
 | 
|---|
| 31 |                     { ad = d; map = lm; }
 | 
|---|
| 32 | 
 | 
|---|
| 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-- */
 | 
|---|
| 42 | DECL_TEMP_SPEC  /* equivalent a template <> , pour SGI-CC en particulier */
 | 
|---|
| 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-- */
 | 
|---|
| 51 | DECL_TEMP_SPEC  /* equivalent a template <> , pour SGI-CC en particulier */
 | 
|---|
| 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 | 
 | 
|---|
| 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)
 | 
|---|
| 68 |   : NObjMgrAdapter(o)
 | 
|---|
| 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> 
 | 
|---|
| 90 | string NOMAdapter_PixelMap<T>::GetDataObjType()
 | 
|---|
| 91 | {
 | 
|---|
| 92 | string type = "PixelMap< ";
 | 
|---|
| 93 | LocalMap<T>* lm = dynamic_cast< LocalMap<T> * >(mMap); 
 | 
|---|
| 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< ";
 | 
|---|
| 99 | SphereECP<T>* se = dynamic_cast< SphereECP<T> * >(mMap); 
 | 
|---|
| 100 | if (se != NULL) type = "SphereECP< ";
 | 
|---|
| 101 | 
 | 
|---|
| 102 | // type +=  DecodeTypeIdName(typeid(T).name());
 | 
|---|
| 103 | type += DataTypeInfo<T>::getTypeName();
 | 
|---|
| 104 | type +=  " > ";
 | 
|---|
| 105 | return(type);
 | 
|---|
| 106 | }
 | 
|---|
| 107 | 
 | 
|---|
| 108 | /* --Methode-- */
 | 
|---|
| 109 | template <class T> 
 | 
|---|
| 110 | AnyDataObj* NOMAdapter_PixelMap<T>::CloneDataObj(bool share)
 | 
|---|
| 111 | {
 | 
|---|
| 112 | LocalMap<T>* lm = dynamic_cast< LocalMap<T> * >(mMap); 
 | 
|---|
| 113 | if (lm != NULL) return( new LocalMap<T>(*lm, share) );
 | 
|---|
| 114 | SphereThetaPhi<T>* st = dynamic_cast< SphereThetaPhi<T> * >(mMap); 
 | 
|---|
| 115 | if (st != NULL) return( new SphereThetaPhi<T>(*st, share) );
 | 
|---|
| 116 | SphereHEALPix<T>* sg = dynamic_cast< SphereHEALPix<T> * >(mMap); 
 | 
|---|
| 117 | if (sg != NULL) return( new SphereHEALPix<T>(*sg, share) );
 | 
|---|
| 118 | SphereECP<T>* se = dynamic_cast< SphereECP<T> * >(mMap); 
 | 
|---|
| 119 | if (se != NULL) return( new SphereECP<T>(*se, share) );
 | 
|---|
| 120 | return(NULL);
 | 
|---|
| 121 | }
 | 
|---|
| 122 | 
 | 
|---|
| 123 | 
 | 
|---|
| 124 | /* --Methode-- */
 | 
|---|
| 125 | template <class T> 
 | 
|---|
| 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 |   }
 | 
|---|
| 140 | SphereHEALPix<T>* sg = dynamic_cast< SphereHEALPix<T> * >(mMap); 
 | 
|---|
| 141 | if (sg != NULL) {
 | 
|---|
| 142 |   FIO_SphereHEALPix<T> fio(sg);
 | 
|---|
| 143 |   fio.Write(pos, nom);
 | 
|---|
| 144 |   return;
 | 
|---|
| 145 |   }
 | 
|---|
| 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 |   }
 | 
|---|
| 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> 
 | 
|---|
| 158 | void NOMAdapter_PixelMap<T>::Print(ostream& os)
 | 
|---|
| 159 | {
 | 
|---|
| 160 | string s = typeid(*mMap).name();
 | 
|---|
| 161 | T moy, sig;
 | 
|---|
| 162 | MeanSig(moy, sig);
 | 
|---|
| 163 | cout << "SkyMap Type: " << s << " NbPixels= " << mMap->NbPixels() << endl;
 | 
|---|
| 164 | cout << "  Mean= " << moy << "  Sig2= " << sig << endl;
 | 
|---|
| 165 | }
 | 
|---|
| 166 | 
 | 
|---|
| 167 | // -- Fonction pour convertir un X,Y en Theta-Phi sur projection MolleWeide --
 | 
|---|
| 168 | char * _SphMollweideProj_XY2ThetaPhi(P2DArrayAdapter * aa, int ix, int iy);
 | 
|---|
| 169 | 
 | 
|---|
| 170 | /* --Methode-- */
 | 
|---|
| 171 | template <class T> 
 | 
|---|
| 172 | P2DArrayAdapter* NOMAdapter_PixelMap<T>::Get2DArray(string & opt)
 | 
|---|
| 173 | {
 | 
|---|
| 174 | LocalMap<T>* lm = dynamic_cast< LocalMap<T> * >(mMap); 
 | 
|---|
| 175 | if (lm != NULL) return(new LocalMapArrAdapter<T>(lm, false));
 | 
|---|
| 176 | int nr = 250;
 | 
|---|
| 177 | int nc = 500;
 | 
|---|
| 178 | SphereECP<T>* se = dynamic_cast< SphereECP<T> * >(mMap); 
 | 
|---|
| 179 | size_t olen = opt.length();
 | 
|---|
| 180 | if ((se != NULL) && (opt.find("ecparray") < olen)) {
 | 
|---|
| 181 |   // On veut la carte bi-dim complete de la sphere ECP
 | 
|---|
| 182 |   TMatrix<T> * mtxecp = new TMatrix<T>(se->GetPixelArray(), true);  // on partage les donnees
 | 
|---|
| 183 |   POTMatrixAdapter<T> * potmtxecp = new POTMatrixAdapter<T>(mtxecp, true);
 | 
|---|
| 184 |   if (opt.find("ecpscaledeg") < olen)  // Echelle angulaire en degre
 | 
|---|
| 185 |     potmtxecp->DefineXYCoordinates(se->MinPhi()*180./M_PI, se->MinTheta()*180./M_PI, 
 | 
|---|
| 186 |                                    se->DeltaPhi()*180./M_PI, se->DeltaTheta()*180./M_PI);
 | 
|---|
| 187 |   else if (opt.find("ecpscalerad") < olen)  // Echelle angulaire en radian
 | 
|---|
| 188 |     potmtxecp->DefineXYCoordinates(se->MinPhi(), se->MinTheta(), se->DeltaPhi(), se->DeltaTheta());
 | 
|---|
| 189 | 
 | 
|---|
| 190 |   return ( potmtxecp );
 | 
|---|
| 191 | }
 | 
|---|
| 192 | SphericalMap<T>* sm = dynamic_cast< SphericalMap<T> *>(mMap);
 | 
|---|
| 193 | if (sm != NULL) { nr = sqrt(0.75*mMap->NbPixels());  nc = 2*nr; }
 | 
|---|
| 194 | TMatrix<T> * mtx = new TMatrix<T>(nr, nc);
 | 
|---|
| 195 | Project_Mol(*mtx, (T)_prjmol_defval);
 | 
|---|
| 196 | POTMatrixAdapter<T> * potma = new POTMatrixAdapter<T>(mtx, true);
 | 
|---|
| 197 | potma->SetInfoStringFunction(_SphMollweideProj_XY2ThetaPhi);
 | 
|---|
| 198 | return ( potma );
 | 
|---|
| 199 | }
 | 
|---|
| 200 | 
 | 
|---|
| 201 | /* --Methode-- */
 | 
|---|
| 202 | template <class T> 
 | 
|---|
| 203 | NTupleInterface* NOMAdapter_PixelMap<T>::GetNTupleInterface(bool& adel)
 | 
|---|
| 204 | {
 | 
|---|
| 205 | adel = true;
 | 
|---|
| 206 | return( new NTupInt_PixelMap<T>(mMap) );
 | 
|---|
| 207 | }
 | 
|---|
| 208 | 
 | 
|---|
| 209 | /* --Methode-- */
 | 
|---|
| 210 | template <class T> 
 | 
|---|
| 211 | void NOMAdapter_PixelMap<T>::MeanSig(T& gmoy, T& gsig)
 | 
|---|
| 212 | {
 | 
|---|
| 213 |   gmoy=0.;
 | 
|---|
| 214 |   gsig = 0.;
 | 
|---|
| 215 |   T valok;
 | 
|---|
| 216 |   for(int k=0; k<mMap->NbPixels(); k++) {
 | 
|---|
| 217 |     valok = (*mMap)(k);
 | 
|---|
| 218 |     gmoy += valok;  gsig += valok*valok;
 | 
|---|
| 219 |   }
 | 
|---|
| 220 |   gmoy /= (T)mMap->NbPixels();
 | 
|---|
| 221 |   gsig = gsig/(T)mMap->NbPixels() - gmoy*gmoy;
 | 
|---|
| 222 | 
 | 
|---|
| 223 | }
 | 
|---|
| 224 | 
 | 
|---|
| 225 | /* --Methode-- */
 | 
|---|
| 226 | template <class T> 
 | 
|---|
| 227 | void NOMAdapter_PixelMap<T>::Project_Mol(TMatrix<T> & mtx, T defval)
 | 
|---|
| 228 | {
 | 
|---|
| 229 |   r_8 xa, yd, teta,phi, facteur;
 | 
|---|
| 230 |   int_4 l,c,k;
 | 
|---|
| 231 |   int_4 nl = mtx.NRows();
 | 
|---|
| 232 |   int_4 nc = mtx.NCols();
 | 
|---|
| 233 |   mtx = defval;   // On met tout a defval
 | 
|---|
| 234 | //  cout << " NRows= " << nl << "  NCols= " << nc  << endl;
 | 
|---|
| 235 |   for(l=0; l<nl; l++) {
 | 
|---|
| 236 |     yd = (r_8)(l+0.5)/(r_8)nl-0.5;
 | 
|---|
| 237 |     facteur=2.*M_PI/sin(acos((double)yd*2));
 | 
|---|
| 238 |     teta = (yd+0.5)*Pi;
 | 
|---|
| 239 |     //    teta = (0.5-yd)*M_PI;
 | 
|---|
| 240 |     for(c=0; c<nc; c++)  {
 | 
|---|
| 241 |       xa = (r_8)(c+0.5)/(r_8)nc-0.5;  
 | 
|---|
| 242 |       phi = xa*facteur+M_PI;
 | 
|---|
| 243 |       if ( (phi <= 2*M_PI) && (phi >= 0.) ) {
 | 
|---|
| 244 |         k = mMap->PixIndexSph(teta, phi);
 | 
|---|
| 245 |         mtx(l,c) = (*mMap)(k);
 | 
|---|
| 246 |       }
 | 
|---|
| 247 |     }
 | 
|---|
| 248 |   }
 | 
|---|
| 249 | }
 | 
|---|
| 250 | 
 | 
|---|
| 251 | static char m_buff[128];
 | 
|---|
| 252 | char * _SphMollweideProj_XY2ThetaPhi(P2DArrayAdapter * aa, int ix, int iy)
 | 
|---|
| 253 | {
 | 
|---|
| 254 |   r_8 xa, yd, teta,phi, facteur;
 | 
|---|
| 255 |   int_4 nl = aa->YSize();
 | 
|---|
| 256 |   int_4 nc = aa->XSize();
 | 
|---|
| 257 |   int l, c;
 | 
|---|
| 258 |   aa->IJ2xy(ix, iy, c, l);
 | 
|---|
| 259 |   yd = (r_8)(l+0.5)/(r_8)nl-0.5;
 | 
|---|
| 260 |   facteur=2.*M_PI/sin(acos((double)yd*2));
 | 
|---|
| 261 |   teta = (yd+0.5)*Pi;
 | 
|---|
| 262 |   xa = (r_8)(c+0.5)/(r_8)nc-0.5;  
 | 
|---|
| 263 |   phi = xa*facteur+M_PI;
 | 
|---|
| 264 |   if ( (phi <= 2*M_PI) && (phi >= 0.) ) 
 | 
|---|
| 265 |     sprintf(m_buff,"(l,b=%5.1f,%5.1f)", phi*180./M_PI, 90.-teta*180./M_PI);
 | 
|---|
| 266 |   else 
 | 
|---|
| 267 |     sprintf(m_buff,"(l,b=?,?)");
 | 
|---|
| 268 | 
 | 
|---|
| 269 |   return (m_buff);
 | 
|---|
| 270 | }
 | 
|---|
| 271 | 
 | 
|---|
| 272 | // -------------------------------------------------------------
 | 
|---|
| 273 | 
 | 
|---|
| 274 | /* --Methode-- */
 | 
|---|
| 275 | template <class T> 
 | 
|---|
| 276 | NTupInt_PixelMap<T>::NTupInt_PixelMap(PixelMap<T>* m)
 | 
|---|
| 277 | {
 | 
|---|
| 278 | mMap = m;
 | 
|---|
| 279 | }
 | 
|---|
| 280 | 
 | 
|---|
| 281 | /* --Methode-- */
 | 
|---|
| 282 | template <class T> 
 | 
|---|
| 283 | NTupInt_PixelMap<T>::~NTupInt_PixelMap()
 | 
|---|
| 284 | {
 | 
|---|
| 285 | }
 | 
|---|
| 286 | 
 | 
|---|
| 287 | /* --Methode-- */
 | 
|---|
| 288 | template <class T> 
 | 
|---|
| 289 | sa_size_t NTupInt_PixelMap<T>::NbLines() const
 | 
|---|
| 290 | {
 | 
|---|
| 291 | return( mMap->NbPixels() );
 | 
|---|
| 292 | }
 | 
|---|
| 293 | 
 | 
|---|
| 294 | /* --Methode-- */
 | 
|---|
| 295 | template <class T> 
 | 
|---|
| 296 | sa_size_t NTupInt_PixelMap<T>::NbColumns() const 
 | 
|---|
| 297 | {
 | 
|---|
| 298 | return(8);
 | 
|---|
| 299 | }
 | 
|---|
| 300 | 
 | 
|---|
| 301 | /* --Methode-- */
 | 
|---|
| 302 | template <class T> 
 | 
|---|
| 303 | r_8* NTupInt_PixelMap<T>::GetLineD(sa_size_t n) const 
 | 
|---|
| 304 | {
 | 
|---|
| 305 | int i;
 | 
|---|
| 306 | if ((n < 0) || (n >= (int)(mMap->NbPixels()) )) 
 | 
|---|
| 307 |     for(i=0; i<8; i++)  mRet[i] = 0.;
 | 
|---|
| 308 | else { 
 | 
|---|
| 309 |   double teta,phi;
 | 
|---|
| 310 |   mMap->PixThetaPhi(n, teta, phi);
 | 
|---|
| 311 |   mRet[0] = n;  mRet[1] = mMap->PixVal(n);
 | 
|---|
| 312 |   mRet[2] = mRet[1];  mRet[3] = 0.;
 | 
|---|
| 313 |   mRet[4] = mRet[1];  mRet[5] = 0.;
 | 
|---|
| 314 |   mRet[6] = teta;     mRet[7] = phi;
 | 
|---|
| 315 |   }
 | 
|---|
| 316 | return(mRet);
 | 
|---|
| 317 | }
 | 
|---|
| 318 | 
 | 
|---|
| 319 | /* --Methode-- */
 | 
|---|
| 320 | template <class T> 
 | 
|---|
| 321 | string NTupInt_PixelMap<T>::VarList_C(const char* nx) const 
 | 
|---|
| 322 | {
 | 
|---|
| 323 | string nomx;
 | 
|---|
| 324 | if (nx) nomx = nx;
 | 
|---|
| 325 | else nomx = "_xh_";
 | 
|---|
| 326 | string vardec = "double i,k,val,real,imag,mod,phas,teta,phi; \n";
 | 
|---|
| 327 | vardec += "i = " + nomx + "[0]; k = " + nomx + "[0];  val = " + nomx + "[1]; \n";
 | 
|---|
| 328 | vardec += "real = " + nomx + "[2];  imag = " + nomx + "[3]; \n";
 | 
|---|
| 329 | vardec += "mod  = " + nomx + "[4];  phas = " + nomx + "[5]; \n";
 | 
|---|
| 330 | vardec += "teta = " + nomx + "[6];  phi  = " + nomx + "[7]; \n";
 | 
|---|
| 331 | return(vardec);
 | 
|---|
| 332 | }
 | 
|---|
| 333 | 
 | 
|---|
| 334 | 
 | 
|---|
| 335 | DECL_TEMP_SPEC  /* equivalent a template <> , pour SGI-CC en particulier */
 | 
|---|
| 336 | r_8* NTupInt_PixelMap< complex<float> >::GetLineD(sa_size_t n) const 
 | 
|---|
| 337 | {
 | 
|---|
| 338 | int i;
 | 
|---|
| 339 | if ((n < 0) || (n >= (int)(mMap->NbPixels()) )) 
 | 
|---|
| 340 |     for(i=0; i<8; i++)  mRet[i] = 0.;
 | 
|---|
| 341 | else { 
 | 
|---|
| 342 |   double teta,phi;
 | 
|---|
| 343 |   mMap->PixThetaPhi(n, teta, phi);
 | 
|---|
| 344 |   mRet[0] = n;  
 | 
|---|
| 345 |   mRet[2] = mMap->PixVal(n).real();  mRet[3] = mMap->PixVal(n).imag();
 | 
|---|
| 346 |   mRet[1] = mRet[4] = sqrt(mRet[2]*mRet[2]+mRet[3]*mRet[3]);
 | 
|---|
| 347 |   mRet[5] = atan2(mRet[3], mRet[2]);
 | 
|---|
| 348 |   mRet[6] = teta;     mRet[7] = phi;
 | 
|---|
| 349 |   }
 | 
|---|
| 350 | return(mRet);
 | 
|---|
| 351 | }
 | 
|---|
| 352 | 
 | 
|---|
| 353 | DECL_TEMP_SPEC  /* equivalent a template <> , pour SGI-CC en particulier */
 | 
|---|
| 354 | r_8* NTupInt_PixelMap< complex<double> >::GetLineD(sa_size_t n) const 
 | 
|---|
| 355 | {
 | 
|---|
| 356 | int i;
 | 
|---|
| 357 | if ((n < 0) || (n >= (int)(mMap->NbPixels()) )) 
 | 
|---|
| 358 |     for(i=0; i<8; i++)  mRet[i] = 0.;
 | 
|---|
| 359 | else { 
 | 
|---|
| 360 |   double teta,phi;
 | 
|---|
| 361 |   mMap->PixThetaPhi(n, teta, phi);
 | 
|---|
| 362 |   mRet[0] = n;  
 | 
|---|
| 363 |   mRet[2] = mMap->PixVal(n).real();  mRet[3] = mMap->PixVal(n).imag();
 | 
|---|
| 364 |   mRet[1] = mRet[4] = sqrt(mRet[2]*mRet[2]+mRet[3]*mRet[3]);
 | 
|---|
| 365 |   mRet[5] = atan2(mRet[3], mRet[2]);
 | 
|---|
| 366 |   mRet[6] = teta;     mRet[7] = phi;
 | 
|---|
| 367 |   }
 | 
|---|
| 368 | return(mRet);
 | 
|---|
| 369 | }
 | 
|---|
| 370 | 
 | 
|---|
| 371 | 
 | 
|---|
| 372 | #ifdef __CXX_PRAGMA_TEMPLATES__
 | 
|---|
| 373 | #pragma define_template NOMAdapter_PixelMap<int_4>
 | 
|---|
| 374 | #pragma define_template NOMAdapter_PixelMap<r_4>
 | 
|---|
| 375 | #pragma define_template NOMAdapter_PixelMap<r_8>
 | 
|---|
| 376 | #pragma define_template NOMAdapter_PixelMap< complex<float> >
 | 
|---|
| 377 | #pragma define_template NOMAdapter_PixelMap< complex<double> >
 | 
|---|
| 378 | #pragma define_template NTupInt_PixelMap<int_4>
 | 
|---|
| 379 | #pragma define_template NTupInt_PixelMap<r_4>
 | 
|---|
| 380 | #pragma define_template NTupInt_PixelMap<r_8>
 | 
|---|
| 381 | #pragma define_template NTupInt_PixelMap< complex<float> >
 | 
|---|
| 382 | #pragma define_template NTupInt_PixelMap< complex<double> >
 | 
|---|
| 383 | #endif
 | 
|---|
| 384 | 
 | 
|---|
| 385 | #if defined(ANSI_TEMPLATES) 
 | 
|---|
| 386 | template class NOMAdapter_PixelMap<int_4>;
 | 
|---|
| 387 | template class NOMAdapter_PixelMap<r_4>;
 | 
|---|
| 388 | template class NOMAdapter_PixelMap<r_8>;
 | 
|---|
| 389 | template class NOMAdapter_PixelMap< complex<float> >;
 | 
|---|
| 390 | template class NOMAdapter_PixelMap< complex<double> >;
 | 
|---|
| 391 | template class NTupInt_PixelMap<int_4>;
 | 
|---|
| 392 | template class NTupInt_PixelMap<r_4>;
 | 
|---|
| 393 | template class NTupInt_PixelMap<r_8>;
 | 
|---|
| 394 | template class NTupInt_PixelMap< complex<float> >;
 | 
|---|
| 395 | template class NTupInt_PixelMap< complex<double> >;
 | 
|---|
| 396 | #endif
 | 
|---|