mirror of
https://github.com/CoolProp/CoolProp.git
synced 2026-04-23 03:00:17 -04:00
Export critical points in DLL; closes #1274
This commit is contained in:
@@ -457,6 +457,23 @@
|
||||
*/
|
||||
EXPORT_CODE void CONVENTION AbstractState_get_phase_envelope_data(const long handle, const long length, double* T, double* p, double* rhomolar_vap, double *rhomolar_liq, double *x, double *y, long *errcode, char *message_buffer, const long buffer_length);
|
||||
|
||||
/**
|
||||
* @brief Calculate all the critical points for a given composition
|
||||
* @param handle The integer handle for the state class stored in memory
|
||||
* @param length The length of the buffers passed to this function
|
||||
* @param T The pointer to the array of temperature (K)
|
||||
* @param p The pointer to the array of pressure (Pa)
|
||||
* @param rhomolar The pointer to the array of molar density (m^3/mol)
|
||||
* @param stable The pointer to the array of boolean flags for whether the critical point is stable (1) or unstable (0)
|
||||
* @param errcode The errorcode that is returned (0 = no error, !0 = error)
|
||||
* @param message_buffer A buffer for the error code
|
||||
* @param buffer_length The length of the buffer for the error code
|
||||
* @return
|
||||
*
|
||||
* @note If there is an error in an update call for one of the inputs, no change in the output array will be made
|
||||
*/
|
||||
EXPORT_CODE void CONVENTION AbstractState_all_critical_points(const long handle, const long length, double *T, double *p, double *rhomolar, long *stable, long *errcode, char *message_buffer, const long buffer_length);
|
||||
|
||||
// *************************************************************************************
|
||||
// *************************************************************************************
|
||||
// ***************************** DEPRECATED *******************************************
|
||||
|
||||
@@ -627,6 +627,26 @@ EXPORT_CODE void CONVENTION AbstractState_get_phase_envelope_data(const long han
|
||||
}
|
||||
}
|
||||
|
||||
EXPORT_CODE void CONVENTION AbstractState_all_critical_points(const long handle, long length, double *T, double *p, double *rhomolar, long *stable, long *errcode, char *message_buffer, const long buffer_length) {
|
||||
*errcode = 0;
|
||||
try {
|
||||
shared_ptr<CoolProp::AbstractState> &AS = handle_manager.get(handle);
|
||||
std::vector<CoolProp::CriticalState> pts = AS->all_critical_points();
|
||||
if (pts.size() > length){
|
||||
throw CoolProp::ValueError(format("Length of critical point vector [%d] is greater than allocated buffer length [%d]", static_cast<int>(pts.size()), static_cast<int>(length)));
|
||||
}
|
||||
for (int i = 0; i < pts.size(); ++i){
|
||||
*(T+i) = pts[i].T;
|
||||
*(p+i) = pts[i].p;
|
||||
*(rhomolar+i) = pts[i].rhomolar;
|
||||
*(stable+i) = pts[i].stable;
|
||||
}
|
||||
}
|
||||
catch (...) {
|
||||
HandleException(errcode, message_buffer, buffer_length);
|
||||
}
|
||||
}
|
||||
|
||||
/// *********************************************************************************
|
||||
/// *********************************************************************************
|
||||
/// EMSCRIPTEN (for javascript)
|
||||
|
||||
Reference in New Issue
Block a user