Changeset 568 for applications/bdmtoolbox/mex
- Timestamp:
- 08/20/09 00:54:44 (15 years ago)
- Location:
- applications/bdmtoolbox/mex
- Files:
-
- 3 modified
Legend:
- Unmodified
- Added
- Removed
-
applications/bdmtoolbox/mex/config2mxstruct.cpp
r411 r568 13 13 } 14 14 catch(exception e){ 15 cout << e.what() <<endl;15 cout <<"Error: " << e.what() <<endl; 16 16 } 17 17 } -
applications/bdmtoolbox/mex/estimator.cpp
r490 r568 109 109 #endif 110 110 111 logger*L = UI::build<logger>( Cfg, "logger");112 ArxDS *DS = UI::build<ArxDS>( Cfg, "system" );113 Array< BM*> Es; UI::get(Es,Cfg, "estimators" );111 shared_ptr<logger> L = UI::build<logger>( Cfg, "logger"); 112 shared_ptr<ArxDS> DS = UI::build<ArxDS>( Cfg, "system" ); 113 Array<shared_ptr<BM> > Es; UI::get(Es,Cfg, "estimators" ); 114 114 int Ndat; 115 115 Cfg.lookupValue ( "experiment.ndat",Ndat ); … … 151 151 152 152 #ifdef MEX 153 mexlog* mL=dynamic_cast<mexlog*>(L );153 mexlog* mL=dynamic_cast<mexlog*>(L.get()); 154 154 155 155 if (mL) { // user wants output!! … … 158 158 } 159 159 #endif 160 ///////161 delete L;162 delete DS;163 for (int i;i<Es.length();i++){delete Es(i);delete Dls(i);}164 160 } -
applications/bdmtoolbox/mex/merger.cpp
r490 r568 59 59 #endif 60 60 // Sources 61 Array< mpdf*> Sources;61 Array<shared_ptr<mpdf> > Sources; 62 62 //abuse Mer to store sources 63 63 Setting& _Sources = Cfg.lookup ("Sources"); … … 66 66 for (int i = 0; i < Slen; i++) { 67 67 try { 68 mpdf*mtmp = UI::build<mpdf> (_Sources, i);68 shared_ptr<mpdf> mtmp = UI::build<mpdf> (_Sources, i); 69 69 Sources (i) = mtmp; 70 70 } catch (UIException) { … … 73 73 shared_ptr<epdf> etmp = UI::build<epdf> (_Sources, i); 74 74 if (etmp) { 75 Sources (i) = new mepdf (etmp); 75 Sources (i) = new mepdf (etmp); // hopefully OK 76 76 } 77 } catch (UIException e) {77 } catch (UIException &e) { 78 78 it_error ("No mpdfs or epdfs found! " + string (e.what())); 79 79 } catch (std::exception e) { 80 80 it_error ("Error in UI at " + _Sources[i].getPath()); 81 81 } 82 } catch (std::exception e) {82 } catch (std::exception &e) { 83 83 it_error ("Error in UI at " + _Sources[i].getPath()); 84 84 } 85 85 } 86 86 87 merger_base*Merger = UI::build<merger_base> (Cfg, "Merger");87 shared_ptr<merger_base> Merger = UI::build<merger_base> (Cfg, "Merger"); 88 88 89 89 // Support 90 Setting & _Supp = Cfg.lookup ("Support"); 91 92 if (_Supp.exists ("grid") && _Supp.exists ("nbins")) { 93 Array<vec> bounds (0); 94 UI::get (bounds, _Supp, "grid"); 95 ivec nbins (0); 96 UI::get (nbins, _Supp, "nbins"); 97 Merger->set_support (bounds, nbins); 98 99 } else { 100 if (_Supp.exists ("pdf") && _Supp.exists ("nsamples")) { 101 epdf *g0 = UI::build<epdf> (_Supp, "pdf"); 102 int npoints = 100; 103 _Supp.lookupValue ("nsamples", npoints); 104 Merger->set_support (*g0, npoints); 105 delete g0; 106 } else it_error ("Use either [grid,nbins] or [pdf,nsamples]."); 90 try { 91 shared_ptr<rectangular_support> RecSup = UI::build<rectangular_support> (Cfg, "Support"); 92 Merger->set_support(*RecSup); 93 } 94 catch (UIException &e) { 95 shared_ptr<epdf> g0 = UI::build<epdf> (Cfg, "Support"); 96 Merger->set_support (*g0, 100); 107 97 } 108 98 // COMPUTE RESULTS 109 Merger->set_sources (Sources , true); // takes care of deletion of sources99 Merger->set_sources (Sources); 110 100 Merger->merge(); 111 101 … … 128 118 } 129 119 130 merger_mix* MerMix=dynamic_cast<merger_mix*>(Merger );120 merger_mix* MerMix=dynamic_cast<merger_mix*>(Merger.get()); 131 121 vec mix_val; 132 122