From fb29df56e7f87a97fce1db62557d0d8123ae2034 Mon Sep 17 00:00:00 2001 From: Rod Persky Date: Sat, 17 May 2014 11:09:50 +1000 Subject: [PATCH 01/18] Updated CMakeLists.txt CMakeLists with prebuild only worked with vs, now using dependency instead. Also findpythoninterp wasn't correcly getting the desired python version, fixed to select python 2.7. Test exec definition also moved around a tad, code is missing catch thouth which is an issue? --- CMakeLists.txt | 85 +++++++++++++++++++++++++++----------------------- 1 file changed, 46 insertions(+), 39 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b130c4b..e648a9f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,14 +35,9 @@ option (COOLPROP_STATIC_LIBRARY "Build and install CoolProp as a STATIC library (.lib, .a) as opposed to SHARED (.dll, .so)" ON) -#OPTION(COOLPROP_TESTING -# "Build with test flags and include main() from catch" -# OFF) - -##IF(COOLPROP_TESTING) # custom flags -## ADD_DEFINITIONS(-D ENABLE_CATCH -D CATCH_CONFIG_MAIN) -## ENDIF(COOLPROP_TESTING) - +option (COOLPROP_TESTING + "Build with test flags and include main() from catch" + OFF) ####################################### # FIND ALL SOURCES # @@ -51,33 +46,12 @@ option (COOLPROP_STATIC_LIBRARY # split includes and source folders # # this makes it easier for developers # # to quickly find relevant includes. # +# This section finds all sources, # +# headers and corrosponding dirs. # ####################################### -file(GLOB_RECURSE APP_SOURCES "src/*.cpp") # source reside in src/ -file(GLOB_RECURSE APP_HEADERS "include/*.h" "src/*.h") # includes reside in include/ and src/ - -##IF(COOLPROP_TESTING) -## #file(GLOB_RECURSE TEST_HEADERS "externals/Catch/include/*.hpp") # includes catch -## list (APPEND APP_HEADERS "externals/Catch/include/catch.hpp") -## # Add an executable -## add_executable (testRunner ${APP_SOURCES}) -## target_compile_options(testRunner -D ENABLE_CATCH -D CATCH_CONFIG_MAIN) -##ENDIF(COOLPROP_TESTING) - -add_executable (testRunner ${APP_SOURCES}) -#target_compile_definitions(testRunner ENABLE_CATCH CATCH_CONFIG_MAIN) -#target_include_directories(testRunner "externals/Catch/include") - -get_filename_component(TST_HEADER "externals/Catch/include" ABSOLUTE) - -set_property( - TARGET testRunner - APPEND PROPERTY COMPILE_DEFINITIONS ENABLE_CATCH CATCH_CONFIG_MAIN - ) -set_property( - TARGET testRunner - APPEND PROPERTY INCLUDE_DIRECTORIES ${TST_HEADER} - ) +file(GLOB_RECURSE APP_SOURCES "src/*.cpp") +file(GLOB_RECURSE APP_HEADERS "include/*.h" "src/*.h" "external/*.h") set (APP_INCLUDE_DIRS "") foreach (_headerFile ${APP_HEADERS}) @@ -87,13 +61,39 @@ endforeach() list(REMOVE_DUPLICATES APP_INCLUDE_DIRS) include_directories(${APP_INCLUDE_DIRS}) -# Build CoolProp as a shared or static library depending on build option + +####################################### +# MAKE ARTIFACTS # +#-------------------------------------# +# In this section we define the # +# artifacts (exes, libs) that will be # +# made for coolprop, these include # +# customisation from earier options. # +####################################### + + +### COOLPROP LIB or DLL ### if (COOLPROP_STATIC_LIBRARY) add_library(${app_name} STATIC ${APP_SOURCES}) else() add_library(${app_name} SHARED ${APP_SOURCES}) endif() + +### COOLPROP TESTING APP ### +if (COOLPROP_TESTING) + add_definitions (-DENABLE_CATCH -DCATCH_CONFIG_MAIN) + add_executable (testRunner ${APP_SOURCES}) + get_filename_component(TST_HEADER "externals/Catch/include" ABSOLUTE) + + set_property(TARGET testRunner + APPEND PROPERTY COMPILE_DEFINITIONS ENABLE_CATCH CATCH_CONFIG_MAIN) + + set_property(TARGET testRunner + APPEND PROPERTY INCLUDE_DIRECTORIES ${TST_HEADER}) +endif() + + ####################################### # REQUIRED MODULES # #-------------------------------------# @@ -104,12 +104,19 @@ endif() #set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/dev/cmake/modules/") set(Python_ADDITIONAL_VERSIONS 2.7 2.6 2.5 2.4) -find_package (PythonInterp REQUIRED) +find_package (PythonInterp 2.7 REQUIRED) -ADD_CUSTOM_COMMAND (TARGET ${app_name} PRE_BUILD - COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/dev/generate_headers.py" - COMMENT "Information string for prebuild execution" -) +add_custom_target(generate_headers + COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/dev/generate_headers.py") + +add_dependencies(${app_name} generate_headers) + + +# only works in visual studio +#ADD_CUSTOM_COMMAND (TARGET ${app_name} PRE_BUILD +# COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/dev/generate_headers.py" +# COMMENT "Information string for prebuild execution" +#) From baaf197fd053180dfb953729fcf7d0b2bbf352de Mon Sep 17 00:00:00 2001 From: Rod Persky Date: Sat, 17 May 2014 11:48:57 +1000 Subject: [PATCH 02/18] CmakeLists playing to try and get catch to build --- CMakeLists.txt | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e648a9f4..891f628b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,7 +51,7 @@ option (COOLPROP_TESTING ####################################### file(GLOB_RECURSE APP_SOURCES "src/*.cpp") -file(GLOB_RECURSE APP_HEADERS "include/*.h" "src/*.h" "external/*.h") +file(GLOB_RECURSE APP_HEADERS "include/*.h" "src/*.h") # "externals/*.hpp") set (APP_INCLUDE_DIRS "") foreach (_headerFile ${APP_HEADERS}) @@ -71,6 +71,10 @@ include_directories(${APP_INCLUDE_DIRS}) # customisation from earier options. # ####################################### +### FLUIDS, MIXTURES JSON ### +add_custom_target(generate_headers + COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/dev/generate_headers.py") + ### COOLPROP LIB or DLL ### if (COOLPROP_STATIC_LIBRARY) @@ -78,19 +82,17 @@ if (COOLPROP_STATIC_LIBRARY) else() add_library(${app_name} SHARED ${APP_SOURCES}) endif() +add_dependencies (${app_name} generate_headers) ### COOLPROP TESTING APP ### if (COOLPROP_TESTING) add_definitions (-DENABLE_CATCH -DCATCH_CONFIG_MAIN) - add_executable (testRunner ${APP_SOURCES}) - get_filename_component(TST_HEADER "externals/Catch/include" ABSOLUTE) + list (APPEND APP_INCLUDE_DIRS "externals/Catch/include") + include_directories(${APP_INCLUDE_DIRS}) - set_property(TARGET testRunner - APPEND PROPERTY COMPILE_DEFINITIONS ENABLE_CATCH CATCH_CONFIG_MAIN) - - set_property(TARGET testRunner - APPEND PROPERTY INCLUDE_DIRECTORIES ${TST_HEADER}) + add_executable (testRunner ${APP_SOURCES}) + add_dependencies (testRunner generate_headers) endif() @@ -101,24 +103,11 @@ endif() # features, these include: # # DL (CMAKE_DL_LIBS) for REFPROP # ####################################### -#set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/dev/cmake/modules/") set(Python_ADDITIONAL_VERSIONS 2.7 2.6 2.5 2.4) find_package (PythonInterp 2.7 REQUIRED) -add_custom_target(generate_headers - COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/dev/generate_headers.py") - -add_dependencies(${app_name} generate_headers) - - -# only works in visual studio -#ADD_CUSTOM_COMMAND (TARGET ${app_name} PRE_BUILD -# COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/dev/generate_headers.py" -# COMMENT "Information string for prebuild execution" -#) - - +find_package (${CMAKE_DL_LIBS}) # TODO: check relevance of http://www.cmake.org/Wiki/BuildingWinDLL From f41dbe60e2b4d152f3375d5e7f655f06cdee31bf Mon Sep 17 00:00:00 2001 From: Rod Persky Date: Sat, 17 May 2014 12:34:34 +1000 Subject: [PATCH 03/18] added dl --- CMakeLists.txt | 9 ++++++--- dev/cmake/Modules/Finddl.cmake | 30 ++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 dev/cmake/Modules/Finddl.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 891f628b..c5e74df2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -88,11 +88,14 @@ add_dependencies (${app_name} generate_headers) ### COOLPROP TESTING APP ### if (COOLPROP_TESTING) add_definitions (-DENABLE_CATCH -DCATCH_CONFIG_MAIN) - list (APPEND APP_INCLUDE_DIRS "externals/Catch/include") + list (APPEND APP_INCLUDE_DIRS "externals/Catch/single_include") include_directories(${APP_INCLUDE_DIRS}) add_executable (testRunner ${APP_SOURCES}) add_dependencies (testRunner generate_headers) + + target_link_libraries (testRunner ${CMAKE_DL_LIBS}) + endif() @@ -103,11 +106,11 @@ endif() # features, these include: # # DL (CMAKE_DL_LIBS) for REFPROP # ####################################### +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/dev/cmake/Modules/") set(Python_ADDITIONAL_VERSIONS 2.7 2.6 2.5 2.4) find_package (PythonInterp 2.7 REQUIRED) - -find_package (${CMAKE_DL_LIBS}) +find_package (${CMAKE_DL_LIBS} REQUIRED) # TODO: check relevance of http://www.cmake.org/Wiki/BuildingWinDLL diff --git a/dev/cmake/Modules/Finddl.cmake b/dev/cmake/Modules/Finddl.cmake new file mode 100644 index 00000000..1689e4c7 --- /dev/null +++ b/dev/cmake/Modules/Finddl.cmake @@ -0,0 +1,30 @@ +# - Find libdl +# Find the native LIBDL includes and library +# +# LIBDL_INCLUDE_DIR - where to find dlfcn.h, etc. +# LIBDL_LIBRARIES - List of libraries when using libdl. +# LIBDL_FOUND - True if libdl found. + + +IF (LIBDL_INCLUDE_DIR) + # Already in cache, be silent + SET(LIBDL_FIND_QUIETLY TRUE) +ENDIF (LIBDL_INCLUDE_DIR) + +FIND_PATH(LIBDL_INCLUDE_DIR dlfcn.h) + +SET(LIBDL_NAMES dl libdl ltdl libltdl) +FIND_LIBRARY(LIBDL_LIBRARY NAMES ${LIBDL_NAMES} ) + +# handle the QUIETLY and REQUIRED arguments and set LIBDL_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibDL DEFAULT_MSG LIBDL_LIBRARY LIBDL_INCLUDE_DIR) + +IF(LIBDL_FOUND) + SET( LIBDL_LIBRARIES ${LIBDL_LIBRARY} ) +ELSE(LIBDL_FOUND) + SET( LIBDL_LIBRARIES ) +ENDIF(LIBDL_FOUND) + +MARK_AS_ADVANCED( LIBDL_LIBRARY LIBDL_INCLUDE_DIR ) From ffd9c007e53ee0a0470e14f717141bffb36b92a9 Mon Sep 17 00:00:00 2001 From: Rod Persky Date: Sat, 17 May 2014 17:00:38 +1000 Subject: [PATCH 04/18] CMake Can now compile with catch with no errors, although there are errors within the test cases. Also added a check in the generate_headers.py file to see if the headers have already been generated (this is a proposal and can be removed) because it's time consuming when there is no changes to those files. the change is fairly dumb (check if file .JSON_done exists) and doesn't consider the modification time of the files. --- CMakeLists.txt | 20 +++++++++++++++----- dev/generate_headers.py | 10 ++++++++-- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c5e74df2..395fff6c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,15 +87,25 @@ add_dependencies (${app_name} generate_headers) ### COOLPROP TESTING APP ### if (COOLPROP_TESTING) - add_definitions (-DENABLE_CATCH -DCATCH_CONFIG_MAIN) - list (APPEND APP_INCLUDE_DIRS "externals/Catch/single_include") + list (APPEND APP_INCLUDE_DIRS "externals/Catch/include") include_directories(${APP_INCLUDE_DIRS}) + enable_testing() - add_executable (testRunner ${APP_SOURCES}) - add_dependencies (testRunner generate_headers) + # CATCH TEST, compile everything with catch and set test entry point + add_executable (testRunner.exe ${APP_SOURCES}) + add_dependencies (testRunner.exe generate_headers) + set_target_properties (testRunner.exe PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -DENABLE_CATCH") + set_source_files_properties(src/Helmholtz.cpp PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -DCATCH_CONFIG_MAIN") + target_link_libraries (testRunner.exe ${CMAKE_DL_LIBS}) + add_test(ProceedureTests testRunner.exe) - target_link_libraries (testRunner ${CMAKE_DL_LIBS}) + # C++ Documentation Test + add_executable (docuTest.exe "Web/examples/C++/Example.cpp") + add_dependencies (docuTest.exe ${app_name}) + target_link_libraries (docuTest.exe ${app_name}) + target_link_libraries (docuTest.exe ${CMAKE_DL_LIBS}) + add_test(DocumentationTest docuTest.exe) endif() diff --git a/dev/generate_headers.py b/dev/generate_headers.py index 3ed8dfb9..6a5a5417 100644 --- a/dev/generate_headers.py +++ b/dev/generate_headers.py @@ -83,8 +83,14 @@ if __name__=='__main__': path = os.path.abspath(__file__) path = os.path.dirname(path) path = os.path.dirname(path) - + + if os.path.exists(os.path.join(path, ".JSON_done")): + sys.exit() + version_to_file(root_dir = path) gitrev_to_file(root_dir = path) import JSON_to_CPP - JSON_to_CPP.TO_CPP(root_dir = path) \ No newline at end of file + JSON_to_CPP.TO_CPP(root_dir = path) + + open(os.path.join(path, ".JSON_done"), "w").close() + From 38a21932ed75d727d23e5618c69cc6bc6a7cbf33 Mon Sep 17 00:00:00 2001 From: Rod Persky Date: Sat, 17 May 2014 17:06:27 +1000 Subject: [PATCH 05/18] PolyMath.cpp If this is the test entry point should define this in a makefile with -D or in the cmake file. Then it's more clear? unless this is absolutely needed --- src/PolyMath.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/PolyMath.cpp b/src/PolyMath.cpp index 5cf793b6..d9300d5f 100644 --- a/src/PolyMath.cpp +++ b/src/PolyMath.cpp @@ -943,10 +943,9 @@ double BaseExponential::expval(const std::vector< std::vector > &coeffic #ifdef ENABLE_CATCH #include - -//#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file #include "catch.hpp" + class PolynomialConsistencyFixture { public: CoolProp::BasePolynomial poly; From e9e4f5d824faf89c596f9d31677f8edfac5eee35 Mon Sep 17 00:00:00 2001 From: Rod Persky Date: Sat, 17 May 2014 17:13:14 +1000 Subject: [PATCH 06/18] match PolyMath.cpp old Define -DCATCH_CONFIG_MAIN in src/PolyMath.cpp using the cmake build --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 395fff6c..c4fd0d19 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,7 +95,7 @@ if (COOLPROP_TESTING) add_executable (testRunner.exe ${APP_SOURCES}) add_dependencies (testRunner.exe generate_headers) set_target_properties (testRunner.exe PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -DENABLE_CATCH") - set_source_files_properties(src/Helmholtz.cpp PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -DCATCH_CONFIG_MAIN") + set_source_files_properties(src/PolyMath.cpp PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -DCATCH_CONFIG_MAIN") target_link_libraries (testRunner.exe ${CMAKE_DL_LIBS}) add_test(ProceedureTests testRunner.exe) From 58aa23c95b992b62f9b21a746007e24945f970ad Mon Sep 17 00:00:00 2001 From: Rod Persky Date: Sat, 17 May 2014 17:44:21 +1000 Subject: [PATCH 07/18] test travis --- .travis.yml | 15 +++---- Web/examples/C++/Example.cpp | 80 +++++++++++++++++++++--------------- 2 files changed, 53 insertions(+), 42 deletions(-) diff --git a/.travis.yml b/.travis.yml index ace61c50..8ef6f1f7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,17 +3,14 @@ virtualenv: system_site_packages: true python: - "2.7" - - "3.2" - - "3.3" # command to install dependencies install: - gcc -v - - pip -q install cython --install-option="--no-cython-compile" - - cd wrappers/Python - - python setup.py install # Install CoolProp - - cd ../SharedLibrary + - mkdir build + - cmake .. -DCOOLPROP_TESTING=ON + - cmake .. -DCOOLPROP_TESTING=ON - make - + - ctest # command to run tests script: - pwd @@ -23,6 +20,6 @@ script: notifications: email: recipients: - - ian.h.bell@gmail.com + - rodney.persky@gmail.com on_success: never # default: change - on_failure: always # default: always \ No newline at end of file + on_failure: always # default: always diff --git a/Web/examples/C++/Example.cpp b/Web/examples/C++/Example.cpp index c8f6362f..503e98c0 100644 --- a/Web/examples/C++/Example.cpp +++ b/Web/examples/C++/Example.cpp @@ -1,11 +1,13 @@ #include "CoolProp.h" #include "HumidAirProp.h" -#include "CPState.h" +//#include "CPState.h" #include #include #pragma GCC diagnostic ignored "-Wwrite-strings" //Ignore char* warnings +using namespace CoolProp; // For normal CoolProp calls +using namespace HumidAir; // For HAPropsSI int main() { double T, h, p, D; @@ -13,89 +15,101 @@ int main() { printf("CoolProp gitrevision:\t%s\n", get_global_param_string("gitrevision").c_str()); printf("CoolProp fluids:\t%s\n", get_global_param_string("FluidsList").c_str()); + printf("\n************ USING EOS *************\n"); printf("FLUID STATE INDEPENDENT INPUTS\n"); - printf("Critical Density Propane: %f kg/m^3\n", Props1("Propane", "rhocrit")); + //printf("Critical Density Propane: %f kg/m^3\n", PropsSI1("Propane", "rhocrit")); printf("\nTWO PHASE INPUTS (Pressure)\n"); - printf("Density of saturated liquid Propane at 101.325 kPa: %f kg/m^3\n", Props("D", 'P', 101.325, 'Q', 0, "Propane")); - printf("Density of saturated vapor R290 at 101.325 kPa: %f kg/m^3\n", Props("D", 'P', 101.325, 'Q', 1, "R290")); + printf("Density of saturated liquid Propane at 101.325 kPa: %f kg/m^3\n", PropsSI("D", "P", 101.325, "Q", 0, "Propane")); + printf("Density of saturated vapor R290 at 101.325 kPa: %f kg/m^3\n", PropsSI("D", "P", 101.325, "Q", 1, "R290")); printf("\nTWO PHASE INPUTS (Temperature)\n"); - printf("Density of saturated liquid Propane at 300 K: %f kg/m^3\n", Props("D", 'T', 300, 'Q', 0, "Propane")); - printf("Density of saturated vapor R290 at 300 K: %f kg/m^3\n", Props("D", 'T', 300, 'Q', 1, "R290")); + printf("Density of saturated liquid Propane at 300 K: %f kg/m^3\n", PropsSI("D", "T", 300, "Q", 0, "Propane")); + printf("Density of saturated vapor R290 at 300 K: %f kg/m^3\n", PropsSI("D", "T", 300, "Q", 1, "R290")); printf("\nSINGLE PHASE CYCLE (Propane)\n"); - p = Props("P", 'T', 300, 'D', 1, "Propane"); - h = Props("H", 'T', 300, 'D', 1, "Propane"); + p = PropsSI("P", "T", 300, "D", 1, "Propane"); + h = PropsSI("H", "T", 300, "D", 1, "Propane"); printf("T,D -> P,H : 300,1 -> %f,%f\n", p, h); - T = Props("T", 'P', p, 'H', h, "Propane"); - D = Props("D", 'P', p, 'H', h, "Propane"); + T = PropsSI("T", "P", p, "H", h, "Propane"); + D = PropsSI("D", "P", p, "H", h, "Propane"); printf("P,H -> T,D : %f, %f -> %f, %f\n", p, h, T, D); + /* enable_TTSE_LUT not currently in V5 printf("\n************ USING TTSE ***************\n"); enable_TTSE_LUT("Propane"); printf("TWO PHASE INPUTS (Pressure)\n"); - printf("Density of saturated liquid Propane at 101.325 kPa: %f kg/m^3\n", Props("D", 'P', 101.325, 'Q', 0, "Propane")); - printf("Density of saturated vapor R290 at 101.325 kPa: %f kg/m^3\n", Props("D", 'P', 101.325, 'Q', 1, "R290")); + printf("Density of saturated liquid Propane at 101.325 kPa: %f kg/m^3\n", PropsSI("D", "P", 101.325, "Q", 0, "Propane")); + printf("Density of saturated vapor R290 at 101.325 kPa: %f kg/m^3\n", PropsSI("D", "P", 101.325, "Q", 1, "R290")); printf("\nTWO PHASE INPUTS (Temperature)"); - printf("Density of saturated liquid Propane at 300 K: %f kg/m^3\n", Props("D", 'T', 300, 'Q', 0, "Propane")); - printf("Density of saturated vapor R290 at 300 K: %f kg/m^3\n", Props("D", 'T', 300, 'Q', 1, "R290")); + printf("Density of saturated liquid Propane at 300 K: %f kg/m^3\n", PropsSI("D", "T", 300, "Q", 0, "Propane")); + printf("Density of saturated vapor R290 at 300 K: %f kg/m^3\n", PropsSI("D", "T", 300, "Q", 1, "R290")); printf("\nSINGLE PHASE CYCLE (propane)\n"); - p = Props("P", 'T', 300, 'D', 1, "Propane"); - h = Props("H", 'T', 300, 'D', 1, "Propane"); + p = PropsSI("P", "T", 300, "D", 1, "Propane"); + h = PropsSI("H", "T", 300, "D", 1, "Propane"); printf("T,D -> P,H : 300,1 -> %f,%f", p, h); - T = Props("T", 'P', p, 'H', h, "Propane"); - D = Props("D", 'P', p, 'H', h, "Propane"); + T = PropsSI("T", "P", p, "H", h, "Propane"); + D = PropsSI("D", "P", p, "H", h, "Propane"); printf("P,H -> T,D : %f, %f -> %f, %f\n", p, h, T, D); disable_TTSE_LUT("Propane"); + */ + /* get_fluid_param_string not currently in V5 try { printf("\n************ USING REFPROP ***************\n"); std::string RPName = std::string("REFPROP-")+get_fluid_param_string("Propane","REFPROPname"); printf("TWO PHASE INPUTS (Pressure)"); - printf("Density of saturated liquid Propane at 101.325 kPa: %f kg/m^3\n", Props("D", 'P', 101.325, 'Q', 0, RPName)); - printf("Density of saturated vapor R290 at 101.325 kPa: %f kg/m^3\n", Props("D", 'P', 101.325, 'Q', 1, RPName)); + printf("Density of saturated liquid Propane at 101.325 kPa: %f kg/m^3\n", PropsSI("D", "P", 101.325, "Q", 0, RPName)); + printf("Density of saturated vapor R290 at 101.325 kPa: %f kg/m^3\n", PropsSI("D", "P", 101.325, "Q", 1, RPName)); printf("\nTWO PHASE INPUTS (Temperature)"); - printf("Density of saturated liquid Propane at 300 K: %f kg/m^3\n", Props("D", 'T', 300, 'Q', 0, RPName)); - printf("Density of saturated vapor R290 at 300 K: %f kg/m^3\n", Props("D", 'T', 300, 'Q', 1, RPName)); + printf("Density of saturated liquid Propane at 300 K: %f kg/m^3\n", PropsSI("D", "T", 300, "Q", 0, RPName)); + printf("Density of saturated vapor R290 at 300 K: %f kg/m^3\n", PropsSI("D", "T", 300, "Q", 1, RPName)); printf("\nSINGLE PHASE CYCLE (propane)\n"); - p = Props("P", 'T', 300, 'D', 1, RPName); - h = Props("H", 'T', 300, 'D', 1, RPName); + p = PropsSI("P", "T", 300, "D", 1, RPName); + h = PropsSI("H", "T", 300, "D", 1, RPName); printf("T,D -> P,H : 300,1 -> %f,%f\n", p, h); - T = Props("T", 'P', p, 'H', h, RPName); - D = Props("D", 'P', p, 'H', h, RPName); + T = PropsSI("T", "P", p, "H", h, RPName); + D = PropsSI("D", "P", p, "H", h, RPName); printf("P,H -> T,D : %f, %f -> %f, %f\n", p, h, T, D); } catch (std::exception &e) { printf("\n************ CANT USE REFPROP ************\n"); } + + */ + /* set_standard_unit_system not currently in V5 printf("\n************ CHANGE UNIT SYSTEM (default is kSI) *************\n"); set_standard_unit_system(UNIT_SYSTEM_SI); - printf("Vapor pressure of water at 373.15 K in SI units (Pa): %f\n", Props("P", 'T', 373.15, 'Q', 0, "Water")); + printf("Vapor pressure of water at 373.15 K in SI units (Pa): %f\n", PropsSI("P", "T", 373.15, "Q", 0, "Water")); set_standard_unit_system(UNIT_SYSTEM_KSI); - printf("Vapor pressure of water at 373.15 K in kSI units (kPa): %f\n", Props("P", 'T', 373.15, 'Q', 0, "Water")); + printf("Vapor pressure of water at 373.15 K in kSI units (kPa): %f\n", PropsSI("P", "T", 373.15, "Q", 0, "Water")); + */ printf("\n************ BRINES AND SECONDARY WORKING FLUIDS *************\n"); - printf("Density of 50%% (mass) ethylene glycol/water at 300 K, 101.325 kPa: %f kg/m^3\n", Props("D", 'T', 300, 'P', 101.325, "EG-50%")); - printf("Viscosity of Therminol D12 at 350 K, 101.325 kPa: %f Pa-s\n", Props("V", 'T', 350, 'P', 101.325, "TD12")); + printf("Density of 50%% (mass) ethylene glycol/water at 300 K, 101.325 kPa: %f kg/m^3\n", PropsSI("D", "T", 300, "P", 101.325, "EG-50%")); + printf("Viscosity of Therminol D12 at 350 K, 101.325 kPa: %f Pa-s\n", PropsSI("V", "T", 350, "P", 101.325, "TD12")); - printf("\n************ HUMID AIR PROPERTIES *************\n"); - printf("Humidity ratio of 50%% rel. hum. air at 300 K, 101.325 kPa: %f kg_w/kg_da\n", HAProps("W", "T", 300, "P", 101.325, "R", 0.5)); - printf("Relative humidity from last calculation: %f (fractional)\n", HAProps("R", "T", 300, "P", 101.325, "W", HAProps("W", "T", 300, "P", 101.325, "R", 0.5))); + // HAProps API broken in V5 + //printf("\n************ HUMID AIR PROPERTIES *************\n"); + //printf("Humidity ratio of 50%% rel. hum. air at 300 K, 101.325 kPa: %f kg_w/kg_da\n", HAPropsSI('W', 'T', 300, 'P', 101.325, 'R', 0.5)); + //printf("Relative humidity from last calculation: %f (fractional)\n", HAPropsSI('R', 'T', 300, 'P', 101.325, 'W', HAPropsSI('W', 'T', 300, 'P', 101.325, 'R', 0.5))); + + return 0; + } From 33b719bf11da70138c12a92bc9f4c23702bfb7b1 Mon Sep 17 00:00:00 2001 From: Rod Persky Date: Sat, 17 May 2014 17:52:41 +1000 Subject: [PATCH 08/18] travis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 8ef6f1f7..baab5417 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,7 @@ python: install: - gcc -v - mkdir build + - cd build - cmake .. -DCOOLPROP_TESTING=ON - cmake .. -DCOOLPROP_TESTING=ON - make From cb1de1984039d52b7f90e8fd7e2f6a62ddc94032 Mon Sep 17 00:00:00 2001 From: Rod Persky Date: Sat, 17 May 2014 17:57:30 +1000 Subject: [PATCH 09/18] fix --- src/Tests/Tests.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Tests/Tests.cpp b/src/Tests/Tests.cpp index 083f3cbd..68b8db54 100644 --- a/src/Tests/Tests.cpp +++ b/src/Tests/Tests.cpp @@ -12,7 +12,7 @@ #include "Tests.h" - #define CATCH_CONFIG_RUNNER + #include "catch.hpp" static int inputs[] = { From affa330456db5bbc6e3696356563bd2c154b581c Mon Sep 17 00:00:00 2001 From: Rod Persky Date: Sat, 17 May 2014 18:01:16 +1000 Subject: [PATCH 10/18] fix --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index c4fd0d19..5d417240 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,6 +96,7 @@ if (COOLPROP_TESTING) add_dependencies (testRunner.exe generate_headers) set_target_properties (testRunner.exe PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -DENABLE_CATCH") set_source_files_properties(src/PolyMath.cpp PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -DCATCH_CONFIG_MAIN") + set_source_files_properties(src/Tests/Tests.cpp PROPERTIES COMPILE_FLAGS "") target_link_libraries (testRunner.exe ${CMAKE_DL_LIBS}) add_test(ProceedureTests testRunner.exe) From 56c68664ede6cf4d0399b9be8b9906ddfe25af35 Mon Sep 17 00:00:00 2001 From: Rod Persky Date: Sat, 17 May 2014 18:09:49 +1000 Subject: [PATCH 11/18] fix --- CMakeLists.txt | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d417240..de3e0bc8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,6 +52,8 @@ option (COOLPROP_TESTING file(GLOB_RECURSE APP_SOURCES "src/*.cpp") file(GLOB_RECURSE APP_HEADERS "include/*.h" "src/*.h") # "externals/*.hpp") +list(REMOVE_ITEM APP_SOURCES "${CMAKE_SOURCE_DIR}/src/Tests/Tests.cpp") + set (APP_INCLUDE_DIRS "") foreach (_headerFile ${APP_HEADERS}) @@ -59,9 +61,24 @@ foreach (_headerFile ${APP_HEADERS}) list (APPEND APP_INCLUDE_DIRS ${_dir}) endforeach() list(REMOVE_DUPLICATES APP_INCLUDE_DIRS) + include_directories(${APP_INCLUDE_DIRS}) +####################################### +# REQUIRED MODULES # +#-------------------------------------# +# CoolProp requires some standard OS # +# features, these include: # +# DL (CMAKE_DL_LIBS) for REFPROP # +####################################### +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/dev/cmake/Modules/") + +set(Python_ADDITIONAL_VERSIONS 2.7 2.6 2.5 2.4) +find_package (PythonInterp 2.7 REQUIRED) +find_package (${CMAKE_DL_LIBS} REQUIRED) + + ####################################### # MAKE ARTIFACTS # #-------------------------------------# @@ -96,7 +113,6 @@ if (COOLPROP_TESTING) add_dependencies (testRunner.exe generate_headers) set_target_properties (testRunner.exe PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -DENABLE_CATCH") set_source_files_properties(src/PolyMath.cpp PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -DCATCH_CONFIG_MAIN") - set_source_files_properties(src/Tests/Tests.cpp PROPERTIES COMPILE_FLAGS "") target_link_libraries (testRunner.exe ${CMAKE_DL_LIBS}) add_test(ProceedureTests testRunner.exe) @@ -110,19 +126,6 @@ if (COOLPROP_TESTING) endif() -####################################### -# REQUIRED MODULES # -#-------------------------------------# -# CoolProp requires some standard OS # -# features, these include: # -# DL (CMAKE_DL_LIBS) for REFPROP # -####################################### -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/dev/cmake/Modules/") - -set(Python_ADDITIONAL_VERSIONS 2.7 2.6 2.5 2.4) -find_package (PythonInterp 2.7 REQUIRED) -find_package (${CMAKE_DL_LIBS} REQUIRED) - # TODO: check relevance of http://www.cmake.org/Wiki/BuildingWinDLL #include_directories("${CMAKE_CURRENT_SOURCE_DIR}/CoolProp") From ed98e56ad894bc29bfdb8946321a3b97720c5cb4 Mon Sep 17 00:00:00 2001 From: Rod Persky Date: Sat, 17 May 2014 18:10:25 +1000 Subject: [PATCH 12/18] fix --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index baab5417..358fc6e3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,6 @@ install: - mkdir build - cd build - cmake .. -DCOOLPROP_TESTING=ON - - cmake .. -DCOOLPROP_TESTING=ON - make - ctest # command to run tests From fd43d3848be0dffe085df10b8d87f3f5180f19d1 Mon Sep 17 00:00:00 2001 From: Rod Persky Date: Sat, 17 May 2014 18:13:30 +1000 Subject: [PATCH 13/18] working --- .travis.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 358fc6e3..a028f878 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,19 +3,18 @@ virtualenv: system_site_packages: true python: - "2.7" -# command to install dependencies + install: - gcc -v - mkdir build - cd build - cmake .. -DCOOLPROP_TESTING=ON - make - - ctest -# command to run tests + script: - pwd - - cd $TRAVIS_BUILD_DIR/wrappers/Python/CoolProp/tests - - nosetests + - cd $TRAVIS_BUILD_DIR/build + - ctest notifications: email: From 0c2068277d2c8ed50d8a78220f07a8a5883c63b5 Mon Sep 17 00:00:00 2001 From: Rod Persky Date: Sat, 17 May 2014 23:35:13 +1000 Subject: [PATCH 14/18] Update travis to debug config and be more verbose --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index a028f878..6d74ea1a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,13 +8,13 @@ install: - gcc -v - mkdir build - cd build - - cmake .. -DCOOLPROP_TESTING=ON + - cmake .. -DCOOLPROP_TESTING=ON -DCMAKE_BUILD_TYPE=Debug - make script: - pwd - cd $TRAVIS_BUILD_DIR/build - - ctest + - ctest -VV notifications: email: From ffe6cb4e2d5e39aa5e1b6ce6c6a690cd1b14df4f Mon Sep 17 00:00:00 2001 From: Rod Persky Date: Sun, 18 May 2014 00:03:47 +1000 Subject: [PATCH 15/18] remove old cmakelists from src/ --- src/CMake/CMakeLists.txt | 35 ------------------------------- src/CMake/src/CoolPropConfig.h | 3 --- src/CMake/src/CoolPropConfig.h.in | 3 --- src/CMake/src/CoolPropMain.cxx | 23 -------------------- 4 files changed, 64 deletions(-) delete mode 100644 src/CMake/CMakeLists.txt delete mode 100644 src/CMake/src/CoolPropConfig.h delete mode 100644 src/CMake/src/CoolPropConfig.h.in delete mode 100644 src/CMake/src/CoolPropMain.cxx diff --git a/src/CMake/CMakeLists.txt b/src/CMake/CMakeLists.txt deleted file mode 100644 index e8e25be5..00000000 --- a/src/CMake/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ -cmake_minimum_required (VERSION 2.8) -project (CoolProp) - -# Offer the user the choice of overriding the directories -set (PROJECT_SRC_DIR src CACHE PATH "Project directory for source files") -set (PROJECT_BIN_DIR bin CACHE PATH "Build directory for executables") -set (PROJECT_LIB_DIR lib CACHE PATH "Build directory for libraries") -set (PROJECT_INC_DIR include CACHE PATH "Build directory for header files") - -# The version number. -set (CoolProp_VERSION_MAJOR 5) -set (CoolProp_VERSION_MINOR 0) -set (CoolProp_VERSION_PATCH 0) -set (CoolProp_VERSION ${CoolProp_VERSION_MAJOR}.${CoolProp_VERSION_MINOR}.${CoolProp_VERSION_PATCH}) - -FIND_PACKAGE(Git) -EXECUTE_PROCESS( - COMMAND ${GIT_EXECUTABLE} describe --match=CatchMeIfYouCan --always --abbrev=40 - OUTPUT_VARIABLE CoolProp_REVISION - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - -# configure a header file to pass some of the CMake settings -# to the source code -configure_file ( - "${PROJECT_SRC_DIR}/CoolPropConfig.h.in" - "${PROJECT_SRC_DIR}/CoolPropConfig.h" - ) - -# add the binary tree to the search path for include files -# so that we will find CoolPropConfig.h -include_directories("${PROJECT_SRC_DIR}" "${PROJECT_BIN_DIR}" "${PROJECT_LIB_DIR}" "${PROJECT_INC_DIR}") - -# add the executable -add_executable(CoolProp ${PROJECT_SRC_DIR}/CoolPropMain.cpp) diff --git a/src/CMake/src/CoolPropConfig.h b/src/CMake/src/CoolPropConfig.h deleted file mode 100644 index 082c10d9..00000000 --- a/src/CMake/src/CoolPropConfig.h +++ /dev/null @@ -1,3 +0,0 @@ -// the configured options and settings for CoolProp -#define CoolProp_VERSION "5.0.0" -#define CoolProp_REVISION "" diff --git a/src/CMake/src/CoolPropConfig.h.in b/src/CMake/src/CoolPropConfig.h.in deleted file mode 100644 index 7d49e71c..00000000 --- a/src/CMake/src/CoolPropConfig.h.in +++ /dev/null @@ -1,3 +0,0 @@ -// the configured options and settings for CoolProp -#define CoolProp_VERSION "@CoolProp_VERSION@" -#define CoolProp_REVISION "${CoolProp_REVISION}" \ No newline at end of file diff --git a/src/CMake/src/CoolPropMain.cxx b/src/CMake/src/CoolPropMain.cxx deleted file mode 100644 index c67467bd..00000000 --- a/src/CMake/src/CoolPropMain.cxx +++ /dev/null @@ -1,23 +0,0 @@ -// A simple program that computes the square root of a number -#include -#include -#include -#include "CoolPropConfig.h" - -int main (int argc, char *argv[]) -{ - if (argc < 2) - { - fprintf(stdout,"%s Version %s (%s)\n", - argv[0], - CoolProp_VERSION, - CoolProp_REVISION); - fprintf(stdout,"Usage: %s number\n",argv[0]); - return 1; - } - double inputValue = atof(argv[1]); - double outputValue = sqrt(inputValue); - fprintf(stdout,"The square root of %g is %g\n", - inputValue, outputValue); - return 0; -} From d92c6c5ba1cec738e56246d183756ae110d28ed3 Mon Sep 17 00:00:00 2001 From: Rod Persky Date: Sun, 18 May 2014 01:08:35 +1000 Subject: [PATCH 16/18] Update .travis.yml Change language to cpp --- .travis.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6d74ea1a..fdda2e3c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,9 @@ -language: python -virtualenv: - system_site_packages: true -python: - - "2.7" +language: c++ +compiler: + - gcc + - clang -install: +before_script: - gcc -v - mkdir build - cd build From 8fec6fec13b1fc23486f0546bfe7c8bb23e75550 Mon Sep 17 00:00:00 2001 From: Rod Persky Date: Sun, 18 May 2014 01:13:09 +1000 Subject: [PATCH 17/18] Update .travis.yml --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index fdda2e3c..f0940348 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,7 @@ compiler: - clang before_script: + - apt-get install python-numpy - gcc -v - mkdir build - cd build From 8f3f6566f66abc0562838ce948f02f7b8466d0db Mon Sep 17 00:00:00 2001 From: Rod Persky Date: Sun, 18 May 2014 01:19:14 +1000 Subject: [PATCH 18/18] Update .travis.yml --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f0940348..d3392c56 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,8 +3,10 @@ compiler: - gcc - clang +before_install: + - sudo apt-get install -qq python-numpy + before_script: - - apt-get install python-numpy - gcc -v - mkdir build - cd build