Ejemplo n.º 1
0
static montecarlo_event_handler_t
get_event_handler (rpacket_t * packet, storage_model_t * storage,
                   double *distance, rk_state *mt_state)
{
  montecarlo_compute_distances (packet, storage);
  double d_boundary = rpacket_get_d_boundary (packet);
  double d_continuum = rpacket_get_d_continuum (packet);
  double d_line = rpacket_get_d_line (packet);
  montecarlo_event_handler_t handler;
  if (d_line <= d_boundary && d_line <= d_continuum)
    {
      *distance = d_line;
      handler = &montecarlo_line_scatter;
    }
  else if (d_boundary <= d_continuum)
    {
      *distance = d_boundary;
      handler = &move_packet_across_shell_boundary;
    }
  else
    {
      *distance = d_continuum;
      handler = montecarlo_continuum_event_handler(packet, storage, mt_state);
    }
  return handler;
}
Ejemplo n.º 2
0
inline montecarlo_event_handler_t get_event_handler(rpacket_t *packet, storage_model_t *storage, double *distance)
{
  double d_boundary, d_electron, d_line;
  montecarlo_compute_distances(packet, storage);
  d_boundary = rpacket_get_d_boundary(packet);
  d_electron = rpacket_get_d_electron(packet);
  d_line = rpacket_get_d_line(packet);
  montecarlo_event_handler_t handler;
  if (d_line <= d_boundary && d_line <= d_electron)
    {
      *distance = d_line;
      handler =  &montecarlo_line_scatter;
    }
  else if (d_boundary <= d_electron)
    {
      *distance = d_boundary;
      handler =  &move_packet_across_shell_boundary;
    }
  else
    {
      *distance = d_electron;
      handler = &montecarlo_thomson_scatter;
    }
  return handler;
}