Changeset 162 for bdm/stat/loggers.cpp

Show
Ignore:
Timestamp:
09/04/08 20:27:01 (16 years ago)
Author:
smidl
Message:

opravy a dokumentace

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • bdm/stat/loggers.cpp

    r102 r162  
    88#endif 
    99 
    10 void memlog::itsave(const char* fname){ 
    11         it_file itf(fname); 
     10void memlog::itsave ( const char* fname ) { 
     11        it_file itf ( fname ); 
    1212        int i; 
    13         for (i=0; i<entries.length();i++){ 
    14          itf << Name(names(i)) << vectors(i); 
     13        for ( i=0; i<entries.length();i++ ) { 
     14                if ( names ( i ).length() <1 ) { 
     15                        std::ostringstream o; 
     16                        o<<"Variable"<<i; 
     17                        itf << Name ( o.str() ) << vectors ( i ); 
     18                } 
     19                else { 
     20                        itf << Name ( names ( i ) ) << vectors ( i ); 
     21                } 
    1522        } 
    1623} 
     
    2633 
    2734// Initialize directory 
    28         makedir(dirname); //  
     35        makedir ( dirname ); // 
    2936 
    3037// directory OK, or it can be overwritten 
     
    4047                                scalarnames ( ii ) = names ( i ) + "_" + entries ( i ).name ( j ); 
    4148                                ii++; 
    42                         } else { 
     49                        } 
     50                        else { 
    4351                                for ( k=0;k<rvsize;k++ ) { //for all scalars in given RV 
    4452                                        sprintf ( num,"%d",k ); 
     
    6270        memlog::init(); 
    6371 
     72        //Delete old data 
    6473        write_buffers ( 0 ); 
    6574} 
     
    8190        for ( i=0;i<nen;i++ ) { //for entries 
    8291                Dt = vectors ( i )._data(); 
    83                 DtRows = vectors(i).rows(); 
    84                  
     92                DtRows = vectors ( i ).rows(); 
     93 
    8594                jj=0; 
    8695                for ( j=0;j<entries ( i ).length();j++ ) { //for RVs in entries 
     
    93102                                                fp = open ( filename, O_CREAT | O_WRONLY | O_APPEND, 00644 ); 
    94103 
    95                                         write ( fp,&Dt[jj*(DtRows)],(Len)*sizeof ( double ) ); 
     104                                        write ( fp,&Dt[jj* ( DtRows ) ], ( Len ) *sizeof ( double ) ); 
    96105                                        close ( fp ); 
    97106 
     
    106115} 
    107116 
    108 void dirfilelog::step ( bool final ) { 
     117void dirfilelog::step ( ) { 
    109118 
    110         if ( final ) { 
    111                 if ( ind>0 ) 
    112                         write_buffers ( ind ); //assuming here that i+1 was not filled 
    113         } else 
    114                 if ( ind== ( maxlen -1 ) ) { 
    115                         write_buffers ( ind+1 ); 
    116                         ind = 0; 
    117                 } else 
    118                         ind++; 
     119        if ( ind== ( maxlen -1 ) ) { 
     120                write_buffers ( ind+1 ); 
     121                ind = 0; 
     122        } 
     123        else 
     124                ind++; 
    119125 
    120126} 
     127 
     128void dirfilelog::finalize ( ) { 
     129        if ( ind>0 ) 
     130                write_buffers ( ind ); //assuming here that i+1 was not filled 
     131}