mirror of
https://github.com/CoolProp/CoolProp.git
synced 2026-04-23 03:00:17 -04:00
@@ -63,10 +63,10 @@ You might want to start by looking at CoolProp.h
|
||||
|
||||
/// Set the global error string
|
||||
/// @param error The error string to use
|
||||
void set_error_string(std::string error);
|
||||
void set_error_string(const std::string &error);
|
||||
/// An internal function to set the global warning string
|
||||
/// @param warning The string to set as the warning string
|
||||
void set_warning_string(std::string warning);
|
||||
void set_warning_string(const std::string &warning);
|
||||
|
||||
/* \brief Extract a value from the saturation ancillary
|
||||
*
|
||||
@@ -81,7 +81,7 @@ You might want to start by looking at CoolProp.h
|
||||
/// Get a globally-defined string
|
||||
/// @param ParamName A string, one of "version", "errstring", "warnstring", "gitrevision", "FluidsList", "fluids_list", "parameter_list","predefined_mixtures"
|
||||
/// @returns str The string, or an error message if not valid input
|
||||
std::string get_global_param_string(std::string ParamName);
|
||||
std::string get_global_param_string(const std::string &ParamName);
|
||||
|
||||
/*/// Get a long that represents the fluid type
|
||||
/// @param FluidName The fluid name as a string
|
||||
@@ -103,7 +103,7 @@ You might want to start by looking at CoolProp.h
|
||||
|
||||
@returns The string, or an error message if not valid input
|
||||
*/
|
||||
std::string get_fluid_param_string(std::string FluidName, std::string ParamName);
|
||||
std::string get_fluid_param_string(const std::string &FluidName, const std::string &ParamName);
|
||||
|
||||
/** \brief Check if the fluid name is valid
|
||||
*
|
||||
@@ -112,13 +112,13 @@ You might want to start by looking at CoolProp.h
|
||||
* \note "gfreilgregre" -> false; "HEOS::Water" -> true; "Water" -> true
|
||||
*
|
||||
*/
|
||||
bool is_valid_fluid_string(std::string &fluidstring);
|
||||
bool is_valid_fluid_string(const std::string &fluidstring);
|
||||
|
||||
/// Returns the BibTeX key from the bibtex library of CoolProp corresponding to the item requested
|
||||
/// @param FluidName The name of the fluid that is part of CoolProp, for instance "n-Propane"
|
||||
/// @param item The key that is desired, one of "EOS", "CP0", "VISCOSITY", "CONDUCTIVITY", "ECS_LENNARD_JONES", "ECS_FITS", "SURFACE_TENSION"
|
||||
/// @returns The BibTeX key
|
||||
std::string get_BibTeXKey(std::string FluidName, std::string item);
|
||||
std::string get_BibTeXKey(const std::string &FluidName, const std::string &item);
|
||||
|
||||
/**
|
||||
\brief Set the reference state based on a string representation
|
||||
@@ -140,7 +140,7 @@ You might want to start by looking at CoolProp.h
|
||||
\f]
|
||||
where \f$ \Delta s = s-s_{spec} \f$ and \f$ \Delta h = h-h_{spec} \f$
|
||||
*/
|
||||
void set_reference_stateS(std::string FluidName, std::string reference_state);
|
||||
void set_reference_stateS(const std::string &FluidName, const std::string &reference_state);
|
||||
|
||||
/// Set the reference state based on a thermodynamic state point specified by temperature and molar density
|
||||
/// @param FluidName The name of the fluid
|
||||
@@ -148,7 +148,7 @@ You might want to start by looking at CoolProp.h
|
||||
/// @param rhomolar Density at reference state [mol/m^3]
|
||||
/// @param h0 Enthalpy at reference state [J/mol]
|
||||
/// @param s0 Entropy at references state [J/mol/K]
|
||||
void set_reference_stateD(std::string FluidName, double T, double rhomolar, double h0, double s0);
|
||||
void set_reference_stateD(const std::string &FluidName, double T, double rhomolar, double h0, double s0);
|
||||
|
||||
/// Return a string representation of the phase
|
||||
/// @param Name1 The first state variable name, one of "T","D","H",etc.
|
||||
|
||||
@@ -226,7 +226,7 @@
|
||||
return str;
|
||||
}
|
||||
|
||||
std::string strjoin(std::vector<std::string> strings, std::string delim);
|
||||
std::string strjoin(const std::vector<std::string> &strings, const std::string &delim);
|
||||
|
||||
void MatInv_2(double A[2][2] , double B[2][2]);
|
||||
|
||||
@@ -245,7 +245,7 @@
|
||||
{
|
||||
return (y1-y0)/(x1-x0)*(x-x0)+y0;
|
||||
};
|
||||
template<class T> T LinearInterp(std::vector<T> x, std::vector<T> y, std::size_t i0, std::size_t i1, T val)
|
||||
template<class T> T LinearInterp(const std::vector<T> &x, const std::vector<T> &y, std::size_t i0, std::size_t i1, T val)
|
||||
{
|
||||
return LinearInterp(x[i0],x[i1],y[i0],y[i1],val);
|
||||
};
|
||||
@@ -262,7 +262,7 @@
|
||||
L2=((x-x0)*(x-x1))/((x2-x0)*(x2-x1));
|
||||
return L0*f0+L1*f1+L2*f2;
|
||||
};
|
||||
template<class T> T QuadInterp(std::vector<T> x, std::vector<T> y, std::size_t i0, std::size_t i1, std::size_t i2, T val)
|
||||
template<class T> T QuadInterp(const std::vector<T> &x, const std::vector<T> &y, std::size_t i0, std::size_t i1, std::size_t i2, T val)
|
||||
{
|
||||
return QuadInterp(x[i0],x[i1],x[i2],y[i0],y[i1],y[i2],val);
|
||||
};
|
||||
@@ -280,7 +280,7 @@
|
||||
L3=((x-x0)*(x-x1)*(x-x2))/((x3-x0)*(x3-x1)*(x3-x2));
|
||||
return L0*f0+L1*f1+L2*f2+L3*f3;
|
||||
};
|
||||
template<class T> T CubicInterp(std::vector<T> x, std::vector<T> y, std::size_t i0, std::size_t i1, std::size_t i2, std::size_t i3, T val)
|
||||
template<class T> T CubicInterp(const std::vector<T> &x, const std::vector<T> &y, std::size_t i0, std::size_t i1, std::size_t i2, std::size_t i3, T val)
|
||||
{
|
||||
return CubicInterp(x[i0],x[i1],x[i2],x[i3],y[i0],y[i1],y[i2],y[i3],val);
|
||||
};
|
||||
@@ -312,7 +312,7 @@
|
||||
|
||||
inline bool double_equal(double a, double b){return std::abs(a - b) <= 1 * DBL_EPSILON * std::max(std::abs(a), std::abs(b));};
|
||||
|
||||
template<class T> T max_abs_value(std::vector<T> x)
|
||||
template<class T> T max_abs_value(const std::vector<T> &x)
|
||||
{
|
||||
T max = 0;
|
||||
std::size_t N = x.size();
|
||||
@@ -324,7 +324,7 @@
|
||||
return max;
|
||||
}
|
||||
|
||||
template<class T> T min_abs_value(std::vector<T> x)
|
||||
template<class T> T min_abs_value(const std::vector<T> &x)
|
||||
{
|
||||
T min = 1e40;
|
||||
std::size_t N = x.size();
|
||||
@@ -341,54 +341,62 @@
|
||||
class Dictionary
|
||||
{
|
||||
private:
|
||||
std::map<std::string, double> numbers;
|
||||
std::map<std::string, std::string> strings;
|
||||
std::map<std::string, std::vector<double> > double_vectors;
|
||||
std::map<std::string, std::vector<std::string> > string_vectors;
|
||||
typedef std::map<std::string, double> numbers_map;
|
||||
numbers_map numbers;
|
||||
typedef std::map<std::string, std::string> strings_map;
|
||||
strings_map strings;
|
||||
typedef std::map<std::string, std::vector<double> > double_vectors_map;
|
||||
double_vectors_map double_vectors;
|
||||
typedef std::map<std::string, std::vector<std::string> > string_vectors_map;
|
||||
string_vectors_map string_vectors;
|
||||
public:
|
||||
Dictionary(){};
|
||||
bool is_empty(void){return numbers.empty() && strings.empty() && double_vectors.empty() && string_vectors.empty();}
|
||||
void add_string(std::string s1, std::string s2){ strings.insert(std::pair<std::string, std::string>(s1, s2));}
|
||||
void add_number(std::string s1, double d){ numbers.insert(std::pair<std::string, double>(s1, d));}
|
||||
void add_double_vector(std::string s1, std::vector<double> d){ double_vectors.insert(std::pair<std::string, std::vector<double> >(s1, d));}
|
||||
void add_string_vector(std::string s1, std::vector<std::string> d){ string_vectors.insert(std::pair<std::string, std::vector<std::string> >(s1, d));}
|
||||
std::string get_string(std::string s)
|
||||
bool is_empty(void) const {return numbers.empty() && strings.empty() && double_vectors.empty() && string_vectors.empty();}
|
||||
void add_string(const std::string &s1, const std::string &s2){ strings.insert(std::pair<std::string, std::string>(s1, s2));}
|
||||
void add_number(const std::string &s1, double d){ numbers.insert(std::pair<std::string, double>(s1, d));}
|
||||
void add_double_vector(const std::string &s1, const std::vector<double> &d){ double_vectors.insert(std::pair<std::string, std::vector<double> >(s1, d));}
|
||||
void add_string_vector(const std::string &s1, const std::vector<std::string> &d){ string_vectors.insert(std::pair<std::string, std::vector<std::string> >(s1, d));}
|
||||
std::string get_string(const std::string &s) const
|
||||
{
|
||||
if (strings.find(s) != strings.end()){
|
||||
return strings[s];
|
||||
}
|
||||
else{
|
||||
throw CoolProp::ValueError(format("%s could not be matched in get_string",s.c_str()));
|
||||
strings_map::const_iterator i = strings.find(s);
|
||||
if (i != strings.end()){
|
||||
return i->second;
|
||||
}
|
||||
else{
|
||||
throw CoolProp::ValueError(format("%s could not be matched in get_string",s.c_str()));
|
||||
}
|
||||
};
|
||||
double get_double(std::string s)
|
||||
double get_double(const std::string &s) const
|
||||
{
|
||||
if (numbers.find(s) != numbers.end()){
|
||||
return numbers[s];
|
||||
}
|
||||
else{
|
||||
throw CoolProp::ValueError(format("%s could not be matched in get_number",s.c_str()));
|
||||
numbers_map::const_iterator i = numbers.find(s);
|
||||
if (i != numbers.end()){
|
||||
return i->second;
|
||||
}
|
||||
else{
|
||||
throw CoolProp::ValueError(format("%s could not be matched in get_number",s.c_str()));
|
||||
}
|
||||
};
|
||||
double get_number(std::string s)
|
||||
double get_number(const std::string &s) const
|
||||
{
|
||||
return get_double(s);
|
||||
};
|
||||
const std::vector<double>& get_double_vector(std::string s)
|
||||
const std::vector<double>& get_double_vector(const std::string &s) const
|
||||
{
|
||||
if (double_vectors.find(s) != double_vectors.end()){
|
||||
return double_vectors[s];
|
||||
}
|
||||
else{
|
||||
double_vectors_map::const_iterator i = double_vectors.find(s);
|
||||
if (i != double_vectors.end()){
|
||||
return i->second;
|
||||
}
|
||||
else{
|
||||
throw CoolProp::ValueError(format("%s could not be matched in get_double_vector",s.c_str()));
|
||||
}
|
||||
};
|
||||
const std::vector<std::string>& get_string_vector(std::string s)
|
||||
const std::vector<std::string>& get_string_vector(const std::string &s) const
|
||||
{
|
||||
if (string_vectors.find(s) != string_vectors.end()){
|
||||
return string_vectors[s];
|
||||
}
|
||||
else{
|
||||
string_vectors_map::const_iterator i = string_vectors.find(s);
|
||||
if (i != string_vectors.end()){
|
||||
return i->second;
|
||||
}
|
||||
else{
|
||||
throw CoolProp::ValueError(format("%s could not be matched in get_string_vector",s.c_str()));
|
||||
}
|
||||
};
|
||||
@@ -587,7 +595,7 @@ template<class T> void normalize_vector(std::vector<T> &x)
|
||||
#endif
|
||||
};
|
||||
|
||||
inline bool path_exists(std::string path)
|
||||
inline bool path_exists(const std::string &path)
|
||||
{
|
||||
#if defined(__ISWINDOWS__) // Defined for 32-bit and 64-bit windows
|
||||
struct _stat buf;
|
||||
@@ -616,50 +624,39 @@ template<class T> void normalize_vector(std::vector<T> &x)
|
||||
std::replace( file_path.begin(), file_path.end(), '\\', '/'); // replace all '\' with '/'
|
||||
|
||||
#if defined(__ISWINDOWS__)
|
||||
char sep = '\\';
|
||||
const char sep = '\\'; // well, Windows (and DOS) allows forward slash "/", too :)
|
||||
#else
|
||||
char sep = '/';
|
||||
const char sep = '/';
|
||||
#endif
|
||||
|
||||
std::vector<std::string> pathsplit = strsplit(file_path,'/');
|
||||
std::string path = pathsplit[0];
|
||||
if (pathsplit.size()>0)
|
||||
std::string path = pathsplit[0]; // will throw if pathsplit.size() == 0
|
||||
for (std::size_t i = 0, sz = pathsplit.size(); i < sz; i++)
|
||||
{
|
||||
for (unsigned int i = 0; i < pathsplit.size(); i++)
|
||||
if (!path_exists(path))
|
||||
{
|
||||
if (!path_exists(path))
|
||||
{
|
||||
#if defined(__ISWINDOWS__) // Defined for 32-bit and 64-bit windows
|
||||
#if defined(_UNICODE)
|
||||
int errcode = CreateDirectoryA((LPCSTR)path.c_str(),NULL);
|
||||
#else
|
||||
int errcode = CreateDirectory((LPCSTR)path.c_str(),NULL);
|
||||
#endif
|
||||
if (errcode == 0){
|
||||
switch(GetLastError()){
|
||||
case ERROR_ALREADY_EXISTS:
|
||||
break;
|
||||
case ERROR_PATH_NOT_FOUND:
|
||||
throw CoolProp::ValueError(format("Unable to make the directory %s",path.c_str()));
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
#if defined(__ISWINDOWS__) // Defined for 32-bit and 64-bit windows
|
||||
int errcode = CreateDirectoryA((LPCSTR)path.c_str(),NULL);
|
||||
if (errcode == 0){
|
||||
switch(GetLastError()){
|
||||
case ERROR_ALREADY_EXISTS:
|
||||
break;
|
||||
case ERROR_PATH_NOT_FOUND:
|
||||
throw CoolProp::ValueError(format("Unable to make the directory %s",path.c_str()));
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#else
|
||||
#if defined(__powerpc__)
|
||||
#else
|
||||
mkdir(path.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
|
||||
#endif
|
||||
|
||||
}
|
||||
#else
|
||||
#if defined(__powerpc__)
|
||||
#else
|
||||
mkdir(path.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
|
||||
#endif
|
||||
}
|
||||
if (i < pathsplit.size()-1)
|
||||
path += format("%c%s", sep, pathsplit[i+1].c_str());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw CoolProp::ValueError(format("Could not make path [%s]",file_path.c_str()));
|
||||
if (i < (sz-1))
|
||||
path += format("%c%s", sep, pathsplit[i+1].c_str());
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -783,7 +783,7 @@ private:
|
||||
public:
|
||||
IdealHelmholtzPlanckEinsteinGeneralized(){N = 0; enabled = false;}
|
||||
// Constructor with std::vector instances
|
||||
IdealHelmholtzPlanckEinsteinGeneralized(std::vector<CoolPropDbl> n, std::vector<CoolPropDbl> theta, std::vector<CoolPropDbl> c, std::vector<CoolPropDbl> d)
|
||||
IdealHelmholtzPlanckEinsteinGeneralized(const std::vector<CoolPropDbl> &n, const std::vector<CoolPropDbl> &theta, const std::vector<CoolPropDbl> &c, const std::vector<CoolPropDbl> &d)
|
||||
:n(n), theta(theta), c(c), d(d)
|
||||
{
|
||||
N = n.size();
|
||||
@@ -794,7 +794,7 @@ public:
|
||||
~IdealHelmholtzPlanckEinsteinGeneralized(){};
|
||||
|
||||
// Extend the vectors to allow for multiple instances feeding values to this function
|
||||
void extend(std::vector<CoolPropDbl> n, std::vector<CoolPropDbl> theta, std::vector<CoolPropDbl> c, std::vector<CoolPropDbl> d)
|
||||
void extend(const std::vector<CoolPropDbl> &n, const std::vector<CoolPropDbl> &theta, const std::vector<CoolPropDbl> &c, const std::vector<CoolPropDbl> &d)
|
||||
{
|
||||
this->n.insert(this->n.end(), n.begin(), n.end());
|
||||
this->theta.insert(this->theta.end(), theta.begin(), theta.end());
|
||||
@@ -992,7 +992,7 @@ public:
|
||||
IdealHelmholtzCP0AlyLee(){enabled = false;};
|
||||
|
||||
/// Constructor with std::vectors
|
||||
IdealHelmholtzCP0AlyLee(std::vector<CoolPropDbl> c, double Tc, double T0)
|
||||
IdealHelmholtzCP0AlyLee(const std::vector<CoolPropDbl> &c, double Tc, double T0)
|
||||
:c(c), Tc(Tc), T0(T0)
|
||||
{
|
||||
tau0=Tc/T0;
|
||||
|
||||
@@ -22,8 +22,8 @@ class FuncWrapperND
|
||||
public:
|
||||
FuncWrapperND(){};
|
||||
virtual ~FuncWrapperND(){};
|
||||
virtual std::vector<double> call(std::vector<double>) = 0;// must be provided
|
||||
virtual std::vector<std::vector<double> > Jacobian(std::vector<double>);
|
||||
virtual std::vector<double> call(const std::vector<double>&) = 0;// must be provided
|
||||
virtual std::vector<std::vector<double> > Jacobian(const std::vector<double>&);
|
||||
};
|
||||
|
||||
// Single-Dimensional solvers, pointer versions
|
||||
@@ -40,7 +40,7 @@ double Newton(FuncWrapper1D &f, double x0, double ftol, int maxiter, std::string
|
||||
|
||||
|
||||
// Multi-Dimensional solvers
|
||||
std::vector<double> NDNewtonRaphson_Jacobian(FuncWrapperND *f, std::vector<double> x0, double tol, int maxiter, std::string *errstring);
|
||||
std::vector<double> NDNewtonRaphson_Jacobian(FuncWrapperND *f, const std::vector<double> &x0, double tol, int maxiter, std::string *errstring);
|
||||
|
||||
}; /*namespace CoolProp*/
|
||||
#endif
|
||||
|
||||
@@ -125,7 +125,7 @@ class ExcessTerm
|
||||
public:
|
||||
std::size_t N;
|
||||
std::vector<std::vector<DepartureFunctionPointer> > DepartureFunctionMatrix;
|
||||
std::vector<std::vector<CoolPropDbl> > F;
|
||||
STLMatrix F;
|
||||
|
||||
ExcessTerm(){};
|
||||
~ExcessTerm(){};
|
||||
|
||||
@@ -184,7 +184,7 @@ std::string get_mixture_binary_pair_data(const std::string &CAS1, const std::str
|
||||
}
|
||||
}
|
||||
|
||||
std::string get_reducing_function_name(std::string CAS1, std::string CAS2)
|
||||
std::string get_reducing_function_name(const std::string &CAS1, const std::string &CAS2)
|
||||
{
|
||||
std::vector<std::string> CAS;
|
||||
CAS.push_back(CAS1);
|
||||
|
||||
@@ -19,7 +19,7 @@ enum x_N_dependency_flag{XN_INDEPENDENT, ///< x_N is an independent variable, an
|
||||
XN_DEPENDENT ///< x_N is an dependent variable, calculated by \f$ x_N = 1-\sum_i x_i\f$
|
||||
};
|
||||
|
||||
std::string get_reducing_function_name(std::string CAS1, std::string CAS2);
|
||||
std::string get_reducing_function_name(const std::string &CAS1, const std::string &CAS2);
|
||||
|
||||
/** \brief Abstract base class for reducing function
|
||||
* An abstract base class for the reducing function to allow for
|
||||
@@ -35,7 +35,7 @@ public:
|
||||
virtual ~ReducingFunction(){};
|
||||
|
||||
/// A factory function to generate the requiredreducing function
|
||||
static shared_ptr<ReducingFunction> factory(const std::vector<CoolPropFluid*> &components, std::vector< std::vector< CoolPropDbl> > &F);
|
||||
static shared_ptr<ReducingFunction> factory(const std::vector<CoolPropFluid*> &components, STLMatrix &F);
|
||||
|
||||
/// The reduced temperature
|
||||
virtual CoolPropDbl Tr(const std::vector<CoolPropDbl> &x) = 0;
|
||||
@@ -103,7 +103,7 @@ protected:
|
||||
std::vector<CoolPropFluid *> pFluids; ///< List of pointer to fluids
|
||||
|
||||
public:
|
||||
GERG2008ReducingFunction(std::vector<CoolPropFluid *> pFluids, STLMatrix beta_v, STLMatrix gamma_v, STLMatrix beta_T, STLMatrix gamma_T)
|
||||
GERG2008ReducingFunction(const std::vector<CoolPropFluid *> &pFluids, const STLMatrix &beta_v, const STLMatrix &gamma_v, STLMatrix beta_T, const STLMatrix &gamma_T)
|
||||
{
|
||||
this->pFluids = pFluids;
|
||||
this->beta_v = beta_v;
|
||||
@@ -324,7 +324,14 @@ protected:
|
||||
LemmonAirHFCReducingFunction(const LemmonAirHFCReducingFunction &);
|
||||
public:
|
||||
/// Set the coefficients based on reducing parameters loaded from JSON
|
||||
static void convert_to_GERG(const std::vector<CoolPropFluid*> &pFluids, std::size_t i, std::size_t j, Dictionary d, CoolPropDbl &beta_T, CoolPropDbl &beta_v, CoolPropDbl &gamma_T, CoolPropDbl &gamma_v)
|
||||
static void convert_to_GERG(const std::vector<CoolPropFluid*> &pFluids,
|
||||
std::size_t i,
|
||||
std::size_t j,
|
||||
const Dictionary &d,
|
||||
CoolPropDbl &beta_T,
|
||||
CoolPropDbl &beta_v,
|
||||
CoolPropDbl &gamma_T,
|
||||
CoolPropDbl &gamma_v)
|
||||
{
|
||||
CoolPropDbl xi_ij = d.get_number("xi");
|
||||
CoolPropDbl zeta_ij = d.get_number("zeta");
|
||||
|
||||
@@ -59,10 +59,10 @@ int get_debug_level(void){return debug_level;}
|
||||
#include "gitrevision.h" // Contents are like "std::string gitrevision = "aa121435436ggregrea4t43t433";"
|
||||
#include "cpversion.h" // Contents are like "char version [] = "2.5";"
|
||||
|
||||
void set_warning_string(std::string warning){
|
||||
void set_warning_string(const std::string &warning){
|
||||
warning_string = warning;
|
||||
}
|
||||
void set_error_string(std::string error){
|
||||
void set_error_string(const std::string &error){
|
||||
error_string = error;
|
||||
}
|
||||
|
||||
@@ -271,7 +271,7 @@ struct output_parameter{
|
||||
};
|
||||
|
||||
void _PropsSI_outputs(shared_ptr<AbstractState> &State,
|
||||
std::vector<output_parameter> output_parameters,
|
||||
const std::vector<output_parameter> &output_parameters,
|
||||
CoolProp::input_pairs input_pair,
|
||||
const std::vector<double> &in1,
|
||||
const std::vector<double> &in2,
|
||||
@@ -355,7 +355,7 @@ void _PropsSI_outputs(shared_ptr<AbstractState> &State,
|
||||
}
|
||||
}
|
||||
try{
|
||||
output_parameter &output = output_parameters[j];
|
||||
const output_parameter &output = output_parameters[j];
|
||||
switch (output.type){
|
||||
case output_parameter::OUTPUT_TYPE_TRIVIAL:
|
||||
case output_parameter::OUTPUT_TYPE_NORMAL:
|
||||
@@ -679,7 +679,7 @@ TEST_CASE("Check inputs to Props1SI","[Props1SI],[PropsSI]")
|
||||
#endif
|
||||
|
||||
|
||||
bool is_valid_fluid_string(std::string &input_fluid_string)
|
||||
bool is_valid_fluid_string(const std::string &input_fluid_string)
|
||||
{
|
||||
try{
|
||||
std::string backend, fluid;
|
||||
@@ -706,7 +706,7 @@ double saturation_ancillary(const std::string &fluid_name, const std::string &ou
|
||||
|
||||
return HEOS->saturation_ancillary(iOutput, Q, iInput, value);
|
||||
}
|
||||
void set_reference_stateS(std::string Ref, std::string reference_state)
|
||||
void set_reference_stateS(const std::string &Ref, const std::string &reference_state)
|
||||
{
|
||||
shared_ptr<CoolProp::HelmholtzEOSMixtureBackend> HEOS;
|
||||
std::vector<std::string> _comps(1, Ref);
|
||||
@@ -763,7 +763,7 @@ void set_reference_stateS(std::string Ref, std::string reference_state)
|
||||
throw ValueError(format("reference state string is invalid: [%s]",reference_state.c_str()));
|
||||
}
|
||||
}
|
||||
void set_reference_stateD(std::string Ref, double T, double rhomolar, double h0, double s0)
|
||||
void set_reference_stateD(const std::string &Ref, double T, double rhomolar, double h0, double s0)
|
||||
{
|
||||
shared_ptr<CoolProp::HelmholtzEOSMixtureBackend> HEOS;
|
||||
std::vector<std::string> _comps(1, Ref);
|
||||
@@ -780,7 +780,7 @@ void set_reference_stateD(std::string Ref, double T, double rhomolar, double h0,
|
||||
HEOS->update_states();
|
||||
}
|
||||
|
||||
std::string get_BibTeXKey(std::string Ref, std::string key)
|
||||
std::string get_BibTeXKey(const std::string &Ref, const std::string &key)
|
||||
{
|
||||
std::vector<std::string> names(1, Ref);
|
||||
HelmholtzEOSMixtureBackend HEOS(names);
|
||||
@@ -796,7 +796,7 @@ std::string get_BibTeXKey(std::string Ref, std::string key)
|
||||
else if (!key.compare("MELTING_LINE")){ return HEOS.get_components()[0]->ancillaries.melting_line.BibTeX;}
|
||||
else{ return "Bad key";}
|
||||
}
|
||||
std::string get_global_param_string(std::string ParamName)
|
||||
std::string get_global_param_string(const std::string &ParamName)
|
||||
{
|
||||
if (!ParamName.compare("version")){ return version; }
|
||||
else if (!ParamName.compare("gitrevision")){
|
||||
@@ -846,7 +846,7 @@ TEST_CASE("Check inputs to get_global_param_string","[get_global_param_string]")
|
||||
};
|
||||
#endif
|
||||
|
||||
std::string get_fluid_param_string(std::string FluidName, std::string ParamName)
|
||||
std::string get_fluid_param_string(const std::string &FluidName, const std::string &ParamName)
|
||||
{
|
||||
try {
|
||||
std::string backend, fluid;
|
||||
|
||||
@@ -240,7 +240,7 @@ void solve_cubic(double a, double b, double c, double d, int &N, double &x0, dou
|
||||
}
|
||||
}
|
||||
|
||||
std::string strjoin(std::vector<std::string> strings, std::string delim)
|
||||
std::string strjoin(const std::vector<std::string> &strings, const std::string &delim)
|
||||
{
|
||||
// Empty input vector
|
||||
if (strings.empty()){return "";}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
namespace CoolProp{
|
||||
|
||||
CoolPropDbl kahanSum(std::vector<CoolPropDbl> &x)
|
||||
CoolPropDbl kahanSum(const std::vector<CoolPropDbl> &x)
|
||||
{
|
||||
CoolPropDbl sum = x[0], y, t;
|
||||
CoolPropDbl c = 0.0; //A running compensation for lost low-order bits.
|
||||
|
||||
@@ -1334,7 +1334,7 @@ double HAProps(const std::string &OutputName, const std::string &Input1Name, dou
|
||||
|
||||
return out;
|
||||
}
|
||||
long get_input_key(std::vector<givens> input_keys, givens key)
|
||||
long get_input_key(const std::vector<givens> &input_keys, givens key)
|
||||
{
|
||||
if (input_keys.size() != 2){throw CoolProp::ValueError("input_keys is not 2-element vector");}
|
||||
|
||||
@@ -1342,7 +1342,7 @@ long get_input_key(std::vector<givens> input_keys, givens key)
|
||||
else if (input_keys[1] == key){ return 1; }
|
||||
else{ return -1; }
|
||||
}
|
||||
bool match_input_key(std::vector<givens> input_keys, givens key)
|
||||
bool match_input_key(const std::vector<givens> &input_keys, givens key)
|
||||
{
|
||||
return get_input_key(input_keys, key) >= 0;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace CoolProp{
|
||||
|
||||
/** \brief Calculate the Jacobian using numerical differentiation by column
|
||||
*/
|
||||
std::vector<std::vector<double> > FuncWrapperND::Jacobian(std::vector<double> x)
|
||||
std::vector<std::vector<double> > FuncWrapperND::Jacobian(const std::vector<double> &x)
|
||||
{
|
||||
double epsilon;
|
||||
std::size_t N = x.size();
|
||||
|
||||
Reference in New Issue
Block a user