Changeset 840 in Sophya for trunk/SophyaLib/SkyMap


Ignore:
Timestamp:
Apr 7, 2000, 5:49:47 PM (25 years ago)
Author:
ansari
Message:

FIO en fichiers separes

Location:
trunk/SophyaLib/SkyMap
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/SkyMap/spherethetaphi.cc

    r809 r840  
    650650}
    651651
    652 ///////////////////////////////////////////////////////////
    653 // --------------------------------------------------------
    654 //   Les objets delegues pour la gestion de persistance
    655 // --------------------------------------------------------
    656 //////////////////////////////////////////////////////////
    657 
    658 template <class T>
    659 FIO_SphereThetaPhi<T>::FIO_SphereThetaPhi()
    660 {
    661   dobj= new SphereThetaPhi<T>;
    662   ownobj= true;
    663 }
    664 
    665 template <class T>
    666 FIO_SphereThetaPhi<T>::FIO_SphereThetaPhi(string const& filename)
    667 {
    668   dobj= new SphereThetaPhi<T>;
    669   dobj->pixels_.SetTemp(true);
    670   ownobj= true;
    671   Read(filename);
    672 }
    673 
    674 template <class T>
    675 FIO_SphereThetaPhi<T>::FIO_SphereThetaPhi(const SphereThetaPhi<T>& obj)
    676 {
    677   dobj= new SphereThetaPhi<T>(obj, true);
    678   dobj->pixels_.SetTemp(true);
    679   ownobj= true;
    680 }
    681 
    682 template <class T>
    683 FIO_SphereThetaPhi<T>::FIO_SphereThetaPhi(SphereThetaPhi<T>* obj)
    684 {
    685   dobj= obj;
    686   ownobj= false;
    687 }
    688 
    689 template <class T>
    690 FIO_SphereThetaPhi<T>::~FIO_SphereThetaPhi()
    691 {
    692   if (ownobj && dobj) delete dobj;
    693 }
    694 
    695 template <class T>
    696 AnyDataObj* FIO_SphereThetaPhi<T>::DataObj()
    697 {
    698   return(dobj);
    699 }
    700 
    701 
    702 template <class T>
    703 void FIO_SphereThetaPhi<T>::SetDataObj(AnyDataObj & o)
    704 {
    705   SphereThetaPhi<T> * po = dynamic_cast< SphereThetaPhi<T> * >(&o);
    706   if (po == NULL) return;
    707   if (ownobj && dobj) delete dobj;
    708   dobj = po; ownobj = false;
    709 }
    710 
    711 template <class T>
    712 void FIO_SphereThetaPhi<T>::ReadSelf(PInPersist& is)
    713 {
    714 
    715   if(dobj == NULL)
    716     {
    717       dobj= new SphereThetaPhi<T>;
    718       dobj->pixels_.SetTemp(true);
    719       ownobj= true;     
    720     }
    721 
    722   // On lit les 3 premiers uint_8
    723   uint_8 itab[3];
    724   is.Get(itab, 3);
    725 // Let's Read the SphereCoordSys object  -- ATTENTIOn - $CHECK$
    726   FIO_SphereCoordSys fio_scs( dobj->GetCoordSys());
    727   fio_scs.Read(is);
    728 
    729   // Pour savoir s'il y avait un DVList Info associe
    730   char strg[256];
    731   is.GetLine(strg, 255);
    732   bool hadinfo= false;
    733   if(strncmp(strg+strlen(strg)-7, "HasInfo", 7) == 0)  hadinfo= true;
    734   if(hadinfo)
    735     {    // Lecture eventuelle du DVList Info
    736       is >> dobj->Info();
    737     }
    738 
    739   int_4 mNTheta;
    740   is.GetI4(mNTheta); 
    741   int_4 mNPix;
    742   is.GetI4(mNPix);
    743   double mOmeg;
    744   is.GetR8(mOmeg);
    745   dobj->setParameters(mNPix, mOmeg, mNTheta);
    746   FIO_NDataBlock<int_4> fio_nd_nphi(&dobj->NPhi_);
    747   fio_nd_nphi.Read(is);
    748   FIO_NDataBlock<int_4> fio_nd_Tnphi(&dobj->TNphi_);
    749   fio_nd_Tnphi.Read(is);
    750   FIO_NDataBlock<r_8> fio_nd_Theta(&dobj->Theta_);
    751   fio_nd_Theta.Read(is);
    752 
    753 FIO_NDataBlock<T> fio_nd(&dobj->pixels_);
    754 fio_nd.Read(is);
    755 }
    756 
    757 template <class T>
    758 void FIO_SphereThetaPhi<T>::WriteSelf(POutPersist& os) const
    759 {
    760 
    761   if(dobj == NULL)
    762     {
    763       cout << " WriteSelf:: dobj= null " << endl;
    764       return;
    765     }
    766 
    767 //  On ecrit 3 uint_8
    768 //  0 : Numero de version,  1 : Size index,  2  reserve a l
    769 uint_8 itab[3];
    770 itab[0] = 1;
    771 itab[1] = dobj->SizeIndex();
    772 itab[2] = 0;
    773 os.Put(itab, 3);
    774 // Let's write the SphereCoordSys object
    775   FIO_SphereCoordSys fio_scs( dobj->GetCoordSys());
    776   fio_scs.Write(os);
    777  
    778   char strg[256];
    779   int_4 mNTheta= dobj->SizeIndex();
    780   int_4 mNPix  = dobj->NbPixels();
    781  
    782   if(dobj->ptrInfo())
    783     {
    784       sprintf(strg,"SphereThetaPhi: NSlices=%6d  NPix=%9d HasInfo",mNTheta,mNPix);
    785       os.PutLine(strg);
    786       os << dobj->Info();
    787     }
    788   else
    789     {
    790       sprintf(strg,"SphereThetaPhi: NSlices=%6d  NPix=%9d ",mNTheta,mNPix);
    791       os.PutLine(strg); 
    792     }
    793 
    794   os.PutI4(mNTheta); 
    795   os.PutI4(mNPix);
    796   os.PutR8(dobj->PixSolAngle());
    797   FIO_NDataBlock<int_4> fio_nd_nphi(&dobj->NPhi_);
    798   fio_nd_nphi.Write(os);
    799   FIO_NDataBlock<int_4> fio_nd_Tnphi(&dobj->TNphi_);
    800   fio_nd_Tnphi.Write(os);
    801   FIO_NDataBlock<r_8> fio_nd_Theta(&dobj->Theta_);
    802   fio_nd_Theta.Write(os);
    803 FIO_NDataBlock<T> fio_nd(&dobj->pixels_);
    804 fio_nd.Write(os);
    805 }
    806652
    807653#ifdef __CXX_PRAGMA_TEMPLATES__
     
    810656#pragma define_template SphereThetaPhi< complex<r_4> >
    811657#pragma define_template SphereThetaPhi< complex<r_8> >
    812 #pragma define_template FIO_SphereThetaPhi<r_8>
    813 #pragma define_template FIO_SphereThetaPhi<r_4>
    814 #pragma define_template FIO_SphereThetaPhi< complex<r_4> >
    815 #pragma define_template FIO_SphereThetaPhi< complex<r_8> >
    816658#endif
    817659#if defined(ANSI_TEMPLATES) || defined(GNU_TEMPLATES)
     
    820662template class SphereThetaPhi< complex<r_4> >;
    821663template class SphereThetaPhi< complex<r_8> >;
    822 template class FIO_SphereThetaPhi<r_8>;
    823 template class FIO_SphereThetaPhi<r_4>;
    824 template class FIO_SphereThetaPhi< complex<r_4> >;
    825 template class FIO_SphereThetaPhi< complex<r_8> >;
    826664#endif
  • trunk/SophyaLib/SkyMap/spherethetaphi.h

    r764 r840  
    88#include "anydataobj.h"
    99#include "ppersist.h"
     10
     11namespace SOPHYA {
     12
     13
    1014
    1115template <class T>
     
    141145    a vector containing the corresponding values of pixels
    142146*/
    143 void GetThetaSlice(int_4 index,r_8& theta,TVector<r_8>& phi,TVector<T>& value) const;
     147virtual void GetThetaSlice(int_4 index,r_8& theta,TVector<r_8>& phi,TVector<T>& value) const;
    144148
    145149/*!   For a theta-slice with index 'index', return :
     
    155159    a vector containing the corresponding values of pixels
    156160*/
    157  void GetThetaSlice(int_4 index, r_8& theta, r_8& phi0,TVector<int_4>& pixelIndices, TVector<T>& value) const ;
     161virtual void GetThetaSlice(int_4 index, r_8& theta, r_8& phi0,TVector<int_4>& pixelIndices, TVector<T>& value) const ;
    158162
    159163
     
    165169// ------------- méthodes internes ----------------------         
    166170void InitNul();
    167 inline void setParameters(int nbpix, double omega, int nbThetaIndex)
     171inline void setParameters( int nbThetaIndex, int nbpix, double omega)
    168172  {
    169173    NPix_= nbpix;
     
    183187};
    184188
    185 // ------------- Classe pour la gestion de persistance --
    186 template <class T>
    187 class FIO_SphereThetaPhi : public PPersist 
    188 {
    189 public:
    190189
    191 FIO_SphereThetaPhi();
    192 FIO_SphereThetaPhi(string const & filename);
    193 FIO_SphereThetaPhi(const SphereThetaPhi<T>& obj);
    194 FIO_SphereThetaPhi(SphereThetaPhi<T>* obj);
    195 virtual ~FIO_SphereThetaPhi();
    196 virtual AnyDataObj* DataObj();
    197 virtual void        SetDataObj(AnyDataObj & o);
    198 inline operator SphereThetaPhi<T>() { return(*dobj); }
    199190
    200 protected :
    201 
    202 virtual void ReadSelf(PInPersist&);           
    203 virtual void WriteSelf(POutPersist&) const; 
    204 SphereThetaPhi<T>* dobj;
    205 bool ownobj;
    206 };
     191} // Fin du namespace
    207192
    208193#endif
Note: See TracChangeset for help on using the changeset viewer.