1 #ifndef COOLPROPTOOLS_H
2 #define COOLPROPTOOLS_H
4 #define _CRT_SECURE_NO_WARNINGS
6 #if defined(_WIN32) || defined(__WIN32__) || defined(_WIN64) || defined(__WIN64__)
14 #if defined(COOLPROP_LIB)
16 # if defined(__ISWINDOWS__)
17 # define EXPORT_CODE extern "C" __declspec(dllexport)
19 # define EXPORT_CODE extern "C"
23 # if defined(__ISWINDOWS__)
24 # define CONVENTION __stdcall
39 #if defined(__powerpc__) || defined(EXTERNC)
41 # define EXPORT_CODE extern "C"
58 # define M_PI 3.14159265358979323846
66 # define _HUGE HUGE_VAL
78 static double acosh(
double x)
80 return log(x + sqrt(x*x - 1.0));
82 static double asinh(
double value)
85 return log(value + sqrt(value * value + 1));
88 return -log(-value + sqrt(value * value + 1));
94 #if defined(__powerpc__)
96 static double acosh(
double x)
98 return log(x + sqrt(x*x - 1.0) );
100 static double asinh(
double value)
103 return log(value + sqrt(value * value + 1));
106 return -log(-value + sqrt(value * value + 1));
111 #if defined(__powerpc__)
120 return (x <= DBL_MAX && x >= -DBL_MAX);
125 #define DEPRECATED(func) func __attribute__ ((deprecated))
126 #elif defined(_MSC_VER)
127 #define DEPRECATED(func) __declspec(deprecated) func
129 #pragma message("WARNING: You need to implement DEPRECATED for this compiler")
130 #define DEPRECATED(func) func
134 #include <functional>
143 s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun<int, int>(std::isspace))));
148 s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::ptr_fun<int, int>(std::isspace))).base(), s.end());
161 std::string
format(
const char* fmt, ...);
163 std::vector<std::string>
strsplit(std::string s,
char del);
165 inline std::string
upper(
const std::string str_)
167 std::string str = str_;
168 std::transform(str.begin(), str.end(), str.begin(), ::toupper);
172 std::string
strjoin(std::vector<std::string> strings, std::string delim);
174 void MatInv_2(
double A[2][2] ,
double B[2][2]);
177 double interp1d(std::vector<double> *x, std::vector<double> *y,
double x0);
178 double powInt(
double x,
int y);
179 double QuadInterp(
double x0,
double x1,
double x2,
double f0,
double f1,
double f2,
double x);
180 double CubicInterp(
double x0,
double x1,
double x2,
double x3,
double f0,
double f1,
double f2,
double f3,
double x);
182 void solve_cubic(
double a,
double b,
double c,
double d,
double *x0,
double *x1,
double *x2);
186 inline double min3(
double x1,
double x2,
double x3){
return std::min(std::min(x1, x2), x3);};
187 inline double max3(
double x1,
double x2,
double x3){
return std::max(std::max(x1, x2), x3);};
std::vector< double > x(ncmax, 0)