source: PSPA/madxPSPA/src/mad_ibs.c @ 478

Last change on this file since 478 was 430, checked in by touze, 11 years ago

import madx-5.01.00

File size: 1.5 KB
Line 
1#include "madx.h"
2
3void
4pro_ibs(struct in_cmd* cmd)
5  /* control for IBS module */
6{
7  struct command* keep_beam = current_beam;
8  struct name_list* nl = current_ibs->par_names;
9  struct command_parameter_list* pl = current_ibs->par;
10  char *filename = NULL, *table_name = NULL;
11  int pos, w_file;
12
13  (void)cmd;
14 
15  if (twiss_table == NULL)
16    warning("no TWISS table present","IBS command ignored");
17  else
18  {
19    if ((current_beam
20         = find_command(twiss_table->org_sequ->name, beam_list)) == NULL)
21      current_beam = find_command("default_beam", beam_list);
22    if (probe_beam != NULL) delete_command(probe_beam);
23    probe_beam = clone_command(current_beam);
24    pos = name_list_pos("file", nl);
25    if (nl->inform[pos])
26    {
27      if ((filename = pl->parameters[pos]->string) == NULL)
28      {
29        if (pl->parameters[pos]->call_def != NULL)
30          filename = pl->parameters[pos]->call_def->string;
31      }
32      if (filename == NULL) filename = permbuff("dummy");
33      w_file = 1;
34    }
35    else w_file = 0;
36    set_option("ibs_table", &w_file); /* fill only if output */
37    if (w_file)
38    {
39      table_name = permbuff("ibs");
40      ibs_table = make_table(table_name, "ibs", ibs_table_cols,
41                             ibs_table_types, current_sequ->n_nodes);
42      add_to_table_list(ibs_table, table_register);
43    }
44    adjust_probe(zero); /* sets correct gamma, beta, etc. */
45    ibs_();
46    if (w_file) out_table(table_name, ibs_table, filename);
47    if (probe_beam) probe_beam = delete_command(probe_beam);
48    current_beam = keep_beam;
49  }
50}
51
52
Note: See TracBrowser for help on using the repository browser.