Changeset 841 in Sophya for trunk/SophyaLib/SkyMap


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

FIO fichiers separes

Location:
trunk/SophyaLib/SkyMap
Files:
4 edited

Legend:

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

    r809 r841  
    550550//--
    551551
    552 //*******************************************************************
    553 // class FIO_LocalMap<T>
    554 //  Les objets delegues pour la gestion de persistance
    555 //*******************************************************************
    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 associe
    641   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 Info
    647       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) const
    691 //
    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   else
    712     {
    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   else
    740     {
    741       string ss("no local mapping");
    742       os.PutStr(ss);
    743     }
    744 
    745 // On ecrit le dataBlock
    746   FIO_NDataBlock<T> fio_nd(&dobj->DataBlock());
    747   fio_nd.Write(os);
    748 }
    749552
    750553#ifdef __CXX_PRAGMA_TEMPLATES__
     
    753556#pragma define_template LocalMap< complex<r_8> >
    754557#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> >
    759558#endif
    760559#if defined(ANSI_TEMPLATES) || defined(GNU_TEMPLATES)
     
    763562template class LocalMap< complex<r_8> >;
    764563template 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> >;
    769564#endif
  • trunk/SophyaLib/SkyMap/localmap.h

    r764 r841  
    5858// ***************** Class LocalMap *****************************
    5959
     60
     61
     62namespace SOPHYA {
     63
     64
    6065template<class T>
    6166class LocalMap : public PixelMap<T>
     
    206211};
    207212
    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
    232216
    233217#endif
  • trunk/SophyaLib/SkyMap/skymapinit.cc

    r764 r841  
    11// Classe d'initialisation du module Outils++
     2#include "machdefs.h"
     3#include "skymapinit.h"
     4
    25#include <unistd.h>
    3 
    4 #include "skymapinit.h"
    56#include "spherethetaphi.h"
    6 #include "spheregorski.h"
     7#include "fiospherehealpix.h"
     8#include "fiospherethetaphi.h"
     9#include "fiolocalmap.h"
    710#include "localmap.h"
    8 
     11 
    912int SkyMapInitiator::FgInit = 0;
    1013
    1114SkyMapInitiator::SkyMapInitiator()
    12   : TArrayInitiator()
     15  : SophyaInitiator()
    1316{
    14   SkyMapInitiator::FgInit++;
    15   if (SkyMapInitiator::FgInit > 1)  return;
     17  FgInit++;
     18  if (FgInit > 1)  return;
    1619
    17 //   Enregistrement des classes PPersist du modules Outils++
     20//   Enregistrement des classes PPersist du module SkyMap
    1821 
    1922  PPRegister(FIO_SphereCoordSys);
     23  DObjRegister(FIO_SphereCoordSys, SphereCoordSys);
    2024
    2125  PPRegister(FIO_SphereThetaPhi<r_4>);
     26  DObjRegister(FIO_SphereThetaPhi<r_4>, SphereThetaPhi<r_4>);
     27
    2228  PPRegister(FIO_SphereThetaPhi<r_8>);
     29  DObjRegister(FIO_SphereThetaPhi<r_8>, SphereThetaPhi<r_8>);
     30
    2331  PPRegister(FIO_SphereThetaPhi< complex<r_4> >);
     32  DObjRegister(FIO_SphereThetaPhi< complex<r_4> >, SphereThetaPhi< complex<r_4> >);
     33
    2434  PPRegister(FIO_SphereThetaPhi< complex<r_8> >);
     35  DObjRegister(FIO_SphereThetaPhi< complex<r_8> >, SphereThetaPhi< complex<r_8> >);
    2536
    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> >);
    3048
    3149  PPRegister(FIO_LocalMap<r_4>);
     50  DObjRegister(FIO_LocalMap<r_4>, LocalMap<r_4>);
     51
    3252  PPRegister(FIO_LocalMap<r_8>);
     53  DObjRegister(FIO_LocalMap<r_8>, LocalMap<r_8>);
     54
    3355  PPRegister(FIO_LocalMap< complex<r_4> >);
     56  DObjRegister(FIO_LocalMap< complex<r_4> >, LocalMap< complex<r_4> >);
     57
    3458  PPRegister(FIO_LocalMap< complex<r_8> >);
     59  DObjRegister(FIO_LocalMap< complex<r_8> >, LocalMap< complex<r_8> >);
    3560
    3661
     
    3964SkyMapInitiator::~SkyMapInitiator()
    4065{
    41   SkyMapInitiator::FgInit--;
     66  FgInit--;
    4267}
    4368
     
    4772static SkyMapInitiator s_sskymapinit_;
    4873
     74 
  • trunk/SophyaLib/SkyMap/skymapinit.h

    r764 r841  
    77
    88// Classe d''initialisation pour le modules SkyMap
    9 #include "tarrinit.h"
     9#include "sophyainit.h"
    1010
    11 class SkyMapInitiator : public TArrayInitiator {
     11namespace SOPHYA {
     12
     13class SkyMapInitiator : public SophyaInitiator {
    1214private:
    1315  static int FgInit;
     
    2022#define SophyaInit() SkyMapInitiator skymapinitiator
    2123
     24} // Fin du namespace
     25
    2226#endif
    2327
Note: See TracChangeset for help on using the changeset viewer.