Changeset 840 in Sophya for trunk/SophyaLib/SkyMap/spherethetaphi.cc
- Timestamp:
- Apr 7, 2000, 5:49:47 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/SkyMap/spherethetaphi.cc
r809 r840 650 650 } 651 651 652 ///////////////////////////////////////////////////////////653 // --------------------------------------------------------654 // Les objets delegues pour la gestion de persistance655 // --------------------------------------------------------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_8723 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 associe730 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 Info736 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) const759 {760 761 if(dobj == NULL)762 {763 cout << " WriteSelf:: dobj= null " << endl;764 return;765 }766 767 // On ecrit 3 uint_8768 // 0 : Numero de version, 1 : Size index, 2 reserve a l769 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 object775 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 else789 {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 }806 652 807 653 #ifdef __CXX_PRAGMA_TEMPLATES__ … … 810 656 #pragma define_template SphereThetaPhi< complex<r_4> > 811 657 #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> >816 658 #endif 817 659 #if defined(ANSI_TEMPLATES) || defined(GNU_TEMPLATES) … … 820 662 template class SphereThetaPhi< complex<r_4> >; 821 663 template 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> >;826 664 #endif
Note:
See TracChangeset
for help on using the changeset viewer.