26 | | bool unknown = false; |
27 | | int update_next = 0; // 1 generator file, 2 agenda file, 3 agenda length |
28 | | const char **param = argv + 1; |
29 | | while ( *param && !unknown ) { |
30 | | if ( update_next ) { |
31 | | if ( update_next == 1 ) { |
32 | | generator_file_name = *param; |
33 | | } else if ( update_next == 2 ) { |
34 | | agenda_file_name = *param; |
35 | | } else { |
36 | | int length = atoi ( *param ); |
37 | | if ( length > 0 ) { |
38 | | agenda_length = length; |
39 | | } else { |
40 | | cerr << "invalid agenda length value ignored" << endl; |
41 | | } |
42 | | } |
| 26 | bool unknown = false; |
| 27 | int update_next = 0; // 1 generator file, 2 agenda file, 3 agenda length |
| 28 | const char **param = argv + 1; |
| 29 | while ( *param && !unknown ) { |
| 30 | if ( update_next ) { |
| 31 | if ( update_next == 1 ) { |
| 32 | generator_file_name = *param; |
| 33 | } else if ( update_next == 2 ) { |
| 34 | agenda_file_name = *param; |
| 35 | } else { |
| 36 | int length = atoi ( *param ); |
| 37 | if ( length > 0 ) { |
| 38 | agenda_length = length; |
| 39 | } else { |
| 40 | cerr << "invalid agenda length value ignored" << endl; |
| 41 | } |
| 42 | } |
44 | | update_next = 0; |
45 | | } else { |
46 | | if ( !strcmp ( *param, "-a" ) ) { |
47 | | update_next = 2; |
48 | | } else if ( !strcmp ( *param, "-g" ) ) { |
49 | | update_next = 1; |
50 | | } else if ( !strcmp ( *param, "-l" ) ) { |
51 | | update_next = 3; |
52 | | } else { |
53 | | unknown = true; |
54 | | } |
55 | | } |
| 44 | update_next = 0; |
| 45 | } else { |
| 46 | if ( !strcmp ( *param, "-a" ) ) { |
| 47 | update_next = 2; |
| 48 | } else if ( !strcmp ( *param, "-g" ) ) { |
| 49 | update_next = 1; |
| 50 | } else if ( !strcmp ( *param, "-l" ) ) { |
| 51 | update_next = 3; |
| 52 | } else { |
| 53 | unknown = true; |
| 54 | } |
| 55 | } |
65 | | UIFile gspec ( generator_file_name ); |
66 | | shared_ptr<generator> gen ( UI::build<generator> ( gspec, "generator", UI::compulsory ) ); |
67 | | for ( int i = 0; i < agenda_length; ++i ) { |
68 | | mat m = gen->next(); |
69 | | square_mat_point *p = new square_mat_point(); |
70 | | p->set_parameters ( m, randu ( m.rows() ), randu() ); |
71 | | mag ( i ) = p; |
72 | | } |
| 65 | UIFile gspec ( generator_file_name ); |
| 66 | shared_ptr<generator> gen ( UI::build<generator> ( gspec, "generator", UI::compulsory ) ); |
| 67 | for ( int i = 0; i < agenda_length; ++i ) { |
| 68 | mat m = gen->next(); |
| 69 | square_mat_point *p = new square_mat_point(); |
| 70 | p->set_parameters ( m, randu ( m.rows() ), randu() ); |
| 71 | mag ( i ) = p; |
| 72 | } |