src/Pulses/PulWaveform.cc
// Input	PWF	: A pulse waveform (this)
//              td      : An evolution time (sec)
// Output       steps   : Number of waveform steps needed
//                        to evolve for time td
Input  PWF     : A pulse waveform (this)
td      : An evolution time (sec)
Output       steps   : Number of waveform steps needed
to evolve for time td
Input PWF : A pulse waveform ( this ) td : An evolution time ( sec ) Output steps : Number of waveform steps needed to evolve for time td
double PulWaveform::steps(double td) const
  {
  if(td<=0 || !WFtp) return 0;			
  int nloops=-1;                                
  double tloop=0;                               
  while(tloop <= td)
    {
    nloops++;
    if(tloop == td)
      return double(nloops*WFsteps);
    tloop += length();
    }
  double lsteps = double(nloops*WFsteps);       
  double t = tloop - length();                  
  for(int i=0; i<WFsteps; i++) 			
    {                                           
    t += length(i);
    if(t == td) return double(i+1+lsteps);
    else if(t > td)
      {
      t -= length(i);
      t = td-t;
      return double(i) + t/length(i) + lsteps;
      }
    }
  PWFfatality(20); 				
  return 0;
  }
double PulWaveform :: steps ( double td ) const { if ( td <= 0 || ! WFtp ) return 0 ; int nloops = -1 ; double tloop = 0 ; while ( tloop <= td ) { nloops ++ ; if ( tloop == td ) return double ( nloops * WFsteps ) ; tloop += length ( ) ; } double lsteps = double ( nloops * WFsteps ) ; double t = tloop - length ( ) ; for ( int i = 0 ; i < WFsteps ; i ++ ) { t += length ( i ) ; if ( t == td ) return double ( i + 1 + lsteps ) ; else if ( t > td ) { t -= length ( i ) ; t = td - t ; return double ( i ) + t / length ( i ) + lsteps ; } } PWFfatality ( 20 ) ; return 0 ; }
Input  PWF     : A pulse waveform (this)
td      : An evolution time (sec)
Output       steps   : Number of waveform steps needed
to evolve for time td
Input PWF : A pulse waveform ( this ) td : An evolution time ( sec ) Output steps : Number of waveform steps needed to evolve for time td
// Exit if no waveform,time // First find out how many // full pulses are needed // Steps evovled so far // Time evolved so far // Now find out how many // waveform steps we need // Should never make it here