Changeset 841 in Sophya for trunk/SophyaLib/SkyMap
- Timestamp:
- Apr 7, 2000, 5:51:36 PM (25 years ago)
- Location:
- trunk/SophyaLib/SkyMap
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/SkyMap/localmap.cc
r809 r841 550 550 //-- 551 551 552 //*******************************************************************553 // class FIO_LocalMap<T>554 // Les objets delegues pour la gestion de persistance555 //*******************************************************************556 557 //++558 template <class T>559 FIO_LocalMap<T>::FIO_LocalMap()560 //561 //--562 {563 dobj= new LocalMap<T>;564 ownobj= true;565 }566 //++567 template <class T>568 FIO_LocalMap<T>::FIO_LocalMap(string const& filename)569 //570 //--571 {572 dobj= new LocalMap<T>;573 dobj->DataBlock().SetTemp(true);574 ownobj= true;575 Read(filename);576 }577 578 //++579 template <class T>580 FIO_LocalMap<T>::FIO_LocalMap(const LocalMap<T>& obj)581 //582 //--583 {584 dobj= new LocalMap<T>(obj, true);585 dobj->DataBlock().SetTemp(true);586 ownobj= true;587 }588 589 template <class T>590 FIO_LocalMap<T>::FIO_LocalMap(LocalMap<T>* obj)591 {592 dobj= obj;593 ownobj= false;594 }595 596 //++597 template <class T>598 FIO_LocalMap<T>::~FIO_LocalMap()599 //600 //--601 {602 if (ownobj && dobj) delete dobj;603 }604 605 //++606 template <class T>607 AnyDataObj* FIO_LocalMap<T>::DataObj()608 //609 //--610 {611 return(dobj);612 }613 614 //++615 template <class T>616 void FIO_LocalMap<T>::SetDataObj(AnyDataObj & o)617 //618 //--619 {620 LocalMap<T> * po = dynamic_cast< LocalMap<T> * >(&o);621 if (po == NULL) return;622 if (ownobj && dobj) delete dobj;623 dobj = po; ownobj = false;624 }625 626 //++627 template <class T>628 void FIO_LocalMap<T>::ReadSelf(PInPersist& is)629 //630 //--631 {632 633 if(dobj == NULL)634 {635 dobj= new LocalMap<T>;636 dobj->DataBlock().SetTemp(true);637 ownobj= true;638 }639 640 // Pour savoir s'il y avait un DVList Info associe641 char strg[256];642 is.GetLine(strg, 255);643 bool hadinfo= false;644 if(strncmp(strg+strlen(strg)-7, "HasInfo", 7) == 0) hadinfo= true;645 if(hadinfo)646 { // Lecture eventuelle du DVList Info647 is >> dobj->Info();648 }649 650 int_4 nSzX;651 is.GetI4(nSzX);652 // dobj->setSize_x(nSzX);653 654 int_4 nSzY;655 is.GetI4(nSzY);656 // dobj->setSize_y(nSzY);657 658 int_4 nPix;659 is.GetI4(nPix);660 // dobj->setNbPixels(nPix);661 dobj->ReSize(nSzX, nSzY);662 string ss("local mapping is done");663 string sso;664 is.GetStr(sso);665 if(sso == ss)666 {667 cout<<" ReadSelf:: local mapping"<<endl;668 int_4 x0, y0;669 double theta, phi, angle;670 is.GetI4(x0);671 is.GetI4(y0);672 is.GetR8(theta);673 is.GetR8(phi);674 is.GetR8(angle);675 dobj->SetOrigin(theta, phi, x0, y0, angle);676 677 double angleX, angleY;678 is.GetR8(angleX);679 is.GetR8(angleY);680 dobj->SetSize(angleX, angleY);681 }682 683 // On lit le DataBlock;684 FIO_NDataBlock<T> fio_nd(&dobj->DataBlock());685 fio_nd.Read(is);686 }687 688 //++689 template <class T>690 void FIO_LocalMap<T>::WriteSelf(POutPersist& os) const691 //692 //--693 {694 if(dobj == NULL)695 {696 cout << " FIO_LocalMap::WriteSelf:: dobj= null " << endl;697 return;698 }699 700 char strg[256];701 int_4 nSzX= dobj->Size_x();702 int_4 nSzY= dobj->Size_y();703 int_4 nPix= dobj->NbPixels();704 705 if(dobj->ptrInfo())706 {707 sprintf(strg,"LocalMap: NPixX=%6d NPixY=%9d HasInfo",nSzX,nSzY);708 os.PutLine(strg);709 os << dobj->Info();710 }711 else712 {713 sprintf(strg,"LocalMap: NPixX=%6d NPixY=%9d ",nSzX,nSzY);714 os.PutLine(strg);715 }716 717 os.PutI4(nSzX);718 os.PutI4(nSzY);719 os.PutI4(nPix);720 721 if(dobj->LocalMap_isDone())722 {723 string ss("local mapping is done");724 os.PutStr(ss);725 int_4 x0, y0;726 double theta, phi, angle;727 dobj->Origin(theta, phi, x0, y0, angle);728 os.PutI4(x0);729 os.PutI4(y0);730 os.PutR8(theta);731 os.PutR8(phi);732 os.PutR8(angle);733 734 double angleX, angleY;735 dobj->Aperture(angleX, angleY);736 os.PutR8(angleX);737 os.PutR8(angleY);738 }739 else740 {741 string ss("no local mapping");742 os.PutStr(ss);743 }744 745 // On ecrit le dataBlock746 FIO_NDataBlock<T> fio_nd(&dobj->DataBlock());747 fio_nd.Write(os);748 }749 552 750 553 #ifdef __CXX_PRAGMA_TEMPLATES__ … … 753 556 #pragma define_template LocalMap< complex<r_8> > 754 557 #pragma define_template LocalMap< complex<r_4> > 755 #pragma define_template FIO_LocalMap<r_8>756 #pragma define_template FIO_LocalMap<r_4>757 #pragma define_template FIO_LocalMap< complex<r_4> >758 #pragma define_template FIO_LocalMap< complex<r_8> >759 558 #endif 760 559 #if defined(ANSI_TEMPLATES) || defined(GNU_TEMPLATES) … … 763 562 template class LocalMap< complex<r_8> >; 764 563 template class LocalMap< complex<r_4> >; 765 template class FIO_LocalMap<r_8>;766 template class FIO_LocalMap<r_4>;767 template class FIO_LocalMap< complex<r_4> >;768 template class FIO_LocalMap< complex<r_8> >;769 564 #endif -
trunk/SophyaLib/SkyMap/localmap.h
r764 r841 58 58 // ***************** Class LocalMap ***************************** 59 59 60 61 62 namespace SOPHYA { 63 64 60 65 template<class T> 61 66 class LocalMap : public PixelMap<T> … … 206 211 }; 207 212 208 // ------------- Classe pour la gestion de persistance -- 209 //! Delegated objects for persitance management 210 template <class T> 211 class FIO_LocalMap : public PPersist 212 { 213 214 public: 215 216 FIO_LocalMap(); 217 FIO_LocalMap(string const & filename); 218 FIO_LocalMap(const LocalMap<T>& obj); 219 FIO_LocalMap(LocalMap<T>* obj); 220 virtual ~FIO_LocalMap(); 221 virtual AnyDataObj* DataObj(); 222 virtual void SetDataObj(AnyDataObj & o); 223 inline operator LocalMap<T>() { return(*dobj); } 224 225 protected : 226 227 virtual void ReadSelf(PInPersist&); 228 virtual void WriteSelf(POutPersist&) const; 229 LocalMap<T>* dobj; 230 bool ownobj; 231 }; 213 214 215 } // Fin du namespace 232 216 233 217 #endif -
trunk/SophyaLib/SkyMap/skymapinit.cc
r764 r841 1 1 // Classe d'initialisation du module Outils++ 2 #include "machdefs.h" 3 #include "skymapinit.h" 4 2 5 #include <unistd.h> 3 4 #include "skymapinit.h"5 6 #include "spherethetaphi.h" 6 #include "spheregorski.h" 7 #include "fiospherehealpix.h" 8 #include "fiospherethetaphi.h" 9 #include "fiolocalmap.h" 7 10 #include "localmap.h" 8 11 9 12 int SkyMapInitiator::FgInit = 0; 10 13 11 14 SkyMapInitiator::SkyMapInitiator() 12 : TArrayInitiator()15 : SophyaInitiator() 13 16 { 14 SkyMapInitiator::FgInit++;15 if ( SkyMapInitiator::FgInit > 1) return;17 FgInit++; 18 if (FgInit > 1) return; 16 19 17 // Enregistrement des classes PPersist du module s Outils++20 // Enregistrement des classes PPersist du module SkyMap 18 21 19 22 PPRegister(FIO_SphereCoordSys); 23 DObjRegister(FIO_SphereCoordSys, SphereCoordSys); 20 24 21 25 PPRegister(FIO_SphereThetaPhi<r_4>); 26 DObjRegister(FIO_SphereThetaPhi<r_4>, SphereThetaPhi<r_4>); 27 22 28 PPRegister(FIO_SphereThetaPhi<r_8>); 29 DObjRegister(FIO_SphereThetaPhi<r_8>, SphereThetaPhi<r_8>); 30 23 31 PPRegister(FIO_SphereThetaPhi< complex<r_4> >); 32 DObjRegister(FIO_SphereThetaPhi< complex<r_4> >, SphereThetaPhi< complex<r_4> >); 33 24 34 PPRegister(FIO_SphereThetaPhi< complex<r_8> >); 35 DObjRegister(FIO_SphereThetaPhi< complex<r_8> >, SphereThetaPhi< complex<r_8> >); 25 36 26 PPRegister(FIO_SphereGorski<r_4>); 27 PPRegister(FIO_SphereGorski<r_8>); 28 PPRegister(FIO_SphereGorski< complex<r_4> >); 29 PPRegister(FIO_SphereGorski< complex<r_8> >); 37 PPRegister(FIO_SphereHealpix<r_4>); 38 DObjRegister(FIO_SphereHealpix<r_4>, SphereHealpix<r_4>); 39 40 PPRegister(FIO_SphereHealpix<r_8>); 41 DObjRegister(FIO_SphereHealpix<r_8>, SphereHealpix<r_8>); 42 43 PPRegister(FIO_SphereHealpix< complex<r_4> >); 44 DObjRegister(FIO_SphereHealpix< complex<r_4> >, SphereHealpix< complex<r_4> >); 45 46 PPRegister(FIO_SphereHealpix< complex<r_8> >); 47 DObjRegister(FIO_SphereHealpix< complex<r_8> >, SphereHealpix< complex<r_8> >); 30 48 31 49 PPRegister(FIO_LocalMap<r_4>); 50 DObjRegister(FIO_LocalMap<r_4>, LocalMap<r_4>); 51 32 52 PPRegister(FIO_LocalMap<r_8>); 53 DObjRegister(FIO_LocalMap<r_8>, LocalMap<r_8>); 54 33 55 PPRegister(FIO_LocalMap< complex<r_4> >); 56 DObjRegister(FIO_LocalMap< complex<r_4> >, LocalMap< complex<r_4> >); 57 34 58 PPRegister(FIO_LocalMap< complex<r_8> >); 59 DObjRegister(FIO_LocalMap< complex<r_8> >, LocalMap< complex<r_8> >); 35 60 36 61 … … 39 64 SkyMapInitiator::~SkyMapInitiator() 40 65 { 41 SkyMapInitiator::FgInit--;66 FgInit--; 42 67 } 43 68 … … 47 72 static SkyMapInitiator s_sskymapinit_; 48 73 74 -
trunk/SophyaLib/SkyMap/skymapinit.h
r764 r841 7 7 8 8 // Classe d''initialisation pour le modules SkyMap 9 #include " tarrinit.h"9 #include "sophyainit.h" 10 10 11 class SkyMapInitiator : public TArrayInitiator { 11 namespace SOPHYA { 12 13 class SkyMapInitiator : public SophyaInitiator { 12 14 private: 13 15 static int FgInit; … … 20 22 #define SophyaInit() SkyMapInitiator skymapinitiator 21 23 24 } // Fin du namespace 25 22 26 #endif 23 27
Note:
See TracChangeset
for help on using the changeset viewer.