Skip to content
Snippets Groups Projects
Commit 6d919feb authored by Pospelov, Gennady's avatar Pospelov, Gennady
Browse files

Merge branch 'PreRelease' of apps.jcns.fz-juelich.de:BornAgain into PreRelease

parents 2b1cc217 9721cc6b
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
......@@ -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;
}
......
......@@ -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
......
......@@ -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
......
......@@ -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()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment