Changeset 2419 in Sophya for trunk/SophyaPI/PIext
- Timestamp:
- Jul 21, 2003, 11:13:10 PM (22 years ago)
- Location:
- trunk/SophyaPI/PIext
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PIext/basexecut.cc
r2380 r2419 581 581 return(0); 582 582 } 583 int kks = 0;584 int kke = v->NElts();585 int kkp = 1;583 int_8 kks = 0; 584 int_8 kke = v->NElts(); 585 int_8 kkp = 1; 586 586 if (tokens.size() > 2) Services2NObjMgr::DecodeLoopParameters(tokens[2], kks, kke, kkp); 587 587 if (kks < 0) kks = 0; 588 if (kke > v->NElts()) kke = v->NElts();588 if (kke > (int_8)v->NElts()) kke = v->NElts(); 589 589 if (kkp < 1) kkp = 1; 590 590 int nelt = (kke-kks-1)/kkp; … … 646 646 return(0); 647 647 } 648 int kks = 0;649 int kke = nti->NbLines();650 int kkp = 1;648 int_8 kks = 0; 649 int_8 kke = nti->NbLines(); 650 int_8 kkp = 1; 651 651 if (tokens.size() > 3) Services2NObjMgr::DecodeLoopParameters(tokens[3], kks, kke, kkp); 652 652 if (kks < 0) kks = 0; 653 if (kke > nti->NbLines()) kke = nti->NbLines();653 if (kke > (int_8)nti->NbLines()) kke = nti->NbLines(); 654 654 if (kkp < 1) kkp = 1; 655 655 int nelt = (kke-kks-1)/kkp; … … 1070 1070 void PIABaseExecutor::RegisterCommands() 1071 1071 { 1072 string kw, usage ;1072 string kw, usage, grp; 1073 1073 kw = "loadmodule"; 1074 1074 usage = "To load and initialize modules \n Usage: loadmodule fnameso modulename"; … … 1614 1614 usage = "Any mathematical expression (math.h) with object variables can be used"; 1615 1615 usage += "\n ------ Object Variable names (double) -------- "; 1616 usage += "\n- NTuple: ntuple variable names"; 1617 usage += "\n- Histo1D/HProf: i,x,val,err"; 1618 usage += "\n- Histo2D: i,j,x,y,val,err"; 1619 usage += "\n- Vector/Matrix: n,r,c,val,real,imag,mod,phas"; 1620 usage += "\n- TArray: n,x,y,z,t,u,val,real,imag,mod,phas"; 1621 usage += "\n- Image: i,j,x,y,val(=pix)"; 1622 usage += "\n- GeneralFitData: x0,ex0 x1,ex1 ... xn,exn y,ey ok"; 1616 usage += "\n (_nl is the table line number or the sequential index)"; 1617 usage += "\n- NTuple: ntuple variable names,_nl"; 1618 usage += "\n- Histo1D/HProf: i,x,val,err,_nl"; 1619 usage += "\n- Histo2D: i,j,x,y,val,err,_nl"; 1620 usage += "\n- Vector/Matrix: n,r,c,val,real,imag,mod,phas,_nl"; 1621 usage += "\n- TArray: n,x,y,z,t,u,val,real,imag,mod,phas,_nl"; 1622 usage += "\n- Image: i,j,x,y,val(=pix),_nl"; 1623 usage += "\n- GeneralFitData: x0,ex0 x1,ex1 ... xn,exn y,ey ok ,_nl"; 1623 1624 usage += "\n- LocalMap/SphereThetaPhi/SphereHEALPix: "; 1624 usage += "\n- i,k,val,real,imag,mod,phas,teta,phi ";1625 usage += "\n- FITS Binary/ASCII table: fits column names ";1625 usage += "\n- i,k,val,real,imag,mod,phas,teta,phi,_nl"; 1626 usage += "\n- FITS Binary/ASCII table: fits column names,_nl"; 1626 1627 #ifdef SANS_EVOLPLANCK 1627 1628 usage += "\n ------ Eros Variable names (double) -------- "; 1628 1629 usage += "\n- StarList: x,y,flux,fond,pixmax,flags,"; 1629 usage += "\n- xref,yref,fluxref,fondref,pixmaxref ";1630 usage += "\n- xref,yref,fluxref,fondref,pixmaxref,_nl"; 1630 1631 #endif 1631 1632 usage += "\n ------ Other parameters -------- "; … … 1635 1636 usage += "\n projh1d projh2d projprof fillvec fillmtx "; 1636 1637 usage += "\n fillnt fillgd1 fillgd2 ntloop exptovec ... "; 1637 mpiac->RegisterCommand(kw, usage, NULL, "Expr. Plotting"); 1638 grp = "Expr. Plotting"; 1639 mpiac->RegisterHelp(kw, usage, grp); 1638 1640 kw = "plot2d"; 1639 1641 usage = "Plots (2D) Y=g(Object) vs. X=f(Object) --- Object Variable names (double) :"; -
trunk/SophyaPI/PIext/dlftypes.h
r912 r2419 15 15 typedef double (* DlFunctionOfXY) (double x, double y); 16 16 // ---- Fonctions pour trace d'expressions d'objets ------------ 17 typedef int (* PlotExprFunc) (double* x, double* rx, double* ry, double* rz, double* rt); 18 typedef int (* NTLoopExprFunc) (double* x, double* rx, double* ry, double* rz, 19 double* rt, int n, int nmax); 17 typedef long long int_8_exprf; 18 // ^- Doit etre le meme que dans (Services2NObjMgr::)LinkExprFunc,PrepareNTExpressionCFile 19 typedef int (* PlotExprFunc) (int_8_exprf nl, double* x, double* rx, double* ry, double* rz, double* rt); 20 typedef int (* NTLoopExprFunc) (int_8_exprf nl, double* x, double* rx, double* ry, double* rz, 21 double* rt, int_8_exprf nstart, int_8_exprf nend); 20 22 21 23 // ---------- Fonctions UserFit ---------------- -
trunk/SophyaPI/PIext/pawexecut.cc
r2322 r2419 501 501 502 502 // evenements a utiliser 503 int_ 4k1=0, k2=objnt->NbLines(), dk=1;503 int_8 k1=0, k2=objnt->NbLines(), dk=1; 504 504 srvo.DecodeLoopParameters(loop,k1,k2,dk); 505 505 if (k1<0) k1=0; 506 506 if (k2<0) k2=objnt->NbLines(); 507 if (k2>(int )objnt->NbLines()) k2=objnt->NbLines();507 if (k2>(int_8)objnt->NbLines()) k2=objnt->NbLines(); 508 508 if (dk<=0) dk=1; 509 509 … … 522 522 double xnt[5]={0,0,0,0,0}; 523 523 double* xn; 524 for(int_ 4k=k1; k<k2; k += dk) {524 for(int_8 k=k1; k<k2; k += dk) { 525 525 xn = objnt->GetLineD(k); 526 if(f( xn,xnt,xnt+1,xnt+2,xnt+3) != 0) {526 if(f((int_8_exprf)k,xn,xnt,xnt+1,xnt+2,xnt+3) != 0) { 527 527 if(fout) fprintf(fout,"%d ",k); else printf("%d ",k); 528 528 for(i=0;i<(int)varnum.size();i++) { -
trunk/SophyaPI/PIext/piacmd.cc
r2377 r2419 493 493 usage += " by Auto_Ini_Ranf(int lp) \n"; 494 494 usage += " Usage: autoiniranf"; 495 Register Help(kw, usage, grp);495 RegisterCommand(kw, usage, NULL, grp); 496 496 497 497 kw = "shell execute"; … … 503 503 usage += " > shell myfile.csh [arg1] [arg2] [...]\n"; 504 504 usage += " (where the first line of \"myfile.csh\" is \"#!/bin/csh\")\n"; 505 Register Help(kw, usage, grp);505 RegisterCommand(kw, usage, NULL, grp); 506 506 507 507 kw = "exitpiapp"; 508 508 usage = "To end the piapp session (Interpreter's command)"; 509 Register Help(kw, usage, grp);509 RegisterCommand(kw, usage, NULL, grp); 510 510 511 511 basexec = new PIABaseExecutor(this, omg, app); -
trunk/SophyaPI/PIext/servnobjm.cc
r2322 r2419 909 909 mImgapp->RedirectStdOutErr(false); 910 910 911 int k1,k2,dk;911 int_8 k1,k2,dk; 912 912 k1 = 0; k2 = objnt->NbLines(); dk = 1; 913 913 DecodeLoopParameters(loop, k1, k2, dk); 914 914 if (k1 < 0) k1 = 0; 915 915 if (k2 < 0) k2 = objnt->NbLines(); 916 if (k2 > (int_ 4)objnt->NbLines()) k2 = objnt->NbLines();916 if (k2 > (int_8)objnt->NbLines()) k2 = objnt->NbLines(); 917 917 if (dk <= 0) dk = 1; 918 918 919 919 try { 920 920 double* xn; 921 int kmax= k2;922 for(k=k 1; k<kmax; k+=dk) {921 int_8 kstart = k1, kend = k2; 922 for(k=kstart; k<kend; k+=dk) { 923 923 xn = objnt->GetLineD(k); 924 if (f( xn, xnt, xnt+1, xnt+2, xnt+3, k, kmax) != 0) {924 if (f((int_8_exprf)k, xn, xnt, xnt+1, xnt+2, xnt+3, (int_8_exprf)kstart,(int_8_exprf) kend) != 0) { 925 925 if (nt) { 926 for(i =0; i<4; i++) fxnt[i] = xnt[i];926 for(int i=0; i<4; i++) fxnt[i] = xnt[i]; 927 927 nt->Fill(fxnt); 928 928 } … … 989 989 990 990 fputs("/* ------ Compare bits on double --------- */ \n", fip); 991 fputs("typedef long long int_8 ;\n", fip);992 fputs("int_8 BitCmp64(double v,int_8flg)\n", fip);993 fputs("{return ((int_8 )((v<0.) ? v-0.1 : v+0.1))&flg;}\n", fip);991 fputs("typedef long long int_8_exprf;\n", fip); 992 fputs("int_8_exprf BitCmp64(double v,int_8_exprf flg)\n", fip); 993 fputs("{return ((int_8_exprf)((v<0.) ? v-0.1 : v+0.1))&flg;}\n", fip); 994 994 fputs("/* ------ Some random number generators --------- */ \n", fip); 995 995 fputs("#if defined(__ppc__) && defined(__MACH__) \n",fip); … … 1011 1011 fputs("#define gaurand() NorRand() \n\n", fip); 1012 1012 1013 fputs("/* NTupleInterface Variable declaration - Generated by piapp \n", fip); 1014 fputs(" -- Services2NObjMgr::PrepareNTExpressionCFile() -- */ \n\n", fip); 1015 fprintf(fip,"int %s(double* _xnti_, double* _rx_, double* _ry_, double* _rz_, \n", 1013 fputs("/* NTupleInterface Variable declaration - Generated by piapp */\n", fip); 1014 fputs("/* -- Services2NObjMgr::PrepareNTExpressionCFile() -- */ \n", fip); 1015 fputs("/* _nl line number or sequential index : _nstart <= _nl < _nend */ \n\n", fip); 1016 fprintf(fip,"int %s(int_8_exprf _nl, double* _xnti_, double* _rx_, double* _ry_, double* _rz_, \n", 1016 1017 funcname.c_str()); 1017 fprintf(fip," double* _rt_, int _n_, int _nmax_) \n");1018 fprintf(fip," double* _rt_, int_8_exprf _nstart, int_8_exprf _nend) \n"); 1018 1019 fprintf(fip, "{ \n %s \n", vardec.c_str()); 1019 1020 fputs(" if (!1) { /* Cut Expression failed */ \n", fip); … … 1178 1179 float fxnt[10]; 1179 1180 1180 int i,k;1181 for( i=0; i<10; i++) xnt[i] = 0.;1182 int k1,k2,dk;1181 int_8 k; 1182 for(k=0; k<10; k++) xnt[k] = 0.; 1183 int_8 k1,k2,dk; 1183 1184 k1 = 0; k2 = objnt->NbLines(); dk = 1; 1184 1185 DecodeLoopParameters(loop, k1, k2, dk); 1185 1186 if (k1 < 0) k1 = 0; 1186 1187 if (k2 < 0) k2 = objnt->NbLines(); 1187 if (k2 > (int_ 4)objnt->NbLines()) k2 = objnt->NbLines();1188 if (k2 > (int_8)objnt->NbLines()) k2 = objnt->NbLines(); 1188 1189 if (dk <= 0) dk = 1; 1189 1190 … … 1192 1193 for(k=k1; k<k2; k += dk) { 1193 1194 xn = objnt->GetLineD(k); 1194 if (f( xn, xnt, xnt+1, xnt+2, xnt+3) != 0) {1195 if (f((int_8_exprf)k,xn, xnt, xnt+1, xnt+2, xnt+3) != 0) { 1195 1196 if (nt) { 1196 for(i =0; i<4; i++) fxnt[i] = xnt[i];1197 for(int i=0; i<4; i++) fxnt[i] = xnt[i]; 1197 1198 nt->Fill(fxnt); 1198 1199 } … … 1251 1252 1252 1253 fputs("/* ------ Compare bits on double --------- */ \n", fip); 1253 fputs("typedef long long int_8 ;\n", fip);1254 fputs("int_8 BitCmp64(double v,int_8flg)\n", fip);1255 fputs("{return ((int_8 )((v<0.) ? v-0.1 : v+0.1))&flg;}\n", fip);1254 fputs("typedef long long int_8_exprf;\n", fip); 1255 fputs("int_8_exprf BitCmp64(double v,int_8_exprf flg)\n", fip); 1256 fputs("{return ((int_8_exprf)((v<0.) ? v-0.1 : v+0.1))&flg;}\n", fip); 1256 1257 fputs("/* ------ Some random number generators --------- */ \n", fip); 1257 1258 fputs("#if defined(__ppc__) && defined(__MACH__) \n",fip); … … 1273 1274 fputs("#define gaurand() NorRand() \n\n", fip); 1274 1275 1275 fputs("int expf_pia_dl_func( double* _zz6qi_, double* _rx_6q_, double* _ry_6q_, double* _rz_6q_, double* _rt_6q_) \n{\n", fip);1276 fputs("int expf_pia_dl_func(int_8_exprf _nl, double* _zz6qi_, double* _rx_6q_, double* _ry_6q_, double* _rz_6q_, double* _rt_6q_) \n{\n", fip); 1276 1277 fprintf(fip,"%s \n", vardec.c_str()); 1277 1278 fprintf(fip, "if (!(%s)) { *_rx_6q_ = *_ry_6q_ = *_rz_6q_ = *_rt_6q_ = 0.; return(0); } \n", cut.c_str()); … … 1323 1324 // Fonction static 1324 1325 /* --Methode-- */ 1325 void Services2NObjMgr::DecodeLoopParameters(string& loop, int & i1, int& i2, int& di)1326 void Services2NObjMgr::DecodeLoopParameters(string& loop, int_8& i1, int_8& i2, int_8& di) 1326 1327 { 1327 1328 // Decode des paramatres de boucle for(int i=i1; i<i2; i+=di) specifies … … 1331 1332 if (l < 1) return; 1332 1333 size_t p = loop.find(':'); 1333 if (p >= l) { i1 = ato i(loop.c_str()); return; }1334 i1 = ato i(loop.substr(0, p).c_str());1334 if (p >= l) { i1 = atol(loop.c_str()); return; } 1335 i1 = atol(loop.substr(0, p).c_str()); 1335 1336 string aa = loop.substr(p+1); 1336 1337 p = aa.find(':'); 1337 1338 if (p < aa.length() ) { 1338 i2 = ato i(aa.substr(0,p).c_str());1339 di = ato i(aa.substr(p+1).c_str());1340 } 1341 else i2 = ato i(aa.c_str());1339 i2 = atol(aa.substr(0,p).c_str()); 1340 di = atol(aa.substr(p+1).c_str()); 1341 } 1342 else i2 = atol(aa.c_str()); 1342 1343 // cout << "-> I1= " << i1 << " I2= " << i2 << " DI= " << di << endl; 1343 1344 return; -
trunk/SophyaPI/PIext/servnobjm.h
r2180 r2419 115 115 116 116 // Utilitaires divers 117 static void DecodeLoopParameters(string& loop, int & i1, int& i2, int& di);117 static void DecodeLoopParameters(string& loop, int_8& i1, int_8& i2, int_8& di); 118 118 string FileName2Name(string const & fn); 119 119 char* PClassIdToClassName(int cid);
Note:
See TracChangeset
for help on using the changeset viewer.