Changeset 685 for applications/bdmtoolbox
- Timestamp:
- 10/29/09 23:23:56 (15 years ago)
- Location:
- applications/bdmtoolbox/mex
- Files:
-
- 2 modified
- 4 moved
Legend:
- Unmodified
- Added
- Removed
-
applications/bdmtoolbox/mex/estimator.cpp
r676 r685 145 145 Setting &S=Cfg; 146 146 for ( int i=0; i<Es.length(); i++ ) { 147 try { 148 UI::get ( Ename, S["estimators"][i], "name" ); 149 } catch ( UIException e ) { 147 if (!UI::get ( Ename, S["estimators"][i], "name" ,UI::optional)){ 150 148 Ename="Est"+num2str ( i ); 151 149 } … … 157 155 vec dt=zeros ( Ds->_drv()._dsize() ); //data variable 158 156 Array<datalink*> Dls ( Es.length() ); 157 Array<datalink*> Dlsc ( Es.length() ); 159 158 Array<datalink_buffered*> Dls_buf (0); 160 159 for ( int i=0; i<Es.length(); i++ ) { 161 if (Es ( i )->_drv().mint()<0){ 160 //connect actual data 161 Dls ( i ) = new datalink ( Es ( i )->_yrv(),Ds->_drv() ); //datalink between a datasource and estimator 162 //connect data in condition 163 if (Es ( i )->_rvc().mint()<0){ 162 164 //delayed values are required 163 165 … … 167 169 Dls_buf(ith_buf) = new datalink_buffered(); 168 170 //add dl to list of buffered DS 169 Dls (i) = Dls_buf(ith_buf);170 Dls (i)->set_connection ( Es ( i )->_drv(),Ds->_drv() ); //datalink between a datasource and estimator171 Dlsc(i) = Dls_buf(ith_buf); 172 Dlsc(i)->set_connection ( Es ( i )->_rvc(),Ds->_drv() ); //datalink between a datasource and estimator 171 173 172 174 } else { 173 Dls ( i ) = new datalink ( Es ( i )->_drv(),Ds->_drv() ); //datalink between a datasource and estimator175 Dlsc ( i ) = new datalink ( Es ( i )->_rvc(),Ds->_drv() ); //datalink between a datasource and estimator 174 176 } 175 177 } … … 180 182 181 183 for ( int i=0; i<Es.length(); i++ ) { 182 Es ( i )->bayes ( Dls ( i )->pushdown ( dt ) ); // update estimates184 Es ( i )->bayes ( Dls ( i )->pushdown ( dt ), Dlsc(i) ->pushdown(dt) ); // update estimates 183 185 Es ( i )->log_write (); 184 186 } … … 204 206 } 205 207 #endif 206 for (int i=0;i<Dls.length(); i++){delete Dls(i); }208 for (int i=0;i<Dls.length(); i++){delete Dls(i); delete Dlsc(i);} 207 209 } -
applications/bdmtoolbox/mex/merger.cpp
r622 r685 58 58 #endif 59 59 // Sources 60 Array<shared_ptr<mpdf> > Sources; 61 //abuse Mer to store sources 62 Setting& _Sources = Cfg.lookup ( "Sources" ); 63 int Slen = _Sources.getLength(); 64 Sources.set_size ( Slen ); 65 for ( int i = 0; i < Slen; i++ ) { 66 try { 67 shared_ptr<mpdf> mtmp = UI::build<mpdf> ( _Sources, i ); 68 Sources ( i ) = mtmp; 69 } catch ( UIException ) { 70 // it is not mpdf - see if it is epdf 71 try { 72 shared_ptr<epdf> etmp = UI::build<epdf> ( _Sources, i ); 73 if ( etmp ) { 74 Sources ( i ) = new mepdf ( etmp ); // hopefully OK 75 } 76 } catch ( UIException &e ) { 77 it_error ( "No mpdfs or epdfs found! " + string ( e.what() ) ); 78 } catch ( std::exception e ) { 79 it_error ( "Error in UI at " + _Sources[i].getPath() ); 80 } 81 } catch ( std::exception &e ) { 82 it_error ( "Error in UI at " + _Sources[i].getPath() ); 83 } 84 } 85 60 Array<shared_ptr<mpdf> > Sources; 61 UI::get(Sources, Cfg, "Sources", UI::compulsory); 86 62 shared_ptr<merger_base> Merger = UI::build<merger_base> ( Cfg, "Merger" ); 87 63 88 64 // Support 89 try { 90 shared_ptr<rectangular_support> RecSup = UI::build<rectangular_support> ( Cfg, "Support" ); 65 try{ 66 shared_ptr<rectangular_support> RecSup = UI::build<rectangular_support> ( Cfg, "Support" ,UI::optional); 67 if(RecSup){ 91 68 Merger->set_support ( *RecSup ); 92 } catch ( UIException &e ) { 93 shared_ptr<discrete_support> DisSup = UI::build<discrete_support> ( Cfg, "Support" ); 94 Merger->set_support ( *DisSup ); 69 } 70 } catch (UIException &e) { 71 shared_ptr<discrete_support> DisSup = UI::build<discrete_support> ( Cfg, "Support", UI::optional ); 72 if (DisSup){ 73 Merger->set_support ( *DisSup ); 74 } else{bdm_error("Support not defined");} 95 75 } 96 76 // COMPUTE RESULTS