Changeset 344 in Sophya for trunk/SophyaPI/PIext/servnobjm.cc
- Timestamp:
- Aug 2, 1999, 6:52:49 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PIext/servnobjm.cc
r341 r344 200 200 201 201 if (vpy) { 202 string titre = (nom.length() < 1) ? "Function f(x)" : nom; 203 P1DArrayAdapter* vya = new POVectorAdapter(vpy, true); 202 string titre; 203 if (nom.length() < 1) { 204 titre = "Function f(x)"; 205 nom = "/tmp/func"; 206 } 207 else titre = nom; 208 209 P1DArrayAdapter* vya = new POVectorAdapter(vpy, false); 204 210 vya->DefineXCoordinate(xmin, (xmax-xmin)/np); 205 211 PIYfXDrawer* dr = new PIYfXDrawer(vya, NULL, true) ; … … 256 262 257 263 if (mtx) { 258 string titre = (nom.length() < 1) ? "Function f(x,y)" : nom; 264 string titre; 265 if (nom.length() < 1) { 266 titre = "Function f(x,y)"; 267 nom = "/tmp/func2d"; 268 } 269 else titre = nom; 259 270 bool fgsr = true; 260 271 int opt = DecodeDispOption(dopt, fgsr); 261 P2DArrayAdapter* arr = new POMatrixAdapter(mtx, true);272 P2DArrayAdapter* arr = new POMatrixAdapter(mtx, false); 262 273 arr->DefineXYCoordinates(xmin, ymin, dx, dy); 263 274 PISurfaceDrawer* sdr = new PISurfaceDrawer(arr, true, true, true); … … 636 647 /* --Methode-- */ 637 648 void Services2NObjMgr::FillNTFrCFile(string & nom, string const & fname, 638 string const & funcname, string & nomnt) 649 string const & funcname, string & nomnt, 650 int nl1, int nl2) 639 651 { 640 652 if (!mImgapp) return; … … 646 658 return; 647 659 } 648 NTupleInterface* objnt = obja->GetNTupleInterface(); 660 bool adel = true; 661 NTupleInterface* objnt = obja->GetNTupleInterface(adel); 649 662 if (objnt == NULL) { 650 663 cout << "Services2NObjMgr::FillNTFrCFile( " << nom << "...) No NTupleInterface !" <<endl; … … 655 668 if (!f) { 656 669 cerr << "Services2NObjMgr::FillNTFrCFile Error Creation NTLoopExprFunc" << endl; 670 if (adel) delete objnt; // Delete de l'objet NTupleInterface si necessaire 657 671 return; 658 672 } … … 691 705 TRY { 692 706 double* xn; 693 int kmax = objnt->NbLines(); 694 for(k=0; k<kmax; k++) { 707 if (nl1 < 0) nl1 = 0; 708 if (nl2 < 0) nl2 = objnt->NbLines(); 709 if (nl2 > objnt->NbLines()) nl2 = objnt->NbLines(); 710 int kmax = nl2; 711 for(k=nl1; k<kmax; k++) { 695 712 xn = objnt->GetLineD(k); 696 713 if (f(xn, xnt, xnt+1, xnt+2, xnt+3, k, kmax) != 0) { … … 709 726 cerr << "Services2NObjMgr::FillNTFrCFile() Exception :" << merr << es; 710 727 } ENDTRY; 711 728 729 if (adel) delete objnt; // Delete de l'objet NTupleInterface si necessaire 712 730 CloseDLL(); 713 731 … … 729 747 return; 730 748 } 731 NTupleInterface* objnt = obja->GetNTupleInterface(); 749 bool adel = true; 750 NTupleInterface* objnt = obja->GetNTupleInterface(adel); 732 751 if (objnt == NULL) { 733 752 cout << "Services2NObjMgr::PrepareNTExpressionCFile( " << nom … … 740 759 if ((fip = fopen(fname.c_str(), "w")) == NULL) { 741 760 cout << "Services2NObjMgr::PrepareNTExpressionCFile()_Error: fopen " << fname << endl; 761 if (adel) delete objnt; // Delete de l'objet NTupleInterface si necessaire 742 762 return; 743 763 } 764 744 765 // constitution du fichier des decalarations des variables de l'interface NTuple 745 766 fputs("#include <stdlib.h> \n", fip); 746 767 fputs("#include <stdio.h> \n", fip); 747 768 fputs("#include <math.h> \n\n", fip); 769 770 fputs("/* ------ Some random number generators --------- */ \n", fip); 771 fputs("#define frand01() ( (float) drand48() ) \n", fip); 772 fputs("#define drand01() drand48() \n", fip); 773 fputs("#define rand01() drand48() \n", fip); 774 fputs("#define frandpm1() ( 2. * frand01() - 1.) \n", fip); 775 fputs("#define drandpm1() ( 2. * drand01() - 1.) \n", fip); 776 fputs("#define randpm1() ( 2. * drand01() - 1.) \n", fip); 777 fputs("double NorRand(void) \n", fip); 778 fputs(" { \n double x,A,B; \n LAB10: \n A = drand01(); \n", fip); 779 fputs(" if ( A == 0. ) goto LAB10; \n B = drand01(); \n", fip); 780 fputs(" x = sqrt(-2.*log(A))*cos(M_2PI*B); \n", fip); 781 fputs(" return(x); \n } \n", fip); 782 fputs("#define GauRand() NorRand() \n", fip); 783 fputs("#define gaurand() NorRand() \n\n", fip); 784 748 785 fputs("/* NTupleInterface Variable declaration - Generated by piapp \n", fip); 749 786 fputs(" -- Services2NObjMgr::PrepareNTExpressionCFile() -- */ \n\n", fip); … … 759 796 760 797 fclose(fip); 798 799 if (adel) delete objnt; // Delete de l'objet NTupleInterface si necessaire 761 800 return; 762 801 } … … 1304 1343 { 1305 1344 if (obja == NULL) return; 1306 NTupleInterface* objnt = obja->GetNTupleInterface(); 1345 bool adel = true; 1346 NTupleInterface* objnt = obja->GetNTupleInterface(adel); 1307 1347 if (objnt == NULL) return; 1308 1348 string vardec = objnt->VarList_C("_zz6qi_"); … … 1311 1351 if (!f) { 1312 1352 cerr << "Services2NObjMgr::::ComputeExpressions() Error Creation PlotExprFunc " << endl; 1353 if (adel) delete objnt; // Delete de l'objet NTupleInterface si necessaire 1313 1354 return; 1314 1355 } … … 1344 1385 1345 1386 1387 if (adel) delete objnt; // Delete de l'objet NTupleInterface si necessaire 1346 1388 // Fermeture du fichier .so 1347 1389 CloseDLL(); … … 1372 1414 fputs("#include <stdlib.h> \n", fip); 1373 1415 fputs("#include <math.h> \n", fip); 1416 1417 fputs("/* ------ Some random number generators --------- */ \n", fip); 1418 fputs("#define frand01() ( (float) drand48() ) \n", fip); 1419 fputs("#define drand01() drand48() \n", fip); 1420 fputs("#define rand01() drand48() \n", fip); 1421 fputs("#define frandpm1() ( 2. * frand01() - 1.) \n", fip); 1422 fputs("#define drandpm1() ( 2. * drand01() - 1.) \n", fip); 1423 fputs("#define randpm1() ( 2. * drand01() - 1.) \n", fip); 1424 fputs("double NorRand(void) \n", fip); 1425 fputs(" { \n double x,A,B; \n LAB10: \n A = drand01(); \n", fip); 1426 fputs(" if ( A == 0. ) goto LAB10; \n B = drand01(); \n", fip); 1427 fputs(" x = sqrt(-2.*log(A))*cos(M_2PI*B); \n", fip); 1428 fputs(" return(x); \n } \n", fip); 1429 fputs("#define GauRand() NorRand() \n", fip); 1430 fputs("#define gaurand() NorRand() \n\n", fip); 1431 1374 1432 fputs("int expf_pia_dl_func(double* _zz6qi_, double* _rx_6q_, double* _ry_6q_, double* _rz_6q_, double* _rt_6q_) \n{\n", fip); 1375 1433 fprintf(fip,"%s \n", vardec.c_str());
Note:
See TracChangeset
for help on using the changeset viewer.