Show
Ignore:
Timestamp:
03/04/10 16:41:30 (14 years ago)
Author:
smidl
Message:

changes in Loggers!

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • library/bdm/base/bdmbase.h

    r822 r850  
    2626 
    2727namespace bdm { 
     28 
    2829//! Structure of RV, i.e. RVs expanded into a flat list of IDs, used for debugging. 
    2930class str { 
     
    346347 
    347348 
     349 
    348350//! Class representing function \f$f(x)\f$ of variable \f$x\f$ represented by \c rv 
    349 class fnc : public root { 
     351class fnc : public root {        
    350352protected: 
    351353        //! Length of the output vector 
     
    490492//! Probability density function with numerical statistics, e.g. posterior density. 
    491493class epdf : public pdf { 
     494        LOG_LEVEL(epdf,jedna,dva,tri,deset); 
    492495 
    493496public: 
     
    505508        epdf() {}; 
    506509        epdf ( const epdf &e ) : pdf ( e ) {}; 
    507                  
     510         
     511         
    508512        //!@} 
    509513 
     
    887891 
    888892class DS : public root { 
     893        LOG_LEVEL(DS,jednicka); 
    889894protected: 
    890895        //! size of data returned by \c getdata() 
     
    903908        //! default constructors 
    904909        DS() : dtsize ( 0 ), utsize ( 0 ), ytsize ( 0 ), Drv(), Urv(), Yrv() { 
    905                 log_level = 1; 
     910                log_level[jednicka] = true; 
    906911        }; 
    907912 
     
    971976\f] 
    972977 
    973  
    974978*/ 
    975979 
    976980class BM : public root { 
     981        LOG_LEVEL(BM,full,likelihood,bounds); 
     982 
    977983protected: 
    978984        //! Random variable of the data (optional) 
     
    9951001 
    9961002        BM() : yrv(), dimy ( 0 ), rvc(), dimc ( 0 ), ll ( 0 ), evalll ( true ) { }; 
    997 //      BM ( const BM &B ) :  yrv ( B.yrv ), dimy(B.dimy), rvc ( B.rvc ),dimc(B.dimc), ll ( B.ll ), evalll ( B.evalll ) {} 
     1003        //      BM ( const BM &B ) :  yrv ( B.yrv ), dimy(B.dimy), rvc ( B.rvc ),dimc(B.dimc), ll ( B.ll ), evalll ( B.evalll ) {} 
    9981004        //! \brief Copy function required in vectors, Arrays of BM etc. Have to be DELETED manually! 
    9991005        //! Prototype: \code BM* _copy() const {return new BM(*this);} \endcode 
    1000         virtual BM* _copy() const {             return NULL;    }; // TODO NEBUDE TU TAKY LEPSI BDM_ERROR??! 
     1006        virtual BM* _copy() const NOT_IMPLEMENTED(NULL); 
    10011007        //!@} 
    10021008 
     
    10891095        //!@{ 
    10901096 
    1091         //! Set boolean options from a string, recognized are: "logbounds,logll" 
    1092         virtual void set_options ( const string &opt ); 
    1093  
    10941097        //! Add all logged variables to a logger 
    10951098        //! Log levels two digits: xy where 
     
    11161119                } 
    11171120 
    1118                 string opt; 
    1119                 if ( UI::get ( opt, set, "options", UI::optional ) ) { 
    1120                         set_options ( opt ); 
    1121                 } 
     1121                UI::get ( log_level, set, "log_level", UI::optional ); 
     1122 
    11221123        } 
    11231124 
     
    11271128                UI::save( &rvc, set, "rvc" );            
    11281129                UI::save( &posterior()._rv(), set, "rv" ); 
    1129  
    1130                 string opt; 
    1131                 switch( posterior()._log_level() ) 
    1132                 { 
    1133                 case 2: 
    1134                         opt = "logbounds "; 
    1135                         break; 
    1136                 case 10: 
    1137                         opt = "logfull "; 
    1138                         break; 
    1139                 default: 
    1140                         opt = ""; 
    1141                         break; 
     1130                UI::save( log_level, set ); 
     1131        } 
     1132 
     1133        void validate() 
     1134        { 
     1135                if ( log_level[full] ) { 
     1136                        const_cast<epdf&> ( posterior() ).log_level[epdf::deset] = true; 
     1137                } else { 
     1138                        if ( log_level[bounds] ) { 
     1139                                const_cast<epdf&> ( posterior() ).log_level[epdf::dva] = true; 
     1140                        } else { 
     1141                                const_cast<epdf&> ( posterior() ).log_level[epdf::jedna] = true;; 
     1142                        } 
     1143                        if ( log_level[likelihood] ) { 
     1144                                // TODO testovat tedy likelyhood misto 1.. log_level = 1; 
     1145                        } 
    11421146                } 
    1143                 if( log_level == 1 ) opt = opt + "logll"; 
    1144                 if( !opt.empty() ) 
    1145                         UI::save( opt, set, "options" ); 
    11461147        } 
    11471148};