mirror of
https://github.com/CoolProp/CoolProp.git
synced 2026-01-21 03:48:08 -05:00
Merge branch 'develop'
This commit is contained in:
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -4,3 +4,6 @@
|
||||
[submodule "externals/Eigen"]
|
||||
path = externals/Eigen
|
||||
url = https://github.com/RLovelett/eigen.git
|
||||
[submodule "externals/REFPROP-headers"]
|
||||
path = externals/REFPROP-headers
|
||||
url = https://github.com/CoolProp/REFPROP-headers.git
|
||||
|
||||
@@ -88,6 +88,7 @@ list(REMOVE_ITEM APP_SOURCES "${CMAKE_SOURCE_DIR}/src/CoolPropLib.cpp")
|
||||
|
||||
|
||||
set (APP_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/externals/Eigen")
|
||||
list (APPEND APP_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/externals/REFPROP-headers")
|
||||
foreach (_headerFile ${APP_HEADERS})
|
||||
get_filename_component(_dir ${_headerFile} PATH)
|
||||
list (APPEND APP_INCLUDE_DIRS ${_dir})
|
||||
|
||||
@@ -86,7 +86,7 @@ def TO_CPP(root_dir, hashes):
|
||||
hex_string = ',\n'.join([', '.join(chunk) for chunk in chunks])
|
||||
|
||||
# Check if hash is up to date based on using variable as key
|
||||
if variable not in hashes or (variable in hashes and hashes[variable] != get_hash(hex_string.encode('ascii'))):
|
||||
if not os.path.isfile(os.path.join(root_dir,'include',outfile)) or variable not in hashes or (variable in hashes and hashes[variable] != get_hash(hex_string.encode('ascii'))):
|
||||
|
||||
# Generate the output string
|
||||
output = '// File generated by the script dev/generate_headers.py on '+ str(datetime.now()) + '\n\n'
|
||||
@@ -276,6 +276,7 @@ def generate():
|
||||
|
||||
import shutil
|
||||
shutil.copy2(os.path.join(repo_root_path, 'externals','Catch','single_include','catch.hpp'),os.path.join(repo_root_path,'include','catch.hpp'))
|
||||
#shutil.copy2(os.path.join(repo_root_path, 'externals','REFPROP-headers','REFPROP_lib.h'),os.path.join(repo_root_path,'include','REFPROP_lib.h'))
|
||||
|
||||
version_to_file(root_dir = repo_root_path)
|
||||
gitrev_to_file(root_dir = repo_root_path)
|
||||
|
||||
@@ -12,6 +12,7 @@ fi
|
||||
CPVERSION="$1"
|
||||
BASEDIR="$HOME/buildbot/server-master/public_html"
|
||||
REPODIR="$HOME/src/CoolPropFull.git"
|
||||
TMPSDIR="$HOME/src/CoolProp.sources"
|
||||
BINFOLDER="binaries"
|
||||
DOCFOLDER="sphinx"
|
||||
SRCFOLDER="$BASEDIR/$BINFOLDER/source"
|
||||
@@ -54,9 +55,21 @@ if [ "$DRYRUN" != "false" ]; then
|
||||
echo "Dry run; skipping folder date"
|
||||
RSYNC_DRY_RUN=--dry-run
|
||||
else
|
||||
printMessage "Updating sources"
|
||||
pushd "$REPODIR"
|
||||
git pull
|
||||
python dev/scripts/git-archive-all $SRCFOLDER/CoolProp_sources.zip
|
||||
#python dev/scripts/git-archive-all $SRCFOLDER/CoolProp_sources.zip
|
||||
popd
|
||||
printMessage "Generating headers"
|
||||
rsync -a --delete "$REPODIR/" "$TMPSDIR"
|
||||
pushd "$TMPSDIR"
|
||||
git reset --hard HEAD
|
||||
python "dev/generate_headers.py"
|
||||
rm -rf .git*
|
||||
cd ..
|
||||
rm $SRCFOLDER/CoolProp_sources.zip
|
||||
zip -r $SRCFOLDER/CoolProp_sources.zip $(basename $TMPSDIR)
|
||||
cd $(basename $TMPSDIR)
|
||||
popd
|
||||
rm -f "$BINFOLDER/README.rst.txt"
|
||||
if [ "$CPVERSION" = "nightly" ]; then
|
||||
|
||||
2
externals/Catch
vendored
2
externals/Catch
vendored
Submodule externals/Catch updated: 08dc8458c0...694c4d7a59
2
externals/Eigen
vendored
2
externals/Eigen
vendored
Submodule externals/Eigen updated: 58dc47ff34...4ff82ebc03
1
externals/REFPROP-headers
vendored
Submodule
1
externals/REFPROP-headers
vendored
Submodule
Submodule externals/REFPROP-headers added at 8e0cc1899f
@@ -46,7 +46,7 @@ surface tension N/m
|
||||
#endif
|
||||
|
||||
enum DLLNameManglingStyle{ NO_NAME_MANGLING = 0, LOWERCASE_NAME_MANGLING, LOWERCASE_AND_UNDERSCORE_NAME_MANGLING };
|
||||
|
||||
|
||||
#include "REFPROP_lib.h"
|
||||
#include "REFPROPMixtureBackend.h"
|
||||
#include "Exceptions.h"
|
||||
@@ -68,26 +68,8 @@ enum DLLNameManglingStyle{ NO_NAME_MANGLING = 0, LOWERCASE_NAME_MANGLING, LOWERC
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
// Some constants for REFPROP... defined by macros for ease of use
|
||||
#define refpropcharlength 255
|
||||
#define filepathlength 255
|
||||
#define lengthofreference 3
|
||||
#define errormessagelength 255
|
||||
#define ncmax 20 // Note: ncmax is the max number of components
|
||||
#define numparams 72
|
||||
#define maxcoefs 50
|
||||
|
||||
std::string LoadedREFPROPRef;
|
||||
|
||||
// Some constants for REFPROP... defined by macros for ease of use
|
||||
#define refpropcharlength 255
|
||||
#define filepathlength 255
|
||||
#define lengthofreference 3
|
||||
#define errormessagelength 255
|
||||
#define ncmax 20 // Note: ncmax is the max number of components
|
||||
#define numparams 72
|
||||
#define maxcoefs 50
|
||||
|
||||
// Check windows
|
||||
#if _WIN32 || _WIN64
|
||||
#if _WIN64
|
||||
@@ -116,9 +98,9 @@ static char default_reference_state[] = "DEF";
|
||||
|
||||
/* Define functions as pointers and initialise them to NULL
|
||||
* Declare the functions for direct access
|
||||
*
|
||||
*
|
||||
* Example: SETPATHdll_POINTER SETPATHdll;
|
||||
*
|
||||
*
|
||||
* ***MAGIC WARNING**!! X Macros in use
|
||||
* See http://stackoverflow.com/a/148610
|
||||
* See http://stackoverflow.com/questions/147267/easy-way-to-use-variables-of-enum-types-as-string-in-c#202511
|
||||
@@ -129,15 +111,15 @@ static char default_reference_state[] = "DEF";
|
||||
|
||||
void *getFunctionPointer(const char * name, DLLNameManglingStyle mangling_style = NO_NAME_MANGLING)
|
||||
{
|
||||
std::string function_name;
|
||||
switch(mangling_style){
|
||||
case NO_NAME_MANGLING:
|
||||
function_name = name; break;
|
||||
case LOWERCASE_NAME_MANGLING:
|
||||
function_name = lower(name); break;
|
||||
case LOWERCASE_AND_UNDERSCORE_NAME_MANGLING:
|
||||
function_name = lower(name) + "_"; break;
|
||||
}
|
||||
std::string function_name;
|
||||
switch(mangling_style){
|
||||
case NO_NAME_MANGLING:
|
||||
function_name = name; break;
|
||||
case LOWERCASE_NAME_MANGLING:
|
||||
function_name = lower(name); break;
|
||||
case LOWERCASE_AND_UNDERSCORE_NAME_MANGLING:
|
||||
function_name = lower(name) + "_"; break;
|
||||
}
|
||||
#if defined(__ISWINDOWS__)
|
||||
return (void *) GetProcAddress(RefpropdllInstance, function_name.c_str());
|
||||
#elif defined(__ISLINUX__)
|
||||
@@ -159,34 +141,34 @@ double setFunctionPointers()
|
||||
printf("REFPROP is not loaded, make sure you call this function after loading the library.\n");
|
||||
return -_HUGE;
|
||||
}
|
||||
/* First determine the type of name mangling in use.
|
||||
* A) RPVersion -> RPVersion
|
||||
* B) RPVersion -> rpversion
|
||||
* C) RPVersion -> rpversion_
|
||||
*/
|
||||
DLLNameManglingStyle mangling_style = NO_NAME_MANGLING; // defaults to no mangling
|
||||
|
||||
SETUPdll = (SETUPdll_POINTER) getFunctionPointer("SETUPdll");
|
||||
if (SETUPdll == NULL){ // some mangling in use
|
||||
SETUPdll = (SETUPdll_POINTER) getFunctionPointer("setupdll");
|
||||
if (SETUPdll != NULL){
|
||||
mangling_style = LOWERCASE_NAME_MANGLING;
|
||||
}
|
||||
else{
|
||||
SETUPdll = (SETUPdll_POINTER) getFunctionPointer("setupdll_");
|
||||
if (SETUPdll != NULL){
|
||||
mangling_style = LOWERCASE_AND_UNDERSCORE_NAME_MANGLING;
|
||||
}
|
||||
else{
|
||||
throw CoolProp::ValueError("Could not load the symbol SETUPdll or any of its mangled forms; REFPROP shared library broken");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* First determine the type of name mangling in use.
|
||||
* A) RPVersion -> RPVersion
|
||||
* B) RPVersion -> rpversion
|
||||
* C) RPVersion -> rpversion_
|
||||
*/
|
||||
DLLNameManglingStyle mangling_style = NO_NAME_MANGLING; // defaults to no mangling
|
||||
|
||||
SETUPdll = (SETUPdll_POINTER) getFunctionPointer("SETUPdll");
|
||||
if (SETUPdll == NULL){ // some mangling in use
|
||||
SETUPdll = (SETUPdll_POINTER) getFunctionPointer("setupdll");
|
||||
if (SETUPdll != NULL){
|
||||
mangling_style = LOWERCASE_NAME_MANGLING;
|
||||
}
|
||||
else{
|
||||
SETUPdll = (SETUPdll_POINTER) getFunctionPointer("setupdll_");
|
||||
if (SETUPdll != NULL){
|
||||
mangling_style = LOWERCASE_AND_UNDERSCORE_NAME_MANGLING;
|
||||
}
|
||||
else{
|
||||
throw CoolProp::ValueError("Could not load the symbol SETUPdll or any of its mangled forms; REFPROP shared library broken");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Set the pointers, platform independent
|
||||
*
|
||||
*
|
||||
* Example: RPVersion = (RPVersion_POINTER) getFunctionPointer(STRINGIFY(RPVersion));
|
||||
*
|
||||
*
|
||||
* ***MAGIC WARNING**!! X Macros in use
|
||||
* See http://stackoverflow.com/a/148610
|
||||
* See http://stackoverflow.com/questions/147267/easy-way-to-use-variables-of-enum-types-as-string-in-c#202511
|
||||
@@ -194,16 +176,16 @@ double setFunctionPointers()
|
||||
#define X(name) name = (name ## _POINTER) getFunctionPointer(STRINGIFY(name), mangling_style);
|
||||
LIST_OF_REFPROP_FUNCTION_NAMES
|
||||
#undef X
|
||||
|
||||
|
||||
return COOLPROP_OK;
|
||||
}
|
||||
|
||||
std::string get_REFPROP_fluid_path()
|
||||
{
|
||||
std::string rpPath = refpropPath;
|
||||
// Allow the user to specify an alternative REFPROP path by configuration value
|
||||
std::string alt_refprop_path = CoolProp::get_config_string(ALTERNATIVE_REFPROP_PATH);
|
||||
if (!alt_refprop_path.empty()){ rpPath = alt_refprop_path; }
|
||||
// Allow the user to specify an alternative REFPROP path by configuration value
|
||||
std::string alt_refprop_path = CoolProp::get_config_string(ALTERNATIVE_REFPROP_PATH);
|
||||
if (!alt_refprop_path.empty()){ rpPath = alt_refprop_path; }
|
||||
#if defined(__ISWINDOWS__)
|
||||
return rpPath;
|
||||
#elif defined(__ISLINUX__)
|
||||
@@ -220,7 +202,7 @@ bool load_REFPROP()
|
||||
// If REFPROP is not loaded
|
||||
if (RefpropdllInstance==NULL)
|
||||
{
|
||||
|
||||
|
||||
// Load it
|
||||
#if defined(__ISWINDOWS__)
|
||||
/* We need this logic on windows because if you use the bitness
|
||||
@@ -284,16 +266,16 @@ bool load_REFPROP()
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
if (setFunctionPointers()!=COOLPROP_OK)
|
||||
{
|
||||
printf("There was an error setting the REFPROP function pointers, check types and names in header file.\n");
|
||||
throw CoolProp::AttributeError("There was an error setting the REFPROP function pointers, check types and names in header file.");
|
||||
return false;
|
||||
}
|
||||
char rpv[1000];
|
||||
RPVersion(rpv, 1000);
|
||||
RPVersion_loaded = rpv;
|
||||
char rpv[1000];
|
||||
RPVersion(rpv);
|
||||
RPVersion_loaded = rpv;
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
@@ -332,7 +314,7 @@ REFPROPMixtureBackend::~REFPROPMixtureBackend() {
|
||||
//delete RefpropdllInstance;
|
||||
RefpropdllInstance = NULL;
|
||||
#endif
|
||||
LoadedREFPROPRef = "";
|
||||
LoadedREFPROPRef = "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -385,7 +367,7 @@ bool REFPROPMixtureBackend::REFPROP_supported () {
|
||||
void REFPROPMixtureBackend::set_REFPROP_fluids(const std::vector<std::string> &fluid_names)
|
||||
{
|
||||
long ierr=0;
|
||||
this->fluid_names = fluid_names;
|
||||
this->fluid_names = fluid_names;
|
||||
char component_string[10000], herr[errormessagelength];
|
||||
std::string components_joined = strjoin(fluid_names,"|");
|
||||
std::string components_joined_raw = strjoin(fluid_names,"|");
|
||||
@@ -397,15 +379,15 @@ void REFPROPMixtureBackend::set_REFPROP_fluids(const std::vector<std::string> &f
|
||||
throw NotImplementedError("You cannot use the REFPROPMixtureBackend.");
|
||||
}
|
||||
|
||||
// Load REFPROP if it isn't loaded yet
|
||||
load_REFPROP(); // This should not be needed.
|
||||
// Load REFPROP if it isn't loaded yet
|
||||
load_REFPROP(); // This should not be needed.
|
||||
|
||||
// If the name of the refrigerant doesn't match
|
||||
// If the name of the refrigerant doesn't match
|
||||
// that of the currently loaded refrigerant
|
||||
if (LoadedREFPROPRef == components_joined_raw)
|
||||
{
|
||||
if (dbg_refprop) std::cout << format("%s:%d: The current fluid can be reused; %s and %s match \n",__FILE__,__LINE__,components_joined_raw.c_str(),LoadedREFPROPRef.c_str());
|
||||
this->Ncomp = N;
|
||||
this->Ncomp = N;
|
||||
mole_fractions.resize(N);
|
||||
mole_fractions_liq.resize(N);
|
||||
mole_fractions_vap.resize(N);
|
||||
@@ -413,18 +395,18 @@ void REFPROPMixtureBackend::set_REFPROP_fluids(const std::vector<std::string> &f
|
||||
}
|
||||
else
|
||||
{
|
||||
// Loop over the file names - first we try with nothing, then .fld, then .FLD, then .ppf - means you can't mix and match
|
||||
for (unsigned int k = 0; k < number_of_endings; k++)
|
||||
{
|
||||
// Build the mixture string
|
||||
for (unsigned int j = 0; j < (unsigned int)N; j++)
|
||||
{
|
||||
if (j == 0){
|
||||
components_joined = fdPath + upper(fluid_names[j])+endings[k];
|
||||
}
|
||||
else{
|
||||
components_joined += "|" + fdPath + upper(fluid_names[j])+endings[k];
|
||||
}
|
||||
// Loop over the file names - first we try with nothing, then .fld, then .FLD, then .ppf - means you can't mix and match
|
||||
for (unsigned int k = 0; k < number_of_endings; k++)
|
||||
{
|
||||
// Build the mixture string
|
||||
for (unsigned int j = 0; j < (unsigned int)N; j++)
|
||||
{
|
||||
if (j == 0){
|
||||
components_joined = fdPath + upper(fluid_names[j])+endings[k];
|
||||
}
|
||||
else{
|
||||
components_joined += "|" + fdPath + upper(fluid_names[j])+endings[k];
|
||||
}
|
||||
}
|
||||
|
||||
if (dbg_refprop) std::cout << format("%s:%d: The fluid %s has not been loaded before, current value is %s \n",__FILE__,__LINE__,components_joined_raw.c_str(),LoadedREFPROPRef.c_str());
|
||||
@@ -454,13 +436,13 @@ void REFPROPMixtureBackend::set_REFPROP_fluids(const std::vector<std::string> &f
|
||||
return;
|
||||
}
|
||||
else if (k < number_of_endings-1){ // Keep going
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw ValueError(format("Could not load these fluids: %s", components_joined_raw.c_str()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void REFPROPMixtureBackend::set_mole_fractions(const std::vector<long double> &mole_fractions)
|
||||
@@ -550,12 +532,12 @@ long double REFPROPMixtureBackend::calc_rhomolar_critical(){
|
||||
};
|
||||
long double REFPROPMixtureBackend::calc_T_reducing(){
|
||||
double rhored_mol_L = 0, Tr = 0;
|
||||
REDXdll(&(mole_fractions[0]), &Tr, &rhored_mol_L);
|
||||
REDXdll(&(mole_fractions[0]), &Tr, &rhored_mol_L);
|
||||
return static_cast<long double>(Tr);
|
||||
};
|
||||
long double REFPROPMixtureBackend::calc_rhomolar_reducing(){
|
||||
double rhored_mol_L = 0, Tr = 0;
|
||||
REDXdll(&(mole_fractions[0]), &Tr, &rhored_mol_L);
|
||||
double rhored_mol_L = 0, Tr = 0;
|
||||
REDXdll(&(mole_fractions[0]), &Tr, &rhored_mol_L);
|
||||
return static_cast<long double>(rhored_mol_L*1000);
|
||||
};
|
||||
long double REFPROPMixtureBackend::calc_Ttriple(){
|
||||
@@ -1220,22 +1202,22 @@ void REFPROPMixtureBackend::update(CoolProp::input_pairs input_pair, double valu
|
||||
_cvmolar = cvmol;
|
||||
_cpmolar = cpmol;
|
||||
_speed_sound = w;
|
||||
_tau = calc_T_critical()/_T;
|
||||
_delta = _rhomolar/calc_rhomolar_critical();
|
||||
_tau = calc_T_critical()/_T;
|
||||
_delta = _rhomolar/calc_rhomolar_critical();
|
||||
}
|
||||
long double REFPROPMixtureBackend::call_phixdll(long itau, long idel)
|
||||
{
|
||||
double val = 0, tau = _tau, delta = _delta;
|
||||
if (PHIXdll == NULL){throw ValueError("PHIXdll function is not available in your version of REFPROP. Please upgrade");}
|
||||
PHIXdll(&itau, &idel, &tau, &delta, &(mole_fractions[0]), &val);
|
||||
return static_cast<long double>(val)/pow(static_cast<long double>(_delta),idel)/pow(static_cast<long double>(_tau),itau);
|
||||
double val = 0, tau = _tau, delta = _delta;
|
||||
if (PHIXdll == NULL){throw ValueError("PHIXdll function is not available in your version of REFPROP. Please upgrade");}
|
||||
PHIXdll(&itau, &idel, &tau, &delta, &(mole_fractions[0]), &val);
|
||||
return static_cast<long double>(val)/pow(static_cast<long double>(_delta),idel)/pow(static_cast<long double>(_tau),itau);
|
||||
}
|
||||
long double REFPROPMixtureBackend::call_phi0dll(long itau, long idel)
|
||||
{
|
||||
throw ValueError("Temporarily the PHI0dll function is not available for REFPROP");
|
||||
double val = 0, tau = _tau, delta = _delta, __T = T(), __rho = rhomolar()/1000;
|
||||
if (PHI0dll == NULL){throw ValueError("PHI0dll function is not available in your version of REFPROP. Please upgrade");}
|
||||
PHI0dll(&itau, &idel, &__T, &__rho, &(mole_fractions[0]), &val);
|
||||
double val = 0, tau = _tau, delta = _delta, __T = T(), __rho = rhomolar()/1000;
|
||||
if (PHI0dll == NULL){throw ValueError("PHI0dll function is not available in your version of REFPROP. Please upgrade");}
|
||||
PHI0dll(&itau, &idel, &__T, &__rho, &(mole_fractions[0]), &val);
|
||||
return static_cast<long double>(val)/pow(delta,idel)/pow(tau,itau);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,273 +0,0 @@
|
||||
|
||||
#ifndef REFPROP_LIB_H
|
||||
#define REFPROP_LIB_H
|
||||
|
||||
/* See http://stackoverflow.com/a/148610
|
||||
* See http://stackoverflow.com/questions/147267/easy-way-to-use-variables-of-enum-types-as-string-in-c#202511
|
||||
* This will be used to generate function names, pointers, etc. below
|
||||
*/
|
||||
#define LIST_OF_REFPROP_FUNCTION_NAMES \
|
||||
X(RPVersion) \
|
||||
X(SETPATHdll) \
|
||||
X(ABFL1dll) \
|
||||
X(ABFL2dll) \
|
||||
X(ACTVYdll) \
|
||||
X(AGdll) \
|
||||
X(CCRITdll) \
|
||||
X(CP0dll) \
|
||||
X(CRITPdll) \
|
||||
X(CSATKdll) \
|
||||
X(CV2PKdll) \
|
||||
X(CVCPKdll) \
|
||||
X(CVCPdll) \
|
||||
X(DBDTdll) \
|
||||
X(DBFL1dll) \
|
||||
X(DBFL2dll) \
|
||||
X(DDDPdll) \
|
||||
X(DDDTdll) \
|
||||
X(DEFLSHdll) \
|
||||
X(DHD1dll) \
|
||||
X(DHFL1dll) \
|
||||
X(DHFL2dll) \
|
||||
X(DHFLSHdll) \
|
||||
X(DIELECdll) \
|
||||
X(DOTFILLdll) \
|
||||
X(DPDD2dll) \
|
||||
X(DPDDKdll) \
|
||||
X(DPDDdll) \
|
||||
X(DPDTKdll) \
|
||||
X(DPDTdll) \
|
||||
X(DPTSATKdll) \
|
||||
X(DSFLSHdll) \
|
||||
X(DSFL1dll) \
|
||||
X(DSFL2dll) \
|
||||
X(ENTHALdll) \
|
||||
X(ENTROdll) \
|
||||
X(ESFLSHdll) \
|
||||
X(FGCTYdll) \
|
||||
X(FUGCOFdll) \
|
||||
X(FPVdll) \
|
||||
X(GERG04dll) \
|
||||
X(GETFIJdll) \
|
||||
X(GETKTVdll) \
|
||||
X(GIBBSdll) \
|
||||
X(HSFLSHdll) \
|
||||
X(INFOdll) \
|
||||
X(LIMITKdll) \
|
||||
X(LIMITSdll) \
|
||||
X(LIMITXdll) \
|
||||
X(MELTPdll) \
|
||||
X(MELTTdll) \
|
||||
X(MLTH2Odll) \
|
||||
X(NAMEdll) \
|
||||
X(PASSCMNdll) \
|
||||
X(PDFL1dll) \
|
||||
X(PDFLSHdll) \
|
||||
X(PEFLSHdll) \
|
||||
X(PHFL1dll) \
|
||||
X(PHFLSHdll) \
|
||||
X(PHIXdll) \
|
||||
X(PHI0dll) \
|
||||
X(PQFLSHdll) \
|
||||
X(PREOSdll) \
|
||||
X(PRESSdll) \
|
||||
X(PSFL1dll) \
|
||||
X(PSFLSHdll) \
|
||||
X(PUREFLDdll) \
|
||||
X(QMASSdll) \
|
||||
X(QMOLEdll) \
|
||||
X(RESIDUALdll) \
|
||||
X(REDXdll) \
|
||||
X(RMIX2dll) \
|
||||
X(SATDdll) \
|
||||
X(SATEdll) \
|
||||
X(SATHdll) \
|
||||
X(SATPdll) \
|
||||
X(SATSdll) \
|
||||
X(SATTdll) \
|
||||
X(SATSPLNdll) \
|
||||
X(SETAGAdll) \
|
||||
X(SETKTVdll) \
|
||||
X(SETMIXdll) \
|
||||
X(SETMODdll) \
|
||||
X(SETREFdll) \
|
||||
X(SETUPdll) \
|
||||
X(SPECGRdll) \
|
||||
X(SUBLPdll) \
|
||||
X(SUBLTdll) \
|
||||
X(SURFTdll) \
|
||||
X(SURTENdll) \
|
||||
X(TDFLSHdll) \
|
||||
X(TEFLSHdll) \
|
||||
X(THERM0dll) \
|
||||
X(THERM2dll) \
|
||||
X(THERM3dll) \
|
||||
X(THERMdll) \
|
||||
X(THFLSHdll) \
|
||||
X(TPFLSHdll) \
|
||||
X(TPFL2dll) \
|
||||
X(TPRHOdll) \
|
||||
X(TQFLSHdll) \
|
||||
X(TRNPRPdll) \
|
||||
X(TSFLSHdll) \
|
||||
X(VIRBdll) \
|
||||
X(VIRCdll) \
|
||||
X(WMOLdll) \
|
||||
X(XMASSdll) \
|
||||
X(XMOLEdll)
|
||||
|
||||
// Get the platform identifiers
|
||||
#include "CoolPropTools.h"
|
||||
|
||||
// Define compiler specific calling conventions
|
||||
// for the shared library.
|
||||
#if defined(__ISWINDOWS__)
|
||||
#define CALLCONV __stdcall
|
||||
#else
|
||||
#define CALLCONV
|
||||
#endif
|
||||
|
||||
// define new macros for function names
|
||||
// http://stackoverflow.com/questions/195975/how-to-make-a-char-string-from-a-c-macros-value
|
||||
#include <string.h>
|
||||
#define STR_VALUE(arg) #arg
|
||||
#define FUNCTION_NAME(name) STR_VALUE(name)
|
||||
#define STRINGIFY(name) STR_VALUE(name)
|
||||
|
||||
// I'll try to follow this example from:
|
||||
// http://www.gershnik.com/tips/cpp.asp
|
||||
// function type: typedef void [compiler stuff] func_t(int, float);
|
||||
// function declaration: func_t func;
|
||||
// pointer type: typedef func_t * func_ptr;
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// For C calling conventions, replaced all "double &" with "double *", and "long &" with "long *"
|
||||
typedef void (CALLCONV RPVersion_TYPE)( char* , long);
|
||||
typedef void (CALLCONV SETPATHdll_TYPE)( const char* );
|
||||
typedef void (CALLCONV ABFL1dll_TYPE)(double *,double *,double *,long *,double *,double *,double *,double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV ABFL2dll_TYPE)(double *,double *,double *,long *,long *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV ACTVYdll_TYPE)(double *,double *,double *,double *);
|
||||
typedef void (CALLCONV AGdll_TYPE)(double *,double *,double *,double *,double *);
|
||||
typedef void (CALLCONV CCRITdll_TYPE)(double *,double *,double *,double *,double *,double *,double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV CP0dll_TYPE)(double *,double *,double *);
|
||||
typedef void (CALLCONV CRITPdll_TYPE)(double *,double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV CSATKdll_TYPE)(long *,double *,long *,double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV CV2PKdll_TYPE)(long *,double *,double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV CVCPKdll_TYPE)(long *,double *,double *,double *,double *);
|
||||
typedef void (CALLCONV CVCPdll_TYPE)(double *,double *,double *,double *,double *);
|
||||
typedef void (CALLCONV DBDTdll_TYPE)(double *,double *,double *);
|
||||
typedef void (CALLCONV DBFL1dll_TYPE)(double *,double *,double *,double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV DBFL2dll_TYPE)(double *,double *,double *,long *,double *,double *,double *,double *,double *,double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV DDDPdll_TYPE)(double *,double *,double *,double *);
|
||||
typedef void (CALLCONV DDDTdll_TYPE)(double *,double *,double *,double *);
|
||||
typedef void (CALLCONV DEFLSHdll_TYPE)(double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV DHD1dll_TYPE)(double *,double *,double *,double *,double *,double *,double *,double *,double *);
|
||||
typedef void (CALLCONV DHFL1dll_TYPE)(double *,double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV DHFL2dll_TYPE)(double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV DHFLSHdll_TYPE)(double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV DIELECdll_TYPE)(double *,double *,double *,double *);
|
||||
typedef void (CALLCONV DOTFILLdll_TYPE)(long *,double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV DPDD2dll_TYPE)(double *,double *,double *,double *);
|
||||
typedef void (CALLCONV DPDDKdll_TYPE)(long *,double *,double *,double *);
|
||||
typedef void (CALLCONV DPDDdll_TYPE)(double *,double *,double *,double *);
|
||||
typedef void (CALLCONV DPDTKdll_TYPE)(long *,double *,double *,double *);
|
||||
typedef void (CALLCONV DPDTdll_TYPE)(double *,double *,double *,double *);
|
||||
typedef void (CALLCONV DPTSATKdll_TYPE)(long *,double *,long *,double *,double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV DSFLSHdll_TYPE)(double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV DSFL1dll_TYPE)(double *,double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV DSFL2dll_TYPE)(double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV ENTHALdll_TYPE)(double *,double *,double *,double *);
|
||||
typedef void (CALLCONV ENTROdll_TYPE)(double *,double *,double *,double *);
|
||||
typedef void (CALLCONV ESFLSHdll_TYPE)(double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV FGCTYdll_TYPE)(double *,double *,double *,double *);
|
||||
typedef void (CALLCONV FPVdll_TYPE)(double *,double *,double *,double *,double *);
|
||||
typedef void (CALLCONV FUGCOFdll_TYPE)(double *,double *,double *,double*, long *,char*,long );
|
||||
typedef void (CALLCONV GERG04dll_TYPE)(long *,long *,long *,char*,long );
|
||||
typedef void (CALLCONV GETFIJdll_TYPE)(char*,double *,char*,char*,long ,long ,long );
|
||||
typedef void (CALLCONV GETKTVdll_TYPE)(long *,long *,char*,double *,char*,char*,char*,char*,long ,long ,long ,long ,long );
|
||||
typedef void (CALLCONV GIBBSdll_TYPE)(double *,double *,double *,double *,double *);
|
||||
typedef void (CALLCONV HSFLSHdll_TYPE)(double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV INFOdll_TYPE)(long *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *);
|
||||
typedef void (CALLCONV LIMITKdll_TYPE)(char*,long *,double *,double *,double *,double *,double *,double *,double *,long *,char*,long ,long );
|
||||
typedef void (CALLCONV LIMITSdll_TYPE)(char*,double *,double *,double *,double *,double *,long );
|
||||
typedef void (CALLCONV LIMITXdll_TYPE)(char*,double *,double *,double *,double *,double *,double *,double *,double *,long *,char*,long ,long );
|
||||
typedef void (CALLCONV MELTPdll_TYPE)(double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV MELTTdll_TYPE)(double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV MLTH2Odll_TYPE)(double *,double *,double *);
|
||||
typedef void (CALLCONV NAMEdll_TYPE)(long *,char*,char*,char*,long ,long ,long );
|
||||
typedef void (CALLCONV PASSCMNdll_TYPE)(char *,long *,long *,long *,char *,long*,double *, double *, long*, char*, long, long, long);
|
||||
typedef void (CALLCONV PDFL1dll_TYPE)(double *,double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV PDFLSHdll_TYPE)(double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV PEFLSHdll_TYPE)(double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV PHFL1dll_TYPE)(double *,double *,double *,long *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV PHFLSHdll_TYPE)(double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV PHIXdll_TYPE)(long *,long *,double *,double *,double *, double *);
|
||||
typedef void (CALLCONV PHI0dll_TYPE)(long *,long *,double *,double *,double *, double *);
|
||||
typedef void (CALLCONV PQFLSHdll_TYPE)(double *,double *,double *,long *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV PREOSdll_TYPE)(long *);
|
||||
typedef void (CALLCONV PRESSdll_TYPE)(double *,double *,double *,double *);
|
||||
typedef void (CALLCONV PSFL1dll_TYPE)(double *,double *,double *,long *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV PSFLSHdll_TYPE)(double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV PUREFLDdll_TYPE)(long *);
|
||||
typedef void (CALLCONV QMASSdll_TYPE)(double *,double *,double *,double *,double *,double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV QMOLEdll_TYPE)(double *,double *,double *,double *,double *,double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV RESIDUALdll_TYPE)(double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *);
|
||||
typedef void (CALLCONV REDXdll_TYPE)(double *,double *,double *);
|
||||
typedef void (CALLCONV RMIX2dll_TYPE)(double *,double *);
|
||||
typedef void (CALLCONV SATDdll_TYPE)(double *,double *,long *,long *,double *,double *,double *,double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV SATEdll_TYPE)(double *,double *,long *,long *,long *,double *,double *,double *,long *,double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV SATHdll_TYPE)(double *,double *,long *,long *,long *,double *,double *,double *,long *,double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV SATPdll_TYPE)(double *,double *,long *,double *,double *,double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV SATSdll_TYPE)(double *,double *,long *,long *,long *,double *,double *,double *,long *,double *,double *,double *,long *,double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV SATTdll_TYPE)(double *,double *,long *,double *,double *,double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV SATSPLNdll_TYPE)(double *,long *,char*,long );
|
||||
typedef void (CALLCONV SETAGAdll_TYPE)(long *,char*,long );
|
||||
typedef void (CALLCONV SETKTVdll_TYPE)(long *,long *,char*,double *,char*,long *,char*,long ,long ,long );
|
||||
typedef void (CALLCONV SETMIXdll_TYPE)(char*,char*,char*,long *,char*,double *,long *,char*,long ,long ,long ,long ,long );
|
||||
typedef void (CALLCONV SETMODdll_TYPE)(long *,char*,char*,char*,long *,char*,long ,long ,long ,long );
|
||||
typedef void (CALLCONV SETREFdll_TYPE)(char*,long *,double *,double *,double *,double *,double *,long *,char*,long ,long );
|
||||
typedef void (CALLCONV SETUPdll_TYPE)(long *,char*,char*,char*,long *,char*,long ,long ,long ,long );
|
||||
typedef void (CALLCONV SPECGRdll_TYPE)(double *,double *,double *,double *);
|
||||
typedef void (CALLCONV SUBLPdll_TYPE)(double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV SUBLTdll_TYPE)(double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV SURFTdll_TYPE)(double *,double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV SURTENdll_TYPE)(double *,double *,double *,double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV TDFLSHdll_TYPE)(double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV TEFLSHdll_TYPE)(double *,double *,double *,long *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV THERM0dll_TYPE)(double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *);
|
||||
typedef void (CALLCONV THERM2dll_TYPE)(double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *);
|
||||
typedef void (CALLCONV THERM3dll_TYPE)(double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *);
|
||||
typedef void (CALLCONV THERMdll_TYPE)(double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *);
|
||||
typedef void (CALLCONV THFLSHdll_TYPE)(double *,double *,double *,long *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV TPFLSHdll_TYPE)(double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV TPFL2dll_TYPE)(double *,double *,double *,double *,double *,double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV TPRHOdll_TYPE)(double *,double *,double *,long *,long *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV TQFLSHdll_TYPE)(double *,double *,double *,long *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV TRNPRPdll_TYPE)(double *,double *,double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV TSFLSHdll_TYPE)(double *,double *,double *,long *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,long *,char*,long );
|
||||
typedef void (CALLCONV VIRBdll_TYPE)(double *,double *,double *);
|
||||
typedef void (CALLCONV VIRCdll_TYPE)(double *,double *,double *);
|
||||
typedef void (CALLCONV WMOLdll_TYPE)(double *,double *);
|
||||
typedef void (CALLCONV XMASSdll_TYPE)(double *,double *,double *);
|
||||
typedef void (CALLCONV XMOLEdll_TYPE)(double *,double *,double *);
|
||||
|
||||
/* Define explicit function pointers
|
||||
* Each will look something like: typedef RPVersion_TYPE * RPVersion_POINTER;
|
||||
*
|
||||
* The ## are needed to escape the _ character in the variable names
|
||||
*
|
||||
* ***MAGIC WARNING**!! X Macros in use
|
||||
* See http://stackoverflow.com/a/148610
|
||||
* See http://stackoverflow.com/questions/147267/easy-way-to-use-variables-of-enum-types-as-string-in-c#202511
|
||||
*/
|
||||
#define X(name) typedef name ## _TYPE * name ## _POINTER;
|
||||
LIST_OF_REFPROP_FUNCTION_NAMES
|
||||
#undef X
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // REFPROP_LIB_H
|
||||
Reference in New Issue
Block a user