Changeset 518 in Sophya


Ignore:
Timestamp:
Oct 26, 1999, 4:31:44 PM (26 years ago)
Author:
ansari
Message:

Introduction de SpherePosition and SphereCoordSys, and Initiator for module Samba - Reza+I. Grivell 26/10/99

Location:
trunk/SophyaLib/Samba
Files:
4 added
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/Samba/Makefile

    r510 r518  
    33all: $(LIB)libSamba.a
    44clean:
    5         rm -f $(OBJ)anagen.o $(OBJ)bruit.o $(OBJ)circle.o $(OBJ)gorfph.o $(OBJ)lambuilder.o $(OBJ)localmap.o $(OBJ)longlat.o $(OBJ)mlobe.o $(OBJ)scan.o $(OBJ)spheregorski.o $(OBJ)spherethetaphi.o $(OBJ)syngen.o $(OBJ)unitvector.o $(OBJ)utilgeom.o $(OBJ)vector3d.o
    6         rm $(LIB)libSamba.a
    7 $(LIB)libSamba.a : $(OBJ)bruit.o $(OBJ)circle.o $(OBJ)gorfph.o $(OBJ)localmap.o $(OBJ)longlat.o $(OBJ)mlobe.o $(OBJ)scan.o $(OBJ)spheregorski.o $(OBJ)spherethetaphi.o $(OBJ)unitvector.o $(OBJ)utilgeom.o $(OBJ)vector3d.o
     5        rm -f $(OBJ)ana2fast.o $(OBJ)anagen.o $(OBJ)bruit.o $(OBJ)circle.o $(OBJ)gorfph.o $(OBJ)lambuilder.o $(OBJ)localmap.o $(OBJ)longlat.o $(OBJ)mlobe.o $(OBJ)sambainit.o $(OBJ)scan.o $(OBJ)spheregorski.o $(OBJ)spherepos.o $(OBJ)spherethetaphi.o $(OBJ)syn2fast.o $(OBJ)syngen.o $(OBJ)unitvector.o $(OBJ)utilgeom.o $(OBJ)vector3d.o
     6        rm -f $(LIB)libSamba.a
     7$(LIB)libSamba.a : $(OBJ)bruit.o $(OBJ)circle.o $(OBJ)gorfph.o $(OBJ)localmap.o $(OBJ)longlat.o $(OBJ)mlobe.o $(OBJ)sambainit.o $(OBJ)scan.o $(OBJ)spheregorski.o $(OBJ)spherepos.o $(OBJ)spherethetaphi.o $(OBJ)unitvector.o $(OBJ)utilgeom.o $(OBJ)vector3d.o
    88        $(ARCXX) $(ARCXXFLAGS) $@ $?
    99ifeq ($(CXX),cxx)
     
    1111endif
    1212 
    13 $(OBJ)anagen.o: anagen.cc anagen.h $(INC)cvector.h \
    14  $(INC)matrix.h \
    15  $(INC)peida.h \
    16  $(INC)machdefs.h \
    17  $(INC)pclassids.h \
    18  $(INC)utils.h \
    19  $(INC)perrors.h \
    20  $(INC)pexceptions.h \
    21  $(INC)fmath.h \
    22  $(INC)ppersist.h \
    23  $(INC)md5.h sphericalmap.h \
    24  $(INC)nbmath.h pixelmap.h \
    25  $(INC)dvlist.h \
    26  $(INC)objfio.h \
    27  $(INC)anydataobj.h \
    28  $(INC)tvector.h \
    29  $(INC)tmatrix.h \
    30  $(INC)ndatablock.h lambuilder.h \
    31  $(INC)fftserver.h
    3213$(OBJ)bruit.o: bruit.cc $(INC)fmath.h bruit.h \
    3314 $(INC)nbrandom.h \
     
    6647 $(INC)ndatablock.h unitvector.h vector3d.h \
    6748 longlat.h utilgeom.h $(INC)timing.h
     49$(OBJ)sambainit.o: sambainit.cc sambainit.h \
     50 $(INC)outilsinit.h \
     51 $(INC)peidainit.h \
     52 $(INC)machdefs.h \
     53 $(INC)pclassids.h
    6854$(OBJ)scan.o: scan.cc $(INC)machdefs.h \
    6955 $(INC)pclassids.h scan.h \
     
    9076 $(INC)strutil.h \
    9177 $(INC)piocmplx.h
     78$(OBJ)spherepos.o: spherepos.cc spherepos.h \
     79 $(INC)machdefs.h \
     80 $(INC)pclassids.h \
     81 $(INC)ppersist.h \
     82 $(INC)pexceptions.h \
     83 $(INC)md5.h unitvector.h vector3d.h \
     84 longlat.h utilgeom.h
    9285$(OBJ)spherethetaphi.o: spherethetaphi.cc spherethetaphi.h sphericalmap.h \
    9386 $(INC)nbmath.h \
     
    10497 $(INC)ndatablock.h \
    10598 $(INC)piocmplx.h
    106 $(OBJ)syngen.o: syngen.cc syngen.h $(INC)cvector.h \
    107  $(INC)matrix.h \
    108  $(INC)peida.h \
    109  $(INC)machdefs.h \
    110  $(INC)pclassids.h \
    111  $(INC)utils.h \
    112  $(INC)perrors.h \
    113  $(INC)pexceptions.h \
    114  $(INC)fmath.h \
    115  $(INC)ppersist.h \
    116  $(INC)md5.h sphericalmap.h \
    117  $(INC)nbmath.h pixelmap.h \
    118  $(INC)dvlist.h \
    119  $(INC)objfio.h \
    120  $(INC)anydataobj.h \
    121  $(INC)tvector.h \
    122  $(INC)tmatrix.h \
    123  $(INC)ndatablock.h lambuilder.h \
    124  $(INC)fftserver.h
    12599$(OBJ)unitvector.o: unitvector.cc unitvector.h vector3d.h longlat.h \
    126100 utilgeom.h
  • trunk/SophyaLib/Samba/Samba.o.list

    r262 r518  
    55longlat.o
    66mlobe.o
     7sambainit.o
    78scan.o
    89spheregorski.o
     10spherepos.o
    911spherethetaphi.o
    1012unitvector.o
  • trunk/SophyaLib/Samba/exclude

    r470 r518  
    11lambuilder.cc
     2ana2fast.cc
     3anagen.cc
     4syngen.cc
     5syn2fast.cc
  • trunk/SophyaLib/Samba/lambuilder.cc

    r461 r518  
    22#include "lambuilder.h"
    33#include <iostream.h>
     4
     5double Lambda2Builder::bignorm = 1.e268; // = 1e-20*1.d288
    46
    57Lambda2Builder::Lambda2Builder(){}
  • trunk/SophyaLib/Samba/lambuilder.h

    r461 r518  
    3636  double fm2_;
    3737  //  static const double bignorm=1e-20*HUGE_VAL;
    38   static const double bignorm=1e-20*1.d288;
     38//  static const double bignorm=1e-20*1.d288;
     39  static const double bignorm;
    3940};
    4041
  • trunk/SophyaLib/Samba/localmap.cc

    r473 r518  
    220220//++
    221221template<class T>
     222bool LocalMap<T>::ContainsSph(double theta, double phi) const
     223//--
     224{
     225  return(true);  // $CHECK$  A MODIFIER - Reza 26/10/99
     226}
     227
     228//++
     229template<class T>
    222230int LocalMap<T>::PixIndexSph(double theta,double phi) const
    223231//
     
    591599    }
    592600
     601// Let's Read the SphereCoordSys object  -- ATTENTIOn - $CHECK$
     602  SphereCoordSys* cs = dynamic_cast<SphereCoordSys*>(is.ReadObject());
     603  dobj->SetCoordSys(cs);
     604
    593605  // Pour savoir s'il y avait un DVList Info associe
    594606  char strg[256];
     
    651663    }
    652664
     665// Let's write the SphereCoordSys object
     666  dobj->GetCoordSys()->Write(os);
     667 
    653668  char strg[256];
    654669  int nSzX= dobj->Size_x();
  • trunk/SophyaLib/Samba/localmap.h

    r473 r518  
     1// This may look like C code, but it is really -*- C++ -*-
    12#ifndef LOCALMAP_SEEN
    23#define LOCALMAP_SEEN
     
    6364virtual T const& PixVal(int k) const;
    6465
     66/* Return true if teta,phi in map  */
     67virtual bool ContainsSph(double theta, double phi) const;
    6568/* return the index of pixel at (theta,phi) */
    6669virtual int PixIndexSph(double theta,double phi) const;
  • trunk/SophyaLib/Samba/pixelmap.h

    r473 r518  
     1// This may look like C code, but it is really -*- C++ -*-
    12#ifndef PIXELMAP_SEEN
    23#define PIXELMAP_SEEN
     
    45#include "ppersist.h"
    56#include "dvlist.h"
     7#include "spherepos.h"
    68#include <iostream.h>
    79
     
    2123public:
    2224 
    23 PixelMap():mInfo_(NULL) {};
    24 virtual ~PixelMap() {};
    25  
     25              PixelMap(SphereCoordSys* cs = NULL) : mInfo_(NULL)
     26                    { if (cs) cs_ = cs; else cs = new SphereCoordSys; }
     27virtual       ~PixelMap()
     28                    { if (mInfo_) delete mInfo_; if (cs_) delete cs_; }
     29
     30// Set/Change/Get the coordinate system
     31virtual void  SetCoordSys(SphereCoordSys* cs)
     32                    { if (cs) { delete cs_;  cs_ = cs; } }
     33inline SphereCoordSys* GetCoordSys() const { return(cs_); }
     34
    2635// Number of pixels
    2736virtual int NbPixels() const=0;
     
    3039virtual T& PixVal(int k)=0;
    3140virtual T const& PixVal(int k) const=0;
    32    
     41
     42// Map s coverage
     43virtual bool ContainsSph(double theta, double phi) const=0;
     44virtual bool Contains(const SpherePosition& spos) const;
     45
    3346// Index of pixel at (theta,phi)
    3447virtual int PixIndexSph(double theta, double phi) const=0;
     48// Index of pixel at a sky-position
     49virtual int PixIndex(const SpherePosition& spos);
     50
    3551
    3652// Value of pixel number at (theta,phi)
     
    5571inline T const& operator()(int k) const {return(PixVal(k));}
    5672
     73// Overloading of () to access pixel at a sky position .
     74inline T& operator()(const SpherePosition& spos)
     75                     { return(PixVal(PixIndex(spos))); }
     76inline T const& operator()(const SpherePosition& spos) const
     77                     { return(PixVal(PixIndex(spos))); }
     78
     79
    5780// Note : no overloading of (double,double) to access pixel (theta,phi).
    5881// overloading of (double,double) in SphericalMap
     
    7598
    7699protected :
    77 
     100    SphereCoordSys *cs_;   // Coordinate system used in the map
    78101    DVList* mInfo_;        // Infos (variables) attachees
    79102};
     103
     104
     105template <class T>
     106int PixelMap<T>::PixIndex(const SpherePosition& spos)
     107{
     108UnitVector v = spos.Transform(*cs_);
     109return(PixIndexSph(v.Theta(), v.Phi()));
     110}
     111
     112template <class T>
     113bool PixelMap<T>::Contains(const SpherePosition& spos) const
     114{
     115UnitVector v = spos.Transform(*cs_);
     116return(ContainsSph(v.Theta(), v.Phi()));
     117}
     118
    80119#endif
  • trunk/SophyaLib/Samba/spheregorski.cc

    r515 r518  
    452452//++
    453453template<class T>
     454bool SphereGorski<T>::ContainsSph(double theta, double phi) const
     455//--
     456{
     457return(true);
     458}
     459
     460/* --Methode-- */
     461//++
     462template<class T>
    454463int SphereGorski<T>::PixIndexSph(double theta,double phi) const
    455464
     
    890899  //  return ( ipf + face_num*pow(nside,2));//    ! in {0, 12*nside**2 - 1}
    891900  // $CHECK$  Reza 25/10/99 , pow remplace par *
    892   //  ipf = ipf / ((ns_max/nside)*(ns_max/nside)); //  ! in {0, nside**2 - 1}
    893   //  return ( ipf + face_num*(nside*nside);//    ! in {0, 12*nside**2 - 1}
     901  ipf = ipf / ((ns_max/nside)*(ns_max/nside));
     902  return (ipf + face_num*nside*nside);
    894903}
    895904
     
    11381147    }
    11391148
     1149// Let's Read the SphereCoordSys object  -- ATTENTIOn - $CHECK$
     1150  SphereCoordSys* cs = dynamic_cast<SphereCoordSys*>(is.ReadObject());
     1151  dobj->SetCoordSys(cs);
     1152
    11401153  // Pour savoir s'il y avait un DVList Info associe
    11411154  char strg[256];
     
    11771190      return;
    11781191    }
     1192
     1193// Let's write the SphereCoordSys object
     1194  dobj->GetCoordSys()->Write(os);
    11791195
    11801196  char strg[256];
  • trunk/SophyaLib/Samba/spheregorski.h

    r487 r518  
    3737void GetThetaSlice(int index,double& theta,TVector<double>& phi,TVector<T>& value) const;
    3838
     39/* Return true if teta,phi in map  */
     40virtual bool ContainsSph(double theta, double phi) const;
    3941/* Indice "RING" du pixel vers lequel pointe une direction definie par
    4042ses  coordonnees spheriques */                                   
  • trunk/SophyaLib/Samba/spherethetaphi.cc

    r515 r518  
    183183//++
    184184template <class T>
     185bool SphereThetaPhi<T>::ContainsSph(double theta, double phi) const
     186//--
     187{
     188  return(true);
     189}
     190
     191/* --Methode-- */
     192//++
     193template <class T>
    185194int SphereThetaPhi<T>::PixIndexSph(double theta, double phi) const
    186195
     
    713722    }
    714723
     724// Let's Read the SphereCoordSys object  -- ATTENTIOn - $CHECK$
     725  SphereCoordSys* cs = dynamic_cast<SphereCoordSys*>(is.ReadObject());
     726  dobj->SetCoordSys(cs);
     727
    715728  // Pour savoir s'il y avait un DVList Info associe
    716729  char strg[256];
     
    767780    }
    768781
     782// Let's write the SphereCoordSys object
     783  dobj->GetCoordSys()->Write(os);
     784 
    769785  char strg[256];
    770786  int mNTheta= dobj->SizeIndex();
  • trunk/SophyaLib/Samba/spherethetaphi.h

    r487 r518  
    3232virtual T const& PixVal(int k) const;
    3333
     34/* Return true if teta,phi in map  */
     35virtual bool ContainsSph(double theta, double phi) const;
    3436/* retourne l'indice du pixel a (theta,phi) */
    3537virtual int PixIndexSph(double theta, double phi) const;
  • trunk/SophyaLib/Samba/unitvector.h

    r262 r518  
    1717  UnitVector(const Vector3d&);
    1818 
    19   Vector3d& operator=(const Vector3d&);
    20   Vector3d& operator+=(const Vector3d&);
    21   Vector3d& operator-=(const Vector3d&);
    22   Vector3d operator+(const Vector3d&) const;
    23   Vector3d operator-(const Vector3d&) const;
     19  virtual Vector3d& operator=(const Vector3d&);
     20  virtual Vector3d& operator+=(const Vector3d&);
     21  virtual Vector3d& operator-=(const Vector3d&);
     22  virtual Vector3d operator+(const Vector3d&) const;
     23  virtual Vector3d operator-(const Vector3d&) const;
     24
     25  virtual Vector3d& operator+=(double d) { return Vector3d::operator+= (d); }
     26  virtual Vector3d operator+(double d) const { return Vector3d::operator+ (d); }
     27  virtual Vector3d operator-(double d) const { return Vector3d::operator- (d); }
    2428
    2529  void Print(ostream& os) const;
  • trunk/SophyaLib/Samba/vector3d.h

    r517 r518  
    3131  Vector3d(const Vector3d&);
    3232
    33   void Setxyz(double x, double y, double z);
    34   void SetThetaPhi(double theta,  double phi);
    35   void ThetaPhi2xyz();
    36   void xyz2ThetaPhi();
    37   double Theta() const {return _theta;}
    38   double Phi() const {return _phi;}
    39   double X() const {return _x;}
    40   double Y() const {return _y;}
    41   double Z() const {return _z;}
     33//   To manipulate the vector
     34  virtual void Setxyz(double x, double y, double z);
     35  virtual void SetThetaPhi(double theta,  double phi);
     36  virtual void ThetaPhi2xyz();
     37  virtual void xyz2ThetaPhi();
    4238
    43   Vector3d& Normalize();
    44   double Norm() const;
     39// Acces to coordinates
     40  inline double Theta() const {return _theta;}
     41  inline double Phi() const {return _phi;}
     42  inline double X() const {return _x;}
     43  inline double Y() const {return _y;}
     44  inline double Z() const {return _z;}
     45
     46  virtual Vector3d& Normalize();
     47  virtual double Norm() const;
    4548
    4649  // produit scalaire
    47   double Psc(const Vector3d&) const;
     50  virtual double Psc(const Vector3d&) const;
    4851
    4952  // ecart angulaire entre 2 vecteurs dans [0,Pi]
    50   double SepAngle(const Vector3d&) const;
     53  virtual double SepAngle(const Vector3d&) const;
    5154
    5255  // produit vectoriel
    53   Vector3d Vect(const Vector3d&) const;
     56  virtual Vector3d Vect(const Vector3d&) const;
    5457
    5558  // vecteur perpendiculaire de meme phi
    56   Vector3d VperpPhi() const;
     59  virtual Vector3d VperpPhi() const;
    5760
    5861  // vecteur perpendiculaire de meme theta
    59   Vector3d VperpTheta() const;
     62  virtual Vector3d VperpTheta() const;
    6063
    61   Vector3d ETheta() const;
    62   Vector3d EPhi() const;
     64  virtual Vector3d ETheta() const;
     65  virtual Vector3d EPhi() const;
    6366
    64   // rotations d'Euler
    65   Vector3d Euler(double, double, double) const;
     67  // rotations d Euler
     68  virtual Vector3d Euler(double, double, double) const;
    6669
    6770  // rotation inverse
    6871  Vector3d InvEuler(double, double, double) const;
    6972
    70   // rotation d'angle phi autour d'un axe omega (regle du tire-bouchon)
     73  // rotation d angle phi autour d'un axe omega (regle du tire-bouchon)
    7174  Vector3d Rotate(const Vector3d& omega,double phi);
    7275
     
    7780  virtual Vector3d operator-(const Vector3d&) const;
    7881
    79   Vector3d& operator+=(double);
    80   Vector3d& operator/=(double);
    81   Vector3d& operator*=(double);
     82  virtual Vector3d& operator+=(double);
     83  virtual Vector3d& operator/=(double);
     84  virtual Vector3d& operator*=(double);
    8285
    83   Vector3d operator+(double) const;
    84   Vector3d operator-(double) const;
    85   Vector3d operator*(double) const;
    86   Vector3d operator/(double) const;
    87   Vector3d operator^(const Vector3d&) const; // produit vectoriel
    88   double operator*(const Vector3d&) const; // produit scalaire
     86  virtual Vector3d operator+(double) const;
     87  virtual Vector3d operator-(double) const;
     88  virtual Vector3d operator*(double) const;
     89  virtual Vector3d operator/(double) const;
     90
     91  virtual Vector3d operator^(const Vector3d&) const; // produit vectoriel
     92  virtual double operator*(const Vector3d&) const; // produit scalaire
     93
    8994  bool operator==(const Vector3d&);
    9095 
Note: See TracChangeset for help on using the changeset viewer.