Changeset 392

Show
Ignore:
Timestamp:
06/19/09 17:57:53 (15 years ago)
Author:
smidl
Message:

compilation fixes - UI_build use exceptions now!!!!

Location:
library/bdm
Files:
5 modified

Legend:

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

    r390 r392  
    570570public: 
    571571        //!Default constructor 
    572         mepdf ( epdf* em, bool owning_ep0=false ) :mpdf ( ) {ep= em ;owning_ep=owning_ep0;}; 
     572        mepdf ( epdf* em, bool owning_ep0=false ) :mpdf ( ) {ep= em ;owning_ep=owning_ep0;dimc=0;}; 
    573573        mepdf (const epdf* em ) :mpdf ( ) {ep=const_cast<epdf*>( em );}; 
    574574        void condition ( const vec &cond ) {} 
  • library/bdm/base/user_info.cpp

    r390 r392  
    229229                { 
    230230                ASSERT_UITYPE(link.result[0],TypeString); 
    231                         if( link.result[0] != "matrix" ) 
     231                        const char* elem1=(const char*)link.result[0]; 
     232                        if( (strcmp(elem1, "matrix") )) 
    232233                                ui_error( "the setting supposed to represent a matrix element has wrong syntax", link.result ); 
    233234 
     
    280281    if ( link.result.isNumber() ) 
    281282    { 
    282         ASSERT_UITYPE(link.result,TypeInt); 
     283  //      ASSERT_UITYPE(link.result,TypeInt); 
    283284        vector.set_length( 1 ); 
    284285        vector(0) = link.result; 
     
    299300 
    300301                Setting &elements = link.result[2]; 
    301         ASSERT_UITYPE(elements[0],TypeInt); 
     302        // ASSERT_UITYPE(elements[0],TypeInt); -- spolehame an autoconvert 
    302303 
    303304 
    304305        if ( matrix.cols() == 1 ) 
    305306                        for ( int i=0; i<len; i++ ) 
    306                                 vector(i) = matrix(i,1); 
     307                                vector(i) = matrix(i,0); 
    307308                else 
    308309                        for ( int i=0; i<len; i++ ) 
    309                                 vector(i) = matrix(1,i); 
     310                                vector(i) = matrix(0,i); 
    310311        return; 
    311312 
     
    353354        if ( matrix.cols() == 1 ) 
    354355                        for ( int i=0; i<len; i++ ) 
    355                                 vector(i) = matrix(i,1); 
     356                                vector(i) = matrix(i,0); 
    356357                else 
    357358                        for ( int i=0; i<len; i++ ) 
    358                                 vector(i) = matrix(1,i); 
     359                                vector(i) = matrix(0,i); 
    359360        return; 
    360361    } 
  • library/bdm/base/user_info.h

    r390 r392  
    1111#include "itpp/itbase.h" 
    1212 
     13#include <stdexcept> 
    1314 
    1415using std::string; 
     
    2728namespace bdm 
    2829{ 
     30         
     31        //! exception used in UI::build if it fails it can be caught and handled - see merger_mex.h 
     32class UIbuildException : public std::invalid_argument { 
     33        public: 
     34                UIbuildException() : std::invalid_argument("class name") { } 
     35}; 
     36         
    2937class UI_File : public Config 
    3038{ 
     
    153161 
    154162                instance = NULL; 
    155                 try 
    156                 { 
    157                         instance = (T*) typeless_instance ; 
     163                //try catch does not work!!! 
     164                instance = dynamic_cast<T*>(typeless_instance); 
     165                if (!instance){ 
     166                        throw UIbuildException(); 
    158167                } 
    159                 catch(...) 
    160                 { 
    161                         it_error ( "UI error: class " + class_name + " is not a descendant of the desired output class. Try to call the UI::build function with a different type parameter." ); 
    162                 } 
    163                  
     168//              catch(...) 
     169//              { 
     170//                      it_error ( "UI error: class " + class_name + " is not a descendant of the desired output class. Try to call the UI::build function with a different type parameter." ); 
     171//              } 
     172//               
    164173                try 
    165174                { 
  • library/bdm/mex/mex_parser.h

    r391 r392  
    2424                Setting & child = setting.add(name,Setting::TypeList); 
    2525                fillList(child,mxarray); 
     26        } 
     27        void addGroup(const mxArray *mxarray, const char* name){ 
     28                Setting & setting = this->getRoot(); //setting is a group 
     29                Setting & child = setting.add(name,Setting::TypeGroup); 
     30                fillGroup(child,mxarray); 
     31        } 
     32        operator Setting&() 
     33        { 
     34                 return getRoot(); 
    2635        } 
    2736private: 
  • library/bdm/stat/merger.h

    r388 r392  
    8181                void set_sources (const Array<mpdf*> &Sources, bool own) { 
    8282                        compositepdf::set_elements (Sources,own); 
     83                        Nsources=mpdfs.length(); 
    8384                        //set sizes 
    8485                        dls.set_size (Sources.length()); 
     
    128129                                smpi (j) = XYZ (j) (0); /* beginning of the interval*/  
    129130                                it_assert(gridsize(j)!=0.0,"Zeros in gridsize!"); 
    130                                 steps (j) = (smpi(j) - XYZ(j)(1))/gridsize(j); 
     131                                steps (j) = ( XYZ(j)(1)-smpi(j) )/gridsize(j); 
    131132                        } 
    132133                        // fill samples 
     
    138139                                for (int j = 0;j < dim;j++) { 
    139140                                        if (ind (j) == gridsize (j) - 1) { //j-th index is full 
    140                                                 ind (j) = 0; //shift back 
     141//                                              ind (j) = 0; //shift back 
    141142                                                smpi(j) = XYZ(j)(0); 
    142143                                                 
    143                                                 ind (j + 1) ++; //increase the next dimension; 
     144//                                              ind (j + 1) ++; //increase the next dimension; 
    144145                                                smpi(j+1) += steps(j+1); 
    145146                                                 
    146147                                                if (ind (j + 1) < gridsize (j + 1) - 1) break; 
    147148                                        } else { 
    148                                                 ind (j) ++;  
     149//                                              ind (j) ++;  
    149150                                                smpi(j) +=steps(j); 
    150151                                                break; 
     
    272273                                        set_method (GEOMETRIC); 
    273274                                else if (!strcmp (meth_str.c_str(), "lognormal")) { 
    274                                         set_method (GEOMETRIC); 
     275                                        set_method (LOGNORMAL); 
    275276                                        set.lookupValue( "beta",beta); 
    276277                                } 
    277278                        } 
    278                         validate(); 
    279279                } 
    280280