英语翻译The scattering program requires the Scatter,ScatterAnalysis,and ScatterApp classes.The ScatterApp class in Listing 5.6 organizes the startup process and creates the visualizations.As usual,it extends AbstractSimul ati on by overriding the doStep method.However,in this case a single step is not a time step.A step calculates a trajectory and scattering angle for the given impact parameter.After a trajectory is calculated,the impact parameter is incr
英语翻译
The scattering program requires the Scatter,ScatterAnalysis,and ScatterApp classes.The ScatterApp class in Listing 5.6 organizes the startup process and creates the visualizations.As usual,it extends AbstractSimul ati on by overriding the doStep method.However,in this case a single step is not a time step.A step calculates a trajectory and scattering angle for the given impact parameter.After a trajectory is calculated,the impact parameter is incremented and the panel is repainted.If necessary,you can eliminate this visualization to increase the computational speed.If the new impact parameter exceeds the beam radius bmax,the animation is stopped and the accumulated data is analyzed.Note that the cal cul ateTrajectory method returns true if the calculation succeeded and that an error message is printed if the calculation fails.Including a failsafe mechanism to stop a computation is good programming practice.