Changeset 417 in PSPA


Ignore:
Timestamp:
Jun 10, 2013, 4:52:52 PM (11 years ago)
Author:
lemeur
Message:

mise a jour des manipulations de faisceau

Location:
Interface_Web/trunk/pspaWT
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • Interface_Web/trunk/pspaWT/History

    r415 r417  
    55     PSPA - Plateforme de simulation en physique des accélérateurs
    66     =========================================================
     7
     810 juin 2013  : Guy Le Meur
     9- redefinition du faisceau (particleBeam) comme donné à z = cte
     10- pour PARMELA, quand le faiceau n'est pas donné par rfgun, on recule
     11  le faisceau, pour qu'au début du calcul il soit tout entier avant le
     12  premier élément.
    713
    81418 avril 2013 : Laurent Garnier
  • Interface_Web/trunk/pspaWT/sources/controler/include/particleBeam.h

    r414 r417  
    2020  double P0Transport_;
    2121
    22   // la representation du faisceau de particules sera a preciser ulterieurement
    23   // Pour l'instant une particule courante est definie par :
    24   // x
    25   // y
    26   // deltaz = z - z0 (z0 est le z de la particule de reference)
    27   // gamma.betax
     22  // ce faisceau contient les coordonnees des particules quand elles
     23  // passe en un z, qui est celui de la particules de reference (
     24  // (particule donne par l'attribut  referenceParticle_ ci-dessous ;
     25  // cette particule est abstraite, car elle est dupliquee dans le faisceau
     26  // proprement dit, et n'intervient plus, en tant que telle, dans la dynamique)
     27
     28  // Une particule courante est definie par :
     29  // x (cm)
     30  // y (cm)
     31  // cdeltat = dephasage, donc décalage en z, exprime en c.dt soit, en cm 
     32  // cdeltat > 0 implique que la particule est en avance sur la particule de ref.
     33  // gamma.betax (radians ? a verifier)
    2834  // gamma.betay
    2935  // gamma.betaz
    30   vector<bareParticle> goodPartic_;
    3136
    32   // par ailleurs, la particules de reference est definie par x,y,z,gamma.betax, gamma.betay, gamma.betaz
    33   // elle est dupliquee dans le faisceau prorement dit (goodPartic_) avec z = z-z0 et ne doit, par consequent,
    34   // pas etre prise en compte dans les calculs de trajectoire.
     37  vector<bareParticle> relativePartic_;
     38  // La particule de reference (abstraite) est definie par x,y,z,gamma.betax, gamma.betay, gamma.betaz
     39  // elle est dupliquee dans le faisceau proprement dit (relativePartic_) avec z = 0;
     40
    3541  bareParticle referenceParticle_;
    3642 
     
    94100 }
    95101
     102
    96103 public:
    97104
     
    112119  vector<bareParticle>& getParticleVector();
    113120  double getXmaxRms();
    114   void getVariance(double& varx, double& vary, double& varz) const;
     121  //  void getVariance(double& varx, double& vary, double& varz) const;
    115122  void set2Moments(beam2Moments& moments);
    116123  void setWithParticles(vector<double>& centroid, bareParticle& referencePart, vector<bareParticle>& particles);
    117124  void printAllXYZ() const;
    118   void Zrange(double& zmin, double& zmax) const;
     125  void ZrangeCdt(double& zmin, double& zmax) const; // extension en phase (cm)
    119126  void donneesDessinEllipse(vector<double>& xcor, vector<double>& ycor, vector<string>& legende, string namex, string namey);
    120127  void particlesPhaseSpaceData(vector<double>& xcor, vector<double>& ycor, vector<string>& legende, string namex, string namey);
    121   virtual string FileOutputFlow() const;
     128
     129
     130 // coordonnees d'une particule dans le faisceau deploye ( passage
     131 // d'une representation z=cte a une representation t=cte)
     132 TRIDVECTOR coordonneesDeployees(unsigned particleIndex, double cdtShift = 0.0);
     133
     134 inline TRIDVECTOR betaGamma(unsigned particleIndex) {
     135     return relativePartic_.at(particleIndex).getBetaGamma();
     136   }
     137
     138  virtual string fileOutputFlow() const;
    122139  virtual bool FileInput(ifstream& ifs);
    123140
  • Interface_Web/trunk/pspaWT/sources/controler/include/softwareParmela.h

    r386 r417  
    1616
    1717    vector<int> relativeParmelaElementIndices_;
     18
    1819
    1920  bool beamFromParmela(string workingDir,unsigned numeroElement, double referencefrequency, vector<double>& centroid, bareParticle& refPart,vector<bareParticle>& particles );
  • Interface_Web/trunk/pspaWT/sources/controler/src/particleBeam.cc

    r414 r417  
    1919
    2020void particleBeam::clear() {
    21   goodPartic_.clear();
     21  relativePartic_.clear();
    2222  rij_.raz();
    2323  P0Transport_ = 0.0;
     
    2727
    2828int particleBeam::getNbParticles() const {
    29   return goodPartic_.size();
     29  return relativePartic_.size();
    3030}
    3131
     
    9999  centroid_ = centroid;
    100100  referenceParticle_ = referencePart;
    101   goodPartic_.clear();
    102   goodPartic_ = particles;
    103   cout << " particleBeam::setWithParticles taille vect. part. ENREGISTRE " << goodPartic_.size() << endl;
     101  relativePartic_.clear();
     102  relativePartic_ = particles;
     103  cout << " particleBeam::setWithParticles taille vect. part. ENREGISTRE " << relativePartic_.size() << endl;
    104104  particleRepresentationOk_ = true;
    105105}
     
    114114void  particleBeam::addParticle( bareParticle p)
    115115{
    116   goodPartic_.push_back(p);
     116  relativePartic_.push_back(p);
    117117}
    118118
    119119const vector<bareParticle>& particleBeam::getParticleVector() const
    120120{
    121   return goodPartic_;
     121  return relativePartic_;
    122122}
    123123
    124124vector<bareParticle>& particleBeam::getParticleVector()
    125125{
    126   return goodPartic_;
    127 }
    128 
    129 void particleBeam::getVariance(double& varx, double& vary, double& varz) const {
    130   unsigned int k;
    131   double x,y,z;
    132   double xav = 0.;
    133   double yav = 0.;
    134   double zav = 0.;
    135   double xavsq = 0.;
    136   double yavsq = 0.;
    137   double zavsq = 0.;
    138 
    139   TRIDVECTOR pos;
    140 
    141 
    142   for ( k = 0 ; k < goodPartic_.size(); k++) {
    143     pos = goodPartic_.at(k).getPosition();
    144     pos.getComponents(x,y,z);
    145     //      partic_[k].getXYZ(x,y,z);
    146     xav += x;
    147     xavsq += x*x;
    148     yav += y;
    149     yavsq += y*y;
    150     zav += z;
    151     zavsq += z*z;
    152   }
    153 
    154   double aginv = double (goodPartic_.size());
    155   aginv = 1.0/aginv;
    156 
    157   varx =  aginv * ( xavsq - xav*xav*aginv );
    158   vary =  aginv * ( yavsq - yav*yav*aginv );
    159   varz =  aginv * ( zavsq - zav*zav*aginv );
    160 }
     126  return relativePartic_;
     127}
     128
     129// void particleBeam::getVariance(double& varx, double& vary, double& varz) const {
     130//   unsigned int k;
     131//   double x,y,z;
     132//   double xav = 0.;
     133//   double yav = 0.;
     134//   double zav = 0.;
     135//   double xavsq = 0.;
     136//   double yavsq = 0.;
     137//   double zavsq = 0.;
     138
     139//   TRIDVECTOR pos;
     140
     141
     142//   for ( k = 0 ; k < goodPartic_.size(); k++) {
     143//     pos = goodPartic_.at(k).getPosition();
     144//     pos.getComponents(x,y,z);
     145//     //      partic_[k].getXYZ(x,y,z);
     146//     xav += x;
     147//     xavsq += x*x;
     148//     yav += y;
     149//     yavsq += y*y;
     150//     zav += z;
     151//     zavsq += z*z;
     152//   }
     153
     154//   double aginv = double (goodPartic_.size());
     155//   aginv = 1.0/aginv;
     156
     157//   varx =  aginv * ( xavsq - xav*xav*aginv );
     158//   vary =  aginv * ( yavsq - yav*yav*aginv );
     159//   varz =  aginv * ( zavsq - zav*zav*aginv );
     160// }
    161161
    162162
    163163void particleBeam::printAllXYZ() const {
    164164  cout << " dump du faisceau : " << endl;
    165   cout <<  goodPartic_.size() << " particules " << endl;
     165  cout <<  relativePartic_.size() << " particules " << endl;
    166166  unsigned int k;
    167   for ( k = 0 ; k < goodPartic_.size(); k++)
     167  for ( k = 0 ; k < relativePartic_.size(); k++)
    168168    {
    169169      double xx,yy,zz;
    170       goodPartic_.at(k).getPosition().getComponents(xx,yy,zz);
     170      relativePartic_.at(k).getPosition().getComponents(xx,yy,zz);
    171171      double betgamx, betgamy, betgamz;
    172       goodPartic_.at(k).getBetaGamma().getComponents(betgamx, betgamy, betgamz);
    173       cout << " part. numero " << k << "  x= " << xx << " y= " << yy  << " z= " << zz << "  betgamx= " << betgamx << " betgamy= " << betgamy  << " betgamz= " << betgamz << endl;
    174     }
    175 }
    176 
    177 
    178 
    179 void particleBeam::Zrange(double& zmin, double& zmax) const {
     172      relativePartic_.at(k).getBetaGamma().getComponents(betgamx, betgamy, betgamz);
     173      cout << " part. numero " << k << "  x= " << xx << " y= " << yy  << " dphas (c.dt, cm) = " << zz << "  betgamx= " << betgamx << " betgamy= " << betgamy  << " betgamz= " << betgamz << endl;
     174    }
     175}
     176
     177
     178// extension en phase (cm)
     179void particleBeam::ZrangeCdt(double& cdtmin, double& cdtmax) const {
    180180  double z;
    181   zmin = GRAND;
    182   zmax = -zmin;
     181  cdtmin = GRAND;
     182  cdtmax = -cdtmin;
    183183
    184184  unsigned int k;
    185   for ( k = 0 ; k < goodPartic_.size(); k++)
     185  for ( k = 0 ; k < relativePartic_.size(); k++)
    186186    {
    187       z = goodPartic_.at(k).getZ();
    188       if ( z < zmin ) zmin = z;
    189       else if ( z > zmax) zmax = z;         
    190     }
    191 }
    192 
    193 
    194 
    195 string particleBeam::FileOutputFlow() const {
     187      z = relativePartic_.at(k).getZ(); // ce z est un dephasage, c.dt, en cm
     188      if ( z < cdtmin ) cdtmin = z;
     189      else if ( z > cdtmax) cdtmax = z;     
     190    }
     191}
     192
     193
     194
     195string particleBeam::fileOutputFlow() const {
    196196  ostringstream sortie;
    197197  unsigned int k;
    198   for ( k = 0 ; k < goodPartic_.size(); k++)
     198  for ( k = 0 ; k < relativePartic_.size(); k++)
    199199    {
    200       sortie << goodPartic_.at(k).FileOutputFlow() << endl;
     200      sortie << relativePartic_.at(k).FileOutputFlow() << endl;
    201201    }
    202202  sortie << endl;
     
    219219
    220220void particleBeam::buildMomentRepresentation() {
    221 
     221  // le faisceau cense etre represente en un z donne (reference) sera
     222  // ici deploye spatialement (faisceau en un temps donne)
    222223  unsigned k,j,m;
    223224  double auxj, auxm;
     
    248249  double PMeVsc;
    249250  double del;
     251  //  double xp,yp,dz,cdt;
    250252  vector<double> part(6, 0.0);
    251253
    252254    vector< vector<double> >& matrice = rij_.getMatrix();
    253255
    254 
    255   for (k=0; k < goodPartic_.size(); k++) {
    256     gamma = goodPartic_.at(k).getGamma();
    257     pos = goodPartic_.at(k).getPosition();
    258     begam= goodPartic_.at(k).getBetaGamma();
     256    TRIDVECTOR positionDeployee;
     257
     258  for (k=0; k < relativePartic_.size(); k++) {
     259
     260    positionDeployee = coordonneesDeployees(k);
     261    gamma = relativePartic_.at(k).getGamma();
     262
     263    //    pos = relativePartic_.at(k).getPosition();
     264    //    cdt = pos.getComponent(2);
     265    begam= relativePartic_.at(k).getBetaGamma();
    259266    begamz = begam.getComponent(2);
    260267    g = gamma -1.0;
     
    262269    del = 100.0 * ( PMeVsc -  P_reference_MeV_sur_c ) / P_reference_MeV_sur_c ; // en %
    263270
    264     part[0] = pos.getComponent(0);
     271    //    dz = begamz * cdt / gamma;
     272    //    xp = begam.getComponent(0)/begamz;
     273    //    yp = begam.getComponent(1)/begamz;
     274
     275    part[0] = positionDeployee.getComponent(0);
    265276    part[1] = begam.getComponent(0)/begamz;
    266     part[2] = pos.getComponent(1);
     277    part[2] = positionDeployee.getComponent(1);
    267278    part[3] = begam.getComponent(1)/begamz;
    268     part[4] = pos.getComponent(2);
     279    part[4] = positionDeployee.getComponent(2);
    269280    part[5] = del;
    270281
     
    286297
    287298  // moyenne
    288   double facmoy = 1.0/double( goodPartic_.size() );
     299  double facmoy = 1.0/double( relativePartic_.size() );
    289300  for ( j = 0; j < 6; j++) {
    290301        ( matrice.at(j) ).at(j) = sqrt(( matrice.at(j) ).at(j) * facmoy );
     
    359370
    360371// renvoie (dans le vecteur coord) la liste des coordonnées d'index 'index' :
    361 // index = 0 , 1, 2 -> x,y,z
     372// index = 0 , 1, 2 -> x,y,z (en coordonnees deployees)
    362373// index = 3,4 -> x' = betax/betaz , y' = betay/betaz
    363374// index = 5 -> Ec : energie cinetique
     
    367378 
    368379  coord.clear();
    369   coord.resize(goodPartic_.size(), 0.0 );
     380  coord.resize(relativePartic_.size(), 0.0 );
    370381  cout << " particleBeam::particlesPhaseSpaceComponent index = " << index << endl;
    371382
    372383  if ( index <= 2 ) {
    373     for (unsigned i = 0; i < goodPartic_.size(); ++i) {
    374       coord.at(i) =  10.*goodPartic_.at(i).getPosition().getComponent(index);  // en mm
     384
     385    for (unsigned i = 0; i < relativePartic_.size(); ++i) {
     386
     387      coord.at(i) =  10.*coordonneesDeployees(i).getComponent(index);
     388      //      coord.at(i) =  10.*relativePartic_.at(i).getPosition().getComponent(index);  // en mm
    375389    }
    376390    return;
     
    378392 
    379393  if ( index >  2 && index < 5 ) {
    380     for (unsigned i = 0; i < goodPartic_.size(); ++i) {
    381       double begamz = goodPartic_.at(i).getBetaGamma().getComponent(2);
     394    for (unsigned i = 0; i < relativePartic_.size(); ++i) {
     395      double begamz = relativePartic_.at(i).getBetaGamma().getComponent(2);
    382396      if ( begamz != 0.0) {
    383         coord.at(i) =  1000.*goodPartic_.at(i).getBetaGamma().getComponent(index - 3)/begamz; // milliradians
     397        coord.at(i) =  1000.*relativePartic_.at(i).getBetaGamma().getComponent(index - 3)/begamz; // milliradians
    384398      } else {
    385399        coord.at(i) = 0.0;
     
    392406    double gamma0 = referenceParticle_.getGamma();
    393407    if ( gamma0 == 0.0 ) return;
    394     for (unsigned i = 0; i < goodPartic_.size(); ++i) {
    395       coord.at(i) =  100.*(goodPartic_.at(i).getGamma() - gamma0)/gamma0;  // en %
     408    for (unsigned i = 0; i < relativePartic_.size(); ++i) {
     409      coord.at(i) =  100.*(relativePartic_.at(i).getGamma() - gamma0)/gamma0;  // en %
    396410    }
    397411    return;
     
    618632  double ecatyp= 0.0;
    619633 
    620   for (unsigned int k = 0; k < goodPartic_.size(); k++) {
     634  for (unsigned int k = 0; k < relativePartic_.size(); k++) {
    621635    if (vshf[k] < vmin) vmin = vshf[k];
    622636    else if (vshf[k] > vmax) vmax = vshf[k];
     
    625639  }
    626640
    627   double sum= (float)goodPartic_.size();
     641  double sum= (float)relativePartic_.size();
    628642  out[0]= sum;
    629643  vmoy /= sum;
     
    654668  }
    655669
    656   for (unsigned int k = 0; k < goodPartic_.size(); k++) {
     670  for (unsigned int k = 0; k < relativePartic_.size(); k++) {
    657671    vshf[k] -= vmoy;
    658672  }
     
    706720}
    707721
     722 // coordonnees d'une particule dans le faisceau deploye ( passage
     723 // d'une representation z=cte a une representation t=cte)
     724TRIDVECTOR particleBeam::coordonneesDeployees(unsigned particleIndex, double cdtShift) {
     725    double gamma = relativePartic_.at(particleIndex).getGamma();
     726    //    TRIDVECTOR pos = relativePartic_.at(particleIndex).getPosition();
     727    double xx = relativePartic_.at(particleIndex).getReferenceToPosition().getComponent(0);
     728    double yy = relativePartic_.at(particleIndex).getReferenceToPosition().getComponent(1);
     729    double cdt = relativePartic_.at(particleIndex).getReferenceToPosition().getComponent(2);
     730    cdt += cdtShift;
     731    //    TRIDVECTOR begam= goodPartic_.at(particleIndex).getBetaGamma();
     732    double begamz = relativePartic_.at(particleIndex).getReferenceToBetaGamma().getComponent(2);
     733    double dz = begamz * cdt / gamma;
     734    double xp = relativePartic_.at(particleIndex).getReferenceToBetaGamma().getComponent(0)/begamz;
     735    double yp = relativePartic_.at(particleIndex).getReferenceToBetaGamma().getComponent(1)/begamz;
     736    xx += xp * dz;
     737    yy += yp * dz;   
     738    return TRIDVECTOR(xx, yy, dz);
     739 }
  • Interface_Web/trunk/pspaWT/sources/controler/src/softwareGenerator.cc

    r386 r417  
    182182  //  passiveParticles.resize(nbProbPart, bareParticle());
    183183  double x,y;
    184   double deltaz;
    185   double deltat;
     184  //  double deltaz;
     185  double cdeltat;
    186186  TRIDVECTOR  pos;
    187187  TRIDVECTOR betagamma;
     
    207207    double gamma = sqrt(1.0 + betagamma.norm2());
    208208
    209     // decalage temporel par rapport a la reference 
    210     deltat = faisceau.at(k).clock - timeRef; // nanoseondes
    211     double ds = CLIGHT_m_per_ns * deltat /gamma;
    212     x += betaGammax * ds;  // en metres
    213     y += betaGammay * ds;
     209    // decalage temporel par rapport a la reference  ?
     210    // on prend le faisceau sous la forme "a un instant donne"
     211
     212    //   deltat = faisceau.at(k).clock - timeRef; // nanoseondes
     213    cdeltat = CLIGHT_m_per_ns * (faisceau.at(k).clock - timeRef); // metres
     214    //    double ds = CLIGHT_m_per_ns * deltat /gamma;
     215    //    x += betaGammax * ds;  // en metres
     216    //    y += betaGammay * ds;
    214217
    215218    // ici on neglige la difference entre gamma de la part. et gamma de la ref.
    216     deltaz = (pzPartRel/EREST_eV) * CLIGHT_m_per_ns * deltat; // en metres
    217 
    218     pos.setComponents(100.*x,100.*y,100.*deltaz);  // en cm
     219    //    deltaz = (pzPartRel/EREST_eV) * CLIGHT_m_per_ns * deltat; // en metres
     220
     221    //    pos.setComponents(100.*x,100.*y,100.*deltaz);  // en cm
     222    pos.setComponents(100.*x,100.*y,100.*cdeltat);  // en cm
    219223    if ( faisceau.at(k).flag == -1 ) {
    220224      particles.push_back(bareParticle(pos,betagamma));
  • Interface_Web/trunk/pspaWT/sources/controler/src/softwareParmela.cc

    r398 r417  
    2222  cout << " setRelativeParmelaElementIndices() taille a priori : " << relativeParmelaElementIndices_.size() << endl;
    2323  abstractElement* elPtr = dataManager_->getElementPointerFromNumero(numeroDeb_);
     24
    2425  bool there_is_rfgun = ( elPtr->getNomdElement().getElementType() == RFgun );
    2526  unsigned offsetNumElem;
     
    262263  particles.clear();
    263264  particles.resize(faisceau.size(), bareParticle());
    264   double x,xp,y,yp;
     265  //  double x,xp,y,yp;
     266  double xp, yp;
    265267  double betagammaz;
    266   double betaz;
    267   double deltaz;
     268  //  double betaz;
     269  double cdt;
    268270  double dephas;
    269271  double g;
     
    273275  // sont donnes en radians
    274276  for (unsigned k = 0; k < faisceau.size(); k++) {
    275     x= faisceau.at(k).xx;
     277    //    x= faisceau.at(k).xx;
    276278    xp=faisceau.at(k).xxp;
    277     y= faisceau.at(k).yy;
     279    //    y= faisceau.at(k).yy;
    278280    yp=faisceau.at(k).yyp;
    279281    // dephasage par rapport a la reference
     
    281283    g = faisceau.at(k).wz/EREST_MeV;
    282284    betagammaz = faisceau.at(k).begamz;
    283     betaz = betagammaz/(g+1.0);
    284     deltaz = FACTEUR * betaz * dephas / referencefrequency;
    285     x += xp * deltaz;
    286     y += yp * deltaz;
    287     pos.setComponents(x,y,deltaz);
     285    //    betaz = betagammaz/(g+1.0);
     286    //    deltaz = FACTEUR * betaz * dephas / referencefrequency;
     287    cdt = FACTEUR * dephas / referencefrequency;
     288    //    x += xp * deltaz;
     289    //    y += yp * deltaz;
     290    pos.setComponents(faisceau.at(k).xx,faisceau.at(k).yy,cdt);
    288291    betagamma.setComponents(xp*betagammaz, yp*betagammaz, betagammaz);
    289292    particles.at(k) = bareParticle(pos,betagamma);
     
    311314    }
    312315   
    313     const vector<bareParticle>& partic = beam->getParticleVector();
     316    //    const vector<bareParticle>& partic = beam->getParticleVector();
    314317    double weight = 1.0;
    315318    double xx,yy,zz;
    316319    double begamx, begamy, begamz;
    317     for (unsigned k = 0; k < partic.size(); k++) {
    318         partic.at(k).getPosition().getComponents(xx,yy,zz);
    319         partic.at(k).getBetaGamma().getComponents(begamx,begamy,begamz);
     320    //    TRIDVECTOR pos, begam;
     321    double zmin = GRAND;
     322    double zmax = -zmin;
     323    double cdtmin, cdtmax;
     324    beam->ZrangeCdt(cdtmin, cdtmax);
     325    cout << " softwareParmela::beamToParmela cdtmin = " << cdtmin << " cdtmax = " << cdtmax << endl;
     326 
     327    for (unsigned k = 0; k < beam->getNbParticles(); k++) {
     328        // partic.at(k).getPosition().getComponents(xx,yy,zz);
     329        // partic.at(k).getBetaGamma().getComponents(begamx,begamy,begamz);
     330      beam->coordonneesDeployees(k, -cdtmax).getComponents(xx,yy,zz);
     331      beam->betaGamma(k).getComponents(begamx,begamy,begamz);
     332      if ( zz > zmax) zmax = zz;
     333      if ( zz < zmin ) zmin = zz;
    320334        outfile << xx << " " << begamx << " " <<  yy << " " << begamy << " " << zz << " " << begamz  << " " << weight << endl;
    321335    }
    322336    outfile.close();
     337    cout << " softwareParmela::beamToParmela zmn = " << zmin << " zmax = " << zmax << endl;
    323338    return true;
    324339}
  • Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_pspaApplication.h

    r414 r417  
    9292  //  void scatterPlot1D(WContainerWidget* toto, vector<double>& xcor, vector<double>& ycor);
    9393
    94   void chartPlot2vec(WContainerWidget* toto, vector<double>& xcor, vector<double>& ycor, bool drawPoints, string title, string legendx, string legendy, int width, int height, bool makeIcon=false);
     94  // void chartPlot2vec(WContainerWidget* toto, vector<double>& xcor, vector<double>& ycor, bool drawPoints, string title, string legendx, string legendy, int width, int height, bool makeIcon=false);
    9595  void chartPlot2vec(WContainerWidget* toto,vector<double>& xcor,vector<double>& ycor,Wt::Chart::SeriesType seriesType,Wt::Chart::FillRangeType fillRange,Wt::Chart::AxisValue value,bool isGridLinesEnables,string title,string legendx,string legendy,int width,int height,bool makeIcon = false);
    9696
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_console.cc

    r411 r417  
    2424    Wt::WLabel *label = new Wt::WLabel("Search ", searchContainer);
    2525    searchLineEdit_ = new Wt::WLineEdit("", searchContainer);
    26     searchLineEdit_->setToolTip("clic here to search a string into the output");
     26    searchLineEdit_->setToolTip("clic here to search a string in the output");
    2727   
    2828    // le panel
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_pspaApplication.cc

    r416 r417  
    702702
    703703
    704 // parametre drawPoints : true = on trace des points (phase space) ; false = on trace des lignes (enveloppes...)
    705 void PspaApplication::chartPlot2vec(WContainerWidget* toto, vector<double>& xcor, vector<double>& ycor, bool drawPoints,string title,string legendx, string legendy,int width, int height, bool makeIcon)
    706 {
    707     int nbpts = xcor.size();
    708     cout << " PspaApplication::chartPlot2vec nbpts = " << nbpts << endl;
    709     WStandardItemModel *model = new WStandardItemModel(nbpts, 2, toto);
    710     for (int i = 0; i < nbpts; ++i) {
    711         model->setData(i, 0, xcor.at(i));
    712         model->setData(i, 1, ycor.at(i));
    713         //    cout << " PspaApplication::chartPlot2vec el= " << i+1 << " x= " << xcor.at(i) << " y= " << ycor.at(i) << endl;
    714     }
    715    
    716     WCartesianChart *chart = new WCartesianChart(toto);
    717     if (!makeIcon) {
    718         chart->setTitle(title);
    719     }
    720     chart->initLayout();
    721    
    722     chart->setModel(model);        // set the model
    723     chart->setXSeriesColumn(0);    // set the column that holds the X data
    724     if (!makeIcon) {
    725         chart->setLegendEnabled(true); // enable the legend
    726     } else {
    727         chart->setLegendEnabled(false); // enable the legend
    728     }
    729    
    730     chart->setType(ScatterPlot);   // set type to ScatterPlot
    731    
    732     // Typically, for mathematical functions, you want the axes to cross
    733     // at the 0 mark:
    734     chart->axis(XAxis).setLocation(ZeroValue);
    735     chart->axis(YAxis).setLocation(ZeroValue);
    736 
    737     // Provide space for the X and Y axis and title.
    738     chart->setPlotAreaPadding(80, Left);  // ?
    739     chart->setPlotAreaPadding(40, Bottom);
    740     chart->setPlotAreaPadding(60, Top);
    741     if ( drawPoints ) {
    742       WDataSeries s(1, PointSeries, Y1Axis);
    743       chart->addSeries(s);   
    744     } else {
    745       WDataSeries s(1, LineSeries, Y1Axis);
    746       chart->addSeries(s);   
    747     }
    748     chart->resize(width, height); // WPaintedWidget must be given explicit size
    749    
    750    
    751     WAxis& axis = chart->axis(XAxis);
    752     axis.setLabelFormat("%.3f");
    753     //       axis.setGridLinesEnabled(true);
    754     axis.setTitle(legendx);
    755    
    756     WAxis& axey = chart->axis(YAxis);
    757     axey.setTitle(legendy);
    758     // axis = chart->axis(YAxis);
    759     // axis.setLabelFormat("%.3f");
    760     // axis.setGridLinesEnabled(true);
    761     // axis.setTitle(legendy);
    762    
    763     if (makeIcon) {
    764       chart->setPlotAreaPadding(0);
    765       chart->setAxisPadding(0);
    766       WFont xAxisFont = chart->axis(XAxis).labelFont();
    767       xAxisFont.setSize(8);
    768       WFont yAxisFont = chart->axis(YAxis).labelFont();
    769       yAxisFont.setSize(8);
    770       chart->axis(XAxis).setLabelFont(xAxisFont);
    771       chart->axis(YAxis).setLabelFont(yAxisFont);
    772     }
    773 
    774 #ifdef HAS_IMAGEMAGIC
    775 /*    Wt::WRasterImage pngImage("png", 600, 600);
    776     Wt::WPainter p(&pngImage);
    777     chart->paint(p);
    778     std::string name;
    779     name = workingDir_ + "/chart-"+sessionId ()+".png";
    780     std::ofstream f(name.c_str(), std::ios::out |std::ios::trunc | std::ios::binary);
    781     pngImage.write(f);   
    782     new WText("<a href='workingArea/chart-"+sessionId ()+".png' target='_blank'>Afficher l'image</a>",toto);
    783    
    784   Wt::WPdfImage pdfImage("30cm", "30cm");
    785     Wt::WPainter p1(&pdfImage);
    786     pdfImage.init();
    787     chart->paint(p1);
    788     name = workingDir_ + "/chart-"+sessionId ()+".pdf";
    789     std::ofstream f1(name.c_str(), std::ios::out |std::ios::trunc | std::ios::binary);
    790     pdfImage.write(f1);
    791  */
    792 #endif
    793 }
     704// // parametre drawPoints : true = on trace des points (phase space) ; false = on trace des lignes (enveloppes...)
     705// void PspaApplication::chartPlot2vec(WContainerWidget* toto, vector<double>& xcor, vector<double>& ycor, bool drawPoints,string title,string legendx, string legendy,int width, int height, bool makeIcon)
     706// {
     707//     int nbpts = xcor.size();
     708//     cout << " PspaApplication::chartPlot2vec nbpts = " << nbpts << endl;
     709//     WStandardItemModel *model = new WStandardItemModel(nbpts, 2, toto);
     710//     for (int i = 0; i < nbpts; ++i) {
     711//         model->setData(i, 0, xcor.at(i));
     712//         model->setData(i, 1, ycor.at(i));
     713//         //    cout << " PspaApplication::chartPlot2vec el= " << i+1 << " x= " << xcor.at(i) << " y= " << ycor.at(i) << endl;
     714//     }
     715   
     716//     WCartesianChart *chart = new WCartesianChart(toto);
     717//     if (!makeIcon) {
     718//         chart->setTitle(title);
     719//     }
     720//     chart->initLayout();
     721   
     722//     chart->setModel(model);        // set the model
     723//     chart->setXSeriesColumn(0);    // set the column that holds the X data
     724//     if (!makeIcon) {
     725//         chart->setLegendEnabled(true); // enable the legend
     726//     } else {
     727//         chart->setLegendEnabled(false); // enable the legend
     728//     }
     729   
     730//     chart->setType(ScatterPlot);   // set type to ScatterPlot
     731   
     732//     // Typically, for mathematical functions, you want the axes to cross
     733//     // at the 0 mark:
     734//     chart->axis(XAxis).setLocation(ZeroValue);
     735//     chart->axis(YAxis).setLocation(ZeroValue);
     736
     737//     // Provide space for the X and Y axis and title.
     738//     chart->setPlotAreaPadding(80, Left);  // ?
     739//     chart->setPlotAreaPadding(40, Bottom);
     740//     chart->setPlotAreaPadding(60, Top);
     741//     if ( drawPoints ) {
     742//       WDataSeries s(1, PointSeries, Y1Axis);
     743//       chart->addSeries(s);   
     744//     } else {
     745//       WDataSeries s(1, LineSeries, Y1Axis);
     746//       chart->addSeries(s);   
     747//     }
     748//     chart->resize(width, height); // WPaintedWidget must be given explicit size
     749   
     750   
     751//     WAxis& axis = chart->axis(XAxis);
     752//     axis.setLabelFormat("%.3f");
     753//     //       axis.setGridLinesEnabled(true);
     754//     axis.setTitle(legendx);
     755   
     756//     WAxis& axey = chart->axis(YAxis);
     757//     axey.setTitle(legendy);
     758//     // axis = chart->axis(YAxis);
     759//     // axis.setLabelFormat("%.3f");
     760//     // axis.setGridLinesEnabled(true);
     761//     // axis.setTitle(legendy);
     762   
     763//     if (makeIcon) {
     764//       chart->setPlotAreaPadding(0);
     765//       chart->setAxisPadding(0);
     766//       WFont xAxisFont = chart->axis(XAxis).labelFont();
     767//       xAxisFont.setSize(8);
     768//       WFont yAxisFont = chart->axis(YAxis).labelFont();
     769//       yAxisFont.setSize(8);
     770//       chart->axis(XAxis).setLabelFont(xAxisFont);
     771//       chart->axis(YAxis).setLabelFont(yAxisFont);
     772//     }
     773
     774// #ifdef HAS_IMAGEMAGIC
     775// /*    Wt::WRasterImage pngImage("png", 600, 600);
     776//     Wt::WPainter p(&pngImage);
     777//     chart->paint(p);
     778//     std::string name;
     779//     name = workingDir_ + "/chart-"+sessionId ()+".png";
     780//     std::ofstream f(name.c_str(), std::ios::out |std::ios::trunc | std::ios::binary);
     781//     pngImage.write(f);   
     782//     new WText("<a href='workingArea/chart-"+sessionId ()+".png' target='_blank'>Afficher l'image</a>",toto);
     783   
     784//   Wt::WPdfImage pdfImage("30cm", "30cm");
     785//     Wt::WPainter p1(&pdfImage);
     786//     pdfImage.init();
     787//     chart->paint(p1);
     788//     name = workingDir_ + "/chart-"+sessionId ()+".pdf";
     789//     std::ofstream f1(name.c_str(), std::ios::out |std::ios::trunc | std::ios::binary);
     790//     pdfImage.write(f1);
     791// */
     792// #endif
     793// }
    794794
    795795
     
    950950*/
    951951 
    952   Wt::WPdfImage pdfImage("1000", "600");
     952//  Wt::WPdfImage pdfImage("1000", "600");
     953  WPdfImage pdfImage("1000", "600");
    953954  {
    954955   Wt::WPainter p1(&pdfImage);
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_serverFileSelector.cc

    r401 r417  
    1111#include <Wt/WIconPair>
    1212#include <Wt/WApplication>
     13
    1314
    1415#include <boost/algorithm/string.hpp>
Note: See TracChangeset for help on using the changeset viewer.