Ejemplo n.º 1
0
/**
 * \fn int trajectory_run_xml (Trajectory * t, Air * a, xmlNode * node, \
 *   char *result)
 * \brief function to run the simulation open all data in a XML file.
 * \param t.
 * \brief Trajectory struct.
 * \param a
 * \brief Air struct.
 * \param node
 * \brief XML node.
 * \param result
 * \brief result file name.
 * \return 1 on success, 0 on error.
 */
int
trajectory_run_xml (Trajectory * t, Air * a, xmlNode * node, char *result)
{
  gsl_rng *rng;
#if DEBUG_TRAJECTORY
  fprintf (stderr, "trajectory_run_xml: start\n");
#endif
  rng = gsl_rng_alloc (gsl_rng_taus);
  gsl_rng_set (rng, RANDOM_SEED);
  node = node->children;
  if (!air_open_xml (a, node))
    goto exit_on_error;
  for (node = node->next; node; node = node->next)
    {
      if (!trajectory_open_xml (t, a, node, result))
        goto exit_on_error;
      trajectory_init (t, a, rng);
      air_wind_uncertainty (a, rng);
      trajectory_calculate (t, a, NULL, 0, t->file);
    }
  gsl_rng_free (rng);
#if DEBUG_TRAJECTORY
  fprintf (stderr, "trajectory_run_xml: end\n");
#endif
  return 1;

exit_on_error:
  show_error ();
  gsl_rng_free (rng);
#if DEBUG_TRAJECTORY
  fprintf (stderr, "trajectory_run_xml: end\n");
#endif
  return 0;
}
Ejemplo n.º 2
0
Archivo: main.c Proyecto: jw3/jbmcgi
int main()
{
  lpTrajectory trajectory;
  int error;

  html_setfile(stdout);

  trajectory = trajectory_create();
  if (trajectory)
  {
    error = doinput(trajectory);
    if (!error) trajectory_calculate(trajectory);
    dooutput(trajectory, error);
    trajectory_destroy(trajectory);
  }
  return 0;
}