From 02008951a5404e4b36bacd570ab7479d6acb4623 Mon Sep 17 00:00:00 2001 From: Laurent Belcour Date: Thu, 19 Sep 2013 11:21:36 +0200 Subject: [PATCH] Does compile under Windows --- sources/core/args.h | 2 +- sources/core/common.cpp | 10 +++++----- sources/core/common.h | 13 +++++++++++++ sources/core/function.cpp | 2 +- sources/core/rational_function.cpp | 4 ++-- sources/core/vertical_segment.cpp | 6 +++--- 6 files changed, 25 insertions(+), 12 deletions(-) diff --git a/sources/core/args.h b/sources/core/args.h index ed288bd..cf59324 100644 --- a/sources/core/args.h +++ b/sources/core/args.h @@ -151,7 +151,7 @@ class arguments float get_float(const std::string& key, float default_value = 0.0f) const { if(_map.count(key) > 0) - return atof(_map.find(key)->second.c_str()) ; + return (float)atof(_map.find(key)->second.c_str()) ; else return default_value ; } diff --git a/sources/core/common.cpp b/sources/core/common.cpp index 084cf8c..6dd4a6c 100644 --- a/sources/core/common.cpp +++ b/sources/core/common.cpp @@ -3,7 +3,7 @@ double norm(const vec& a) { double norm = 0.0 ; - for(unsigned int i=0; i T clamp(T x, T a, T b) return std::max(std::min(x, b), a); } +#ifdef WIN32 +#define NOT_IMPLEMENTED() \ +std::cerr << "<> not implemented " << __FUNCDNAME__ << " in file " << __FILE__ \ + << ":" << __LINE__ << std::endl; \ +throw +#else #define NOT_IMPLEMENTED() \ std::cerr << "<> not implemented " << __PRETTY_FUNCTION__ << " in file " << __FILE__ \ << ":" << __LINE__ << std::endl; \ throw +#endif +// Mathematical definition not provided on the Window plateform #ifdef WIN32 #define M_PI 3.14159265 + +template bool isnan(T x) +{ + return x==std::numeric_limits::signaling_NaN(); +} #endif #ifdef WIN32 diff --git a/sources/core/function.cpp b/sources/core/function.cpp index ff4c8ef..2215f50 100644 --- a/sources/core/function.cpp +++ b/sources/core/function.cpp @@ -10,7 +10,7 @@ void function::save(const std::string& filename, const arguments& args) const bool is_matlab = args["export"] == "matlab"; // Open the file - std::ofstream file(filename); + std::ofstream file(filename.c_str()); if(!file.is_open()) { std::cerr << "<> unable to open output file for writing" << std::endl; diff --git a/sources/core/rational_function.cpp b/sources/core/rational_function.cpp index ab4206a..467eb22 100644 --- a/sources/core/rational_function.cpp +++ b/sources/core/rational_function.cpp @@ -261,7 +261,7 @@ vec rational_function_1d::value(const vec& x) const std::ostream& operator<< (std::ostream& out, const rational_function_1d& r) { std::cout << "p = [" ; - for(unsigned int i=0; i::max()) ; - max = args.get_vec("max", _nX, std::numeric_limits::max()) ; + min = args.get_vec("min", _nX, -std::numeric_limits::max()) ; + max = args.get_vec("max", _nX, std::numeric_limits::max()) ; for(int k=0; k