From a82160c4bf6b59523c13fbb9d6f1684135fdaa01 Mon Sep 17 00:00:00 2001 From: Ian Bell Date: Tue, 3 Jun 2014 21:34:26 +0200 Subject: [PATCH] Clean up shared_ptr mess Signed-off-by: Ian Bell --- include/crossplatform_shared_ptr.h | 10 ++++++++-- src/Backends/Helmholtz/ExcessHEFunction.h | 2 +- src/Helmholtz.cpp | 6 ------ src/Tests/Tests.cpp | 1 + src/main.cxx | 16 ++++------------ 5 files changed, 14 insertions(+), 21 deletions(-) diff --git a/include/crossplatform_shared_ptr.h b/include/crossplatform_shared_ptr.h index b375c26b..28a8acaf 100644 --- a/include/crossplatform_shared_ptr.h +++ b/include/crossplatform_shared_ptr.h @@ -3,18 +3,24 @@ #include "PlatformDetermination.h" -// Based on the platform and compiler, include the necessary header to give access to std::tr1::shared_ptr +// Based on the platform and compiler, include the necessary header to give access to std::tr1::shared_ptr directly as shared_ptr #if defined(__ISLINUX__) #include +using namespace std::tr1; #elif defined(__ISAPPLE__) #include +using namespace std::tr1; #elif defined(__ISWINDOWS__) && defined(__MINGW32__) +#include +using namespace std::tr1; +#elif defined(__ISWINDOWS__) && !defined(__MINGW32__) #include +using namespace std::tr1; #else #pragma error #endif -using namespace std::tr1; + #endif diff --git a/src/Backends/Helmholtz/ExcessHEFunction.h b/src/Backends/Helmholtz/ExcessHEFunction.h index 80271a12..da19051e 100644 --- a/src/Backends/Helmholtz/ExcessHEFunction.h +++ b/src/Backends/Helmholtz/ExcessHEFunction.h @@ -80,7 +80,7 @@ public: virtual double d2alphar_dTau2(double tau, double delta) = 0; }; -typedef std::tr1::shared_ptr DepartureFunctionPointer; +typedef shared_ptr DepartureFunctionPointer; class ExcessTerm { diff --git a/src/Helmholtz.cpp b/src/Helmholtz.cpp index c1506fd3..96014c97 100644 --- a/src/Helmholtz.cpp +++ b/src/Helmholtz.cpp @@ -1049,7 +1049,6 @@ long double ResidualHelmholtzNonAnalytic::dDelta2(const long double &tau, const long double dDELTA_dDelta_over_delta_minus_1=(Ai*theta*2.0/betai*pow(pow(delta-1.0,2),1.0/(2.0*betai)-1.0)+2.0*Bi*ai*pow(pow(delta-1.0,2),ai-1.0)); long double dPSI2_dDelta2=(2.0*Ci*pow(delta-1.0,2)-1.0)*2.0*Ci*PSI; -<<<<<<< HEAD if (fabs(delta-1) < 10*DBL_EPSILON){ dDELTA2_dDelta2 = 0; @@ -1060,11 +1059,6 @@ long double ResidualHelmholtzNonAnalytic::dDelta2(const long double &tau, const dDELTAbi2_dDelta2 = bi*(pow(DELTA,bi-1.0)*dDELTA2_dDelta2+(bi-1.0)*pow(DELTA,bi-2.0)*pow(dDELTA_dDelta,2)); } -======= - long double dDELTA2_dDelta2=1.0/(delta-1.0)*dDELTA_dDelta+pow(delta-1.0,2)*(4.0*Bi*ai*(ai-1.0)*pow(pow(delta-1.0,2),ai-2.0)+2.0*pow(Ai/betai,2)*pow(pow(pow(delta-1.0,2),1.0/(2.0*betai)-1.0),2)+Ai*theta*4.0/betai*(1.0/(2.0*betai)-1.0)*pow(pow(delta-1.0,2),1.0/(2.0*betai)-2.0)); - long double dDELTAbi2_dDelta2=bi*(pow(DELTA,bi-1.0)*dDELTA2_dDelta2+(bi-1.0)*pow(DELTA,bi-2.0)*pow(dDELTA_dDelta,2)); - ->>>>>>> cb497b443cbbf60be06b3485369837a785fb34c9 // At critical point, DELTA is 0, and 1/0^n is undefined if (fabs(DELTA) < 10*DBL_EPSILON) { diff --git a/src/Tests/Tests.cpp b/src/Tests/Tests.cpp index d7c46273..8af4ee18 100644 --- a/src/Tests/Tests.cpp +++ b/src/Tests/Tests.cpp @@ -5,6 +5,7 @@ the build to avoid double declaration of the main function and Catch clashing */ #include "Tests.h" +#include "time.h" #if defined ENABLE_CATCH #define CATCH_CONFIG_RUNNER diff --git a/src/main.cxx b/src/main.cxx index d5f33aec..e908c3b6 100644 --- a/src/main.cxx +++ b/src/main.cxx @@ -65,14 +65,9 @@ int main() for (std::size_t i = 0; i < sizeof(NBP_refs)/sizeof(NBP_refs[0]); ++i) { try{ -<<<<<<< HEAD - set_reference_stateS(NBP_refs[i],"RESET"); - HelmholtzEOSMixtureBackend HEOS(std::vector(1,NBP_refs[i])); -======= //set_reference_stateS(NBP_refs[i],"RESET"); std::vector comps(1,NBP_refs[i]); HelmholtzEOSMixtureBackend HEOS(comps); ->>>>>>> cb497b443cbbf60be06b3485369837a785fb34c9 HEOS.update(PQ_INPUTS, 101325, 0); double delta_a1 = HEOS.smass()/(HEOS.gas_constant()/HEOS.molar_mass()); double delta_a2 = -HEOS.hmass()/(HEOS.gas_constant()/HEOS.molar_mass()*HEOS.get_reducing().T); @@ -86,14 +81,9 @@ int main() for (std::size_t i = 0; i < sizeof(IIR_refs)/sizeof(IIR_refs[0]); ++i) { try{ -<<<<<<< HEAD - set_reference_stateS(IIR_refs[i],"RESET"); - HelmholtzEOSMixtureBackend HEOS(std::vector(1,IIR_refs[i])); -======= //set_reference_stateS(IIR_refs[i],"RESET"); std::vector comps(1,IIR_refs[i]); HelmholtzEOSMixtureBackend HEOS(comps); ->>>>>>> cb497b443cbbf60be06b3485369837a785fb34c9 HEOS.update(QT_INPUTS, 0, 273.15); double delta_a1 = (HEOS.smass()-1000)/(HEOS.gas_constant()/HEOS.molar_mass()); double delta_a2 = -(HEOS.hmass()-200000)/(HEOS.gas_constant()/HEOS.molar_mass()*HEOS.get_reducing().T); @@ -167,7 +157,7 @@ int main() if (0) { double rrr0 = PropsSI("P","T",200,"Dmolar",14000,"REFPROP::R125"); - double rrr2 = PropsSI("P","T",200,"Dmolar",14000,"R125"); + double rrr2 = PropsSI("P","T",200,"Dmolar",14000,"R125"); double rrr =0 ; } if (0) @@ -193,10 +183,12 @@ int main() double rr0 = PropsSI("L","T",647.35,"Dmass",272,"Water"); + #if ENABLE_CATCH std::vector tags; - tags.push_back("[transport]"); + tags.push_back("[rp1485]"); //run_user_defined_tests(tags); run_tests(); + #endif std::string fl = get_global_param_string("FluidsList"); double rr = PropsSI("D", "P", 3e5, "T", 300, "Nitrogen");