diff --git a/Core/Tools/src/OutputDataReadStrategy.cpp b/Core/Tools/src/OutputDataReadStrategy.cpp index a26135653d71fca22e04c98804cdfa5476f1e697..6b12e326070777ad859254f01b11425231ea1f51 100644 --- a/Core/Tools/src/OutputDataReadStrategy.cpp +++ b/Core/Tools/src/OutputDataReadStrategy.cpp @@ -67,8 +67,9 @@ OutputData<double > *OutputDataReadStreamIMA::readOutputData(std::istream &input while( std::getline(input_stream, sline)) { - std::string str = Utils::String::round_doubles(sline, 10); - vdouble1d_t buff = Utils::String::parse_doubles(str); + //std::string str = Utils::String::round_doubles(sline, 10); + //vdouble1d_t buff = Utils::String::parse_doubles(str); + vdouble1d_t buff = Utils::String::parse_doubles(sline); buff_2d.push_back(buff); } @@ -123,8 +124,8 @@ OutputData<double > *OutputDataReadStreamV1::readOutputData(std::istream &input_ while( std::getline(input_stream, sline) ) { if(sline[0] == '#') continue; - std::string str = Utils::String::round_doubles(sline, 10); - vdouble1d_t buff = Utils::String::parse_doubles(str); + //std::string str = Utils::String::round_doubles(sline, 10); + vdouble1d_t buff = Utils::String::parse_doubles(sline); if( buff_xaxis.empty() ) { buff_xaxis = buff; diff --git a/Core/Tools/src/Utils.cpp b/Core/Tools/src/Utils.cpp index 207ad3900bc8e3261a5f7b8ee156b7cd21ec3f03..1946b17b10d76349bb6431b32f2682394229dc65 100644 --- a/Core/Tools/src/Utils.cpp +++ b/Core/Tools/src/Utils.cpp @@ -20,6 +20,7 @@ #include <boost/regex.hpp> #include <boost/algorithm/string/replace.hpp> #include <boost/algorithm/string.hpp> +#include <string> #ifdef DEBUG_FPE #include <fenv.h> @@ -36,11 +37,17 @@ vdouble1d_t Utils::String::parse_doubles(const std::string& str) { vdouble1d_t buff_1d; std::istringstream iss(str); - std::copy(std::istream_iterator<double>(iss), - std::istream_iterator<double>(), back_inserter(buff_1d)); + std::string svalue; + while(iss >> svalue) { + buff_1d.push_back(std::strtod(svalue.c_str(), NULL)); + } +// approach below doesnt work under mac 10.6 for doubles like 4.3882628771e-313 +// std::copy(std::istream_iterator<double>(iss), +// std::istream_iterator<double>(), back_inserter(buff_1d)); if( buff_1d.empty() ) { std::cout << "OutputDataReadFileASCII::parse_doubles() -> " "Warning! No parsed values in 1d vector of doubles." << std::endl; + std::cout << "Line '" << str << "'" << std::endl; } return buff_1d; } diff --git a/Fit/PythonAPI/src/IMinimizer.pypp.cpp b/Fit/PythonAPI/src/IMinimizer.pypp.cpp index 2ca3a9995dccae2cfbe454093505fb843cb4be06..8159223e52499a60376110866692a1251c299cb6 100644 --- a/Fit/PythonAPI/src/IMinimizer.pypp.cpp +++ b/Fit/PythonAPI/src/IMinimizer.pypp.cpp @@ -35,18 +35,6 @@ struct IMinimizer_wrapper : IMinimizer, bp::wrapper< IMinimizer > { IMinimizer::clear( ); } - virtual ::std::string getAlgorithmName( ) const { - if( bp::override func_getAlgorithmName = this->get_override( "getAlgorithmName" ) ) - return func_getAlgorithmName( ); - else - return this->IMinimizer::getAlgorithmName( ); - } - - - ::std::string default_getAlgorithmName( ) const { - return IMinimizer::getAlgorithmName( ); - } - virtual double getErrorOfVariable( ::std::size_t arg0 ) const { if( bp::override func_getErrorOfVariable = this->get_override( "getErrorOfVariable" ) ) return func_getErrorOfVariable( arg0 ); @@ -83,18 +71,6 @@ struct IMinimizer_wrapper : IMinimizer, bp::wrapper< IMinimizer > { return IMinimizer::getMinValue( ); } - virtual ::std::string getMinimizerName( ) const { - if( bp::override func_getMinimizerName = this->get_override( "getMinimizerName" ) ) - return func_getMinimizerName( ); - else - return this->IMinimizer::getMinimizerName( ); - } - - - ::std::string default_getMinimizerName( ) const { - return IMinimizer::getMinimizerName( ); - } - virtual ::std::size_t getNCalls( ) const { if( bp::override func_getNCalls = this->get_override( "getNCalls" ) ) return func_getNCalls( ); @@ -226,17 +202,6 @@ void register_IMinimizer_class(){ , clear_function_type(&::IMinimizer::clear) , default_clear_function_type(&IMinimizer_wrapper::default_clear) ); - } - { //::IMinimizer::getAlgorithmName - - typedef ::std::string ( ::IMinimizer::*getAlgorithmName_function_type )( ) const; - typedef ::std::string ( IMinimizer_wrapper::*default_getAlgorithmName_function_type )( ) const; - - IMinimizer_exposer.def( - "getAlgorithmName" - , getAlgorithmName_function_type(&::IMinimizer::getAlgorithmName) - , default_getAlgorithmName_function_type(&IMinimizer_wrapper::default_getAlgorithmName) ); - } { //::IMinimizer::getErrorOfVariable @@ -271,17 +236,6 @@ void register_IMinimizer_class(){ , getMinValue_function_type(&::IMinimizer::getMinValue) , default_getMinValue_function_type(&IMinimizer_wrapper::default_getMinValue) ); - } - { //::IMinimizer::getMinimizerName - - typedef ::std::string ( ::IMinimizer::*getMinimizerName_function_type )( ) const; - typedef ::std::string ( IMinimizer_wrapper::*default_getMinimizerName_function_type )( ) const; - - IMinimizer_exposer.def( - "getMinimizerName" - , getMinimizerName_function_type(&::IMinimizer::getMinimizerName) - , default_getMinimizerName_function_type(&IMinimizer_wrapper::default_getMinimizerName) ); - } { //::IMinimizer::getNCalls diff --git a/Fit/PythonAPI/src/MinimizerOptions.pypp.cpp b/Fit/PythonAPI/src/MinimizerOptions.pypp.cpp index f5102837bca21a738f397d30cd9752699c273ab9..37544e22ac7eb7fb2983529852d2a7dc818e936f 100644 --- a/Fit/PythonAPI/src/MinimizerOptions.pypp.cpp +++ b/Fit/PythonAPI/src/MinimizerOptions.pypp.cpp @@ -124,36 +124,6 @@ void register_MinimizerOptions_class(){ "getTolerance" , getTolerance_function_type( &::MinimizerOptions::getTolerance ) ); - } - { //::MinimizerOptions::getValue - - typedef void ( ::MinimizerOptions::*getValue_function_type )( ::std::string const &,int & ) ; - - MinimizerOptions_exposer.def( - "getValue" - , getValue_function_type( &::MinimizerOptions::getValue ) - , ( bp::arg("name"), bp::arg("val") ) ); - - } - { //::MinimizerOptions::getValue - - typedef void ( ::MinimizerOptions::*getValue_function_type )( ::std::string const &,double & ) ; - - MinimizerOptions_exposer.def( - "getValue" - , getValue_function_type( &::MinimizerOptions::getValue ) - , ( bp::arg("name"), bp::arg("val") ) ); - - } - { //::MinimizerOptions::getValue - - typedef void ( ::MinimizerOptions::*getValue_function_type )( ::std::string const &,::std::string & ) ; - - MinimizerOptions_exposer.def( - "getValue" - , getValue_function_type( &::MinimizerOptions::getValue ) - , ( bp::arg("name"), bp::arg("val") ) ); - } { //::MinimizerOptions::print diff --git a/dev-tools/python-bindings/MakePyFit.py b/dev-tools/python-bindings/MakePyFit.py index a967f7f81e1950580f380c0389fb1e02b5cfc0e4..f1d13a512fe7dd14231e9a279a3c0b07a8ed7a79 100644 --- a/dev-tools/python-bindings/MakePyFit.py +++ b/dev-tools/python-bindings/MakePyFit.py @@ -70,6 +70,8 @@ def ManualClassTunings(mb): cl = mb.class_("IMinimizer") cl.member_function("setChiSquaredFunction").exclude() cl.member_function("setGradientFunction").exclude() + cl.member_function("getAlgorithmName").exclude() # temporarily due to compilation problems under MSVC + cl.member_function("getMinimizerName").exclude() # temporarily due to compilation problems under MSVC for fun in cl.member_functions(): if "getOptions" in fun.name: if "::MinimizerOptions const & ( ::IMinimizer::* )( ) const" in fun.decl_string: @@ -110,6 +112,11 @@ def ManualClassTunings(mb): cl.member_function( "getMinimizer" ).call_policies = call_policies.return_value_policy( call_policies.reference_existing_object ) cl.member_function( "setMinimizer" ).include() + cl = mb.class_("MinimizerOptions") # alternatively transformation can be used + for fun in cl.member_functions(): + if "getValue" in fun.name: + fun.exclude() + cl = mb.class_("IObserver") cl.member_function("update").include()