Changeset 138 in PSPA for Interface_Web/trunk/pspaWT/src
- Timestamp:
- Dec 4, 2012, 7:46:42 PM (12 years ago)
- Location:
- Interface_Web/trunk/pspaWT/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
Interface_Web/trunk/pspaWT/src/GWt_pspaApplication.cc
r132 r138 19 19 #include "GWt_LigneFaisceau.h" 20 20 #include "GWt_globalParameters.h" 21 #include "particleBeam.h" 21 22 #include "bareParticle.h" 22 23 #include "nomDeLogiciel.h" … … 187 188 probleme_->setHidden(true); 188 189 190 // signal de calcul en cours 191 encours_ = new WText(); 192 encours_->decorationStyle().setBackgroundColor (WColor("green")); 193 encours_->setHidden(true); 194 189 195 // le panel 190 196 WPanel *panelLogiciels = new WPanel(executeW); … … 197 203 contenuSections_->addWidget(exec_go_); 198 204 contenuSections_->addWidget(probleme_); 205 contenuSections_->addWidget(encours_); 199 206 contenuSections_->addWidget(new WBreak()); 200 207 contenuSections_->addWidget(new WBreak()); … … 206 213 207 214 208 W Widget* PspaApplication::createDrawingWidget()215 WContainerWidget* PspaApplication::createDrawingWidget() 209 216 { 210 217 WContainerWidget* dessin = new WContainerWidget(); 211 218 219 dessin->addWidget(new WText(" graphic analysis : ")); 220 dessin->addWidget(new WBreak()); 212 221 dessin->addWidget(new WText(" drawing after element : ")); 222 223 224 choixElementDessin_ = new WComboBox(); 225 dessin->addWidget(choixElementDessin_); 226 WPushButton* caroule = new WPushButton("dessiner"); 227 dessin->addWidget(caroule); 228 caroule->clicked().connect(this, &PspaApplication::dessiner); 229 230 dessin->addWidget(new WBreak()); 231 232 toto_ = new WContainerWidget(); 233 dessin->addWidget(toto_); 213 234 return dessin; 214 235 } … … 378 399 addConsoleMessage(string("on va peut etre y arriver")); 379 400 static_cast<GWt_globalParameters*>(globalParam_)->updateGlobals(); 380 401 encours_->decorationStyle().setBackgroundColor (WColor("green")); 402 encours_->setText("calcul en cours"); 403 encours_->setHidden(false); 381 404 string resultat; 382 405 if ( !dtmanage_->executeAll(resultat)) probleme_->setHidden(false); … … 384 407 addConsoleMessage(resultat); 385 408 // cout << " PspaApplication : affichage console termine " << endl; 409 410 encours_->setText("c'est fini"); 411 encours_->decorationStyle().setBackgroundColor (WColor("orange")); 412 386 413 faireDessin(); 387 414 } … … 414 441 void PspaApplication::faireDessin() 415 442 { 416 417 // leDessin_.clear(); 418 419 420 if ( dtmanage_->getCurrentBeam()->momentRepresentationOk() ) faireDessinTransport(); 421 else if ( dtmanage_->getCurrentBeam()->particleRepresentationOk() ) faireDessinParmela(); 443 choixElementDessin_->clear(); 444 int nombre = dtmanage_->beamLineSize(); 445 for ( int numero =1; numero <= nombre; numero++) 446 { 447 choixElementDessin_->addItem(dtmanage_->getLabelFromElementNumero(numero)); 448 } 449 450 } 451 452 void PspaApplication::dessiner() 453 { 454 455 toto_->clear(); 456 457 int index = choixElementDessin_->currentIndex(); 458 particleBeam* beam = dtmanage_->getDiagnosticBeam(index); 459 460 if ( beam->momentRepresentationOk() ) faireDessinTransport(toto_, beam); 461 else if ( beam->particleRepresentationOk() ) faireDessinParmela(toto_, beam); 422 462 else addConsoleMessage("the beam state does not allow providing a drawing"); 423 } 424 425 void PspaApplication::faireDessinParmela() 426 { 427 WContainerWidget* toto = static_cast<WContainerWidget*>(leDessin_); 428 // toto->clear(); 429 new WText("emittance", toto); 430 vector<bareParticle>& partic = dtmanage_->getCurrentBeam()->getParticleVector(); 431 432 463 ////////////////////////////////////////// 464 } 465 466 467 void PspaApplication::faireDessinParmela(WContainerWidget* toto, particleBeam* beam) 468 { 469 // WContainerWidget* toto = static_cast<WContainerWidget*>(leDessin_); 470 // // toto->clear(); 471 // new WText("emittance", toto); 472 // vector<bareParticle>& partic = dtmanage_->getCurrentBeam()->getParticleVector(); 473 new WText("emittance parmela", toto); 474 vector<bareParticle>& partic = beam->getParticleVector(); 433 475 WStandardItemModel *model = new WStandardItemModel(partic.size(), 3, toto); 434 476 // model->setHeaderData(0, WString("X")); … … 481 523 // } 482 524 483 void PspaApplication::faireDessinTransport() 484 { 485 // WContainerWidget* toto = leDessin_; 486 WContainerWidget* toto = static_cast<WContainerWidget*>(leDessin_); 525 void PspaApplication::faireDessinTransport(WContainerWidget* toto, particleBeam* beam) 526 { 527 // WContainerWidget* toto = static_cast<WContainerWidget*>(leDessin_); 487 528 // toto->clear(); 488 529 new WText("emittance transport", toto); … … 490 531 vector<double> xcor; 491 532 vector<double> ycor; 492 dtmanage_->getCurrentBeam()->donneesDessinEllipseXxp(xcor,ycor); 533 // dtmanage_->getCurrentBeam()->donneesDessinEllipseXxp(xcor,ycor); 534 beam->donneesDessinEllipseXxp(xcor,ycor); 493 535 int nbpts = xcor.size(); 494 536 cout << " PspaApplication::faireDessinTransport() nbpts = " << nbpts << endl; -
Interface_Web/trunk/pspaWT/src/GWt_soleno.cc
r112 r138 22 22 dialog_ = new WDialog("element SOLENOID"); 23 23 24 new WText("length : ",dialog_->contents());24 new WText("length (cm) : ",dialog_->contents()); 25 25 xlengthEdit_ = new WLineEdit(param[1].c_str(), dialog_->contents()); 26 26 new WBreak(dialog_->contents()); 27 new WText("aperture : ",dialog_->contents());27 new WText("aperture (cm) : ",dialog_->contents()); 28 28 apertureEdit_ = new WLineEdit(param[2].c_str(), dialog_->contents()); 29 29 new WBreak(dialog_->contents()); -
Interface_Web/trunk/pspaWT/src/dataManager.cc
r128 r138 467 467 } 468 468 469 particleBeam* dataManager::getDiagnosticBeam(int index) 470 { 471 cout << " particleBeam* dataManager je vais dessiner " << getLabelFromElementNumero(index+1) << endl; 472 return &diagnosticBeam_.at(index); 473 } -
Interface_Web/trunk/pspaWT/src/elementSoleno.cc
r128 r138 68 68 { 69 69 ostringstream sortie; 70 sortie << label_ << ":" << " SOLENOID, L=" << lenghtElem_ << ", B=" << B0_ << ";"; 70 // on passe la longueur en metres 71 sortie << label_ << ":" << " SOLENOID, L=" << 0.01*lenghtElem_ << ", B=" << B0_ << ";"; 71 72 return sortie.str(); 72 73 } -
Interface_Web/trunk/pspaWT/src/particleBeam.cc
r129 r138 446 446 void particleBeam::donneesDessinEllipseXxp(vector<double>& xcor, vector<double>& ycor) 447 447 { 448 int k; 449 double x,y; 450 448 451 if ( !momentRepresentationOk_ ) return; 449 452 … … 455 458 double r = ( rij_transportMoments_.at(1) ).at(0); 456 459 460 int nbintv = 50; 461 if ( xm == 0.0 ) return; 462 double pas = 2.0 * xm / nbintv; 463 457 464 // cout << " r= " << r << endl; 458 459 double rac = sqrt(1 - r*r); 460 double alpha = -r / rac; 461 double beta = xm / ( ym * rac); 462 // double gamma = ym / ( xm * rac ); 463 double epsil = xm * ym * rac; 464 465 466 int nbintv = 50; 467 double pas = 2.0 * xm / nbintv; 468 double fac1 = -1.0 / ( beta * beta); 469 double fac2 = epsil/beta; 470 double fac3 = -alpha/beta; 471 int k; 472 double x,y; 473 double aux; 474 for ( k=0; k < nbintv; k++) 475 { 476 x = -xm + k*pas; 477 aux = fac1 * x * x + fac2; 478 // cout << " aux2= " << aux << endl; 479 if ( aux <= 0.0 ) 480 { 481 aux = 0.0; 482 } 483 else aux = sqrt(aux); 465 double rac = (1 - r*r); 466 if ( rac > 0.0 ) 467 { 468 rac = sqrt(1 - r*r); 469 double alpha = -r / rac; 470 double beta = xm / ( ym * rac); 471 // double gamma = ym / ( xm * rac ); 472 double epsil = xm * ym * rac; 473 double fac1 = -1.0 / ( beta * beta); 474 double fac2 = epsil/beta; 475 double fac3 = -alpha/beta; 476 double aux; 477 for ( k=0; k < nbintv; k++) 478 { 479 x = -xm + k*pas; 480 aux = fac1 * x * x + fac2; 481 // cout << " aux2= " << aux << endl; 482 if ( aux <= 0.0 ) 483 { 484 aux = 0.0; 485 } 486 else aux = sqrt(aux); 484 487 485 // y = fac3*x; 486 y = fac3*x + aux; 487 xcor.push_back(x); 488 ycor.push_back(y); 489 } 490 491 for ( k=0; k <= nbintv; k++) 492 { 493 x = xm - k*pas; 494 aux = fac1 * x * x + fac2; 495 if ( aux <= 0.0 ) 496 { 497 aux = 0.0; 498 } 499 else aux = sqrt(aux); 500 // y = fac3*x; 501 y = fac3*x - aux; 502 xcor.push_back(x); 503 ycor.push_back(y); 504 } 505 } 488 // y = fac3*x; 489 y = fac3*x + aux; 490 xcor.push_back(x); 491 ycor.push_back(y); 492 } 493 494 for ( k=0; k <= nbintv; k++) 495 { 496 x = xm - k*pas; 497 aux = fac1 * x * x + fac2; 498 if ( aux <= 0.0 ) 499 { 500 aux = 0.0; 501 } 502 else aux = sqrt(aux); 503 // y = fac3*x; 504 y = fac3*x - aux; 505 xcor.push_back(x); 506 ycor.push_back(y); 507 } 508 } 509 else 510 // cas degenere 511 { 512 double fac = -ym/xm; 513 for ( k=0; k < nbintv; k++) 514 { 515 x = -xm + k*pas; 516 y = fac*x; 517 xcor.push_back(x); 518 ycor.push_back(y); 519 } 520 521 } 522 }
Note: See TracChangeset
for help on using the changeset viewer.