Show
Ignore:
Timestamp:
06/09/10 14:00:40 (14 years ago)
Author:
mido
Message:

astyle applied all over the library

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • library/tests/stresssuite/square_mat_prep.cpp

    r717 r1064  
    2222 
    2323int main ( int argc, char const *argv[] ) { 
    24         RNG_randomize(); 
     24    RNG_randomize(); 
    2525 
    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            } 
    4343 
    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        } 
    5656 
    57                 ++param; 
    58         } 
     57        ++param; 
     58    } 
    5959 
    60         if ( unknown || update_next ) { 
    61                 cerr << "usage: " << argv[0] << " [ -g generator.cfg ] [ -a agenda_output.cfg ] [ -l agenda_length ]" << endl; 
    62         } else { 
    63                 Array<shared_ptr<square_mat_point> > mag ( agenda_length ); 
     60    if ( unknown || update_next ) { 
     61        cerr << "usage: " << argv[0] << " [ -g generator.cfg ] [ -a agenda_output.cfg ] [ -l agenda_length ]" << endl; 
     62    } else { 
     63        Array<shared_ptr<square_mat_point> > mag ( agenda_length ); 
    6464 
    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        } 
    7373 
    74                 UIFile fag; 
    75                 UI::save ( mag, fag, "agenda" ); 
    76                 fag.save ( agenda_file_name ); 
    77         } 
     74        UIFile fag; 
     75        UI::save ( mag, fag, "agenda" ); 
     76        fag.save ( agenda_file_name ); 
     77    } 
    7878}