Changeset 682 in Sophya


Ignore:
Timestamp:
Dec 10, 1999, 5:56:03 PM (26 years ago)
Author:
ansari
Message:

Compilation Mac pour CodeWarrior PRO 5

Location:
trunk/SophyaLib
Files:
1 added
1 deleted
25 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/BaseTools/machdefs.h

    r632 r682  
    233233#undef  HAS_VEC_NEW
    234234#define NO_STRSTREAM
    235 #define STREAMPOS_IS_CLASS
     235//#define STREAMPOS_IS_CLASS
    236236#define ITER_TAG
    237237#define HAS_IOS_BIN
  • trunk/SophyaLib/NTools/datime.c

    r517 r682  
    66#include <math.h>
    77#ifdef __MWERKS__
    8    #include "mwerksmath.h"
    9 //   #include "unixmac.h"
     8#include "unixmac.h"
    109#endif
    1110
  • trunk/SophyaLib/NTools/generalfit.cc

    r519 r682  
    55#include <math.h>
    66#ifdef __MWERKS__
    7    #include "mwerksmath.h"
    8  //  #include "unixmac.h"
     7#include "unixmac.h"
    98#endif
    109#include <string.h>
  • trunk/SophyaLib/NTools/histos.cc

    r514 r682  
    11//
    2 // $Id: histos.cc,v 1.6 1999-10-25 16:39:57 ansari Exp $
     2// $Id: histos.cc,v 1.7 1999-12-10 16:55:51 ansari Exp $
    33//
    44
     
    17811781
    17821782// Que faut-il ecrire?
    1783 int errok = (dobj->err2) ? 1 : 0;
     1783int_4 errok = (dobj->err2) ? 1 : 0;
    17841784
    17851785// Ecriture entete pour identifier facilement
  • trunk/SophyaLib/NTools/matxop.c

    r220 r682  
    393393if (szv < 25) szv = 25;
    394394
    395 if ( (FVeci = malloc(nvarmx*sizeof(float *))) == NULL )
     395if ( (FVeci = (float**) malloc(nvarmx*sizeof(float *))) == NULL )
    396396  { printf("InitRFitLin_Erreur: (Pb malloc(Veci)) \n");
    397397  return(1);
    398398  }
    399399
    400 if ( (FVSpace = malloc(nvarmx*szv*sizeof(float))) == NULL )
     400if ( (FVSpace = (float*)  malloc(nvarmx*szv*sizeof(float))) == NULL )
    401401  { printf("InitRFitLin_Erreur: (Pb malloc(VSpace)) \n");
    402402  free(FVeci);
     
    407407
    408408
    409 if ( (FVecf = malloc(3*sizeof(float *))) == NULL )
     409if ( (FVecf = (float**) malloc(3*sizeof(float *))) == NULL )
    410410  { printf("InitRFitLin_Erreur: (Pb malloc(Vecf)) \n");
    411411  free(FVeci);
     
    414414  }
    415415
    416 if ( (FVSpacef = malloc(3*szv*sizeof(float))) == NULL )
     416if ( (FVSpacef = (float*) malloc(3*szv*sizeof(float))) == NULL )
    417417  { printf("InitRFitLin_Erreur: (Pb malloc(VSpacef)) \n");
    418418  free(FVeci);
     
    425425
    426426
    427 if ( (FFMtx = malloc(nvarmx*nvarmx*sizeof(double))) == NULL )
     427if ( (FFMtx = (double*) malloc(nvarmx*nvarmx*sizeof(double))) == NULL )
    428428  { printf("InitRFitLin_Erreur: (Pb malloc(FMtx)) \n");
    429429  free(FVeci);
     
    434434  }
    435435
    436 if ( (FFMtx2 = malloc(nvarmx*nvarmx*sizeof(double))) == NULL )
     436if ( (FFMtx2 = (double*) malloc(nvarmx*nvarmx*sizeof(double))) == NULL )
    437437  { printf("InitRFitLin_Erreur: (Pb malloc(FMtx2)) \n");
    438438  free(FVeci);
     
    444444  }
    445445
    446 if ( (FFSort = malloc((nvarmx+1)*nvarmx*sizeof(double))) == NULL )
     446if ( (FFSort = (double*) malloc((nvarmx+1)*nvarmx*sizeof(double))) == NULL )
    447447  { printf("InitRFitLin_Erreur: (Pb malloc(FFSort)) \n");
    448448  free(FVeci);
     
    705705if (szv < 25) szv = 25;
    706706
    707 if ( (DVeci = malloc(nvarmx*sizeof(double *))) == NULL )
     707if ( (DVeci = (double**) malloc(nvarmx*sizeof(double *))) == NULL )
    708708  { printf("InitDFitLin_Erreur: (Pb malloc(Veci)) \n");
    709709  return(1);
    710710  }
    711711
    712 if ( (DVSpace = malloc(nvarmx*szv*sizeof(double))) == NULL )
     712if ( (DVSpace = (double*) malloc(nvarmx*szv*sizeof(double))) == NULL )
    713713  { printf("InitDFitLin_Erreur: (Pb malloc(VSpace)) \n");
    714714  free(DVeci);
     
    719719
    720720
    721 if ( (DVecf = malloc(3*sizeof(double *))) == NULL )
     721if ( (DVecf = (double**) malloc(3*sizeof(double *))) == NULL )
    722722  { printf("InitDFitLin_Erreur: (Pb malloc(Vecf)) \n");
    723723  free(DVeci);
     
    726726  }
    727727
    728 if ( (DVSpacef = malloc(3*szv*sizeof(double))) == NULL )
     728if ( (DVSpacef = (double*) malloc(3*szv*sizeof(double))) == NULL )
    729729  { printf("InitDFitLin_Erreur: (Pb malloc(VSpacef)) \n");
    730730  free(DVeci);
     
    737737
    738738
    739 if ( (DFMtx = malloc(nvarmx*nvarmx*sizeof(double))) == NULL )
     739if ( (DFMtx = (double*) malloc(nvarmx*nvarmx*sizeof(double))) == NULL )
    740740  { printf("InitDFitLin_Erreur: (Pb malloc(FMtx)) \n");
    741741  free(DVeci);
     
    746746  }
    747747
    748 if ( (DFMtx2 = malloc(nvarmx*nvarmx*sizeof(double))) == NULL )
     748if ( (DFMtx2 = (double*) malloc(nvarmx*nvarmx*sizeof(double))) == NULL )
    749749  { printf("InitDFitLin_Erreur: (Pb malloc(FMtx2)) \n");
    750750  free(DVeci);
  • trunk/SophyaLib/NTools/nbmath.c

    r220 r682  
    16431643{
    16441644int npt,k,i,nclass;
    1645 double *class,aa1,c2,cut;
     1645double *clas,aa1,c2,cut;
    16461646
    16471647*a1 =0.;
     
    16541654/* printf("pass 1: %g*x c2=%g/%d\n",*a1,c2,npt); */
    16551655
    1656 class = malloc( *n * sizeof(double) );
    1657 if( class == NULL ) {*n=npt; return(-3.);}
     1656clas = (double*) malloc( *n * sizeof(double) );
     1657if( clas == NULL ) {*n=npt; return(-3.);}
    16581658
    16591659/* elimination des mauvais points */
     
    16621662  if(ey[i]<=0.) continue;
    16631663  c2 = (y[i]-aa1*x[i])/ey[i];
    1664   class[nclass] = c2*c2;
     1664  clas[nclass] = c2*c2;
    16651665  nclass++;
    16661666}
    1667 qsort(class,(size_t) nclass,(size_t) sizeof(double),qSort_Dble);
     1667qsort(clas,(size_t) nclass,(size_t) sizeof(double),qSort_Dble);
    16681668k = (int) ( (1. - per_clean ) * (double) nclass );
    16691669if(k<0) k=0;
    16701670if(k>=nclass) k = nclass-1;
    1671 cut = class[k];
     1671cut = clas[k];
    16721672k = 0;
    16731673for(i=0;i<*n;i++) {
    1674   class[i] = ey[i];
     1674  clas[i] = ey[i];
    16751675  c2 = (y[i]-aa1*x[i])/ey[i];
    16761676  c2 *= c2;
    1677   if(ey[i]>0. && c2>cut) {class[i] = -1.; k++;}
     1677  if(ey[i]>0. && c2>cut) {clas[i] = -1.; k++;}
    16781678}
    16791679/* printf("nombre pt tues %d cut=%g\n",k,cut); */
     
    16811681/* 2sd passe */
    16821682npt = *n;
    1683 c2 = FitProp(x,y,class,&npt,&aa1);
    1684 if(c2<0.) {*n = npt; free(class); return(-2.);}
     1683c2 = FitProp(x,y,clas,&npt,&aa1);
     1684if(c2<0.) {*n = npt; free(clas); return(-2.);}
    16851685*a1 = aa1;
    16861686*n = npt;
    16871687/* printf("pass 2: %g*x c2=%g/%d\n",*a1,c2,npt); */
    16881688
    1689 free(class);
     1689free(clas);
    16901690return(c2);
    16911691}
     
    17301730{
    17311731int npt,k,i,nclass;
    1732 double *class,aa0,aa1,c2,cut;
     1732double *clas,aa0,aa1,c2,cut;
    17331733
    17341734*a0 = *a1 =0.;
     
    17421742/* printf("pass 1: %g + %g*x c2=%g/%d\n",*a0,*a1,c2,npt); */
    17431743
    1744 class = malloc( *n * sizeof(double) );
    1745 if( class == NULL ) {*n=npt; return(-3.);}
     1744clas = (double*) malloc( *n * sizeof(double) );
     1745if( clas == NULL ) {*n=npt; return(-3.);}
    17461746
    17471747/* elimination des mauvais points */
     
    17501750  if(ey[i]<=0.) continue;
    17511751  c2 = (y[i]-(aa0+aa1*x[i]))/ey[i];
    1752   class[nclass] = c2*c2;
     1752  clas[nclass] = c2*c2;
    17531753  nclass++;
    17541754}
    1755 qsort(class,(size_t) nclass,(size_t) sizeof(double),qSort_Dble);
     1755qsort(clas,(size_t) nclass,(size_t) sizeof(double),qSort_Dble);
    17561756k = (int) ( (1. - per_clean ) * (double) nclass );
    17571757if(k<0) k=0;
    17581758if(k>=nclass) k = nclass-1;
    1759 cut = class[k];
     1759cut = clas[k];
    17601760k = 0;
    17611761for(i=0;i<*n;i++) {
    1762   class[i] = ey[i];
     1762  clas[i] = ey[i];
    17631763  c2 = (y[i]-(aa0+aa1*x[i]))/ey[i];
    17641764  c2 *= c2;
    1765   if(ey[i]>0. && c2>cut) {class[i] = -1.; k++;}
     1765  if(ey[i]>0. && c2>cut) {clas[i] = -1.; k++;}
    17661766}
    17671767/* printf("nombre pt tues %d cut=%g\n",k,cut); */
     
    17691769/* 2sd passe */
    17701770npt = *n;
    1771 c2 = FitLin(x,y,class,&npt,&aa0,&aa1);
    1772 if(c2<0.) {*n = npt; free(class); return(-2.);}
     1771c2 = FitLin(x,y,clas,&npt,&aa0,&aa1);
     1772if(c2<0.) {*n = npt; free(clas); return(-2.);}
    17731773*a0 = aa0;
    17741774*a1 = aa1;
     
    17761776/* printf("pass 2: %g + %g*x c2=%g/%d\n",*a0,*a1,c2,npt); */
    17771777
    1778 free(class);
     1778free(clas);
    17791779return(c2);
    17801780}
     
    18151815{
    18161816int npt,k,i,nclass;
    1817 double *class,aa0,aa1,aa2,c2,cut;
     1817double *clas,aa0,aa1,aa2,c2,cut;
    18181818
    18191819*a0 = *a1 = *a2 =0.;
     
    18281828/* printf("pass 1: %g + %g*x + %g*x**2 c2=%g/%d\n",*a0,*a1,*a2,c2,npt); */
    18291829
    1830 class = malloc( *n * sizeof(double) );
    1831 if( class == NULL ) {*n=npt; return(-3.);}
     1830clas = (double*) malloc( *n * sizeof(double) );
     1831if( clas == NULL ) {*n=npt; return(-3.);}
    18321832
    18331833/* elimination des mauvais points */
     
    18361836  if(ey[i]<=0.) continue;
    18371837  c2 = (y[i]-(aa0+aa1*x[i]+aa2*x[i]*x[i]))/ey[i];
    1838   class[nclass] = c2*c2;
     1838  clas[nclass] = c2*c2;
    18391839  nclass++;
    18401840}
    1841 qsort(class,(size_t) nclass,(size_t) sizeof(double),qSort_Dble);
     1841qsort(clas,(size_t) nclass,(size_t) sizeof(double),qSort_Dble);
    18421842k = (int) ( (1. - per_clean ) * (double) nclass );
    18431843if(k<0) k=0;
    18441844if(k>=nclass) k = nclass-1;
    1845 cut = class[k];
     1845cut = clas[k];
    18461846k = 0;
    18471847for(i=0;i<*n;i++) {
    1848   class[i] = ey[i];
     1848  clas[i] = ey[i];
    18491849  c2 = (y[i]-(aa0+aa1*x[i]+aa2*x[i]*x[i]))/ey[i];
    18501850  c2 *= c2;
    1851   if(ey[i]>0. && c2>cut) {class[i] = -1.; k++;}
     1851  if(ey[i]>0. && c2>cut) {clas[i] = -1.; k++;}
    18521852}
    18531853/* printf("nombre pt tues %d cut=%g\n",k,cut); */
     
    18551855/* 2sd passe */
    18561856npt = *n;
    1857 c2 = FitPar(x,y,class,&npt,&aa0,&aa1,&aa2);
    1858 if(c2<0.) {*n = npt; free(class); return(-2.);}
     1857c2 = FitPar(x,y,clas,&npt,&aa0,&aa1,&aa2);
     1858if(c2<0.) {*n = npt; free(clas); return(-2.);}
    18591859*a0 = aa0;
    18601860*a1 = aa1;
     
    18631863/* printf("pass 2: %g + %g*x + %g*x**2 c2=%g/%d\n",*a0,*a1,*a2,c2,npt); */
    18641864
    1865 free(class);
     1865free(clas);
    18661866return(c2);
    18671867}
  • trunk/SophyaLib/NTools/nbrandom.c

    r244 r682  
    495495
    496496sof = sizeof(struct tirage_alea);
    497 if( (t = malloc(sof) ) == NULL ) {
     497if( (t = (struct tirage_alea*)malloc(sof) ) == NULL ) {
    498498  printf("impossible d'allouer *tirage_alea par malloc \n");
    499499  return(NULL);
     
    503503
    504504sof = nbin * sizeof(double);
    505 if( (t->Tab = malloc(sof) ) == NULL ) {
     505if( (t->Tab = (double*)malloc(sof) ) == NULL ) {
    506506  printf("impossible d'allouer *tirage_alea.Tab par malloc \n");
    507507  return(NULL);
  • trunk/SophyaLib/NTools/nbrandom.h

    r517 r682  
    88#include <stdlib.h>
    99#ifdef __MWERKS__
    10    #include "mwerksmath.h"
    11    #include "unixmac.h"
     10#include "unixmac.h"
    1211#endif
    1312
  • trunk/SophyaLib/Samba/ana2fast.cc

    r522 r682  
    55#include "ana2fast.h"
    66#include "lambuilder.h"
     7#ifdef __MWERKS__
     8#include "unixmac.h"
     9#endif
     10
    711
    812/*extern "C" {
  • trunk/SophyaLib/Samba/bruit.cc

    r680 r682  
    44
    55#ifdef __MWERKS__
    6    #include "mwerksmath.h"
    7    #include "unixmac.h"
     6#include "unixmac.h"
    87#endif
    98
  • trunk/SophyaLib/Samba/lambuilder.cc

    r568 r682  
    22#include "lambuilder.h"
    33#include <iostream.h>
     4#ifdef __MWERKS__
     5#include "unixmac.h"
     6#endif
     7
    48//++
    59// Class        Lambda2Builder
     
    812//--
    913
    10 double Lambda2Builder::bignorm = 1.e268; // = 1e-20*1.d288
     14const double LambdaBuilder::bignorm = 1.e268; // = 1e-20*1.d288
    1115
    1216Lambda2Builder::Lambda2Builder(){}
  • trunk/SophyaLib/Samba/localmap.cc

    r604 r682  
    66#include <string.h>
    77#include <iostream.h>
     8
     9
     10//*****************************************************************************
     11//++
     12// Class        LocalMap
     13//
     14// include      localmap.h nbmath.h
     15//
     16//    A local map of a region of the sky, in cartesian coordinates.
     17//    It has an origin in (theta0, phi0), mapped to pixel(x0, y0)
     18//    (x0, y0 might be outside of this local map)
     19//    default value of (x0, y0) is middle of the map, center of
     20//    pixel(nx/2, ny/2)
     21//
     22//    A local map is a 2 dimensional array, with i as column index and j
     23//    as row index. The map is supposed to lie on a plan tangent to the
     24//    celestial sphere in a point whose coordinates are (x0,y0) on the local
     25//    map and (theta0, phi0) on the sphere. The range of the map is defined
     26//    by two values of angles covered respectively by all the pixels in
     27//    x direction and all the pixels in y direction (SetSize()).
     28//
     29//    A "reference plane" is considered : this plane is tangent to the
     30//    celestial sphere in a point with angles theta=Pi/2 and phi=0. This
     31//    point is the origine of coordinates is of the reference plane. The
     32//    x-axis is the tangent parallel to the equatorial line and oriented
     33//    toward the increasing phi's ; the y-axis is parallel to the meridian
     34//    line and oriented toward the north pole.
     35//   
     36//    Internally, a map is first defined within this reference plane and
     37//    tranported until the point (theta0, phi0) in such a way that both
     38//    axes are kept parallel to meridian and parallel lines of the sphere.
     39//    The user can define its own map with axes rotated with respect to
     40//    reference axes (this rotation is characterized by angle between
     41//    the local parallel line and the wanted x-axis-- see method
     42//    SetOrigin(...))
     43//   
     44//
     45
     46//
     47//--
     48//++
     49//
     50// Links        Parents
     51//
     52//    PixelMap
     53//   
     54//--
     55//++
     56//
     57// Links        Childs
     58//
     59//     
     60//--
     61//++
     62// Titre        Constructors
     63//--
     64//++
     65template<class T>
     66LocalMap<T>::LocalMap()
     67//
     68//     
     69//--
     70{
     71  InitNul();
     72  pixels_.Reset();
     73}
     74
     75//++
     76template<class T>
     77LocalMap<T>::LocalMap(int_4 nx, int_4 ny) : nSzX_(nx), nSzY_(ny)
     78//
     79//   
     80//--
     81{
     82  InitNul();
     83  nPix_= nx*ny;
     84  pixels_.ReSize(nPix_);
     85  pixels_.Reset();
     86}
     87
     88//++
     89template<class T>
     90LocalMap<T>::LocalMap(const LocalMap<T>& lm, bool share)
     91  : pixels_(lm.pixels_, share)
     92
     93//
     94//    copy constructor
     95//--
     96{
     97  cout<<" LocalMap:: Appel du constructeur de recopie " << endl;
     98
     99  if(lm.mInfo_) mInfo_= new DVList(*lm.mInfo_);
     100  nSzX_= lm.nSzX_;
     101  nSzY_= lm.nSzY_;
     102  nPix_= lm.nPix_;
     103  originFlag_= lm.originFlag_;
     104  extensFlag_= lm.extensFlag_;
     105  x0_= lm.x0_;
     106  y0_= lm.y0_;
     107  theta0_= lm.theta0_;
     108  phi0_= lm.phi0_;
     109  angle_= lm.angle_;
     110  cos_angle_= lm.cos_angle_;
     111  sin_angle_= lm.sin_angle_;
     112  angleX_= lm.angleX_;
     113  angleY_= lm.angleY_;
     114  tgAngleX_= lm.tgAngleX_;
     115  tgAngleY_= lm.tgAngleY_;
     116}
     117
     118//++
     119// Titre        Destructor
     120//--
     121//++
     122template<class T>
     123LocalMap<T>::~LocalMap()
     124//
     125//--
     126{
     127  InitNul();
     128}
     129
     130
     131
     132//++
     133// Titre        Public Methods
     134//--
     135
     136//++
     137template<class T>
     138void LocalMap<T>::ReSize(int_4 nx, int_4 ny)
     139//
     140//    Resize storage area for pixels
     141//--
     142{
     143  InitNul();
     144  nSzX_ = nx;
     145  nSzY_ = ny;
     146  nPix_= nx*ny;
     147  pixels_.ReSize(nPix_);
     148  pixels_.Reset();
     149}
     150
     151//++
     152template<class T>
     153int_4 LocalMap<T>::NbPixels() const
     154//
     155//    Return number of pixels
     156//--
     157{
     158  return(nPix_);
     159}
     160
     161//++
     162template<class T>
     163T& LocalMap<T>::PixVal(int_4 k)
     164//
     165//    Return value of pixel with index k
     166//--
     167{
     168  if((k < 0) || (k >= nPix_))
     169    {
     170      cout << " LocalMap::PIxVal : exceptions  a mettre en place" <<endl;
     171      //  THROW(out_of_range("LocalMap::PIxVal Pixel index out of range"));
     172      THROW(rangeCheckErr);
     173      //throw "LocalMap::PIxVal Pixel index out of range";
     174    }
     175  return(pixels_(k));
     176}
     177
     178//++
     179
     180template<class T>
     181T const& LocalMap<T>::PixVal(int_4 k) const
     182//
     183//   const version of previous method
     184//--
     185{
     186  if((k < 0) || (k >= nPix_))
     187    {
     188      cout << " LocalMap::PIxVal : exceptions  a mettre en place" <<endl;
     189      //    THROW(out_of_range("LocalMap::PIxVal Pixel index out of range"));
     190     
     191      throw "LocalMap::PIxVal Pixel index out of range";
     192    }
     193  return *(pixels_.Data()+k);
     194}
     195
     196template<class T>
     197bool LocalMap<T>::ContainsSph(double theta, double phi) const
     198{
     199// $CHECK$  Reza 11/11/99 - A modifier
     200return(true);
     201}
     202
     203//++
     204template<class T>
     205int_4 LocalMap<T>::PixIndexSph(double theta,double phi) const
     206//
     207//    Return index of the pixel with spherical coordinates (theta,phi)
     208//--
     209{
     210  int_4 i,j;
     211  if(!(originFlag_) || !(extensFlag_))
     212    {
     213      cout << " LocalMap: correspondance carte-sphere non etablie" << endl;
     214      exit(0);
     215    }
     216
     217  // theta et phi en coordonnees relatives (on se ramene a une situation par rapport au plan de reference)
     218  double theta_aux= theta;
     219  double phi_aux  = phi;
     220  UserToReference(theta_aux, phi_aux);
     221
     222  // coordonnees dans le plan local en unites de pixels
     223  double x,y;
     224  AngleProjToPix(theta_aux,phi_aux, x, y);
     225
     226  double xmin= -x0_-0.5;
     227  double xmax= xmin+nSzX_;
     228  if((x > xmax) || (x < xmin)) return(-1);
     229  double xcurrent= xmin;
     230  for(i = 0; i < nSzX_; i++ )
     231    {
     232      xcurrent += 1.;
     233      if( x < xcurrent ) break;
     234    }
     235  double ymin= -y0_-0.5;
     236  double ymax= ymin+nSzY_;
     237  if((y >  ymax) || (y < ymin)) return(-1);
     238  double ycurrent= ymin;
     239  for(j = 0; j < nSzY_; j++ )
     240    {
     241      ycurrent += 1.;
     242      if( y < ycurrent ) break;
     243    }
     244  return (j*nSzX_+i);
     245}
     246
     247//++
     248template<class T>
     249void LocalMap<T>::PixThetaPhi(int_4 k,double& theta,double& phi) const
     250//
     251//    Return (theta, phi) coordinates of pixel with index k
     252//--
     253{
     254  if(!(originFlag_) || !(extensFlag_))
     255    {
     256      cout << " LocalMap: correspondance carte-sphere non etablie" << endl;
     257      exit(0);
     258    }
     259
     260  int_4 i,j;
     261  Getij(k,i,j);
     262
     263  double X= double(i-x0_);
     264  double Y= double(j-y0_);
     265  // situation de ce pixel dans le plan de reference
     266  double x= X*cos_angle_-Y*sin_angle_;
     267  double y= X*sin_angle_+Y* cos_angle_;
     268  // projection sur la sphere
     269  PixProjToAngle(x, y, theta, phi);
     270  // retour au plan utilisateur
     271  ReferenceToUser(theta, phi);
     272}
     273
     274template <class T>
     275T LocalMap<T>::SetPixels(T v)
     276{
     277pixels_.Reset(v);
     278return(v);
     279}
     280 
     281//++
     282template<class T>
     283double LocalMap<T>::PixSolAngle(int_4 k) const
     284//
     285//    Pixel Solid angle  (steradians)
     286//    All the pixels have not necessarly the same size in (theta, phi)
     287//    because of the projection scheme which is not yet fixed.   
     288//--
     289{
     290  int_4 i,j;
     291  Getij(k,i,j);
     292  double X= double(i-x0_);
     293  double Y= double(j-y0_);
     294  double XR= X+double(i)*0.5;
     295  double XL= X-double(i)*0.5;
     296  double YU= Y+double(j)*0.5;
     297  double YL= Y-double(j)*0.5;
     298
     299  // situation  dans le plan de reference
     300  double x0= XL*cos_angle_-YL*sin_angle_;
     301  double y0= XL*sin_angle_+YL*cos_angle_;
     302  double xa= XR*cos_angle_-YL*sin_angle_;
     303  double ya= XR*sin_angle_+YL*cos_angle_;
     304  double xb= XL*cos_angle_-YU*sin_angle_;
     305  double yb= XL*sin_angle_+YU*cos_angle_;
     306
     307  // projection sur la sphere
     308  double thet0,phi0,theta,phia,thetb,phib;
     309  PixProjToAngle(x0, y0, thet0, phi0);
     310  PixProjToAngle(xa, ya, theta, phia);
     311  PixProjToAngle(xb, yb, thetb, phib);
     312
     313  // angle solide
     314  double sol= fabs((xa-x0)*(yb-y0)-(xb-x0)*(ya-y0));
     315  return sol;
     316}
     317
     318//++
     319template<class T>
     320void LocalMap<T>::SetOrigin(double theta0,double phi0,double angle)
     321//
     322//    set the referential of the map (angles in degrees)
     323//    (default x0=siz_x/2,  y0=siz_y/2)
     324//--
     325{
     326  theta0_= theta0;
     327  phi0_  = phi0;
     328  angle_ = angle;
     329  x0_= nSzX_/2;
     330  y0_= nSzY_/2;
     331  cos_angle_= cos(angle*Pi/180.);
     332  sin_angle_= sin(angle*Pi/180.);
     333  originFlag_= true;
     334  cout << " LocalMap:: set origin 1 done" << endl;
     335}
     336 
     337//++
     338template<class T>
     339void LocalMap<T>::SetOrigin(double theta0,double phi0,int_4 x0,int_4 y0,double angle)
     340//
     341//    set the referential of the map (angles in degrees)
     342//--
     343{
     344  theta0_= theta0;
     345  phi0_  = phi0;
     346  angle_ = angle;
     347  x0_= x0;
     348  y0_= y0;
     349  cos_angle_= cos(angle*Pi/180.);
     350  sin_angle_= sin(angle*Pi/180.);
     351  originFlag_= true;
     352  cout << " LocalMap:: set origin 2 done" << endl;
     353}
     354
     355//++
     356template<class T>
     357void LocalMap<T>::SetSize(double angleX,double angleY)
     358//
     359//    angle range of tthe map (angles in degrees)
     360//--
     361{
     362  angleX_= angleX;
     363  angleY_= angleY;
     364
     365  // tangente de la moitie de l'ouverture angulaire totale
     366  tgAngleX_= tan(0.5*angleX_*Pi/180.);
     367  tgAngleY_= tan(0.5*angleY_*Pi/180.);
     368
     369  extensFlag_= true;
     370  cout << " LocalMap:: set extension done" << endl;
     371}
     372
     373//++
     374template<class T>
     375void LocalMap<T>::Project(SphericalMap<T>& sphere) const
     376//
     377//    Projection to a spherical map   
     378//--
     379{
     380  for(int m = 0; m < nPix_; m++)
     381    {
     382      double theta,phi;
     383      PixThetaPhi(m,theta,phi);
     384      sphere(theta,phi)= pixels_(m);
     385      // cout << "theta " << theta << " phi " << phi << " valeur " << sphere(theta,phi)<< endl;
     386    }
     387}
     388// Titre        Private Methods
     389//++
     390template<class T>
     391void LocalMap<T>::InitNul()
     392//
     393//    set some attributes to zero
     394//--
     395{
     396  originFlag_= false;
     397  extensFlag_= false;
     398  cos_angle_= 1.0;
     399  sin_angle_= 0.0;
     400//  pixels_.Reset(); Pas de reset par InitNul (en cas de share) - Reza 20/11/99 $CHECK$
     401}
     402
     403//++
     404template<class T>
     405void LocalMap<T>::Getij(int_4 k,int_4& i,int_4& j) const
     406//
     407//    Return 2 indices corresponding to the pixel number k
     408//--
     409{
     410  i= (k+1)%nSzX_-1;
     411  if(i == -1) i= nSzX_-1;
     412  j= (k-i+2)/nSzX_;
     413}
     414
     415//++
     416template<class T>
     417void  LocalMap<T>::ReferenceToUser(double& theta,double& phi) const
     418//
     419//    Transform a pair of coordinates (theta, phi) given in
     420//    reference coordinates into map coordinates
     421//--     
     422{
     423  if(theta > Pi || theta < 0. || phi < 0. || phi >= 2*Pi)
     424    {
     425      throw "LocalMap::ReferenceToUser (theta,phi) out of range";
     426    }
     427
     428  theta= theta0_*Pi/180.+theta-Pi*0.5;
     429  if(theta < 0.)
     430    {
     431      theta= -theta;
     432      phi += Pi;
     433    }
     434  else
     435    {
     436      if(theta > Pi)
     437        {
     438          theta= 2.*Pi-theta;
     439          phi += Pi;
     440        }
     441    }
     442
     443  phi= phi0_*Pi/180.+phi;
     444  while(phi >= 2.*Pi) phi-= 2.*Pi;
     445
     446  if(theta > Pi || theta < 0. || phi < 0. || phi >= 2*Pi)
     447    {
     448      cout <<  " LocalMap::ReferenceToUser : erreur bizarre dans le transfert a la carte utilisateur " << endl;
     449      cout << " theta= " << theta << " phi= " << phi << endl;
     450      exit(0);
     451    }
     452}
     453
     454//++
     455template<class T>
     456void  LocalMap<T>::UserToReference(double& theta,double& phi) const
     457//
     458//    Transform a pair of coordinates (theta, phi) given in
     459//    map coordinates into reference coordinates
     460//--     
     461{
     462  if(theta > Pi || theta < 0. || phi < 0. || phi >= 2*Pi)
     463    {
     464      cout<<" LocalMap::UserToReference: exceptions a mettre en place" <<endl;
     465      // THROW(out_of_range("LocalMap::PIxVal Pixel index out of range"));
     466      throw "LocalMap::UserToReference (theta,phi) out of range";
     467    }
     468
     469  double phi1= phi-phi0_*Pi/180.;
     470  if(phi1 < 0.) phi1+= 2.*Pi;
     471
     472  double theta1= theta-theta0_*Pi/180.+Pi*0.5;
     473  if(theta1 < 0.)
     474    {
     475      theta= -theta1;
     476      phi1+= Pi;
     477    }
     478  else
     479    {
     480      if(theta1 > Pi)
     481        {
     482          theta= 2.*Pi-theta1;
     483          phi1+= Pi;
     484        }
     485    }
     486
     487  while(phi1 >= 2.*Pi) phi1-= 2.*Pi;
     488  phi= phi1;
     489  if(theta > Pi || theta < 0. || phi < 0. || phi >= 2*Pi)
     490    {
     491      cout <<  " LocalMap::UserToReference : erreur bizarre dans le transfert a la carte de reference " << endl;
     492      cout << " theta= " << theta << " phi= " << phi << endl;
     493      exit(0);
     494    }
     495}
     496
     497//++
     498template<class T>
     499void LocalMap<T>::PixProjToAngle(double x,double y,double& theta,double& phi) const
     500//
     501// 
     502//    Given coordinates in pixel units in the REFERENCE PLANE, return
     503//    (theta, phi) in "absolute" referential theta=pi/2 ,phi=0.   
     504//--
     505{
     506  theta= Pi*0.5-atan(2.*y*tgAngleY_/(double)nSzY_);
     507  phi= atan2(2.*x*tgAngleX_,(double)nSzX_);
     508  if(phi < 0.) phi += DeuxPi;
     509}
     510
     511//++
     512template<class T>
     513void LocalMap<T>::AngleProjToPix(double theta,double phi,double& x,double& y) const
     514//
     515//    Given coordinates  (theta, phi) in "absolute" referential
     516//    theta=pi/2 ,phi=0  return pixel indices  (i,j) in the REFERENCE PLANE.
     517//--
     518{
     519  if(phi >= Pi) phi-= DeuxPi;
     520  //  y=0.5*mSzY_*cot(theta)/tgAngleY_;  $CHECK-REZA-04/99$
     521  y= 0.5*nSzY_/tan(theta)/tgAngleY_;  // ? cot = 1/tan ? 
     522  x= 0.5*nSzX_*tan(phi)/tgAngleX_;
     523}
     524
     525template<class T>
     526void LocalMap<T>::print(ostream& os) const
     527{
     528  os<<" SzX= "<<nSzX_<<", SzY= "<<nSzY_<<", NPix= "<<nPix_<<endl;
     529  if(LocalMap_isDone())
     530    {
     531      os<<" theta0= "<<theta0_<<", phi0= "<<phi0_<<", angle= "<<angle_<<endl;
     532      os<<" x0= "<<x0_<<", y0= "<<y0_<<endl;
     533      os<<" cos= "<<cos_angle_<<", & sin= "<<sin_angle_<<endl;
     534      os<<" angleX= "<<angleX_<<", angleY= "<<angleY_<<endl;
     535      os<<" tg(angleX)= "<<tgAngleX_<<", tg(angleY)= "<<tgAngleY_<<endl;
     536    }
     537
     538  os << " contenu de pixels : ";
     539  for(int i=0; i < nPix_; i++)
     540    {
     541      if(i%5 == 0) os << endl;
     542      os <<  pixels_(i) <<", ";
     543    }
     544  os << endl;
     545}
     546//++
     547// Titre        class FIO_LocalMap
     548//    Delegated objects for persitance management
     549//--
     550
     551//*******************************************************************
     552// class FIO_LocalMap<T>
     553//  Les objets delegues pour la gestion de persistance
     554//*******************************************************************
     555
     556//++
     557template <class T>
     558FIO_LocalMap<T>::FIO_LocalMap()
     559//
     560//--
     561{
     562  dobj= new LocalMap<T>;
     563  ownobj= true;
     564}
     565//++
     566template <class T>
     567FIO_LocalMap<T>::FIO_LocalMap(string const& filename)
     568//
     569//--
     570{
     571  dobj= new LocalMap<T>;
     572  dobj->DataBlock().SetTemp(true);
     573  ownobj= true;
     574  Read(filename);
     575}
     576
     577//++
     578template <class T>
     579FIO_LocalMap<T>::FIO_LocalMap(const LocalMap<T>& obj)
     580//
     581//--
     582{
     583  dobj= new LocalMap<T>(obj, true);
     584  dobj->DataBlock().SetTemp(true);
     585  ownobj= true;
     586}
     587
     588template <class T>
     589FIO_LocalMap<T>::FIO_LocalMap(LocalMap<T>* obj)
     590{
     591  dobj= obj;
     592  ownobj= false;
     593}
     594
     595//++
     596template <class T>
     597FIO_LocalMap<T>::~FIO_LocalMap()
     598//
     599//--
     600{
     601  if (ownobj && dobj) delete dobj;
     602}
     603//++
     604template <class T>
     605AnyDataObj* FIO_LocalMap<T>::DataObj()
     606//
     607//--
     608{
     609  return(dobj);
     610}
     611
     612//++
     613template <class T>
     614void FIO_LocalMap<T>::ReadSelf(PInPersist& is)
     615//
     616//--
     617{
     618
     619  if(dobj == NULL)
     620    {
     621      dobj= new LocalMap<T>;
     622      dobj->DataBlock().SetTemp(true);
     623      ownobj= true;
     624    }
     625
     626  // Pour savoir s'il y avait un DVList Info associe
     627  char strg[256];
     628  is.GetLine(strg, 255);
     629  bool hadinfo= false;
     630  if(strncmp(strg+strlen(strg)-7, "HasInfo", 7) == 0)  hadinfo= true;
     631  if(hadinfo)
     632    {    // Lecture eventuelle du DVList Info
     633      is >> dobj->Info();
     634    }
     635
     636  int_4 nSzX;
     637  is.GetI4(nSzX);
     638  dobj->setSize_x(nSzX);
     639
     640  int_4 nSzY;
     641  is.GetI4(nSzY);
     642  dobj->setSize_y(nSzY);
     643
     644  int_4 nPix;
     645  is.GetI4(nPix);
     646  dobj->setNbPixels(nPix);
     647
     648  string ss("local mapping is done");
     649  string sso;
     650  is.GetStr(sso);
     651  if(sso == ss)
     652    {
     653      cout<<" ReadSelf:: local mapping"<<endl;
     654      int_4 x0, y0;
     655      double theta, phi, angle;
     656      is.GetI4(x0);
     657      is.GetI4(y0);
     658      is.GetR8(theta);
     659      is.GetR8(phi);
     660      is.GetR8(angle);
     661      dobj->SetOrigin(theta, phi, x0, y0, angle);
     662
     663      double angleX, angleY;
     664      is.GetR8(angleX);
     665      is.GetR8(angleY);
     666      dobj->SetSize(angleX, angleY);
     667    }
     668
     669// On lit le DataBlock;
     670  is >> dobj->DataBlock();
     671}
     672
     673//++
     674template <class T>
     675void FIO_LocalMap<T>::WriteSelf(POutPersist& os) const
     676//
     677//--
     678{
     679  if(dobj == NULL)
     680    {
     681      cout << " FIO_LocalMap::WriteSelf:: dobj= null " << endl;
     682      return;
     683    }
     684
     685  char strg[256];
     686  int_4 nSzX= dobj->Size_x();
     687  int_4 nSzY= dobj->Size_y();
     688  int_4 nPix= dobj->NbPixels();
     689 
     690  if(dobj->ptrInfo())
     691    {
     692      sprintf(strg,"LocalMap: NPixX=%6d  NPixY=%9d HasInfo",nSzX,nSzY);
     693      os.PutLine(strg);
     694      os << dobj->Info();
     695    }
     696  else
     697    {
     698      sprintf(strg,"LocalMap: NPixX=%6d  NPixY=%9d ",nSzX,nSzY);
     699      os.PutLine(strg); 
     700    }
     701
     702  os.PutI4(nSzX);
     703  os.PutI4(nSzY);
     704  os.PutI4(nPix);
     705
     706  if(dobj->LocalMap_isDone())
     707    {
     708      string ss("local mapping is done");
     709      os.PutStr(ss);
     710      int_4 x0, y0;
     711      double theta, phi, angle;
     712      dobj->Origin(theta, phi, x0, y0, angle);
     713      os.PutI4(x0);
     714      os.PutI4(y0);
     715      os.PutR8(theta);
     716      os.PutR8(phi);
     717      os.PutR8(angle);
     718
     719      double angleX, angleY;
     720      dobj->Aperture(angleX, angleY);
     721      os.PutR8(angleX);
     722      os.PutR8(angleY);
     723    }
     724  else
     725    {
     726      string ss("no local mapping");
     727      os.PutStr(ss);
     728    }
     729
     730// On ecrit le dataBlock
     731  os << dobj->DataBlock();
     732}
    8733
    9734#ifdef __CXX_PRAGMA_TEMPLATES__
     
    27752template class FIO_LocalMap< complex<double> >;
    28753#endif
    29 
    30 //*****************************************************************************
    31 //++
    32 // Class        LocalMap
    33 //
    34 // include      localmap.h nbmath.h
    35 //
    36 //    A local map of a region of the sky, in cartesian coordinates.
    37 //    It has an origin in (theta0, phi0), mapped to pixel(x0, y0)
    38 //    (x0, y0 might be outside of this local map)
    39 //    default value of (x0, y0) is middle of the map, center of
    40 //    pixel(nx/2, ny/2)
    41 //
    42 //    A local map is a 2 dimensional array, with i as column index and j
    43 //    as row index. The map is supposed to lie on a plan tangent to the
    44 //    celestial sphere in a point whose coordinates are (x0,y0) on the local
    45 //    map and (theta0, phi0) on the sphere. The range of the map is defined
    46 //    by two values of angles covered respectively by all the pixels in
    47 //    x direction and all the pixels in y direction (SetSize()).
    48 //
    49 //    A "reference plane" is considered : this plane is tangent to the
    50 //    celestial sphere in a point with angles theta=Pi/2 and phi=0. This
    51 //    point is the origine of coordinates is of the reference plane. The
    52 //    x-axis is the tangent parallel to the equatorial line and oriented
    53 //    toward the increasing phi's ; the y-axis is parallel to the meridian
    54 //    line and oriented toward the north pole.
    55 //   
    56 //    Internally, a map is first defined within this reference plane and
    57 //    tranported until the point (theta0, phi0) in such a way that both
    58 //    axes are kept parallel to meridian and parallel lines of the sphere.
    59 //    The user can define its own map with axes rotated with respect to
    60 //    reference axes (this rotation is characterized by angle between
    61 //    the local parallel line and the wanted x-axis-- see method
    62 //    SetOrigin(...))
    63 //   
    64 //
    65 
    66 //
    67 //--
    68 //++
    69 //
    70 // Links        Parents
    71 //
    72 //    PixelMap
    73 //   
    74 //--
    75 //++
    76 //
    77 // Links        Childs
    78 //
    79 //     
    80 //--
    81 //++
    82 // Titre        Constructors
    83 //--
    84 //++
    85 template<class T>
    86 LocalMap<T>::LocalMap()
    87 //
    88 //     
    89 //--
    90 {
    91   InitNul();
    92   pixels_.Reset();
    93 }
    94 
    95 //++
    96 template<class T>
    97 LocalMap<T>::LocalMap(int nx, int ny) : nSzX_(nx), nSzY_(ny)
    98 //
    99 //   
    100 //--
    101 {
    102   InitNul();
    103   nPix_= nx*ny;
    104   pixels_.ReSize(nPix_);
    105   pixels_.Reset();
    106 }
    107 
    108 //++
    109 template<class T>
    110 LocalMap<T>::LocalMap(const LocalMap<T>& lm, bool share)
    111   : pixels_(lm.pixels_, share)
    112 
    113 //
    114 //    copy constructor
    115 //--
    116 {
    117   cout<<" LocalMap:: Appel du constructeur de recopie " << endl;
    118 
    119   if(lm.mInfo_) mInfo_= new DVList(*lm.mInfo_);
    120   nSzX_= lm.nSzX_;
    121   nSzY_= lm.nSzY_;
    122   nPix_= lm.nPix_;
    123   originFlag_= lm.originFlag_;
    124   extensFlag_= lm.extensFlag_;
    125   x0_= lm.x0_;
    126   y0_= lm.y0_;
    127   theta0_= lm.theta0_;
    128   phi0_= lm.phi0_;
    129   angle_= lm.angle_;
    130   cos_angle_= lm.cos_angle_;
    131   sin_angle_= lm.sin_angle_;
    132   angleX_= lm.angleX_;
    133   angleY_= lm.angleY_;
    134   tgAngleX_= lm.tgAngleX_;
    135   tgAngleY_= lm.tgAngleY_;
    136 }
    137 
    138 //++
    139 // Titre        Destructor
    140 //--
    141 //++
    142 template<class T>
    143 LocalMap<T>::~LocalMap()
    144 //
    145 //--
    146 {
    147   InitNul();
    148 }
    149 
    150 
    151 
    152 //++
    153 // Titre        Public Methods
    154 //--
    155 
    156 //++
    157 template<class T>
    158 void LocalMap<T>::ReSize(int nx, int ny)
    159 //
    160 //    Resize storage area for pixels
    161 //--
    162 {
    163   InitNul();
    164   nSzX_ = nx;
    165   nSzY_ = ny;
    166   nPix_= nx*ny;
    167   pixels_.ReSize(nPix_);
    168   pixels_.Reset();
    169 }
    170 
    171 //++
    172 template<class T>
    173 int LocalMap<T>::NbPixels() const
    174 //
    175 //    Return number of pixels
    176 //--
    177 {
    178   return(nPix_);
    179 }
    180 
    181 //++
    182 template<class T>
    183 T& LocalMap<T>::PixVal(int k)
    184 //
    185 //    Return value of pixel with index k
    186 //--
    187 {
    188   if((k < 0) || (k >= nPix_))
    189     {
    190       cout << " LocalMap::PIxVal : exceptions  a mettre en place" <<endl;
    191       //  THROW(out_of_range("LocalMap::PIxVal Pixel index out of range"));
    192       THROW(rangeCheckErr);
    193       //throw "LocalMap::PIxVal Pixel index out of range";
    194     }
    195   return(pixels_(k));
    196 }
    197 
    198 //++
    199 
    200 template<class T>
    201 T const& LocalMap<T>::PixVal(int k) const
    202 //
    203 //   const version of previous method
    204 //--
    205 {
    206   if((k < 0) || (k >= nPix_))
    207     {
    208       cout << " LocalMap::PIxVal : exceptions  a mettre en place" <<endl;
    209       //    THROW(out_of_range("LocalMap::PIxVal Pixel index out of range"));
    210      
    211       throw "LocalMap::PIxVal Pixel index out of range";
    212     }
    213   return *(pixels_.Data()+k);
    214 }
    215 
    216 template<class T>
    217 bool LocalMap<T>::ContainsSph(double theta, double phi) const
    218 {
    219 // $CHECK$  Reza 11/11/99 - A modifier
    220 return(true);
    221 }
    222 
    223 //++
    224 template<class T>
    225 int LocalMap<T>::PixIndexSph(double theta,double phi) const
    226 //
    227 //    Return index of the pixel with spherical coordinates (theta,phi)
    228 //--
    229 {
    230   int i,j;
    231   if(!(originFlag_) || !(extensFlag_))
    232     {
    233       cout << " LocalMap: correspondance carte-sphere non etablie" << endl;
    234       exit(0);
    235     }
    236 
    237   // theta et phi en coordonnees relatives (on se ramene a une situation par rapport au plan de reference)
    238   double theta_aux= theta;
    239   double phi_aux  = phi;
    240   UserToReference(theta_aux, phi_aux);
    241 
    242   // coordonnees dans le plan local en unites de pixels
    243   double x,y;
    244   AngleProjToPix(theta_aux,phi_aux, x, y);
    245 
    246   double xmin= -x0_-0.5;
    247   double xmax= xmin+nSzX_;
    248   if((x > xmax) || (x < xmin)) return(-1);
    249   double xcurrent= xmin;
    250   for(i = 0; i < nSzX_; i++ )
    251     {
    252       xcurrent += 1.;
    253       if( x < xcurrent ) break;
    254     }
    255   double ymin= -y0_-0.5;
    256   double ymax= ymin+nSzY_;
    257   if((y >  ymax) || (y < ymin)) return(-1);
    258   double ycurrent= ymin;
    259   for(j = 0; j < nSzY_; j++ )
    260     {
    261       ycurrent += 1.;
    262       if( y < ycurrent ) break;
    263     }
    264   return (j*nSzX_+i);
    265 }
    266 
    267 //++
    268 template<class T>
    269 void LocalMap<T>::PixThetaPhi(int k,double& theta,double& phi) const
    270 //
    271 //    Return (theta, phi) coordinates of pixel with index k
    272 //--
    273 {
    274   if(!(originFlag_) || !(extensFlag_))
    275     {
    276       cout << " LocalMap: correspondance carte-sphere non etablie" << endl;
    277       exit(0);
    278     }
    279 
    280   int i,j;
    281   Getij(k,i,j);
    282 
    283   double X= double(i-x0_);
    284   double Y= double(j-y0_);
    285   // situation de ce pixel dans le plan de reference
    286   double x= X*cos_angle_-Y*sin_angle_;
    287   double y= X*sin_angle_+Y* cos_angle_;
    288   // projection sur la sphere
    289   PixProjToAngle(x, y, theta, phi);
    290   // retour au plan utilisateur
    291   ReferenceToUser(theta, phi);
    292 }
    293 
    294 template <class T>
    295 T LocalMap<T>::SetPixels(T v)
    296 {
    297 pixels_.Reset(v);
    298 return(v);
    299 }
    300  
    301 //++
    302 template<class T>
    303 double LocalMap<T>::PixSolAngle(int k) const
    304 //
    305 //    Pixel Solid angle  (steradians)
    306 //    All the pixels have not necessarly the same size in (theta, phi)
    307 //    because of the projection scheme which is not yet fixed.   
    308 //--
    309 {
    310   int i,j;
    311   Getij(k,i,j);
    312   double X= double(i-x0_);
    313   double Y= double(j-y0_);
    314   double XR= X+double(i)*0.5;
    315   double XL= X-double(i)*0.5;
    316   double YU= Y+double(j)*0.5;
    317   double YL= Y-double(j)*0.5;
    318 
    319   // situation  dans le plan de reference
    320   double x0= XL*cos_angle_-YL*sin_angle_;
    321   double y0= XL*sin_angle_+YL*cos_angle_;
    322   double xa= XR*cos_angle_-YL*sin_angle_;
    323   double ya= XR*sin_angle_+YL*cos_angle_;
    324   double xb= XL*cos_angle_-YU*sin_angle_;
    325   double yb= XL*sin_angle_+YU*cos_angle_;
    326 
    327   // projection sur la sphere
    328   double thet0,phi0,theta,phia,thetb,phib;
    329   PixProjToAngle(x0, y0, thet0, phi0);
    330   PixProjToAngle(xa, ya, theta, phia);
    331   PixProjToAngle(xb, yb, thetb, phib);
    332 
    333   // angle solide
    334   double sol= fabs((xa-x0)*(yb-y0)-(xb-x0)*(ya-y0));
    335   return sol;
    336 }
    337 
    338 //++
    339 template<class T>
    340 void LocalMap<T>::SetOrigin(double theta0,double phi0,double angle)
    341 //
    342 //    set the referential of the map (angles in degrees)
    343 //    (default x0=siz_x/2,  y0=siz_y/2)
    344 //--
    345 {
    346   theta0_= theta0;
    347   phi0_  = phi0;
    348   angle_ = angle;
    349   x0_= nSzX_/2;
    350   y0_= nSzY_/2;
    351   cos_angle_= cos(angle*Pi/180.);
    352   sin_angle_= sin(angle*Pi/180.);
    353   originFlag_= true;
    354   cout << " LocalMap:: set origin 1 done" << endl;
    355 }
    356  
    357 //++
    358 template<class T>
    359 void LocalMap<T>::SetOrigin(double theta0,double phi0,int x0,int y0,double angle)
    360 //
    361 //    set the referential of the map (angles in degrees)
    362 //--
    363 {
    364   theta0_= theta0;
    365   phi0_  = phi0;
    366   angle_ = angle;
    367   x0_= x0;
    368   y0_= y0;
    369   cos_angle_= cos(angle*Pi/180.);
    370   sin_angle_= sin(angle*Pi/180.);
    371   originFlag_= true;
    372   cout << " LocalMap:: set origin 2 done" << endl;
    373 }
    374 
    375 //++
    376 template<class T>
    377 void LocalMap<T>::SetSize(double angleX,double angleY)
    378 //
    379 //    angle range of tthe map (angles in degrees)
    380 //--
    381 {
    382   angleX_= angleX;
    383   angleY_= angleY;
    384 
    385   // tangente de la moitie de l'ouverture angulaire totale
    386   tgAngleX_= tan(0.5*angleX_*Pi/180.);
    387   tgAngleY_= tan(0.5*angleY_*Pi/180.);
    388 
    389   extensFlag_= true;
    390   cout << " LocalMap:: set extension done" << endl;
    391 }
    392 
    393 //++
    394 template<class T>
    395 void LocalMap<T>::Project(SphericalMap<T>& sphere) const
    396 //
    397 //    Projection to a spherical map   
    398 //--
    399 {
    400   for(int m = 0; m < nPix_; m++)
    401     {
    402       double theta,phi;
    403       PixThetaPhi(m,theta,phi);
    404       sphere(theta,phi)= pixels_(m);
    405       // cout << "theta " << theta << " phi " << phi << " valeur " << sphere(theta,phi)<< endl;
    406     }
    407 }
    408 // Titre        Private Methods
    409 //++
    410 template<class T>
    411 void LocalMap<T>::InitNul()
    412 //
    413 //    set some attributes to zero
    414 //--
    415 {
    416   originFlag_= false;
    417   extensFlag_= false;
    418   cos_angle_= 1.0;
    419   sin_angle_= 0.0;
    420 //  pixels_.Reset(); Pas de reset par InitNul (en cas de share) - Reza 20/11/99 $CHECK$
    421 }
    422 
    423 //++
    424 template<class T>
    425 void LocalMap<T>::Getij(int k,int& i,int& j) const
    426 //
    427 //    Return 2 indices corresponding to the pixel number k
    428 //--
    429 {
    430   i= (k+1)%nSzX_-1;
    431   if(i == -1) i= nSzX_-1;
    432   j= (k-i+2)/nSzX_;
    433 }
    434 
    435 //++
    436 template<class T>
    437 void  LocalMap<T>::ReferenceToUser(double& theta,double& phi) const
    438 //
    439 //    Transform a pair of coordinates (theta, phi) given in
    440 //    reference coordinates into map coordinates
    441 //--     
    442 {
    443   if(theta > Pi || theta < 0. || phi < 0. || phi >= 2*Pi)
    444     {
    445       throw "LocalMap::ReferenceToUser (theta,phi) out of range";
    446     }
    447 
    448   theta= theta0_*Pi/180.+theta-Pi*0.5;
    449   if(theta < 0.)
    450     {
    451       theta= -theta;
    452       phi += Pi;
    453     }
    454   else
    455     {
    456       if(theta > Pi)
    457         {
    458           theta= 2.*Pi-theta;
    459           phi += Pi;
    460         }
    461     }
    462 
    463   phi= phi0_*Pi/180.+phi;
    464   while(phi >= 2.*Pi) phi-= 2.*Pi;
    465 
    466   if(theta > Pi || theta < 0. || phi < 0. || phi >= 2*Pi)
    467     {
    468       cout <<  " LocalMap::ReferenceToUser : erreur bizarre dans le transfert a la carte utilisateur " << endl;
    469       cout << " theta= " << theta << " phi= " << phi << endl;
    470       exit(0);
    471     }
    472 }
    473 
    474 //++
    475 template<class T>
    476 void  LocalMap<T>::UserToReference(double& theta,double& phi) const
    477 //
    478 //    Transform a pair of coordinates (theta, phi) given in
    479 //    map coordinates into reference coordinates
    480 //--     
    481 {
    482   if(theta > Pi || theta < 0. || phi < 0. || phi >= 2*Pi)
    483     {
    484       cout<<" LocalMap::UserToReference: exceptions a mettre en place" <<endl;
    485       // THROW(out_of_range("LocalMap::PIxVal Pixel index out of range"));
    486       throw "LocalMap::UserToReference (theta,phi) out of range";
    487     }
    488 
    489   double phi1= phi-phi0_*Pi/180.;
    490   if(phi1 < 0.) phi1+= 2.*Pi;
    491 
    492   double theta1= theta-theta0_*Pi/180.+Pi*0.5;
    493   if(theta1 < 0.)
    494     {
    495       theta= -theta1;
    496       phi1+= Pi;
    497     }
    498   else
    499     {
    500       if(theta1 > Pi)
    501         {
    502           theta= 2.*Pi-theta1;
    503           phi1+= Pi;
    504         }
    505     }
    506 
    507   while(phi1 >= 2.*Pi) phi1-= 2.*Pi;
    508   phi= phi1;
    509   if(theta > Pi || theta < 0. || phi < 0. || phi >= 2*Pi)
    510     {
    511       cout <<  " LocalMap::UserToReference : erreur bizarre dans le transfert a la carte de reference " << endl;
    512       cout << " theta= " << theta << " phi= " << phi << endl;
    513       exit(0);
    514     }
    515 }
    516 
    517 //++
    518 template<class T>
    519 void LocalMap<T>::PixProjToAngle(double x,double y,double& theta,double& phi) const
    520 //
    521 // 
    522 //    Given coordinates in pixel units in the REFERENCE PLANE, return
    523 //    (theta, phi) in "absolute" referential theta=pi/2 ,phi=0.   
    524 //--
    525 {
    526   theta= Pi*0.5-atan(2.*y*tgAngleY_/(double)nSzY_);
    527   phi= atan2(2.*x*tgAngleX_,(double)nSzX_);
    528   if(phi < 0.) phi += DeuxPi;
    529 }
    530 
    531 //++
    532 template<class T>
    533 void LocalMap<T>::AngleProjToPix(double theta,double phi,double& x,double& y) const
    534 //
    535 //    Given coordinates  (theta, phi) in "absolute" referential
    536 //    theta=pi/2 ,phi=0  return pixel indices  (i,j) in the REFERENCE PLANE.
    537 //--
    538 {
    539   if(phi >= Pi) phi-= DeuxPi;
    540   //  y=0.5*mSzY_*cot(theta)/tgAngleY_;  $CHECK-REZA-04/99$
    541   y= 0.5*nSzY_/tan(theta)/tgAngleY_;  // ? cot = 1/tan ? 
    542   x= 0.5*nSzX_*tan(phi)/tgAngleX_;
    543 }
    544 
    545 template<class T>
    546 void LocalMap<T>::print(ostream& os) const
    547 {
    548   os<<" SzX= "<<nSzX_<<", SzY= "<<nSzY_<<", NPix= "<<nPix_<<endl;
    549   if(LocalMap_isDone())
    550     {
    551       os<<" theta0= "<<theta0_<<", phi0= "<<phi0_<<", angle= "<<angle_<<endl;
    552       os<<" x0= "<<x0_<<", y0= "<<y0_<<endl;
    553       os<<" cos= "<<cos_angle_<<", & sin= "<<sin_angle_<<endl;
    554       os<<" angleX= "<<angleX_<<", angleY= "<<angleY_<<endl;
    555       os<<" tg(angleX)= "<<tgAngleX_<<", tg(angleY)= "<<tgAngleY_<<endl;
    556     }
    557 
    558   os << " contenu de pixels : ";
    559   for(int i=0; i < nPix_; i++)
    560     {
    561       if(i%5 == 0) os << endl;
    562       os <<  pixels_(i) <<", ";
    563     }
    564   os << endl;
    565 }
    566 //++
    567 // Titre        class FIO_LocalMap
    568 //    Delegated objects for persitance management
    569 //--
    570 
    571 //*******************************************************************
    572 // class FIO_LocalMap<T>
    573 //  Les objets delegues pour la gestion de persistance
    574 //*******************************************************************
    575 
    576 //++
    577 template <class T>
    578 FIO_LocalMap<T>::FIO_LocalMap()
    579 //
    580 //--
    581 {
    582   dobj= new LocalMap<T>;
    583   ownobj= true;
    584 }
    585 //++
    586 template <class T>
    587 FIO_LocalMap<T>::FIO_LocalMap(string const& filename)
    588 //
    589 //--
    590 {
    591   dobj= new LocalMap<T>;
    592   dobj->DataBlock().SetTemp(true);
    593   ownobj= true;
    594   Read(filename);
    595 }
    596 
    597 //++
    598 template <class T>
    599 FIO_LocalMap<T>::FIO_LocalMap(const LocalMap<T>& obj)
    600 //
    601 //--
    602 {
    603   dobj= new LocalMap<T>(obj, true);
    604   dobj->DataBlock().SetTemp(true);
    605   ownobj= true;
    606 }
    607 
    608 template <class T>
    609 FIO_LocalMap<T>::FIO_LocalMap(LocalMap<T>* obj)
    610 {
    611   dobj= obj;
    612   ownobj= false;
    613 }
    614 
    615 //++
    616 template <class T>
    617 FIO_LocalMap<T>::~FIO_LocalMap()
    618 //
    619 //--
    620 {
    621   if (ownobj && dobj) delete dobj;
    622 }
    623 //++
    624 template <class T>
    625 AnyDataObj* FIO_LocalMap<T>::DataObj()
    626 //
    627 //--
    628 {
    629   return(dobj);
    630 }
    631 
    632 //++
    633 template <class T>
    634 void FIO_LocalMap<T>::ReadSelf(PInPersist& is)
    635 //
    636 //--
    637 {
    638 
    639   if(dobj == NULL)
    640     {
    641       dobj= new LocalMap<T>;
    642       dobj->DataBlock().SetTemp(true);
    643       ownobj= true;
    644     }
    645 
    646   // Pour savoir s'il y avait un DVList Info associe
    647   char strg[256];
    648   is.GetLine(strg, 255);
    649   bool hadinfo= false;
    650   if(strncmp(strg+strlen(strg)-7, "HasInfo", 7) == 0)  hadinfo= true;
    651   if(hadinfo)
    652     {    // Lecture eventuelle du DVList Info
    653       is >> dobj->Info();
    654     }
    655 
    656   int nSzX;
    657   is.GetI4(nSzX);
    658   dobj->setSize_x(nSzX);
    659 
    660   int nSzY;
    661   is.GetI4(nSzY);
    662   dobj->setSize_y(nSzY);
    663 
    664   int nPix;
    665   is.GetI4(nPix);
    666   dobj->setNbPixels(nPix);
    667 
    668   string ss("local mapping is done");
    669   string sso;
    670   is.GetStr(sso);
    671   if(sso == ss)
    672     {
    673       cout<<" ReadSelf:: local mapping"<<endl;
    674       int x0, y0;
    675       double theta, phi, angle;
    676       is.GetI4(x0);
    677       is.GetI4(y0);
    678       is.GetR8(theta);
    679       is.GetR8(phi);
    680       is.GetR8(angle);
    681       dobj->SetOrigin(theta, phi, x0, y0, angle);
    682 
    683       double angleX, angleY;
    684       is.GetR8(angleX);
    685       is.GetR8(angleY);
    686       dobj->SetSize(angleX, angleY);
    687     }
    688 
    689 // On lit le DataBlock;
    690   is >> dobj->DataBlock();
    691 }
    692 
    693 //++
    694 template <class T>
    695 void FIO_LocalMap<T>::WriteSelf(POutPersist& os) const
    696 //
    697 //--
    698 {
    699   if(dobj == NULL)
    700     {
    701       cout << " FIO_LocalMap::WriteSelf:: dobj= null " << endl;
    702       return;
    703     }
    704 
    705   char strg[256];
    706   int nSzX= dobj->Size_x();
    707   int nSzY= dobj->Size_y();
    708   int nPix= dobj->NbPixels();
    709  
    710   if(dobj->ptrInfo())
    711     {
    712       sprintf(strg,"LocalMap: NPixX=%6d  NPixY=%9d HasInfo",nSzX,nSzY);
    713       os.PutLine(strg);
    714       os << dobj->Info();
    715     }
    716   else
    717     {
    718       sprintf(strg,"LocalMap: NPixX=%6d  NPixY=%9d ",nSzX,nSzY);
    719       os.PutLine(strg); 
    720     }
    721 
    722   os.PutI4(nSzX);
    723   os.PutI4(nSzY);
    724   os.PutI4(nPix);
    725 
    726   if(dobj->LocalMap_isDone())
    727     {
    728       string ss("local mapping is done");
    729       os.PutStr(ss);
    730       int x0, y0;
    731       double theta, phi, angle;
    732       dobj->Origin(theta, phi, x0, y0, angle);
    733       os.PutI4(x0);
    734       os.PutI4(y0);
    735       os.PutR8(theta);
    736       os.PutR8(phi);
    737       os.PutR8(angle);
    738 
    739       double angleX, angleY;
    740       dobj->Aperture(angleX, angleY);
    741       os.PutR8(angleX);
    742       os.PutR8(angleY);
    743     }
    744   else
    745     {
    746       string ss("no local mapping");
    747       os.PutStr(ss);
    748     }
    749 
    750 // On ecrit le dataBlock
    751   os << dobj->DataBlock();
    752 }
    753 
  • trunk/SophyaLib/Samba/localmap.h

    r604 r682  
    6565
    6666LocalMap();
    67 LocalMap(int nx, int ny);
     67LocalMap(int_4 nx, int_4 ny);
    6868LocalMap(const LocalMap<T>& lm, bool share=false);
    6969virtual ~LocalMap();
     
    7171// ---------- Overloading of () to access pixel number k ----
    7272
    73 inline T& operator()(int k) {return(PixVal(k));}
    74 inline T const& operator()(int k) const {return(PixVal(k));}
    75 inline T& operator()(int ix, int iy) {return PixVal(iy*nSzX_+ix);};
    76 inline T const& operator()(int ix, int iy) const {return PixVal(iy*nSzX_+ix);};
     73inline T& operator()(int_4 k) {return(PixVal(k));}
     74inline T const& operator()(int_4 k) const {return(PixVal(k));}
     75inline T& operator()(int_4 ix, int_4 iy) {return PixVal(iy*nSzX_+ix);};
     76inline T const& operator()(int_4 ix, int_4 iy) const {return PixVal(iy*nSzX_+ix);};
    7777   
    7878// ---------- Definition of PixelMap abstract methods -------
     
    8080/* return/set the number of pixels */
    8181/*!    Return number of pixels */
    82 virtual int NbPixels() const;
    83 inline void setNbPixels(int n) {nPix_= n;}
     82virtual int_4 NbPixels() const;
     83inline void setNbPixels(int_4 n) {nPix_= n;}
    8484 
    8585/* return the value of pixel number k */
    8686/*!    Return value of pixel with index k */
    87 virtual T& PixVal(int k);
     87virtual T& PixVal(int_4 k);
    8888/*!   const version of previous method */
    89 virtual T const& PixVal(int k) const;
     89virtual T const& PixVal(int_4 k) const;
    9090
    9191/* Return true if teta,phi in map  */
     
    9393/* return the index of pixel at (theta,phi) */
    9494/*!    Return index of the pixel with spherical coordinates (theta,phi) */
    95 virtual int PixIndexSph(double theta,double phi) const;
     95virtual int_4 PixIndexSph(double theta,double phi) const;
    9696   
    9797/* return the spherical coordinates of center of pixel number k */
    9898/*!    Return (theta, phi) coordinates of pixel with index k */
    99 virtual void PixThetaPhi(int k,double& theta,double& phi) const;
     99virtual void PixThetaPhi(int_4 k,double& theta,double& phi) const;
    100100
    101101/*! Set all pixels to value v */
     
    108108    because of the projection scheme which is not yet fixed.
    109109*/ 
    110 virtual double PixSolAngle(int k) const;
     110virtual double PixSolAngle(int_4 k) const;
    111111
    112112// ---------- Specific methods ------------------------------
    113113
    114114/*!    Resize storage area for pixels */
    115 void ReSize(int nx, int ny);
     115void ReSize(int_4 nx, int_4 ny);
    116116
    117117inline virtual char* TypeOfMap() const {return "LOCAL";};
     
    124124virtual void SetOrigin(double theta=90.,double phi=0.,double angle=0.);
    125125/*!    set the referential of the map (angles in degrees) */
    126 virtual void SetOrigin(double theta,double phi,int x0,int y0,double angle=0.);
     126virtual void SetOrigin(double theta,double phi,int_4 x0,int_4 y0,double angle=0.);
    127127
    128128/* Pixel size (degres) */
     
    140140 
    141141/* provides a integer characterizing the pixelization refinement  (here : number of pixels) */
    142 inline virtual int SizeIndex() const {return(nPix_);}
    143 inline int Size_x() const {return nSzX_;}
    144 inline int XSize() const {return nSzX_;}
    145 inline void setSize_x(int n) {nSzX_= n;}
    146 inline int Size_y() const {return nSzY_;}
    147 inline int YSize() const {return nSzY_;}
    148 inline void setSize_y(int n) {nSzY_= n;}
    149 
    150 inline void Origin(double& theta,double& phi,int& x0,int& y0,double& angle) const {theta= theta0_; phi= phi0_; x0= x0_; y0= y0_;angle= angle_;}
     142inline virtual int_4 SizeIndex() const {return(nPix_);}
     143inline int_4 Size_x() const {return nSzX_;}
     144inline int_4 XSize() const {return nSzX_;}
     145inline void setSize_x(int_4 n) {nSzX_= n;}
     146inline int_4 Size_y() const {return nSzY_;}
     147inline int_4 YSize() const {return nSzY_;}
     148inline void setSize_y(int_4 n) {nSzY_= n;}
     149
     150inline void Origin(double& theta,double& phi,int_4& x0,int_4& y0,double& angle) const {theta= theta0_; phi= phi0_; x0= x0_; y0= y0_;angle= angle_;}
    151151
    152152inline void Aperture(double& anglex,double& angley) const {anglex= angleX_; angley= angleY_;}
     
    154154/* retourne le pointeur vers/remplit  le vecteur des contenus des pixels */
    155155inline const NDataBlock<T>* getDataBlock() const {return (&pixels_);}
    156 inline void setDataBlock(T* data, int n) {pixels_.FillFrom(n,data);}
     156inline void setDataBlock(T* data, int_4 n) {pixels_.FillFrom(n,data);}
    157157
    158158/*  Acces to the DataBlock  */
     
    169169void InitNul();
    170170/*!    Return 2 indices corresponding to the pixel number k */
    171 void Getij(int k,int& i,int& j) const;
     171void Getij(int_4 k,int_4& i,int_4& j) const;
    172172/*!    Transform a pair of coordinates (theta, phi) given in
    173173    reference coordinates into map coordinates
     
    189189// ---------- Variables internes ----------------------------
    190190
    191 int nSzX_;
    192 int nSzY_;
    193 int nPix_;
     191int_4 nSzX_;
     192int_4 nSzY_;
     193int_4 nPix_;
    194194bool originFlag_;
    195195bool extensFlag_;
    196 int x0_;
    197 int y0_;
     196int_4 x0_;
     197int_4 y0_;
    198198double theta0_;
    199199double phi0_;
  • trunk/SophyaLib/Samba/pixelmap.h

    r592 r682  
    3636
    3737/*! Number of pixels */
    38 virtual int NbPixels() const=0;
     38virtual int_4 NbPixels() const=0;
    3939   
    4040/*! Value of pixel number k */
    41 virtual T& PixVal(int k)=0;
    42 virtual T const& PixVal(int k) const=0;
     41virtual T& PixVal(int_4 k)=0;
     42virtual T const& PixVal(int_4 k) const=0;
    4343
    4444// Map s coverage
     
    4747
    4848/*! Index of pixel at (theta,phi) */
    49 virtual int PixIndexSph(double theta, double phi) const=0;
     49virtual int_4 PixIndexSph(double theta, double phi) const=0;
    5050// Index of pixel at a sky-position
    51 virtual int PixIndex(const SpherePosition& spos);
     51virtual int_4 PixIndex(const SpherePosition& spos);
    5252
    5353/*! Value of pixel number at (theta,phi) */
     
    5858
    5959/*! Spherical coordinates of center of pixel number k */
    60 virtual void PixThetaPhi(int k, double& theta, double& phi) const=0;
     60virtual void PixThetaPhi(int_4 k, double& theta, double& phi) const=0;
    6161
    6262/*! provides a integer characterizing the pixelization refinement
    6363 (depending of the type of the map)
    6464*/             
    65 virtual int SizeIndex() const=0;
     65virtual int_4 SizeIndex() const=0;
    6666virtual char* TypeOfMap() const =0;
    6767
    6868/*! Pixel  (steradians) */
    69 virtual double PixSolAngle(int k) const =0;
     69virtual double PixSolAngle(int_4 k) const =0;
    7070
    7171/*! Overloading of () to access pixel number k. */
    72 inline T& operator()(int k) {return(PixVal(k));}
    73 inline T const& operator()(int k) const {return(PixVal(k));}
     72inline T& operator()(int_4 k) {return(PixVal(k));}
     73inline T const& operator()(int_4 k) const {return(PixVal(k));}
    7474
    7575// Overloading of () to access pixel at a sky position .
     
    110110
    111111template <class T>
    112 int PixelMap<T>::PixIndex(const SpherePosition& spos)
     112int_4 PixelMap<T>::PixIndex(const SpherePosition& spos)
    113113{
    114114UnitVector v = spos.Transform(*cs_);
  • trunk/SophyaLib/Samba/scan.cc

    r567 r682  
    352352{
    353353
    354   int NmaxPts, NmaxTrs, NPts1Tr;
     354  int_4 NmaxPts, NmaxTrs, NPts1Tr;
    355355  r_4 Ouverture, OmegaTeta, OmegaPhi, OmegaRad, FrequenceEch;
    356356  r_4 TempsFinal,  TempsInitial, PhiZero;
  • trunk/SophyaLib/Samba/spheregorski.cc

    r604 r682  
    186186//++
    187187template<class T>
    188 SphereGorski<T>::SphereGorski(int m)
     188SphereGorski<T>::SphereGorski(int_4 m)
    189189
    190190//    m is the "nside" of the Gorski algorithm
     
    246246//++
    247247template<class T>
    248 void SphereGorski<T>::Resize(int m)
     248void SphereGorski<T>::Resize(int_4 m)
    249249
    250250//    m is the "nside" of the Gorski algorithm
     
    272272
    273273template<class T>
    274 void  SphereGorski<T>::Pixelize( int m)
     274void  SphereGorski<T>::Pixelize( int_4 m)
    275275
    276276//    prépare la pixelisation Gorski (m a la même signification
     
    313313//++
    314314template<class T>
    315 int SphereGorski<T>::NbPixels() const
     315int_4 SphereGorski<T>::NbPixels() const
    316316
    317317//    Retourne le nombre de pixels du découpage
     
    323323//++
    324324template<class T>
    325 int SphereGorski<T>::NbThetaSlices() const
     325int_4 SphereGorski<T>::NbThetaSlices() const
    326326
    327327//    Return number of slices in theta direction on the  sphere
     
    333333//++
    334334template<class T>
    335 void SphereGorski<T>::GetThetaSlice(int index,double& theta,TVector<double>& phi,TVector<T>& value) const
     335void SphereGorski<T>::GetThetaSlice(int_4 index,double& theta,TVector<double>& phi,TVector<T>& value) const
    336336
    337337//    For a theta-slice with index 'index', return :
     
    354354    }
    355355
    356   int iring= 0;
    357   int lring  = 0;
     356  int_4 iring= 0;
     357  int_4 lring  = 0;
    358358  if(index < nSide_-1)
    359359    {
     
    368368  else
    369369    {
    370       int nc= 4*nSide_-1-index;
     370      int_4 nc= 4*nSide_-1-index;
    371371      iring = nPix_-2*nc*(nc+1);
    372372      lring = 4*nc;
     
    377377  double TH= 0.;
    378378  double FI= 0.;
    379   for(int kk = 0; kk < lring;kk++)
     379  for(int_4 kk = 0; kk < lring;kk++)
    380380    {
    381381      PixThetaPhi(kk+iring,TH,FI);
     
    389389//++
    390390template<class T>
    391 T& SphereGorski<T>::PixVal(int k)
     391T& SphereGorski<T>::PixVal(int_4 k)
    392392
    393393//    Return value of  pixel with "RING" index k
     
    406406//++
    407407template<class T>
    408 T const& SphereGorski<T>::PixVal(int k) const
     408T const& SphereGorski<T>::PixVal(int_4 k) const
    409409
    410410//    Return value of  pixel with "RING" index k
     
    422422//++
    423423template<class T>
    424 T& SphereGorski<T>::PixValNest(int k)
     424T& SphereGorski<T>::PixValNest(int_4 k)
    425425
    426426//    Return value of  pixel with "NESTED" index k
     
    438438
    439439template<class T>
    440 T const& SphereGorski<T>::PixValNest(int k) const
     440T const& SphereGorski<T>::PixValNest(int_4 k) const
    441441
    442442//    Return value of  pixel with "NESTED" index k
     
    449449      THROW(rangeCheckErr);
    450450  }
    451   int pix= nest2ring(nSide_,k);
     451  int_4 pix= nest2ring(nSide_,k);
    452452  return *(pixels_.Data()+pix);
    453453}
     
    456456//++
    457457template<class T>
    458 bool SphereGorski<T>::ContainsSph(double theta, double phi) const
     458bool SphereGorski<T>::ContainsSph(double /*theta*/, double /*phi*/) const
    459459//--
    460460{
     
    465465//++
    466466template<class T>
    467 int SphereGorski<T>::PixIndexSph(double theta,double phi) const
     467int_4 SphereGorski<T>::PixIndexSph(double theta,double phi) const
    468468
    469469//    Return "RING" index of the pixel corresponding to
     
    476476//++
    477477template<class T>
    478 int SphereGorski<T>::PixIndexSphNest(double theta,double  phi) const
     478int_4 SphereGorski<T>::PixIndexSphNest(double theta,double  phi) const
    479479
    480480//    Return "NESTED" index of the pixel corresponding to
     
    489489//++
    490490template<class T>
    491 void SphereGorski<T>::PixThetaPhi(int k,double& theta,double& phi) const
     491void SphereGorski<T>::PixThetaPhi(int_4 k,double& theta,double& phi) const
    492492
    493493//   Return (theta,phi) coordinates of middle of  pixel with "RING" index k
     
    506506//++
    507507template<class T>
    508 double SphereGorski<T>::PixSolAngle(int dummy) const
     508double SphereGorski<T>::PixSolAngle(int_4 /*dummy*/) const
    509509//    Pixel Solid angle  (steradians)
    510510//    All the pixels have the same solid angle. The dummy argument is
     
    518518//++
    519519template<class T>
    520 void SphereGorski<T>::PixThetaPhiNest(int k,double& theta,double& phi) const
     520void SphereGorski<T>::PixThetaPhiNest(int_4 k,double& theta,double& phi) const
    521521
    522522//   Return (theta,phi) coordinates of middle of  pixel with "NESTED" index k
     
    528528//++
    529529template<class T>
    530 int SphereGorski<T>::NestToRing(int k) const
     530int_4 SphereGorski<T>::NestToRing(int_4 k) const
    531531
    532532//    translation from NESTED index  into RING index
     
    539539//++
    540540template<class T>
    541 int SphereGorski<T>::RingToNest(int k) const
     541int_4 SphereGorski<T>::RingToNest(int_4 k) const
    542542//
    543543//    translation from  RING index  into NESTED index
     
    550550
    551551template<class T>
    552 int SphereGorski<T>::nest2ring(int nside, int ipnest) const
     552int_4 SphereGorski<T>::nest2ring(int_4 nside, int_4 ipnest) const
    553553{
    554554  /*
     
    632632
    633633template<class T>
    634 int SphereGorski<T>::ring2nest(int nside, int ipring) const
     634int_4 SphereGorski<T>::ring2nest(int_4 nside, int_4 ipring) const
    635635{
    636636  /*
     
    741741
    742742template<class T>
    743 int SphereGorski<T>::ang2pix_ring(int nside, double theta, double phi) const
     743int_4 SphereGorski<T>::ang2pix_ring(int_4 nside, double theta, double phi) const
    744744{
    745745  /*
     
    817817
    818818template<class T>
    819 int SphereGorski<T>::ang2pix_nest(int nside, double theta, double phi) const
     819int_4 SphereGorski<T>::ang2pix_nest(int_4 nside, double theta, double phi) const
    820820{
    821821  /*
     
    914914
    915915template<class T>
    916 void SphereGorski<T>::pix2ang_ring(int nside,int ipix,double& theta,double& phi) const {
     916void SphereGorski<T>::pix2ang_ring(int_4 nside,int_4 ipix,double& theta,double& phi) const {
    917917  /*
    918918    ===================================================
     
    982982
    983983template<class T>
    984 void SphereGorski<T>::pix2ang_nest(int nside,int ipix,double& theta,double& phi) const {
     984void SphereGorski<T>::pix2ang_nest(int_4 nside,int_4 ipix,double& theta,double& phi) const {
    985985  /*
    986986    ==================================================
     
    11741174    }
    11751175
    1176   int nSide;
     1176  int_4 nSide;
    11771177  is.GetI4(nSide);
    11781178  dobj->setSizeIndex(nSide);
    11791179
    1180   int nPix;
     1180  int_4 nPix;
    11811181  is.GetI4(nPix);
    11821182  dobj->setNbPixels(nPix);
     
    12041204
    12051205  char strg[256];
    1206   int nSide= dobj->SizeIndex();
    1207   int nPix = dobj->NbPixels();
     1206  int_4 nSide= dobj->SizeIndex();
     1207  int_4 nPix = dobj->NbPixels();
    12081208 
    12091209  if(dobj->ptrInfo())
  • trunk/SophyaLib/Samba/spheregorski.h

    r604 r682  
    6464  nside MUST be a power of 2 (<= 8192)
    6565*/
    66 SphereGorski(int m);
     66SphereGorski(int_4 m);
    6767SphereGorski(const SphereGorski<T>& s, bool share=false);
    6868//!     Destructor
     
    7373/* Nombre de pixels du decoupage */
    7474/*!    Return number of  pixels of the  splitting */
    75 virtual int NbPixels() const;
    76 inline void setNbPixels(int n) {nPix_= n;}
     75virtual int_4 NbPixels() const;
     76inline void setNbPixels(int_4 n) {nPix_= n;}
    7777
    7878/* Valeur du contenu du pixel d'indice "RING" k  */
    7979/*!    Return value of  pixel with "RING" index k */
    80 virtual T& PixVal(int k);
    81 virtual T const& PixVal(int k) const;
     80virtual T& PixVal(int_4 k);
     81virtual T const& PixVal(int_4 k) const;
    8282
    8383/* Nombre de tranches en theta */
    8484/*!    Return number of slices in theta direction on the  sphere */
    85 int NbThetaSlices() const;
     85int_4 NbThetaSlices() const;
    8686/*!   For a theta-slice with index 'index', return :
    8787
     
    9292    a vector containing the corresponding values of pixels
    9393*/
    94 void GetThetaSlice(int index,double& theta,TVector<double>& phi,TVector<T>& value) const;
     94void GetThetaSlice(int_4 index,double& theta,TVector<double>& phi,TVector<T>& value) const;
    9595
    9696/* Return true if teta,phi in map  */
     
    100100/*!  Return "RING" index of the pixel corresponding to direction (theta, phi).
    101101 */
    102 virtual int PixIndexSph(double theta,double phi) const;
     102virtual int_4 PixIndexSph(double theta,double phi) const;
    103103
    104104/* Coordonnees spheriques du milieu du pixel d'indice "RING" k   */
    105 virtual void PixThetaPhi(int k,double& theta,double& phi) const;
     105virtual void PixThetaPhi(int_4 k,double& theta,double& phi) const;
    106106
    107107/*! Set all pixels to value v */
     
    115115   fulfil this requirement.
    116116*/
    117 virtual double PixSolAngle(int dummy) const;
     117virtual double PixSolAngle(int_4 dummy) const;
    118118inline void setPixSolAngle(double x) {omeg_= x;}
    119119
     
    127127  nside MUST be a power of 2 (<= 8192)
    128128*/
    129 virtual void Resize(int m);
     129virtual void Resize(int_4 m);
    130130
    131131inline virtual char* TypeOfMap() const {return "RING";};
     
    133133/* Valeur du contenu du pixel d'indice "NEST" k */
    134134/*!    Return value of  pixel with "NESTED" index k */
    135 virtual T& PixValNest(int k);
     135virtual T& PixValNest(int_4 k);
    136136/*!    Return value of  pixel with "NESTED" index k */
    137 virtual T const& PixValNest(int k) const;
     137virtual T const& PixValNest(int_4 k) const;
    138138
    139139/* Indice "NEST" du pixel vers lequel pointe une direction definie par
     
    141141/*! Return "NESTED" index of the pixel corresponding to direction (theta, phi).
    142142 */
    143 virtual int PixIndexSphNest(double theta,double phi) const;
     143virtual int_4 PixIndexSphNest(double theta,double phi) const;
    144144
    145145/* Coordonnees spheriques du milieu du pixel d'indice "NEST" k       */
    146146/*!   Return (theta,phi) coordinates of middle of  pixel with "NESTED" index k
    147147 */
    148 virtual void PixThetaPhiNest(int k,double& theta,double& phi) const;
     148virtual void PixThetaPhiNest(int_4 k,double& theta,double& phi) const;
    149149
    150150/* algorithme de pixelisation */
    151 void Pixelize(int);
     151void Pixelize(int_4);
    152152
    153153/* convertit index nested en ring  */
    154154/*!    translation from NESTED index  into RING index */
    155 int NestToRing(int) const;
     155int_4 NestToRing(int_4) const;
    156156
    157157/* convertit index ring en nested" */
    158158/*!    translation from  RING index  into NESTED index */
    159 int RingToNest(int) const;
     159int_4 RingToNest(int_4) const;
    160160
    161161
    162162/* retourne/fixe la valeur du parametre Gorski */
    163 inline virtual int SizeIndex() const {return(nSide_);}
    164 inline void setSizeIndex(int n) {nSide_= n;}
     163inline virtual int_4 SizeIndex() const {return(nSide_);}
     164inline void setSizeIndex(int_4 n) {nSide_= n;}
    165165
    166166/* retourne les pointeurs /remplit les tableaux */
    167167inline const NDataBlock<T>* getDataBlock() const { return (&pixels_); }
    168 inline void setDataBlock(T* data,int m) { pixels_.FillFrom(m,data); }
     168inline void setDataBlock(T* data,int_4 m) { pixels_.FillFrom(m,data); }
    169169
    170170/*  Acces to the DataBlock  */
     
    182182void InitNul();
    183183
    184 int  nest2ring(int nside,int ipnest) const;
    185 int  ring2nest(int nside,int ipring) const;
    186 
    187 int  ang2pix_ring(int nside,double theta,double phi) const;
    188 int  ang2pix_nest(int nside,double theta,double phi) const;
    189 void pix2ang_ring(int nside,int ipix,double& theta,double& phi) const;
    190 void pix2ang_nest(int nside,int ipix,double& theta,double& phi) const;
     184int_4  nest2ring(int_4 nside,int_4 ipnest) const;
     185int_4  ring2nest(int_4 nside,int_4 ipring) const;
     186
     187int_4  ang2pix_ring(int_4 nside,double theta,double phi) const;
     188int_4  ang2pix_nest(int_4 nside,double theta,double phi) const;
     189void pix2ang_ring(int_4 nside,int_4 ipix,double& theta,double& phi) const;
     190void pix2ang_nest(int_4 nside,int_4 ipix,double& theta,double& phi) const;
    191191
    192192// ------------- variables internes -----------------------
    193 int nSide_;
    194 int nPix_;
     193int_4 nSide_;
     194int_4 nPix_;
    195195double omeg_;
    196196
     
    234234static PIXELS_XY& instance();
    235235
    236 NDataBlock<int> pix2x_;
    237 NDataBlock<int> pix2y_;
    238 NDataBlock<int> x2pix_;
    239 NDataBlock<int> y2pix_;
     236NDataBlock<int_4> pix2x_;
     237NDataBlock<int_4> pix2y_;
     238NDataBlock<int_4> x2pix_;
     239NDataBlock<int_4> y2pix_;
    240240
    241241private :
  • trunk/SophyaLib/Samba/spherepos.cc

    r525 r682  
    11#include "spherepos.h"
    22
    3 static char *head_spherepos_cc_ = "$Header: /Users/garnier/temp/CVSSophya/SophyaLib/Samba/spherepos.cc,v 1.2 1999-10-27 10:45:47 ansari Exp $";
     3static char *head_spherepos_cc_ = "$Header: /Users/garnier/temp/CVSSophya/SophyaLib/Samba/spherepos.cc,v 1.3 1999-12-10 16:55:59 ansari Exp $";
    44
    55
     
    6969}
    7070
    71 UnitVector SpherePosition::Transform(const SphereCoordSys& cs) const
     71UnitVector SpherePosition::Transform(const SphereCoordSys& /*cs*/) const
    7272{
    7373return(*this);
  • trunk/SophyaLib/Samba/spherethetaphi.cc

    r604 r682  
    5050//++
    5151template <class T>
    52 SphereThetaPhi<T>::SphereThetaPhi(int m)
     52SphereThetaPhi<T>::SphereThetaPhi(int_4 m)
    5353
    5454//    m is the number of slices in theta on an hemisphere (the polar cap
     
    6868  NTheta_= s.NTheta_;
    6969  NPix_  = s.NPix_;
    70   NPhi_  = new int[NTheta_];
     70  NPhi_  = new int_4[NTheta_];
    7171  Theta_ = new double[NTheta_+1];
    72   TNphi_ = new int[NTheta_+1];
     72  TNphi_ = new int_4[NTheta_+1];
    7373  for(int k = 0; k < NTheta_; k++)
    7474    {
     
    123123//++
    124124template <class T>
    125 void SphereThetaPhi<T>::Resize(int m)
     125void SphereThetaPhi<T>::Resize(int_4 m)
    126126//   re-pixelize the sphere
    127127//--
     
    134134//++
    135135template <class T>
    136 int SphereThetaPhi<T>::NbPixels() const
     136int_4 SphereThetaPhi<T>::NbPixels() const
    137137
    138138//    Return total number of pixels
     
    145145//++
    146146template <class T>
    147 T& SphereThetaPhi<T>::PixVal(int k)
     147T& SphereThetaPhi<T>::PixVal(int_4 k)
    148148
    149149//    Return value of pixel with index k
     
    161161//++
    162162template <class T>
    163 T const& SphereThetaPhi<T>::PixVal(int k) const
     163T const& SphereThetaPhi<T>::PixVal(int_4 k) const
    164164
    165165//    Return value of pixel with index k
     
    178178//++
    179179template <class T>
    180 bool SphereThetaPhi<T>::ContainsSph(double theta, double phi) const
     180bool SphereThetaPhi<T>::ContainsSph(double /*theta*/, double /*phi*/) const
    181181//--
    182182{
     
    187187//++
    188188template <class T>
    189 int SphereThetaPhi<T>::PixIndexSph(double theta, double phi) const
     189int_4 SphereThetaPhi<T>::PixIndexSph(double theta, double phi) const
    190190
    191191//    Return index of the pixel corresponding to
     
    208208  dphi= DeuxPi/(double)NPhi_[i-1];
    209209 
    210   if (fgzn)  k= NPix_-TNphi_[i]+(int)(phi/dphi);
    211   else k= TNphi_[i-1]+(int)(phi/dphi);
     210  if (fgzn)  k= NPix_-TNphi_[i]+(int_4)(phi/dphi);
     211  else k= TNphi_[i-1]+(int_4)(phi/dphi);
    212212  return(k);
    213213}
     
    216216//++
    217217template <class T>
    218 void SphereThetaPhi<T>::PixThetaPhi(int k,double& theta,double& phi) const
     218void SphereThetaPhi<T>::PixThetaPhi(int_4 k,double& theta,double& phi) const
    219219
    220220//   Return (theta,phi) coordinates of middle of  pixel with  index k
     
    250250//++
    251251template <class T>
    252 double SphereThetaPhi<T>::PixSolAngle(int dummy) const
     252double SphereThetaPhi<T>::PixSolAngle(int_4 /*dummy*/) const
    253253
    254254//    Pixel Solid angle  (steradians)
     
    264264//++
    265265template <class T>
    266 void SphereThetaPhi<T>::Limits(int k,double& tetMin,double& tetMax,double& phiMin,double& phiMax)
     266void SphereThetaPhi<T>::Limits(int_4 k,double& tetMin,double& tetMax,double& phiMin,double& phiMax)
    267267
    268268//   Return values of theta,phi which limit the pixel with  index k
     
    317317//++
    318318template <class T>
    319 int SphereThetaPhi<T>::NbThetaSlices() const
     319int_4 SphereThetaPhi<T>::NbThetaSlices() const
    320320
    321321//    Return number of theta-slices on the sphere
     
    330330//++
    331331template <class T>
    332 int SphereThetaPhi<T>::NPhi(int kt) const
     332int_4 SphereThetaPhi<T>::NPhi(int_4 kt) const
    333333
    334334//    Return number of pixels in phi-direction of the kt-th slice
     
    353353//++
    354354template <class T>
    355 void SphereThetaPhi<T>::Theta(int kt,double& tetMin,double& tetMax)
     355void SphereThetaPhi<T>::Theta(int_4 kt,double& tetMin,double& tetMax)
    356356
    357357//    Return  theta values which limit the slice kt
     
    385385//++
    386386template <class T>
    387 void SphereThetaPhi<T>::Phi(int kt,int jp,double& phiMin,double& phiMax)
     387void SphereThetaPhi<T>::Phi(int_4 kt,int_4 jp,double& phiMin,double& phiMax)
    388388
    389389//   Return values of phi which limit the jp-th pixel of the kt-th slice
     
    416416//++
    417417template <class T>
    418 int SphereThetaPhi<T>::Index(int kt,int jp) const
     418int_4 SphereThetaPhi<T>::Index(int_4 kt,int_4 jp) const
    419419
    420420//    Return pixel index  with sequence index jp in the slice kt
     
    449449//++
    450450template <class T>
    451 void SphereThetaPhi<T>::ThetaPhiIndex(int k,int& kt,int& jp)
     451void SphereThetaPhi<T>::ThetaPhiIndex(int_4 k,int_4& kt,int_4& jp)
    452452
    453453//    Return indices kt (theta) and jp (phi) of  pixel with index k
     
    477477//++
    478478template <class T>
    479 void  SphereThetaPhi<T>::Pixelize(int m)
     479void  SphereThetaPhi<T>::Pixelize(int_4 m)
    480480
    481481//    achieve the splitting into pixels (m has the same signification
     
    507507 
    508508  // Le nombre de pixels en phi de chacune des bandes en theta
    509   NPhi_ = new int[m];
     509  NPhi_ = new int_4[m];
    510510 
    511511  // Le nombre/Deuxpi total des pixels contenus dans les bandes de z superieur a une
    512512  // bande donnee (mTPphi[m] contient le nombre de pixels total de l'hemisphere)
    513   TNphi_= new int[m+1];
     513  TNphi_= new int_4[m+1];
    514514 
    515515  // Calcul du nombre total de pixels dans chaque bande pour optimiser
     
    524524    {
    525525      TNphi_[j]= TNphi_[j-1]+NPhi_[j-1];
    526       NPhi_[j] = (int)(.5+4.*(double)(m-.5)*sin(Pi*(double)j/(double)(2.*m-1.))) ;
     526      NPhi_[j] = (int_4)(.5+4.*(double)(m-.5)*sin(Pi*(double)j/(double)(2.*m-1.))) ;
    527527    }
    528528 
     
    556556//++
    557557template <class T>
    558 void SphereThetaPhi<T>::GetThetaSlice(int index,double& theta, TVector<double>& phi, TVector<T>& value) const
     558void SphereThetaPhi<T>::GetThetaSlice(int_4 index,double& theta, TVector<double>& phi, TVector<T>& value) const
    559559
    560560//    For a theta-slice with index 'index', return :
     
    593593
    594594template <class T>
    595 void SphereThetaPhi<T>::setmNPhi(int* array, int m)
     595void SphereThetaPhi<T>::setmNPhi(int_4* array, int_4 m)
    596596  //remplit le tableau contenant le nombre de pixels en phi de chacune des bandes en theta
    597597  //
    598598{
    599   NPhi_= new int[m];
     599  NPhi_= new int_4[m];
    600600  for(int k = 0; k < m; k++) NPhi_[k]= array[k];
    601601}
    602602
    603603template <class T>
    604 void SphereThetaPhi<T>::setmTNphi(int* array, int m)
     604void SphereThetaPhi<T>::setmTNphi(int_4* array, int_4 m)
    605605  //remplit  le tableau contenant le nombre/Deuxpi total des pixels contenus dans les bandes
    606606  //
    607607{
    608   TNphi_= new int[m];
     608  TNphi_= new int_4[m];
    609609  for(int k = 0; k < m; k++) TNphi_[k]= array[k];
    610610}
    611611
    612612template <class T>
    613 void SphereThetaPhi<T>::setmTheta(double* array, int m)
     613void SphereThetaPhi<T>::setmTheta(double* array, int_4 m)
    614614  //remplit  le tableau contenant les valeurs limites de theta
    615615  //
     
    620620
    621621template <class T>
    622 void SphereThetaPhi<T>::setDataBlock(T* data, int m)
     622void SphereThetaPhi<T>::setDataBlock(T* data, int_4 m)
    623623  // remplit  le vecteur des contenus des pixels
    624624{
     
    743743    }
    744744
    745   int mNTheta;
     745  int_4 mNTheta;
    746746  is.GetI4(mNTheta); 
    747747  dobj->setSizeIndex(mNTheta);
    748748
    749   int mNPix;
     749  int_4 mNPix;
    750750  is.GetI4(mNPix);
    751751  dobj->setNbPixels(mNPix);
     
    755755  dobj->setPixSolAngle(mOmeg);
    756756
    757   int* mNphi= new int[mNTheta];
     757  int_4* mNphi= new int_4[mNTheta];
    758758  is.GetI4s(mNphi, mNTheta);
    759759  dobj->setmNPhi(mNphi, mNTheta);
    760760  delete [] mNphi;
    761761
    762   int* mTNphi= new int[mNTheta+1];
     762  int_4* mTNphi= new int_4[mNTheta+1];
    763763  is.GetI4s(mTNphi, mNTheta+1);
    764764  dobj->setmTNphi(mTNphi, mNTheta+1);
     
    788788 
    789789  char strg[256];
    790   int mNTheta= dobj->SizeIndex();
    791   int mNPix  = dobj->NbPixels();
     790  int_4 mNTheta= dobj->SizeIndex();
     791  int_4 mNPix  = dobj->NbPixels();
    792792 
    793793  if(dobj->ptrInfo())
  • trunk/SophyaLib/Samba/spherethetaphi.h

    r604 r682  
    3131    pet is a dummy parameter at the moment.
    3232*/
    33 SphereThetaPhi(int m);
     33SphereThetaPhi(int_4 m);
    3434SphereThetaPhi(const SphereThetaPhi<T>& s, bool share=false);
    3535virtual ~SphereThetaPhi();
     
    3939/* retourne/fixe le nombre de pixels */
    4040/*!    Return total number of pixels  */
    41 virtual int NbPixels() const;
    42 inline void setNbPixels(int nbpix) { NPix_= nbpix; }
     41virtual int_4 NbPixels() const;
     42inline void setNbPixels(int_4 nbpix) { NPix_= nbpix; }
    4343
    4444/* retourne la valeur du pixel d'indice k */
    4545/*!    Return value of pixel with index k */
    46 virtual T&       PixVal(int k);
    47 virtual T const& PixVal(int k) const;
     46virtual T&       PixVal(int_4 k);
     47virtual T const& PixVal(int_4 k) const;
    4848
    4949/* Return true if teta,phi in map  */
     
    5151/* retourne l'indice du pixel a (theta,phi) */
    5252/*    Return index of the pixel corresponding to direction (theta, phi). */
    53 virtual int PixIndexSph(double theta, double phi) const;
     53virtual int_4 PixIndexSph(double theta, double phi) const;
    5454
    5555/* retourne les coordonnees Spheriques du centre du pixel d'indice k */
    5656/*!   Return (theta,phi) coordinates of middle of  pixel with  index k */
    57 virtual void PixThetaPhi(int k, double& theta, double& phi) const;
     57virtual void PixThetaPhi(int_4 k, double& theta, double& phi) const;
    5858
    5959/*! Setting pixel values to a constant */
     
    6767    fulfil this requirement.
    6868*/
    69 virtual double PixSolAngle(int dummy) const;
     69virtual double PixSolAngle(int_4 dummy) const;
    7070inline void setPixSolAngle(double omega) { Omega_= omega; }
    7171 
    7272/* retourne/fixe la valeur du parametre de decoupage m */
    73 inline virtual int SizeIndex() const { return( NTheta_); }
    74 inline void setSizeIndex(int nbindex) { NTheta_= nbindex; }
     73inline virtual int_4 SizeIndex() const { return( NTheta_); }
     74inline void setSizeIndex(int_4 nbindex) { NTheta_= nbindex; }
    7575
    7676// ------------- Specific methods  ----------------------
    7777
    7878/*!   re-pixelize the sphere */
    79 virtual void Resize(int m);
     79virtual void Resize(int_4 m);
    8080
    8181inline virtual char* TypeOfMap() const {return "TETAFI";};
     
    8383/* Valeurs de theta des paralleles et phi des meridiens limitant le pixel d'indice k */
    8484/*   Return values of theta,phi which limit the pixel with  index k */
    85 virtual void Limits(int k,double& th1,double& th2,double& phi1,double& phi2);
     85virtual void Limits(int_4 k,double& th1,double& th2,double& phi1,double& phi2);
    8686
    8787/* Nombre de tranches en theta */
    8888/*!    Return number of theta-slices on the sphere */
    89 int NbThetaSlices() const;
     89int_4 NbThetaSlices() const;
    9090
    9191/* Nombre de pixels en phi de la tranche d'indice kt */
    92 int NPhi(int kt) const;
     92int_4 NPhi(int_4 kt) const;
    9393
    9494/* Renvoie dans t1,t2 les valeurs respectives de theta min et theta max  */
    9595/* de la tranche d'indice kt  */
    9696/*!    Return  theta values which limit the slice kt */
    97 void Theta(int kt, double& t1, double& t2);
     97void Theta(int_4 kt, double& t1, double& t2);
    9898
    9999/* Renvoie dans p1,p2 les valeurs phimin et phimax du pixel d'indice jp  */
    100100/* dans la tranche d'indice kt  */
    101101/*!   Return values of phi which limit the jp-th pixel of the kt-th slice */
    102 void Phi(int kt, int jp, double& p1, double& p2);
     102void Phi(int_4 kt, int_4 jp, double& p1, double& p2);
    103103
    104104/* Renvoie l'indice k du pixel d'indice jp dans la tranche d'indice kt   */
    105105/*!   Return pixel index  with sequence index jp in the slice kt */
    106 int Index(int kt, int jp) const;
     106int_4 Index(int_4 kt, int_4 jp) const;
    107107
    108108/* Indice kt de la tranche et indice jp du pixel d'indice k  */
    109109/*!    Return indices kt (theta) and jp (phi) of  pixel with index k */
    110 void ThetaPhiIndex(int k,int& kt,int& jp);
     110void ThetaPhiIndex(int_4 k,int_4& kt,int_4& jp);
    111111
    112112/*!    achieve the splitting into pixels (m has the same signification
     
    121121    phi of the slice closest of the equator with z<0).
    122122*/
    123 void Pixelize(int);
     123void Pixelize(int_4);
    124124
    125125/*!   For a theta-slice with index 'index', return :
     
    131131    a vector containing the corresponding values of pixels
    132132*/
    133 void GetThetaSlice(int index,double& theta,TVector<double>& phi,TVector<T>& value) const;
     133void GetThetaSlice(int_4 index,double& theta,TVector<double>& phi,TVector<T>& value) const;
    134134
    135135/*retourne le tableau contenant le nombre de pixels en phi de chacune des bandes en theta */
    136 inline const int* getmNPhi() const { return(NPhi_); }
    137 void setmNPhi(int* array, int m);
     136inline const int_4* getmNPhi() const { return(NPhi_); }
     137void setmNPhi(int_4* array, int_4 m);
    138138
    139139/* retourne/remplit le tableau contenant le nombre/Deuxpi total des pixels contenus dans les bandes */
    140 inline const int* getmTNphi() const { return(TNphi_); }
    141 void setmTNphi(int* array, int m);
     140inline const int_4* getmTNphi() const { return(TNphi_); }
     141void setmTNphi(int_4* array, int_4 m);
    142142
    143143/* retourne/remplit le tableau contenant les valeurs limites de theta */
    144144inline const double* getmTheta() const { return(Theta_); }
    145 void setmTheta(double* array, int m);
     145void setmTheta(double* array, int_4 m);
    146146
    147147/* retourne le pointeur vers/remplit  le vecteur des contenus des pixels */
    148148inline const NDataBlock<T>* getDataBlock() const { return (&pixels_); }
    149 void setDataBlock(T* data, int m);
     149void setDataBlock(T* data, int_4 m);
    150150
    151151/*  Acces to the DataBlock  */
     
    163163
    164164// ------------- variables internes ---------------------
    165 int NTheta_;
    166 int NPix_;
     165int_4 NTheta_;
     166int_4 NPix_;
    167167double Omega_;
    168 int* NPhi_;
    169 int* TNphi_;
     168int_4* NPhi_;
     169int_4* TNphi_;
    170170double* Theta_;
    171171NDataBlock<T> pixels_;
  • trunk/SophyaLib/Samba/sphericalmap.h

    r473 r682  
    3434// index characterizing the size pixelization : m for SphereThetaPhi
    3535// nside for Gorski sphere...
    36 virtual void Resize(int m)=0;
    37 virtual int NbThetaSlices() const=0;
    38 virtual void GetThetaSlice(int index,double& theta, TVector<double>& phi, TVector<T>& value) const=0;
     36virtual void Resize(int_4 m)=0;
     37virtual int_4 NbThetaSlices() const=0;
     38virtual void GetThetaSlice(int_4 index,double& theta, TVector<double>& phi, TVector<T>& value) const=0;
    3939};
    4040#endif
  • trunk/SophyaLib/Samba/syn2fast.cc

    r483 r682  
    33#include "lambuilder.h"
    44#include "fftserver.h"
     5#ifdef __MWERKS__
     6#include "unixmac.h"
     7#endif
    58
    69extern "C" {
  • trunk/SophyaLib/Samba/unitvector.h

    r518 r682  
    1717  UnitVector(const Vector3d&);
    1818 
    19   virtual Vector3d& operator=(const Vector3d&);
     19  /*virtual*/ Vector3d& operator=(const Vector3d&);  //$CHECK$ EA 101299 operator = non virtual
    2020  virtual Vector3d& operator+=(const Vector3d&);
    2121  virtual Vector3d& operator-=(const Vector3d&);
  • trunk/SophyaLib/Samba/utilgeom.h

    r517 r682  
    33#include <math.h>
    44#ifdef __MWERKS__
    5    #include "mwerksmath.h"
    6 //   #include "unixmac.h"
     5#include "unixmac.h"
    76#endif
    87#include <vector>
  • trunk/SophyaLib/Samba/vector3d.h

    r565 r682  
    77#include <string.h>
    88#ifdef __MWERKS__
    9    #include "mwerksmath.h"
    10 //   #include "unixmac.h"
     9#include "unixmac.h"
    1110#endif
    1211#include "longlat.h"
     
    9190  Vector3d Rotate(const Vector3d& omega,double phi);
    9291
    93   virtual Vector3d& operator=(const Vector3d&);
     92  /*virtual*/ Vector3d& operator=(const Vector3d&); // $CHECK$ EA 101299
    9493  virtual Vector3d& operator+=(const Vector3d&);
    9594  virtual Vector3d& operator-=(const Vector3d&);
Note: See TracChangeset for help on using the changeset viewer.