From 4d9017dcae965acacfbe5cd8dc65f5a010c4365e Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Wed, 22 Jun 2016 15:29:25 +0800 Subject: cleanup mass_profile/projector.hpp --- mass_profile/projector.hpp | 158 +++++++++++++++++++++++---------------------- 1 file changed, 80 insertions(+), 78 deletions(-) (limited to 'mass_profile') diff --git a/mass_profile/projector.hpp b/mass_profile/projector.hpp index 6f2f192..fda6cdb 100644 --- a/mass_profile/projector.hpp +++ b/mass_profile/projector.hpp @@ -40,47 +40,46 @@ namespace opt_utilities { attach_model(*(rhs.pmodel)); if(rhs.pcfunc) - { - pcfunc=rhs.pcfunc->clone(); - } + { + pcfunc=rhs.pcfunc->clone(); + } else - { - pcfunc=NULL_PTR; - } - + { + pcfunc=NULL_PTR; + } } //assign operator projector& operator=(const projector& rhs) { cm_per_pixel=rhs.cm_per_pixel; if(pmodel) - { - pmodel->destroy(); - } + { + pmodel->destroy(); + } if(pcfunc) - { - pcfunc->destroy(); - } + { + pcfunc->destroy(); + } if(rhs.pcfunc) - { - pcfunc=rhs.pcfunc->clone(); - } + { + pcfunc=rhs.pcfunc->clone(); + } if(rhs.pmodel) - { - pmodel=rhs.pmodel->clone(); - } + { + pmodel=rhs.pmodel->clone(); + } } //destr ~projector() { if(pmodel) - { - pmodel->destroy(); - } + { + pmodel->destroy(); + } if(pcfunc) - { - pcfunc->destroy(); - } + { + pcfunc->destroy(); + } } //used to clone self model,std::vector,std::vector >* @@ -100,10 +99,11 @@ namespace opt_utilities { this->clear_param_info(); for(size_t i=0;ipush_param_info(m.get_param_info(i)); - } - this->push_param_info(param_info,std::string>("bkg",0,0,1E99)); + { + this->push_param_info(m.get_param_info(i)); + } + this -> push_param_info(param_info, + std::string>("bkg",0,0,1E99)); pmodel=m.clone(); pmodel->clear_param_modifier(); } @@ -111,9 +111,9 @@ namespace opt_utilities void attach_cfunc(const func_obj& cf) { if(pcfunc) - { - pcfunc->destroy(); - } + { + pcfunc->destroy(); + } pcfunc=cf.clone(); } @@ -131,10 +131,10 @@ namespace opt_utilities T calc_v_ring(T rsph,T rcyc) { if(rcyc& rlist,int nsph,int nrad) { if(nsph& p)const { std::vector p1(this->reform_param(p)); for(size_t i=0;i!=p1.size();++i) - { - if(get_element(p1,i)>this->get_param_info(i).get_upper_limit()|| - get_element(p1,i)get_param_info(i).get_lower_limit()) - { - // std::cerr<get_param_info(i).get_name()<<"\t"<this->get_param_info(i).get_upper_limit()|| + get_element(p1,i)get_param_info(i).get_lower_limit()) + { + // std::cerr<get_param_info(i).get_name()<<"\t"< p2(p1.size()-1); for(size_t i=0;imeets_constraint(p2); } @@ -183,27 +186,26 @@ namespace opt_utilities std::vector unprojected(pmodel->eval(x,p)); std::vector projected(unprojected.size()); - for(size_t nrad=0;nrad