Changeset 682 in Sophya
- Timestamp:
- Dec 10, 1999, 5:56:03 PM (26 years ago)
- Location:
- trunk/SophyaLib
- Files:
-
- 1 added
- 1 deleted
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/BaseTools/machdefs.h
r632 r682 233 233 #undef HAS_VEC_NEW 234 234 #define NO_STRSTREAM 235 #define STREAMPOS_IS_CLASS235 //#define STREAMPOS_IS_CLASS 236 236 #define ITER_TAG 237 237 #define HAS_IOS_BIN -
trunk/SophyaLib/NTools/datime.c
r517 r682 6 6 #include <math.h> 7 7 #ifdef __MWERKS__ 8 #include "mwerksmath.h" 9 // #include "unixmac.h" 8 #include "unixmac.h" 10 9 #endif 11 10 -
trunk/SophyaLib/NTools/generalfit.cc
r519 r682 5 5 #include <math.h> 6 6 #ifdef __MWERKS__ 7 #include "mwerksmath.h" 8 // #include "unixmac.h" 7 #include "unixmac.h" 9 8 #endif 10 9 #include <string.h> -
trunk/SophyaLib/NTools/histos.cc
r514 r682 1 1 // 2 // $Id: histos.cc,v 1. 6 1999-10-25 16:39:57ansari Exp $2 // $Id: histos.cc,v 1.7 1999-12-10 16:55:51 ansari Exp $ 3 3 // 4 4 … … 1781 1781 1782 1782 // Que faut-il ecrire? 1783 int errok = (dobj->err2) ? 1 : 0;1783 int_4 errok = (dobj->err2) ? 1 : 0; 1784 1784 1785 1785 // Ecriture entete pour identifier facilement -
trunk/SophyaLib/NTools/matxop.c
r220 r682 393 393 if (szv < 25) szv = 25; 394 394 395 if ( (FVeci = malloc(nvarmx*sizeof(float *))) == NULL )395 if ( (FVeci = (float**) malloc(nvarmx*sizeof(float *))) == NULL ) 396 396 { printf("InitRFitLin_Erreur: (Pb malloc(Veci)) \n"); 397 397 return(1); 398 398 } 399 399 400 if ( (FVSpace = malloc(nvarmx*szv*sizeof(float))) == NULL )400 if ( (FVSpace = (float*) malloc(nvarmx*szv*sizeof(float))) == NULL ) 401 401 { printf("InitRFitLin_Erreur: (Pb malloc(VSpace)) \n"); 402 402 free(FVeci); … … 407 407 408 408 409 if ( (FVecf = malloc(3*sizeof(float *))) == NULL )409 if ( (FVecf = (float**) malloc(3*sizeof(float *))) == NULL ) 410 410 { printf("InitRFitLin_Erreur: (Pb malloc(Vecf)) \n"); 411 411 free(FVeci); … … 414 414 } 415 415 416 if ( (FVSpacef = malloc(3*szv*sizeof(float))) == NULL )416 if ( (FVSpacef = (float*) malloc(3*szv*sizeof(float))) == NULL ) 417 417 { printf("InitRFitLin_Erreur: (Pb malloc(VSpacef)) \n"); 418 418 free(FVeci); … … 425 425 426 426 427 if ( (FFMtx = malloc(nvarmx*nvarmx*sizeof(double))) == NULL )427 if ( (FFMtx = (double*) malloc(nvarmx*nvarmx*sizeof(double))) == NULL ) 428 428 { printf("InitRFitLin_Erreur: (Pb malloc(FMtx)) \n"); 429 429 free(FVeci); … … 434 434 } 435 435 436 if ( (FFMtx2 = malloc(nvarmx*nvarmx*sizeof(double))) == NULL )436 if ( (FFMtx2 = (double*) malloc(nvarmx*nvarmx*sizeof(double))) == NULL ) 437 437 { printf("InitRFitLin_Erreur: (Pb malloc(FMtx2)) \n"); 438 438 free(FVeci); … … 444 444 } 445 445 446 if ( (FFSort = malloc((nvarmx+1)*nvarmx*sizeof(double))) == NULL )446 if ( (FFSort = (double*) malloc((nvarmx+1)*nvarmx*sizeof(double))) == NULL ) 447 447 { printf("InitRFitLin_Erreur: (Pb malloc(FFSort)) \n"); 448 448 free(FVeci); … … 705 705 if (szv < 25) szv = 25; 706 706 707 if ( (DVeci = malloc(nvarmx*sizeof(double *))) == NULL )707 if ( (DVeci = (double**) malloc(nvarmx*sizeof(double *))) == NULL ) 708 708 { printf("InitDFitLin_Erreur: (Pb malloc(Veci)) \n"); 709 709 return(1); 710 710 } 711 711 712 if ( (DVSpace = malloc(nvarmx*szv*sizeof(double))) == NULL )712 if ( (DVSpace = (double*) malloc(nvarmx*szv*sizeof(double))) == NULL ) 713 713 { printf("InitDFitLin_Erreur: (Pb malloc(VSpace)) \n"); 714 714 free(DVeci); … … 719 719 720 720 721 if ( (DVecf = malloc(3*sizeof(double *))) == NULL )721 if ( (DVecf = (double**) malloc(3*sizeof(double *))) == NULL ) 722 722 { printf("InitDFitLin_Erreur: (Pb malloc(Vecf)) \n"); 723 723 free(DVeci); … … 726 726 } 727 727 728 if ( (DVSpacef = malloc(3*szv*sizeof(double))) == NULL )728 if ( (DVSpacef = (double*) malloc(3*szv*sizeof(double))) == NULL ) 729 729 { printf("InitDFitLin_Erreur: (Pb malloc(VSpacef)) \n"); 730 730 free(DVeci); … … 737 737 738 738 739 if ( (DFMtx = malloc(nvarmx*nvarmx*sizeof(double))) == NULL )739 if ( (DFMtx = (double*) malloc(nvarmx*nvarmx*sizeof(double))) == NULL ) 740 740 { printf("InitDFitLin_Erreur: (Pb malloc(FMtx)) \n"); 741 741 free(DVeci); … … 746 746 } 747 747 748 if ( (DFMtx2 = malloc(nvarmx*nvarmx*sizeof(double))) == NULL )748 if ( (DFMtx2 = (double*) malloc(nvarmx*nvarmx*sizeof(double))) == NULL ) 749 749 { printf("InitDFitLin_Erreur: (Pb malloc(FMtx2)) \n"); 750 750 free(DVeci); -
trunk/SophyaLib/NTools/nbmath.c
r220 r682 1643 1643 { 1644 1644 int npt,k,i,nclass; 1645 double *clas s,aa1,c2,cut;1645 double *clas,aa1,c2,cut; 1646 1646 1647 1647 *a1 =0.; … … 1654 1654 /* printf("pass 1: %g*x c2=%g/%d\n",*a1,c2,npt); */ 1655 1655 1656 clas s =malloc( *n * sizeof(double) );1657 if( clas s== NULL ) {*n=npt; return(-3.);}1656 clas = (double*) malloc( *n * sizeof(double) ); 1657 if( clas == NULL ) {*n=npt; return(-3.);} 1658 1658 1659 1659 /* elimination des mauvais points */ … … 1662 1662 if(ey[i]<=0.) continue; 1663 1663 c2 = (y[i]-aa1*x[i])/ey[i]; 1664 clas s[nclass] = c2*c2;1664 clas[nclass] = c2*c2; 1665 1665 nclass++; 1666 1666 } 1667 qsort(clas s,(size_t) nclass,(size_t) sizeof(double),qSort_Dble);1667 qsort(clas,(size_t) nclass,(size_t) sizeof(double),qSort_Dble); 1668 1668 k = (int) ( (1. - per_clean ) * (double) nclass ); 1669 1669 if(k<0) k=0; 1670 1670 if(k>=nclass) k = nclass-1; 1671 cut = clas s[k];1671 cut = clas[k]; 1672 1672 k = 0; 1673 1673 for(i=0;i<*n;i++) { 1674 clas s[i] = ey[i];1674 clas[i] = ey[i]; 1675 1675 c2 = (y[i]-aa1*x[i])/ey[i]; 1676 1676 c2 *= c2; 1677 if(ey[i]>0. && c2>cut) {clas s[i] = -1.; k++;}1677 if(ey[i]>0. && c2>cut) {clas[i] = -1.; k++;} 1678 1678 } 1679 1679 /* printf("nombre pt tues %d cut=%g\n",k,cut); */ … … 1681 1681 /* 2sd passe */ 1682 1682 npt = *n; 1683 c2 = FitProp(x,y,clas s,&npt,&aa1);1684 if(c2<0.) {*n = npt; free(clas s); return(-2.);}1683 c2 = FitProp(x,y,clas,&npt,&aa1); 1684 if(c2<0.) {*n = npt; free(clas); return(-2.);} 1685 1685 *a1 = aa1; 1686 1686 *n = npt; 1687 1687 /* printf("pass 2: %g*x c2=%g/%d\n",*a1,c2,npt); */ 1688 1688 1689 free(clas s);1689 free(clas); 1690 1690 return(c2); 1691 1691 } … … 1730 1730 { 1731 1731 int npt,k,i,nclass; 1732 double *clas s,aa0,aa1,c2,cut;1732 double *clas,aa0,aa1,c2,cut; 1733 1733 1734 1734 *a0 = *a1 =0.; … … 1742 1742 /* printf("pass 1: %g + %g*x c2=%g/%d\n",*a0,*a1,c2,npt); */ 1743 1743 1744 clas s =malloc( *n * sizeof(double) );1745 if( clas s== NULL ) {*n=npt; return(-3.);}1744 clas = (double*) malloc( *n * sizeof(double) ); 1745 if( clas == NULL ) {*n=npt; return(-3.);} 1746 1746 1747 1747 /* elimination des mauvais points */ … … 1750 1750 if(ey[i]<=0.) continue; 1751 1751 c2 = (y[i]-(aa0+aa1*x[i]))/ey[i]; 1752 clas s[nclass] = c2*c2;1752 clas[nclass] = c2*c2; 1753 1753 nclass++; 1754 1754 } 1755 qsort(clas s,(size_t) nclass,(size_t) sizeof(double),qSort_Dble);1755 qsort(clas,(size_t) nclass,(size_t) sizeof(double),qSort_Dble); 1756 1756 k = (int) ( (1. - per_clean ) * (double) nclass ); 1757 1757 if(k<0) k=0; 1758 1758 if(k>=nclass) k = nclass-1; 1759 cut = clas s[k];1759 cut = clas[k]; 1760 1760 k = 0; 1761 1761 for(i=0;i<*n;i++) { 1762 clas s[i] = ey[i];1762 clas[i] = ey[i]; 1763 1763 c2 = (y[i]-(aa0+aa1*x[i]))/ey[i]; 1764 1764 c2 *= c2; 1765 if(ey[i]>0. && c2>cut) {clas s[i] = -1.; k++;}1765 if(ey[i]>0. && c2>cut) {clas[i] = -1.; k++;} 1766 1766 } 1767 1767 /* printf("nombre pt tues %d cut=%g\n",k,cut); */ … … 1769 1769 /* 2sd passe */ 1770 1770 npt = *n; 1771 c2 = FitLin(x,y,clas s,&npt,&aa0,&aa1);1772 if(c2<0.) {*n = npt; free(clas s); return(-2.);}1771 c2 = FitLin(x,y,clas,&npt,&aa0,&aa1); 1772 if(c2<0.) {*n = npt; free(clas); return(-2.);} 1773 1773 *a0 = aa0; 1774 1774 *a1 = aa1; … … 1776 1776 /* printf("pass 2: %g + %g*x c2=%g/%d\n",*a0,*a1,c2,npt); */ 1777 1777 1778 free(clas s);1778 free(clas); 1779 1779 return(c2); 1780 1780 } … … 1815 1815 { 1816 1816 int npt,k,i,nclass; 1817 double *clas s,aa0,aa1,aa2,c2,cut;1817 double *clas,aa0,aa1,aa2,c2,cut; 1818 1818 1819 1819 *a0 = *a1 = *a2 =0.; … … 1828 1828 /* printf("pass 1: %g + %g*x + %g*x**2 c2=%g/%d\n",*a0,*a1,*a2,c2,npt); */ 1829 1829 1830 clas s =malloc( *n * sizeof(double) );1831 if( clas s== NULL ) {*n=npt; return(-3.);}1830 clas = (double*) malloc( *n * sizeof(double) ); 1831 if( clas == NULL ) {*n=npt; return(-3.);} 1832 1832 1833 1833 /* elimination des mauvais points */ … … 1836 1836 if(ey[i]<=0.) continue; 1837 1837 c2 = (y[i]-(aa0+aa1*x[i]+aa2*x[i]*x[i]))/ey[i]; 1838 clas s[nclass] = c2*c2;1838 clas[nclass] = c2*c2; 1839 1839 nclass++; 1840 1840 } 1841 qsort(clas s,(size_t) nclass,(size_t) sizeof(double),qSort_Dble);1841 qsort(clas,(size_t) nclass,(size_t) sizeof(double),qSort_Dble); 1842 1842 k = (int) ( (1. - per_clean ) * (double) nclass ); 1843 1843 if(k<0) k=0; 1844 1844 if(k>=nclass) k = nclass-1; 1845 cut = clas s[k];1845 cut = clas[k]; 1846 1846 k = 0; 1847 1847 for(i=0;i<*n;i++) { 1848 clas s[i] = ey[i];1848 clas[i] = ey[i]; 1849 1849 c2 = (y[i]-(aa0+aa1*x[i]+aa2*x[i]*x[i]))/ey[i]; 1850 1850 c2 *= c2; 1851 if(ey[i]>0. && c2>cut) {clas s[i] = -1.; k++;}1851 if(ey[i]>0. && c2>cut) {clas[i] = -1.; k++;} 1852 1852 } 1853 1853 /* printf("nombre pt tues %d cut=%g\n",k,cut); */ … … 1855 1855 /* 2sd passe */ 1856 1856 npt = *n; 1857 c2 = FitPar(x,y,clas s,&npt,&aa0,&aa1,&aa2);1858 if(c2<0.) {*n = npt; free(clas s); return(-2.);}1857 c2 = FitPar(x,y,clas,&npt,&aa0,&aa1,&aa2); 1858 if(c2<0.) {*n = npt; free(clas); return(-2.);} 1859 1859 *a0 = aa0; 1860 1860 *a1 = aa1; … … 1863 1863 /* printf("pass 2: %g + %g*x + %g*x**2 c2=%g/%d\n",*a0,*a1,*a2,c2,npt); */ 1864 1864 1865 free(clas s);1865 free(clas); 1866 1866 return(c2); 1867 1867 } -
trunk/SophyaLib/NTools/nbrandom.c
r244 r682 495 495 496 496 sof = sizeof(struct tirage_alea); 497 if( (t = malloc(sof) ) == NULL ) {497 if( (t = (struct tirage_alea*)malloc(sof) ) == NULL ) { 498 498 printf("impossible d'allouer *tirage_alea par malloc \n"); 499 499 return(NULL); … … 503 503 504 504 sof = nbin * sizeof(double); 505 if( (t->Tab = malloc(sof) ) == NULL ) {505 if( (t->Tab = (double*)malloc(sof) ) == NULL ) { 506 506 printf("impossible d'allouer *tirage_alea.Tab par malloc \n"); 507 507 return(NULL); -
trunk/SophyaLib/NTools/nbrandom.h
r517 r682 8 8 #include <stdlib.h> 9 9 #ifdef __MWERKS__ 10 #include "mwerksmath.h" 11 #include "unixmac.h" 10 #include "unixmac.h" 12 11 #endif 13 12 -
trunk/SophyaLib/Samba/ana2fast.cc
r522 r682 5 5 #include "ana2fast.h" 6 6 #include "lambuilder.h" 7 #ifdef __MWERKS__ 8 #include "unixmac.h" 9 #endif 10 7 11 8 12 /*extern "C" { -
trunk/SophyaLib/Samba/bruit.cc
r680 r682 4 4 5 5 #ifdef __MWERKS__ 6 #include "mwerksmath.h" 7 #include "unixmac.h" 6 #include "unixmac.h" 8 7 #endif 9 8 -
trunk/SophyaLib/Samba/lambuilder.cc
r568 r682 2 2 #include "lambuilder.h" 3 3 #include <iostream.h> 4 #ifdef __MWERKS__ 5 #include "unixmac.h" 6 #endif 7 4 8 //++ 5 9 // Class Lambda2Builder … … 8 12 //-- 9 13 10 double Lambda2Builder::bignorm = 1.e268; // = 1e-20*1.d28814 const double LambdaBuilder::bignorm = 1.e268; // = 1e-20*1.d288 11 15 12 16 Lambda2Builder::Lambda2Builder(){} -
trunk/SophyaLib/Samba/localmap.cc
r604 r682 6 6 #include <string.h> 7 7 #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 //++ 65 template<class T> 66 LocalMap<T>::LocalMap() 67 // 68 // 69 //-- 70 { 71 InitNul(); 72 pixels_.Reset(); 73 } 74 75 //++ 76 template<class T> 77 LocalMap<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 //++ 89 template<class T> 90 LocalMap<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 //++ 122 template<class T> 123 LocalMap<T>::~LocalMap() 124 // 125 //-- 126 { 127 InitNul(); 128 } 129 130 131 132 //++ 133 // Titre Public Methods 134 //-- 135 136 //++ 137 template<class T> 138 void 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 //++ 152 template<class T> 153 int_4 LocalMap<T>::NbPixels() const 154 // 155 // Return number of pixels 156 //-- 157 { 158 return(nPix_); 159 } 160 161 //++ 162 template<class T> 163 T& 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 180 template<class T> 181 T 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 196 template<class T> 197 bool LocalMap<T>::ContainsSph(double theta, double phi) const 198 { 199 // $CHECK$ Reza 11/11/99 - A modifier 200 return(true); 201 } 202 203 //++ 204 template<class T> 205 int_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 //++ 248 template<class T> 249 void 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 274 template <class T> 275 T LocalMap<T>::SetPixels(T v) 276 { 277 pixels_.Reset(v); 278 return(v); 279 } 280 281 //++ 282 template<class T> 283 double 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 //++ 319 template<class T> 320 void 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 //++ 338 template<class T> 339 void 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 //++ 356 template<class T> 357 void 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 //++ 374 template<class T> 375 void 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 //++ 390 template<class T> 391 void 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 //++ 404 template<class T> 405 void 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 //++ 416 template<class T> 417 void 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 //++ 455 template<class T> 456 void 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 //++ 498 template<class T> 499 void 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 //++ 512 template<class T> 513 void 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 525 template<class T> 526 void 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 //++ 557 template <class T> 558 FIO_LocalMap<T>::FIO_LocalMap() 559 // 560 //-- 561 { 562 dobj= new LocalMap<T>; 563 ownobj= true; 564 } 565 //++ 566 template <class T> 567 FIO_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 //++ 578 template <class T> 579 FIO_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 588 template <class T> 589 FIO_LocalMap<T>::FIO_LocalMap(LocalMap<T>* obj) 590 { 591 dobj= obj; 592 ownobj= false; 593 } 594 595 //++ 596 template <class T> 597 FIO_LocalMap<T>::~FIO_LocalMap() 598 // 599 //-- 600 { 601 if (ownobj && dobj) delete dobj; 602 } 603 //++ 604 template <class T> 605 AnyDataObj* FIO_LocalMap<T>::DataObj() 606 // 607 //-- 608 { 609 return(dobj); 610 } 611 612 //++ 613 template <class T> 614 void 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 //++ 674 template <class T> 675 void 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 } 8 733 9 734 #ifdef __CXX_PRAGMA_TEMPLATES__ … … 27 752 template class FIO_LocalMap< complex<double> >; 28 753 #endif 29 30 //*****************************************************************************31 //++32 // Class LocalMap33 //34 // include localmap.h nbmath.h35 //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 of40 // pixel(nx/2, ny/2)41 //42 // A local map is a 2 dimensional array, with i as column index and j43 // as row index. The map is supposed to lie on a plan tangent to the44 // celestial sphere in a point whose coordinates are (x0,y0) on the local45 // map and (theta0, phi0) on the sphere. The range of the map is defined46 // by two values of angles covered respectively by all the pixels in47 // x direction and all the pixels in y direction (SetSize()).48 //49 // A "reference plane" is considered : this plane is tangent to the50 // celestial sphere in a point with angles theta=Pi/2 and phi=0. This51 // point is the origine of coordinates is of the reference plane. The52 // x-axis is the tangent parallel to the equatorial line and oriented53 // toward the increasing phi's ; the y-axis is parallel to the meridian54 // line and oriented toward the north pole.55 //56 // Internally, a map is first defined within this reference plane and57 // tranported until the point (theta0, phi0) in such a way that both58 // 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 to60 // reference axes (this rotation is characterized by angle between61 // the local parallel line and the wanted x-axis-- see method62 // SetOrigin(...))63 //64 //65 66 //67 //--68 //++69 //70 // Links Parents71 //72 // PixelMap73 //74 //--75 //++76 //77 // Links Childs78 //79 //80 //--81 //++82 // Titre Constructors83 //--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 constructor115 //--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 Destructor140 //--141 //++142 template<class T>143 LocalMap<T>::~LocalMap()144 //145 //--146 {147 InitNul();148 }149 150 151 152 //++153 // Titre Public Methods154 //--155 156 //++157 template<class T>158 void LocalMap<T>::ReSize(int nx, int ny)159 //160 // Resize storage area for pixels161 //--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() const174 //175 // Return number of pixels176 //--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 k186 //--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) const202 //203 // const version of previous method204 //--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) const218 {219 // $CHECK$ Reza 11/11/99 - A modifier220 return(true);221 }222 223 //++224 template<class T>225 int LocalMap<T>::PixIndexSph(double theta,double phi) const226 //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 pixels243 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) const270 //271 // Return (theta, phi) coordinates of pixel with index k272 //--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 reference286 double x= X*cos_angle_-Y*sin_angle_;287 double y= X*sin_angle_+Y* cos_angle_;288 // projection sur la sphere289 PixProjToAngle(x, y, theta, phi);290 // retour au plan utilisateur291 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) const304 //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 reference320 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 sphere328 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 solide334 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 totale386 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) const396 //397 // Projection to a spherical map398 //--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 Methods409 //++410 template<class T>411 void LocalMap<T>::InitNul()412 //413 // set some attributes to zero414 //--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) const426 //427 // Return 2 indices corresponding to the pixel number k428 //--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) const438 //439 // Transform a pair of coordinates (theta, phi) given in440 // reference coordinates into map coordinates441 //--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 else455 {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) const477 //478 // Transform a pair of coordinates (theta, phi) given in479 // map coordinates into reference coordinates480 //--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 else499 {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) const520 //521 //522 // Given coordinates in pixel units in the REFERENCE PLANE, return523 // (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) const534 //535 // Given coordinates (theta, phi) in "absolute" referential536 // 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) const547 {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_LocalMap568 // Delegated objects for persitance management569 //--570 571 //*******************************************************************572 // class FIO_LocalMap<T>573 // Les objets delegues pour la gestion de persistance574 //*******************************************************************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 associe647 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 Info653 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) const696 //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 else717 {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 else745 {746 string ss("no local mapping");747 os.PutStr(ss);748 }749 750 // On ecrit le dataBlock751 os << dobj->DataBlock();752 }753 -
trunk/SophyaLib/Samba/localmap.h
r604 r682 65 65 66 66 LocalMap(); 67 LocalMap(int nx, intny);67 LocalMap(int_4 nx, int_4 ny); 68 68 LocalMap(const LocalMap<T>& lm, bool share=false); 69 69 virtual ~LocalMap(); … … 71 71 // ---------- Overloading of () to access pixel number k ---- 72 72 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, intiy) {return PixVal(iy*nSzX_+ix);};76 inline T const& operator()(int ix, intiy) const {return PixVal(iy*nSzX_+ix);};73 inline T& operator()(int_4 k) {return(PixVal(k));} 74 inline T const& operator()(int_4 k) const {return(PixVal(k));} 75 inline T& operator()(int_4 ix, int_4 iy) {return PixVal(iy*nSzX_+ix);}; 76 inline T const& operator()(int_4 ix, int_4 iy) const {return PixVal(iy*nSzX_+ix);}; 77 77 78 78 // ---------- Definition of PixelMap abstract methods ------- … … 80 80 /* return/set the number of pixels */ 81 81 /*! Return number of pixels */ 82 virtual int NbPixels() const;83 inline void setNbPixels(int n) {nPix_= n;}82 virtual int_4 NbPixels() const; 83 inline void setNbPixels(int_4 n) {nPix_= n;} 84 84 85 85 /* return the value of pixel number k */ 86 86 /*! Return value of pixel with index k */ 87 virtual T& PixVal(int k);87 virtual T& PixVal(int_4 k); 88 88 /*! const version of previous method */ 89 virtual T const& PixVal(int k) const;89 virtual T const& PixVal(int_4 k) const; 90 90 91 91 /* Return true if teta,phi in map */ … … 93 93 /* return the index of pixel at (theta,phi) */ 94 94 /*! Return index of the pixel with spherical coordinates (theta,phi) */ 95 virtual int PixIndexSph(double theta,double phi) const;95 virtual int_4 PixIndexSph(double theta,double phi) const; 96 96 97 97 /* return the spherical coordinates of center of pixel number k */ 98 98 /*! Return (theta, phi) coordinates of pixel with index k */ 99 virtual void PixThetaPhi(int k,double& theta,double& phi) const;99 virtual void PixThetaPhi(int_4 k,double& theta,double& phi) const; 100 100 101 101 /*! Set all pixels to value v */ … … 108 108 because of the projection scheme which is not yet fixed. 109 109 */ 110 virtual double PixSolAngle(int k) const;110 virtual double PixSolAngle(int_4 k) const; 111 111 112 112 // ---------- Specific methods ------------------------------ 113 113 114 114 /*! Resize storage area for pixels */ 115 void ReSize(int nx, intny);115 void ReSize(int_4 nx, int_4 ny); 116 116 117 117 inline virtual char* TypeOfMap() const {return "LOCAL";}; … … 124 124 virtual void SetOrigin(double theta=90.,double phi=0.,double angle=0.); 125 125 /*! set the referential of the map (angles in degrees) */ 126 virtual void SetOrigin(double theta,double phi,int x0,inty0,double angle=0.);126 virtual void SetOrigin(double theta,double phi,int_4 x0,int_4 y0,double angle=0.); 127 127 128 128 /* Pixel size (degres) */ … … 140 140 141 141 /* 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_;}142 inline virtual int_4 SizeIndex() const {return(nPix_);} 143 inline int_4 Size_x() const {return nSzX_;} 144 inline int_4 XSize() const {return nSzX_;} 145 inline void setSize_x(int_4 n) {nSzX_= n;} 146 inline int_4 Size_y() const {return nSzY_;} 147 inline int_4 YSize() const {return nSzY_;} 148 inline void setSize_y(int_4 n) {nSzY_= n;} 149 150 inline 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_;} 151 151 152 152 inline void Aperture(double& anglex,double& angley) const {anglex= angleX_; angley= angleY_;} … … 154 154 /* retourne le pointeur vers/remplit le vecteur des contenus des pixels */ 155 155 inline const NDataBlock<T>* getDataBlock() const {return (&pixels_);} 156 inline void setDataBlock(T* data, int n) {pixels_.FillFrom(n,data);}156 inline void setDataBlock(T* data, int_4 n) {pixels_.FillFrom(n,data);} 157 157 158 158 /* Acces to the DataBlock */ … … 169 169 void InitNul(); 170 170 /*! Return 2 indices corresponding to the pixel number k */ 171 void Getij(int k,int& i,int& j) const;171 void Getij(int_4 k,int_4& i,int_4& j) const; 172 172 /*! Transform a pair of coordinates (theta, phi) given in 173 173 reference coordinates into map coordinates … … 189 189 // ---------- Variables internes ---------------------------- 190 190 191 int nSzX_;192 int nSzY_;193 int nPix_;191 int_4 nSzX_; 192 int_4 nSzY_; 193 int_4 nPix_; 194 194 bool originFlag_; 195 195 bool extensFlag_; 196 int x0_;197 int y0_;196 int_4 x0_; 197 int_4 y0_; 198 198 double theta0_; 199 199 double phi0_; -
trunk/SophyaLib/Samba/pixelmap.h
r592 r682 36 36 37 37 /*! Number of pixels */ 38 virtual int NbPixels() const=0;38 virtual int_4 NbPixels() const=0; 39 39 40 40 /*! Value of pixel number k */ 41 virtual T& PixVal(int k)=0;42 virtual T const& PixVal(int k) const=0;41 virtual T& PixVal(int_4 k)=0; 42 virtual T const& PixVal(int_4 k) const=0; 43 43 44 44 // Map s coverage … … 47 47 48 48 /*! Index of pixel at (theta,phi) */ 49 virtual int PixIndexSph(double theta, double phi) const=0;49 virtual int_4 PixIndexSph(double theta, double phi) const=0; 50 50 // Index of pixel at a sky-position 51 virtual int PixIndex(const SpherePosition& spos);51 virtual int_4 PixIndex(const SpherePosition& spos); 52 52 53 53 /*! Value of pixel number at (theta,phi) */ … … 58 58 59 59 /*! Spherical coordinates of center of pixel number k */ 60 virtual void PixThetaPhi(int k, double& theta, double& phi) const=0;60 virtual void PixThetaPhi(int_4 k, double& theta, double& phi) const=0; 61 61 62 62 /*! provides a integer characterizing the pixelization refinement 63 63 (depending of the type of the map) 64 64 */ 65 virtual int SizeIndex() const=0;65 virtual int_4 SizeIndex() const=0; 66 66 virtual char* TypeOfMap() const =0; 67 67 68 68 /*! Pixel (steradians) */ 69 virtual double PixSolAngle(int k) const =0;69 virtual double PixSolAngle(int_4 k) const =0; 70 70 71 71 /*! 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));}72 inline T& operator()(int_4 k) {return(PixVal(k));} 73 inline T const& operator()(int_4 k) const {return(PixVal(k));} 74 74 75 75 // Overloading of () to access pixel at a sky position . … … 110 110 111 111 template <class T> 112 int PixelMap<T>::PixIndex(const SpherePosition& spos)112 int_4 PixelMap<T>::PixIndex(const SpherePosition& spos) 113 113 { 114 114 UnitVector v = spos.Transform(*cs_); -
trunk/SophyaLib/Samba/scan.cc
r567 r682 352 352 { 353 353 354 int NmaxPts, NmaxTrs, NPts1Tr;354 int_4 NmaxPts, NmaxTrs, NPts1Tr; 355 355 r_4 Ouverture, OmegaTeta, OmegaPhi, OmegaRad, FrequenceEch; 356 356 r_4 TempsFinal, TempsInitial, PhiZero; -
trunk/SophyaLib/Samba/spheregorski.cc
r604 r682 186 186 //++ 187 187 template<class T> 188 SphereGorski<T>::SphereGorski(int m)188 SphereGorski<T>::SphereGorski(int_4 m) 189 189 190 190 // m is the "nside" of the Gorski algorithm … … 246 246 //++ 247 247 template<class T> 248 void SphereGorski<T>::Resize(int m)248 void SphereGorski<T>::Resize(int_4 m) 249 249 250 250 // m is the "nside" of the Gorski algorithm … … 272 272 273 273 template<class T> 274 void SphereGorski<T>::Pixelize( int m)274 void SphereGorski<T>::Pixelize( int_4 m) 275 275 276 276 // prépare la pixelisation Gorski (m a la même signification … … 313 313 //++ 314 314 template<class T> 315 int SphereGorski<T>::NbPixels() const315 int_4 SphereGorski<T>::NbPixels() const 316 316 317 317 // Retourne le nombre de pixels du découpage … … 323 323 //++ 324 324 template<class T> 325 int SphereGorski<T>::NbThetaSlices() const325 int_4 SphereGorski<T>::NbThetaSlices() const 326 326 327 327 // Return number of slices in theta direction on the sphere … … 333 333 //++ 334 334 template<class T> 335 void SphereGorski<T>::GetThetaSlice(int index,double& theta,TVector<double>& phi,TVector<T>& value) const335 void SphereGorski<T>::GetThetaSlice(int_4 index,double& theta,TVector<double>& phi,TVector<T>& value) const 336 336 337 337 // For a theta-slice with index 'index', return : … … 354 354 } 355 355 356 int iring= 0;357 int lring = 0;356 int_4 iring= 0; 357 int_4 lring = 0; 358 358 if(index < nSide_-1) 359 359 { … … 368 368 else 369 369 { 370 int nc= 4*nSide_-1-index;370 int_4 nc= 4*nSide_-1-index; 371 371 iring = nPix_-2*nc*(nc+1); 372 372 lring = 4*nc; … … 377 377 double TH= 0.; 378 378 double FI= 0.; 379 for(int kk = 0; kk < lring;kk++)379 for(int_4 kk = 0; kk < lring;kk++) 380 380 { 381 381 PixThetaPhi(kk+iring,TH,FI); … … 389 389 //++ 390 390 template<class T> 391 T& SphereGorski<T>::PixVal(int k)391 T& SphereGorski<T>::PixVal(int_4 k) 392 392 393 393 // Return value of pixel with "RING" index k … … 406 406 //++ 407 407 template<class T> 408 T const& SphereGorski<T>::PixVal(int k) const408 T const& SphereGorski<T>::PixVal(int_4 k) const 409 409 410 410 // Return value of pixel with "RING" index k … … 422 422 //++ 423 423 template<class T> 424 T& SphereGorski<T>::PixValNest(int k)424 T& SphereGorski<T>::PixValNest(int_4 k) 425 425 426 426 // Return value of pixel with "NESTED" index k … … 438 438 439 439 template<class T> 440 T const& SphereGorski<T>::PixValNest(int k) const440 T const& SphereGorski<T>::PixValNest(int_4 k) const 441 441 442 442 // Return value of pixel with "NESTED" index k … … 449 449 THROW(rangeCheckErr); 450 450 } 451 int pix= nest2ring(nSide_,k);451 int_4 pix= nest2ring(nSide_,k); 452 452 return *(pixels_.Data()+pix); 453 453 } … … 456 456 //++ 457 457 template<class T> 458 bool SphereGorski<T>::ContainsSph(double theta, double phi) const458 bool SphereGorski<T>::ContainsSph(double /*theta*/, double /*phi*/) const 459 459 //-- 460 460 { … … 465 465 //++ 466 466 template<class T> 467 int SphereGorski<T>::PixIndexSph(double theta,double phi) const467 int_4 SphereGorski<T>::PixIndexSph(double theta,double phi) const 468 468 469 469 // Return "RING" index of the pixel corresponding to … … 476 476 //++ 477 477 template<class T> 478 int SphereGorski<T>::PixIndexSphNest(double theta,double phi) const478 int_4 SphereGorski<T>::PixIndexSphNest(double theta,double phi) const 479 479 480 480 // Return "NESTED" index of the pixel corresponding to … … 489 489 //++ 490 490 template<class T> 491 void SphereGorski<T>::PixThetaPhi(int k,double& theta,double& phi) const491 void SphereGorski<T>::PixThetaPhi(int_4 k,double& theta,double& phi) const 492 492 493 493 // Return (theta,phi) coordinates of middle of pixel with "RING" index k … … 506 506 //++ 507 507 template<class T> 508 double SphereGorski<T>::PixSolAngle(int dummy) const508 double SphereGorski<T>::PixSolAngle(int_4 /*dummy*/) const 509 509 // Pixel Solid angle (steradians) 510 510 // All the pixels have the same solid angle. The dummy argument is … … 518 518 //++ 519 519 template<class T> 520 void SphereGorski<T>::PixThetaPhiNest(int k,double& theta,double& phi) const520 void SphereGorski<T>::PixThetaPhiNest(int_4 k,double& theta,double& phi) const 521 521 522 522 // Return (theta,phi) coordinates of middle of pixel with "NESTED" index k … … 528 528 //++ 529 529 template<class T> 530 int SphereGorski<T>::NestToRing(intk) const530 int_4 SphereGorski<T>::NestToRing(int_4 k) const 531 531 532 532 // translation from NESTED index into RING index … … 539 539 //++ 540 540 template<class T> 541 int SphereGorski<T>::RingToNest(intk) const541 int_4 SphereGorski<T>::RingToNest(int_4 k) const 542 542 // 543 543 // translation from RING index into NESTED index … … 550 550 551 551 template<class T> 552 int SphereGorski<T>::nest2ring(int nside, intipnest) const552 int_4 SphereGorski<T>::nest2ring(int_4 nside, int_4 ipnest) const 553 553 { 554 554 /* … … 632 632 633 633 template<class T> 634 int SphereGorski<T>::ring2nest(int nside, intipring) const634 int_4 SphereGorski<T>::ring2nest(int_4 nside, int_4 ipring) const 635 635 { 636 636 /* … … 741 741 742 742 template<class T> 743 int SphereGorski<T>::ang2pix_ring(intnside, double theta, double phi) const743 int_4 SphereGorski<T>::ang2pix_ring(int_4 nside, double theta, double phi) const 744 744 { 745 745 /* … … 817 817 818 818 template<class T> 819 int SphereGorski<T>::ang2pix_nest(intnside, double theta, double phi) const819 int_4 SphereGorski<T>::ang2pix_nest(int_4 nside, double theta, double phi) const 820 820 { 821 821 /* … … 914 914 915 915 template<class T> 916 void SphereGorski<T>::pix2ang_ring(int nside,intipix,double& theta,double& phi) const {916 void SphereGorski<T>::pix2ang_ring(int_4 nside,int_4 ipix,double& theta,double& phi) const { 917 917 /* 918 918 =================================================== … … 982 982 983 983 template<class T> 984 void SphereGorski<T>::pix2ang_nest(int nside,intipix,double& theta,double& phi) const {984 void SphereGorski<T>::pix2ang_nest(int_4 nside,int_4 ipix,double& theta,double& phi) const { 985 985 /* 986 986 ================================================== … … 1174 1174 } 1175 1175 1176 int nSide;1176 int_4 nSide; 1177 1177 is.GetI4(nSide); 1178 1178 dobj->setSizeIndex(nSide); 1179 1179 1180 int nPix;1180 int_4 nPix; 1181 1181 is.GetI4(nPix); 1182 1182 dobj->setNbPixels(nPix); … … 1204 1204 1205 1205 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(); 1208 1208 1209 1209 if(dobj->ptrInfo()) -
trunk/SophyaLib/Samba/spheregorski.h
r604 r682 64 64 nside MUST be a power of 2 (<= 8192) 65 65 */ 66 SphereGorski(int m);66 SphereGorski(int_4 m); 67 67 SphereGorski(const SphereGorski<T>& s, bool share=false); 68 68 //! Destructor … … 73 73 /* Nombre de pixels du decoupage */ 74 74 /*! Return number of pixels of the splitting */ 75 virtual int NbPixels() const;76 inline void setNbPixels(int n) {nPix_= n;}75 virtual int_4 NbPixels() const; 76 inline void setNbPixels(int_4 n) {nPix_= n;} 77 77 78 78 /* Valeur du contenu du pixel d'indice "RING" k */ 79 79 /*! Return value of pixel with "RING" index k */ 80 virtual T& PixVal(int k);81 virtual T const& PixVal(int k) const;80 virtual T& PixVal(int_4 k); 81 virtual T const& PixVal(int_4 k) const; 82 82 83 83 /* Nombre de tranches en theta */ 84 84 /*! Return number of slices in theta direction on the sphere */ 85 int NbThetaSlices() const;85 int_4 NbThetaSlices() const; 86 86 /*! For a theta-slice with index 'index', return : 87 87 … … 92 92 a vector containing the corresponding values of pixels 93 93 */ 94 void GetThetaSlice(int index,double& theta,TVector<double>& phi,TVector<T>& value) const;94 void GetThetaSlice(int_4 index,double& theta,TVector<double>& phi,TVector<T>& value) const; 95 95 96 96 /* Return true if teta,phi in map */ … … 100 100 /*! Return "RING" index of the pixel corresponding to direction (theta, phi). 101 101 */ 102 virtual int PixIndexSph(double theta,double phi) const;102 virtual int_4 PixIndexSph(double theta,double phi) const; 103 103 104 104 /* Coordonnees spheriques du milieu du pixel d'indice "RING" k */ 105 virtual void PixThetaPhi(int k,double& theta,double& phi) const;105 virtual void PixThetaPhi(int_4 k,double& theta,double& phi) const; 106 106 107 107 /*! Set all pixels to value v */ … … 115 115 fulfil this requirement. 116 116 */ 117 virtual double PixSolAngle(int dummy) const;117 virtual double PixSolAngle(int_4 dummy) const; 118 118 inline void setPixSolAngle(double x) {omeg_= x;} 119 119 … … 127 127 nside MUST be a power of 2 (<= 8192) 128 128 */ 129 virtual void Resize(int m);129 virtual void Resize(int_4 m); 130 130 131 131 inline virtual char* TypeOfMap() const {return "RING";}; … … 133 133 /* Valeur du contenu du pixel d'indice "NEST" k */ 134 134 /*! Return value of pixel with "NESTED" index k */ 135 virtual T& PixValNest(int k);135 virtual T& PixValNest(int_4 k); 136 136 /*! Return value of pixel with "NESTED" index k */ 137 virtual T const& PixValNest(int k) const;137 virtual T const& PixValNest(int_4 k) const; 138 138 139 139 /* Indice "NEST" du pixel vers lequel pointe une direction definie par … … 141 141 /*! Return "NESTED" index of the pixel corresponding to direction (theta, phi). 142 142 */ 143 virtual int PixIndexSphNest(double theta,double phi) const;143 virtual int_4 PixIndexSphNest(double theta,double phi) const; 144 144 145 145 /* Coordonnees spheriques du milieu du pixel d'indice "NEST" k */ 146 146 /*! Return (theta,phi) coordinates of middle of pixel with "NESTED" index k 147 147 */ 148 virtual void PixThetaPhiNest(int k,double& theta,double& phi) const;148 virtual void PixThetaPhiNest(int_4 k,double& theta,double& phi) const; 149 149 150 150 /* algorithme de pixelisation */ 151 void Pixelize(int );151 void Pixelize(int_4); 152 152 153 153 /* convertit index nested en ring */ 154 154 /*! translation from NESTED index into RING index */ 155 int NestToRing(int) const;155 int_4 NestToRing(int_4) const; 156 156 157 157 /* convertit index ring en nested" */ 158 158 /*! translation from RING index into NESTED index */ 159 int RingToNest(int) const;159 int_4 RingToNest(int_4) const; 160 160 161 161 162 162 /* retourne/fixe la valeur du parametre Gorski */ 163 inline virtual int SizeIndex() const {return(nSide_);}164 inline void setSizeIndex(int n) {nSide_= n;}163 inline virtual int_4 SizeIndex() const {return(nSide_);} 164 inline void setSizeIndex(int_4 n) {nSide_= n;} 165 165 166 166 /* retourne les pointeurs /remplit les tableaux */ 167 167 inline const NDataBlock<T>* getDataBlock() const { return (&pixels_); } 168 inline void setDataBlock(T* data,int m) { pixels_.FillFrom(m,data); }168 inline void setDataBlock(T* data,int_4 m) { pixels_.FillFrom(m,data); } 169 169 170 170 /* Acces to the DataBlock */ … … 182 182 void InitNul(); 183 183 184 int nest2ring(int nside,intipnest) const;185 int ring2nest(int nside,intipring) const;186 187 int ang2pix_ring(intnside,double theta,double phi) const;188 int ang2pix_nest(intnside,double theta,double phi) const;189 void pix2ang_ring(int nside,intipix,double& theta,double& phi) const;190 void pix2ang_nest(int nside,intipix,double& theta,double& phi) const;184 int_4 nest2ring(int_4 nside,int_4 ipnest) const; 185 int_4 ring2nest(int_4 nside,int_4 ipring) const; 186 187 int_4 ang2pix_ring(int_4 nside,double theta,double phi) const; 188 int_4 ang2pix_nest(int_4 nside,double theta,double phi) const; 189 void pix2ang_ring(int_4 nside,int_4 ipix,double& theta,double& phi) const; 190 void pix2ang_nest(int_4 nside,int_4 ipix,double& theta,double& phi) const; 191 191 192 192 // ------------- variables internes ----------------------- 193 int nSide_;194 int nPix_;193 int_4 nSide_; 194 int_4 nPix_; 195 195 double omeg_; 196 196 … … 234 234 static PIXELS_XY& instance(); 235 235 236 NDataBlock<int > pix2x_;237 NDataBlock<int > pix2y_;238 NDataBlock<int > x2pix_;239 NDataBlock<int > y2pix_;236 NDataBlock<int_4> pix2x_; 237 NDataBlock<int_4> pix2y_; 238 NDataBlock<int_4> x2pix_; 239 NDataBlock<int_4> y2pix_; 240 240 241 241 private : -
trunk/SophyaLib/Samba/spherepos.cc
r525 r682 1 1 #include "spherepos.h" 2 2 3 static char *head_spherepos_cc_ = "$Header: /Users/garnier/temp/CVSSophya/SophyaLib/Samba/spherepos.cc,v 1. 2 1999-10-27 10:45:47ansari Exp $";3 static char *head_spherepos_cc_ = "$Header: /Users/garnier/temp/CVSSophya/SophyaLib/Samba/spherepos.cc,v 1.3 1999-12-10 16:55:59 ansari Exp $"; 4 4 5 5 … … 69 69 } 70 70 71 UnitVector SpherePosition::Transform(const SphereCoordSys& cs) const71 UnitVector SpherePosition::Transform(const SphereCoordSys& /*cs*/) const 72 72 { 73 73 return(*this); -
trunk/SophyaLib/Samba/spherethetaphi.cc
r604 r682 50 50 //++ 51 51 template <class T> 52 SphereThetaPhi<T>::SphereThetaPhi(int m)52 SphereThetaPhi<T>::SphereThetaPhi(int_4 m) 53 53 54 54 // m is the number of slices in theta on an hemisphere (the polar cap … … 68 68 NTheta_= s.NTheta_; 69 69 NPix_ = s.NPix_; 70 NPhi_ = new int [NTheta_];70 NPhi_ = new int_4[NTheta_]; 71 71 Theta_ = new double[NTheta_+1]; 72 TNphi_ = new int [NTheta_+1];72 TNphi_ = new int_4[NTheta_+1]; 73 73 for(int k = 0; k < NTheta_; k++) 74 74 { … … 123 123 //++ 124 124 template <class T> 125 void SphereThetaPhi<T>::Resize(int m)125 void SphereThetaPhi<T>::Resize(int_4 m) 126 126 // re-pixelize the sphere 127 127 //-- … … 134 134 //++ 135 135 template <class T> 136 int SphereThetaPhi<T>::NbPixels() const136 int_4 SphereThetaPhi<T>::NbPixels() const 137 137 138 138 // Return total number of pixels … … 145 145 //++ 146 146 template <class T> 147 T& SphereThetaPhi<T>::PixVal(int k)147 T& SphereThetaPhi<T>::PixVal(int_4 k) 148 148 149 149 // Return value of pixel with index k … … 161 161 //++ 162 162 template <class T> 163 T const& SphereThetaPhi<T>::PixVal(int k) const163 T const& SphereThetaPhi<T>::PixVal(int_4 k) const 164 164 165 165 // Return value of pixel with index k … … 178 178 //++ 179 179 template <class T> 180 bool SphereThetaPhi<T>::ContainsSph(double theta, double phi) const180 bool SphereThetaPhi<T>::ContainsSph(double /*theta*/, double /*phi*/) const 181 181 //-- 182 182 { … … 187 187 //++ 188 188 template <class T> 189 int SphereThetaPhi<T>::PixIndexSph(double theta, double phi) const189 int_4 SphereThetaPhi<T>::PixIndexSph(double theta, double phi) const 190 190 191 191 // Return index of the pixel corresponding to … … 208 208 dphi= DeuxPi/(double)NPhi_[i-1]; 209 209 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); 212 212 return(k); 213 213 } … … 216 216 //++ 217 217 template <class T> 218 void SphereThetaPhi<T>::PixThetaPhi(int k,double& theta,double& phi) const218 void SphereThetaPhi<T>::PixThetaPhi(int_4 k,double& theta,double& phi) const 219 219 220 220 // Return (theta,phi) coordinates of middle of pixel with index k … … 250 250 //++ 251 251 template <class T> 252 double SphereThetaPhi<T>::PixSolAngle(int dummy) const252 double SphereThetaPhi<T>::PixSolAngle(int_4 /*dummy*/) const 253 253 254 254 // Pixel Solid angle (steradians) … … 264 264 //++ 265 265 template <class T> 266 void SphereThetaPhi<T>::Limits(int k,double& tetMin,double& tetMax,double& phiMin,double& phiMax)266 void SphereThetaPhi<T>::Limits(int_4 k,double& tetMin,double& tetMax,double& phiMin,double& phiMax) 267 267 268 268 // Return values of theta,phi which limit the pixel with index k … … 317 317 //++ 318 318 template <class T> 319 int SphereThetaPhi<T>::NbThetaSlices() const319 int_4 SphereThetaPhi<T>::NbThetaSlices() const 320 320 321 321 // Return number of theta-slices on the sphere … … 330 330 //++ 331 331 template <class T> 332 int SphereThetaPhi<T>::NPhi(intkt) const332 int_4 SphereThetaPhi<T>::NPhi(int_4 kt) const 333 333 334 334 // Return number of pixels in phi-direction of the kt-th slice … … 353 353 //++ 354 354 template <class T> 355 void SphereThetaPhi<T>::Theta(int kt,double& tetMin,double& tetMax)355 void SphereThetaPhi<T>::Theta(int_4 kt,double& tetMin,double& tetMax) 356 356 357 357 // Return theta values which limit the slice kt … … 385 385 //++ 386 386 template <class T> 387 void SphereThetaPhi<T>::Phi(int kt,intjp,double& phiMin,double& phiMax)387 void SphereThetaPhi<T>::Phi(int_4 kt,int_4 jp,double& phiMin,double& phiMax) 388 388 389 389 // Return values of phi which limit the jp-th pixel of the kt-th slice … … 416 416 //++ 417 417 template <class T> 418 int SphereThetaPhi<T>::Index(int kt,intjp) const418 int_4 SphereThetaPhi<T>::Index(int_4 kt,int_4 jp) const 419 419 420 420 // Return pixel index with sequence index jp in the slice kt … … 449 449 //++ 450 450 template <class T> 451 void SphereThetaPhi<T>::ThetaPhiIndex(int k,int& kt,int& jp)451 void SphereThetaPhi<T>::ThetaPhiIndex(int_4 k,int_4& kt,int_4& jp) 452 452 453 453 // Return indices kt (theta) and jp (phi) of pixel with index k … … 477 477 //++ 478 478 template <class T> 479 void SphereThetaPhi<T>::Pixelize(int m)479 void SphereThetaPhi<T>::Pixelize(int_4 m) 480 480 481 481 // achieve the splitting into pixels (m has the same signification … … 507 507 508 508 // Le nombre de pixels en phi de chacune des bandes en theta 509 NPhi_ = new int [m];509 NPhi_ = new int_4[m]; 510 510 511 511 // Le nombre/Deuxpi total des pixels contenus dans les bandes de z superieur a une 512 512 // 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]; 514 514 515 515 // Calcul du nombre total de pixels dans chaque bande pour optimiser … … 524 524 { 525 525 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.))) ; 527 527 } 528 528 … … 556 556 //++ 557 557 template <class T> 558 void SphereThetaPhi<T>::GetThetaSlice(int index,double& theta, TVector<double>& phi, TVector<T>& value) const558 void SphereThetaPhi<T>::GetThetaSlice(int_4 index,double& theta, TVector<double>& phi, TVector<T>& value) const 559 559 560 560 // For a theta-slice with index 'index', return : … … 593 593 594 594 template <class T> 595 void SphereThetaPhi<T>::setmNPhi(int * array, intm)595 void SphereThetaPhi<T>::setmNPhi(int_4* array, int_4 m) 596 596 //remplit le tableau contenant le nombre de pixels en phi de chacune des bandes en theta 597 597 // 598 598 { 599 NPhi_= new int [m];599 NPhi_= new int_4[m]; 600 600 for(int k = 0; k < m; k++) NPhi_[k]= array[k]; 601 601 } 602 602 603 603 template <class T> 604 void SphereThetaPhi<T>::setmTNphi(int * array, intm)604 void SphereThetaPhi<T>::setmTNphi(int_4* array, int_4 m) 605 605 //remplit le tableau contenant le nombre/Deuxpi total des pixels contenus dans les bandes 606 606 // 607 607 { 608 TNphi_= new int [m];608 TNphi_= new int_4[m]; 609 609 for(int k = 0; k < m; k++) TNphi_[k]= array[k]; 610 610 } 611 611 612 612 template <class T> 613 void SphereThetaPhi<T>::setmTheta(double* array, int m)613 void SphereThetaPhi<T>::setmTheta(double* array, int_4 m) 614 614 //remplit le tableau contenant les valeurs limites de theta 615 615 // … … 620 620 621 621 template <class T> 622 void SphereThetaPhi<T>::setDataBlock(T* data, int m)622 void SphereThetaPhi<T>::setDataBlock(T* data, int_4 m) 623 623 // remplit le vecteur des contenus des pixels 624 624 { … … 743 743 } 744 744 745 int mNTheta;745 int_4 mNTheta; 746 746 is.GetI4(mNTheta); 747 747 dobj->setSizeIndex(mNTheta); 748 748 749 int mNPix;749 int_4 mNPix; 750 750 is.GetI4(mNPix); 751 751 dobj->setNbPixels(mNPix); … … 755 755 dobj->setPixSolAngle(mOmeg); 756 756 757 int * mNphi= new int[mNTheta];757 int_4* mNphi= new int_4[mNTheta]; 758 758 is.GetI4s(mNphi, mNTheta); 759 759 dobj->setmNPhi(mNphi, mNTheta); 760 760 delete [] mNphi; 761 761 762 int * mTNphi= new int[mNTheta+1];762 int_4* mTNphi= new int_4[mNTheta+1]; 763 763 is.GetI4s(mTNphi, mNTheta+1); 764 764 dobj->setmTNphi(mTNphi, mNTheta+1); … … 788 788 789 789 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(); 792 792 793 793 if(dobj->ptrInfo()) -
trunk/SophyaLib/Samba/spherethetaphi.h
r604 r682 31 31 pet is a dummy parameter at the moment. 32 32 */ 33 SphereThetaPhi(int m);33 SphereThetaPhi(int_4 m); 34 34 SphereThetaPhi(const SphereThetaPhi<T>& s, bool share=false); 35 35 virtual ~SphereThetaPhi(); … … 39 39 /* retourne/fixe le nombre de pixels */ 40 40 /*! Return total number of pixels */ 41 virtual int NbPixels() const;42 inline void setNbPixels(int nbpix) { NPix_= nbpix; }41 virtual int_4 NbPixels() const; 42 inline void setNbPixels(int_4 nbpix) { NPix_= nbpix; } 43 43 44 44 /* retourne la valeur du pixel d'indice k */ 45 45 /*! Return value of pixel with index k */ 46 virtual T& PixVal(int k);47 virtual T const& PixVal(int k) const;46 virtual T& PixVal(int_4 k); 47 virtual T const& PixVal(int_4 k) const; 48 48 49 49 /* Return true if teta,phi in map */ … … 51 51 /* retourne l'indice du pixel a (theta,phi) */ 52 52 /* Return index of the pixel corresponding to direction (theta, phi). */ 53 virtual int PixIndexSph(double theta, double phi) const;53 virtual int_4 PixIndexSph(double theta, double phi) const; 54 54 55 55 /* retourne les coordonnees Spheriques du centre du pixel d'indice k */ 56 56 /*! Return (theta,phi) coordinates of middle of pixel with index k */ 57 virtual void PixThetaPhi(int k, double& theta, double& phi) const;57 virtual void PixThetaPhi(int_4 k, double& theta, double& phi) const; 58 58 59 59 /*! Setting pixel values to a constant */ … … 67 67 fulfil this requirement. 68 68 */ 69 virtual double PixSolAngle(int dummy) const;69 virtual double PixSolAngle(int_4 dummy) const; 70 70 inline void setPixSolAngle(double omega) { Omega_= omega; } 71 71 72 72 /* 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; }73 inline virtual int_4 SizeIndex() const { return( NTheta_); } 74 inline void setSizeIndex(int_4 nbindex) { NTheta_= nbindex; } 75 75 76 76 // ------------- Specific methods ---------------------- 77 77 78 78 /*! re-pixelize the sphere */ 79 virtual void Resize(int m);79 virtual void Resize(int_4 m); 80 80 81 81 inline virtual char* TypeOfMap() const {return "TETAFI";}; … … 83 83 /* Valeurs de theta des paralleles et phi des meridiens limitant le pixel d'indice k */ 84 84 /* 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);85 virtual void Limits(int_4 k,double& th1,double& th2,double& phi1,double& phi2); 86 86 87 87 /* Nombre de tranches en theta */ 88 88 /*! Return number of theta-slices on the sphere */ 89 int NbThetaSlices() const;89 int_4 NbThetaSlices() const; 90 90 91 91 /* Nombre de pixels en phi de la tranche d'indice kt */ 92 int NPhi(intkt) const;92 int_4 NPhi(int_4 kt) const; 93 93 94 94 /* Renvoie dans t1,t2 les valeurs respectives de theta min et theta max */ 95 95 /* de la tranche d'indice kt */ 96 96 /*! Return theta values which limit the slice kt */ 97 void Theta(int kt, double& t1, double& t2);97 void Theta(int_4 kt, double& t1, double& t2); 98 98 99 99 /* Renvoie dans p1,p2 les valeurs phimin et phimax du pixel d'indice jp */ 100 100 /* dans la tranche d'indice kt */ 101 101 /*! Return values of phi which limit the jp-th pixel of the kt-th slice */ 102 void Phi(int kt, intjp, double& p1, double& p2);102 void Phi(int_4 kt, int_4 jp, double& p1, double& p2); 103 103 104 104 /* Renvoie l'indice k du pixel d'indice jp dans la tranche d'indice kt */ 105 105 /*! Return pixel index with sequence index jp in the slice kt */ 106 int Index(int kt, intjp) const;106 int_4 Index(int_4 kt, int_4 jp) const; 107 107 108 108 /* Indice kt de la tranche et indice jp du pixel d'indice k */ 109 109 /*! Return indices kt (theta) and jp (phi) of pixel with index k */ 110 void ThetaPhiIndex(int k,int& kt,int& jp);110 void ThetaPhiIndex(int_4 k,int_4& kt,int_4& jp); 111 111 112 112 /*! achieve the splitting into pixels (m has the same signification … … 121 121 phi of the slice closest of the equator with z<0). 122 122 */ 123 void Pixelize(int );123 void Pixelize(int_4); 124 124 125 125 /*! For a theta-slice with index 'index', return : … … 131 131 a vector containing the corresponding values of pixels 132 132 */ 133 void GetThetaSlice(int index,double& theta,TVector<double>& phi,TVector<T>& value) const;133 void GetThetaSlice(int_4 index,double& theta,TVector<double>& phi,TVector<T>& value) const; 134 134 135 135 /*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, intm);136 inline const int_4* getmNPhi() const { return(NPhi_); } 137 void setmNPhi(int_4* array, int_4 m); 138 138 139 139 /* 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, intm);140 inline const int_4* getmTNphi() const { return(TNphi_); } 141 void setmTNphi(int_4* array, int_4 m); 142 142 143 143 /* retourne/remplit le tableau contenant les valeurs limites de theta */ 144 144 inline const double* getmTheta() const { return(Theta_); } 145 void setmTheta(double* array, int m);145 void setmTheta(double* array, int_4 m); 146 146 147 147 /* retourne le pointeur vers/remplit le vecteur des contenus des pixels */ 148 148 inline const NDataBlock<T>* getDataBlock() const { return (&pixels_); } 149 void setDataBlock(T* data, int m);149 void setDataBlock(T* data, int_4 m); 150 150 151 151 /* Acces to the DataBlock */ … … 163 163 164 164 // ------------- variables internes --------------------- 165 int NTheta_;166 int NPix_;165 int_4 NTheta_; 166 int_4 NPix_; 167 167 double Omega_; 168 int * NPhi_;169 int * TNphi_;168 int_4* NPhi_; 169 int_4* TNphi_; 170 170 double* Theta_; 171 171 NDataBlock<T> pixels_; -
trunk/SophyaLib/Samba/sphericalmap.h
r473 r682 34 34 // index characterizing the size pixelization : m for SphereThetaPhi 35 35 // 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;36 virtual void Resize(int_4 m)=0; 37 virtual int_4 NbThetaSlices() const=0; 38 virtual void GetThetaSlice(int_4 index,double& theta, TVector<double>& phi, TVector<T>& value) const=0; 39 39 }; 40 40 #endif -
trunk/SophyaLib/Samba/syn2fast.cc
r483 r682 3 3 #include "lambuilder.h" 4 4 #include "fftserver.h" 5 #ifdef __MWERKS__ 6 #include "unixmac.h" 7 #endif 5 8 6 9 extern "C" { -
trunk/SophyaLib/Samba/unitvector.h
r518 r682 17 17 UnitVector(const Vector3d&); 18 18 19 virtual Vector3d& operator=(const Vector3d&);19 /*virtual*/ Vector3d& operator=(const Vector3d&); //$CHECK$ EA 101299 operator = non virtual 20 20 virtual Vector3d& operator+=(const Vector3d&); 21 21 virtual Vector3d& operator-=(const Vector3d&); -
trunk/SophyaLib/Samba/utilgeom.h
r517 r682 3 3 #include <math.h> 4 4 #ifdef __MWERKS__ 5 #include "mwerksmath.h" 6 // #include "unixmac.h" 5 #include "unixmac.h" 7 6 #endif 8 7 #include <vector> -
trunk/SophyaLib/Samba/vector3d.h
r565 r682 7 7 #include <string.h> 8 8 #ifdef __MWERKS__ 9 #include "mwerksmath.h" 10 // #include "unixmac.h" 9 #include "unixmac.h" 11 10 #endif 12 11 #include "longlat.h" … … 91 90 Vector3d Rotate(const Vector3d& omega,double phi); 92 91 93 virtual Vector3d& operator=(const Vector3d&);92 /*virtual*/ Vector3d& operator=(const Vector3d&); // $CHECK$ EA 101299 94 93 virtual Vector3d& operator+=(const Vector3d&); 95 94 virtual Vector3d& operator-=(const Vector3d&);
Note:
See TracChangeset
for help on using the changeset viewer.