#include "machdefs.h" #include #include #include #include #include #include "nomskymapadapter.h" #include "spherethetaphi.h" #include "spheregorski.h" #include "localmap.h" //---------------------------------------------------------------- // Class Adaptateur d'objet (Pour NamedObjMgr) d'objet PixelMap //---------------------------------------------------------------- /* --Methode-- */ template NOMAdapter_PixelMap::NOMAdapter_PixelMap(PixelMap * o) : NObjMgrAdapter((AnyDataObj *)o) { mMap = o; } /* --Methode-- */ template NOMAdapter_PixelMap::~NOMAdapter_PixelMap() { } /* --Methode-- */ template NObjMgrAdapter* NOMAdapter_PixelMap::Clone(AnyDataObj* o) { PixelMap* m = dynamic_cast *>(o); if (m) return ( new NOMAdapter_PixelMap(m) ); return ( new NObjMgrAdapter(o) ); } /* --Methode-- */ template AnyDataObj* NOMAdapter_PixelMap::GetCopyObj() { LocalMap* lm = dynamic_cast< LocalMap * >(mMap); if (lm != NULL) return( new LocalMap(*lm) ); SphereThetaPhi* st = dynamic_cast< SphereThetaPhi * >(mMap); if (st != NULL) return( new SphereThetaPhi(*st) ); SphereGorski* sg = dynamic_cast< SphereGorski * >(mMap); if (sg != NULL) return( new SphereGorski(*sg) ); return(NULL); } /* --Methode-- */ template void NOMAdapter_PixelMap::SavePPF(POutPersist& pos, string const & nom) { LocalMap* lm = dynamic_cast< LocalMap * >(mMap); if (lm != NULL) { FIO_LocalMap fio(lm); fio.Write(pos, nom); return; } SphereThetaPhi* st = dynamic_cast< SphereThetaPhi * >(mMap); if (st != NULL) { FIO_SphereThetaPhi fio(st); fio.Write(pos, nom); return; } SphereGorski* sg = dynamic_cast< SphereGorski * >(mMap); if (sg != NULL) { FIO_SphereGorski fio(sg); fio.Write(pos, nom); return; } string s = typeid(*mMap).name(); cout << "NOMAdapter_PixelMap::SavePPF() - Error : Not supported for " << s << endl; } /* --Methode-- */ template void NOMAdapter_PixelMap::Print(ostream& os) { string s = typeid(*mMap).name(); cout << "SkyMap Type: " << s << " NbPixels= " << mMap->NbPixels() << endl; } /* --Methode-- */ template P2DArrayAdapter* NOMAdapter_PixelMap::Get2DArray(string &) { return(NULL); } /* --Methode-- */ template NTupleInterface* NOMAdapter_PixelMap::GetNTupleInterface(bool& adel) { adel = true; return( new NTupInt_PixelMap(mMap) ); } // ------------------------------------------------------------- /* --Methode-- */ template NTupInt_PixelMap::NTupInt_PixelMap(PixelMap* m) { mMap = m; } /* --Methode-- */ template NTupInt_PixelMap::~NTupInt_PixelMap() { } /* --Methode-- */ template uint_4 NTupInt_PixelMap::NbLines() const { return( mMap->NbPixels() ); } /* --Methode-- */ template uint_4 NTupInt_PixelMap::NbColumns() const { return(8); } /* --Methode-- */ template r_8* NTupInt_PixelMap::GetLineD(int n) const { int i; if ((n < 0) || (n >= (int)(mMap->NbPixels()) )) for(i=0; i<8; i++) mRet[i] = 0.; else { double teta,phi; mMap->PixThetaPhi(n, teta, phi); mRet[0] = n; mRet[1] = mMap->PixVal(n); mRet[2] = mRet[1]; mRet[3] = 0.; mRet[4] = mRet[1]; mRet[5] = 0.; mRet[6] = teta; mRet[7] = phi; } return(mRet); } /* --Methode-- */ template string NTupInt_PixelMap::VarList_C(const char* nx) const { string nomx; if (nx) nomx = nx; else nomx = "_xh_"; string vardec = "double i,k,val,real,imag,mod,phas,teta,phi; \n"; vardec += "i = " + nomx + "[0]; k = " + nomx + "[0]; val = " + nomx + "[1]; \n"; vardec += "real = " + nomx + "[2]; imag = " + nomx + "[3]; \n"; vardec += "mod = " + nomx + "[4]; phas = " + nomx + "[5]; \n"; vardec += "teta = " + nomx + "[6]; phi = " + nomx + "[7]; \n"; return(vardec); } r_8* NTupInt_PixelMap< complex >::GetLineD(int n) const { int i; if ((n < 0) || (n >= (int)(mMap->NbPixels()) )) for(i=0; i<8; i++) mRet[i] = 0.; else { double teta,phi; mMap->PixThetaPhi(n, teta, phi); mRet[0] = n; mRet[2] = mMap->PixVal(n).real(); mRet[3] = mMap->PixVal(n).imag(); mRet[1] = mRet[4] = sqrt(mRet[2]*mRet[2]+mRet[3]*mRet[3]); mRet[5] = atan2(mRet[3], mRet[2]); mRet[6] = teta; mRet[7] = phi; } return(mRet); } r_8* NTupInt_PixelMap< complex >::GetLineD(int n) const { int i; if ((n < 0) || (n >= (int)(mMap->NbPixels()) )) for(i=0; i<8; i++) mRet[i] = 0.; else { double teta,phi; mMap->PixThetaPhi(n, teta, phi); mRet[0] = n; mRet[2] = mMap->PixVal(n).real(); mRet[3] = mMap->PixVal(n).imag(); mRet[1] = mRet[4] = sqrt(mRet[2]*mRet[2]+mRet[3]*mRet[3]); mRet[5] = atan2(mRet[3], mRet[2]); mRet[6] = teta; mRet[7] = phi; } return(mRet); } #ifdef __CXX_PRAGMA_TEMPLATES__ #pragma define_template NOMAdapter_PixelMap #pragma define_template NOMAdapter_PixelMap #pragma define_template NOMAdapter_PixelMap< complex > #pragma define_template NOMAdapter_PixelMap< complex > #pragma define_template NTupInt_PixelMap #pragma define_template NTupInt_PixelMap #pragma define_template NTupInt_PixelMap< complex > #pragma define_template NTupInt_PixelMap< complex > #endif #if defined(ANSI_TEMPLATES) template class NOMAdapter_PixelMap; template class NOMAdapter_PixelMap; template class NOMAdapter_PixelMap< complex >; template class NOMAdapter_PixelMap< complex >; template class NTupInt_PixelMap; template class NTupInt_PixelMap; template class NTupInt_PixelMap< complex >; template class NTupInt_PixelMap< complex >; #endif