From f02e95c7a40213f4e4ebc8979df7ca48adf94e2a Mon Sep 17 00:00:00 2001 From: Ian Bell Date: Sun, 16 Aug 2015 20:04:59 -0600 Subject: [PATCH] Catch exceptions properly for critical point routines; silence output --- .../Helmholtz/HelmholtzEOSMixtureBackend.cpp | 4 +++- wrappers/Python/CoolProp/cAbstractState.pxd | 22 +++++++++---------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/Backends/Helmholtz/HelmholtzEOSMixtureBackend.cpp b/src/Backends/Helmholtz/HelmholtzEOSMixtureBackend.cpp index 2533c0c0..7ce829e9 100644 --- a/src/Backends/Helmholtz/HelmholtzEOSMixtureBackend.cpp +++ b/src/Backends/Helmholtz/HelmholtzEOSMixtureBackend.cpp @@ -3102,7 +3102,9 @@ public: CoolProp::SimpleState crit = HEOS.get_state("critical"); critical_points.push_back(crit); N_critical_points++; - std::cout << HEOS.get_mole_fractions()[0] << " " << crit.rhomolar << " " << crit.T << " " << p_MPa << std::endl; + if (get_debug_level() > 0){ + std::cout << HEOS.get_mole_fractions()[0] << " " << crit.rhomolar << " " << crit.T << " " << p_MPa << std::endl; + } } // Update the storage values diff --git a/wrappers/Python/CoolProp/cAbstractState.pxd b/wrappers/Python/CoolProp/cAbstractState.pxd index 3057e519..4d939153 100644 --- a/wrappers/Python/CoolProp/cAbstractState.pxd +++ b/wrappers/Python/CoolProp/cAbstractState.pxd @@ -42,20 +42,20 @@ cdef extern from "AbstractState.h" namespace "CoolProp": bool clear() ## Limits - double Tmin() - double Tmax() - double pmax() - double Ttriple() + double Tmin() except +ValueError + double Tmax() except +ValueError + double pmax() except +ValueError + double Ttriple() except +ValueError ## Critical point - double T_critical() - double rhomass_critical() - double rhomolar_critical() - double p_critical() + double T_critical() except +ValueError + double rhomass_critical() except +ValueError + double rhomolar_critical() except +ValueError + double p_critical() except +ValueError ## Reducing point - double T_reducing() - double rhomolar_reducing() - double rhomass_reducing() + double T_reducing() except +ValueError + double rhomolar_reducing() except +ValueError + double rhomass_reducing() except +ValueError void ideal_curve(const string &, vector[double] &T, vector[double] &p) except +ValueError