本文整理汇总了C++中Plot::addKey方法的典型用法代码示例。如果您正苦于以下问题:C++ Plot::addKey方法的具体用法?C++ Plot::addKey怎么用?C++ Plot::addKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plot
的用法示例。
在下文中一共展示了Plot::addKey方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
//We compute the trajectory
for(int nTraj=0; !stopStepper ; nTraj++)
{
//We call the function which solve eq of the motion
mySolve.controlledRK5(mySystem,x,t,dt,error,desiredErrorMin,desiredErrorMax);
//If the electron is always bonded to the attractor, we do not consider the event
if((t-myIC.tBirth)>10.*myField.opticalCycle)
{
unexpectedStop=true;
stopStepper=true;
}
//We stop when the electron is fully ionized
if(sqrt(x[0]*x[0]+x[1]*x[1]+x[2]*x[2])>300.)
stopStepper=true;
//We check if the step is no too small (otherwise the simulation will take too much time)
if(dt<dtMin)
{
stopStepper=true;
unexpectedStop=true;
}
}
//We store the asymptotic velocity in a container of map type with a view to making a data binning
mySpectra.storeDataBinning(x, t, myIC.weightIonization, unexpectedStop || isWeightTooSmall);
if(unexpectedStop==true)
unexpectedStopNbr+=1;
if(isWeightTooSmall==true)
weightTooSmallNbr+=1;
//We update the load bar and display some informations
if(iVYPerpBirth+nVYPerpBirth*((iVZPrimPerpBirth-1)+(iFieldBirth-1)*nVZPrimPerpBirth)%1000==0)
{
myDisplay.loadbar(iVYPerpBirth+nVYPerpBirth*((iVZPrimPerpBirth-1)+(iFieldBirth-1)*nVZPrimPerpBirth),nFieldBirth*nVZPrimPerpBirth*nVYPerpBirth);
myDisplay("ellipticity", myField.ellipticity);
myDisplay("rhoBirth",myIC.rhoBirth);
myDisplay("phaseBirth",myField.pulsation*myIC.tBirth*180./M_PI);
myDisplay("vPerpBirth", myIC.vPerpBirth);
myDisplay("vYPerpBirth", myIC.vYPerpBirth);
myDisplay("vZPrimPerpBirth", myIC.vZPrimPerpBirth);
myDisplay.variableArg<double>("charges", 4, myPotential->charge[0], myPotential->charge[1], myPotential->charge[2], myPotential->charge[3]);
myDisplay.variableArg<double>("bondLength", 3, myPotential->bondLength[0], myPotential->bondLength[1], myPotential->bondLength[2], myPotential->bondLength[3]);
myDisplay("step", dt);
myDisplay("stepMin", dtMin);
myDisplay("error", error);
myDisplay("errorMin", desiredErrorMin);
myDisplay("asymptoticEnergy",mySpectra.asymptoticEnergy(x,t));
myDisplay("weightIonization",myIC.weightIonization);
myDisplay("binsWidth",mySpectra.binsWidth);
myDisplay("spectraPointNbr", mySpectra.spectraPointsNbr);
myDisplay("ptsNumber", nFieldBirth*nVZPrimPerpBirth*nVYPerpBirth);
myDisplay("unexpectedStopNbr", double(unexpectedStopNbr)/(nFieldBirth*nVZPrimPerpBirth*nVYPerpBirth)*100., "%");
myDisplay("weightMinThreshold",weightMinThreshold);
myDisplay("weightTooSmallNbr", double(weightTooSmallNbr)/(nFieldBirth*nVZPrimPerpBirth*nVYPerpBirth)*100., "%");
}
}
}
}
//Finally we write the data binning in the file "dataFile"
mySpectra.writeDataBinning(dataFile);
//We build the legend of the plot
myPlot.addKey("nField",nFieldBirth);
myPlot.addKey("nVYPerp",nVYPerpBirth);
myPlot.addKey("nVZPrimPerp",nVZPrimPerpBirth);
myPlot.addKeyVariableArg<double>("charges", 4, myPotential->charge[0], myPotential->charge[1], myPotential->charge[2], myPotential->charge[3]);
myPlot.addKeyVariableArg<double>("bondLength", 3, myPotential->bondLength[0], myPotential->bondLength[1], myPotential->bondLength[2], myPotential->bondLength[3]);
myPlot.addKey("weightThreshold",weightMinThreshold);
myPlot.addKey("weightTooSmallNbr", int(double(weightTooSmallNbr)/(nFieldBirth*nVZPrimPerpBirth*nVYPerpBirth)*1000.)/10., "%");
myPlot.addKey("spectraPointNbr", mySpectra.spectraPointsNbr);
myPlot.addKey("unexpectedStopNbr",int(double(unexpectedStopNbr)/(nFieldBirth*nVZPrimPerpBirth*nVYPerpBirth)*1000.)/10., "%");
myPlot.addKey("binsWidth",mySpectra.binsWidth);
myPlot.addKey("ErrorMax",desiredErrorMax);
myPlot.addKey("dtMin",dtMin);
myPlot.addKey("ellipticity", myField.ellipticity);
myPlot.addKey("fieldAmplMax",myField.fieldAmpl, "au");
myPlot.addKey("waveLenght",myField.waveLenght*1.E9, "nm");
myPlot.addKey("duration",myDisplay.elapsedTime);
myPlot.addInstruction("set xlabel 'Asymptotic energy (au)'");
myPlot.addInstruction("set ylabel 'Probability (log)'");
myPlot.addInstruction("set xrange [0:1]");
myPlot.setPlotType("plot");
myPlot.addPlot("'data.dat' index 0 using 1:2 w l lc rgb 'violet' title 'Photo-electron spectrum with vY positive'");
myPlot.addPlot("'data.dat' index 1 using 1:2 w l lc rgb 'violet' title 'Photo-electron spectrum with vY negative'");
myPlot.gnuplot();
return 0;
}