Commit Graph

36 Commits

Author SHA1 Message Date
Ian Bell
4b8bd14d93 Add first_saturation_deriv to high-level interface around AbstractState; closes #835 2015-10-16 14:37:02 +02:00
Ian Bell
7137b0fd23 Close #535 for real this time 2015-03-11 19:24:59 -06:00
Ian Bell
7eeb81c818 Errors are handled properly in high-level wrapping of low-level API; Closes #535 2015-03-11 19:15:07 -06:00
mikekaganski
e875b56f9a Fix AbstractState_keyed_output return on error 2015-03-09 17:52:58 +10:00
mikekaganski
81e18a0a08 Fix Coverity CID 38574 2015-03-07 16:57:11 +10:00
mikekaganski
0b96d38859 Fix Coverity CID 38624 2015-03-06 19:09:11 +10:00
Ian Bell
c063a40183 Implement a wrapper of AbstractState that can be called through the shared library
Closes #508
Closes #497

Sample code:

```
    #include "CoolPropLib.h"

    const long buffer_length = 255;
    char message_buffer[buffer_length];
    long errcode = 0;
    const long N = 2;
    double fractions[N] = {0.5, 0.5};
    long T_param = get_param_index("T");
    long PQ = get_input_pair_index("PQ_INPUTS");

    long handle = AbstractState_factory("HEOS", "Water&Ethanol", &errcode, message_buffer, buffer_length);
    AbstractState_set_fractions(handle, fractions, N, &errcode, message_buffer, buffer_length);
    AbstractState_update(handle, PQ, 101325, 0,  &errcode, message_buffer, buffer_length);
    double Tc = AbstractState_keyed_output(handle, T_param, &errcode, message_buffer, buffer_length);
    AbstractState_free(handle, &errcode, message_buffer, buffer_length);
```
2015-03-01 15:30:31 -07:00
mikekaganski
28691e8e75 const, ref and iterator optimization
1. Another set of arguments optimized:
* args-by-val converted to args-by-ref
* in some cases, reverse has been done, if that is better: if the
object's copy is modified in the func, it's better to avoid extra copy
from arg to local var
2. some const functions marked as such (this is just a beginning)
3. iterators were replaced with const_iterators where applicable
4. catches that catch std::exception& changed to catch (...) - that is
safer; if exception handling is restructured, this will have to be
reconsidered anyway
5. removed some basic structures' constructors; changed them to hold
const char*s to avoid unnecessary string constructions;
6. in some places, moved variable declarations to their definitions, to
avoid calling default constructors and then assigning
7. removed some unnecessary shared_pointers in favor of local objects;
8. in FORTRAN-style functions, added const specifiers to input doubles;
9. fixed a place where values were inserted into a map while iterating
through it
10. fixed is_valid_*_derivative: they could accept incorrect values and
throw when upper index is less than lower
2015-03-01 10:51:01 +10:00
mikekaganski
75b7d51f59 Return result of redirect_stdout to user
What happens if stdout had been closed and not reopen?
2015-02-22 13:58:00 +10:00
Ian Bell
6d2f52f230 Squashed bugs found by @mikekaganski; See #483
Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
2015-02-21 11:26:24 -07:00
Ian Bell
4f63c8834f Fix potential buffer overflow; fixed #472 2015-02-18 20:31:52 -05:00
Ian Bell
0064728b56 Fix bug with CoolPropLib.cpp int key scope
Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
2015-01-30 05:07:06 -07:00
Ian Bell
2495df75ed Catch exceptions in High-Level API; Closes #441
Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
2015-01-30 05:00:31 -07:00
Ian Bell
2285e3b8c9 Removed some more functions
Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
2014-12-26 22:23:01 -05:00
Ian Bell
d064baf230 Fix bug with PhaseSI function (at DLL level) taking Output parameter as first parameter
Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
2014-12-18 18:18:45 -06:00
Ian Bell
71e59e3410 Disable the clearing of FPU exceptions on platforms that do not support it
Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
2014-12-18 16:03:27 -06:00
Ian Bell
b4e8dad1f3 On gcc/clang, always turn on FPU clearing; See #353
Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
2014-12-18 15:16:19 -06:00
Ian Bell
55c0e89609 Clear FPU bits for non-MSVC compilers; See #353 2014-12-18 00:47:15 +01:00
Ian Bell
4a59d578aa Only check FPU bits with MSVC compiler
Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
2014-12-06 16:48:03 -05:00
Ian Bell
2ae3445810 Resolved bizarre FPU exception error on windows with visual studio
Resetting the FPU flags seems to make Excel not error out randomly.  This is sort of a bug in Excel.

Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
2014-12-06 16:14:22 -05:00
Ian Bell
41fc9b1144 saturation ancillaries are now exposed through the high-level API
Closes https://github.com/CoolProp/CoolProp/issues/225

Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
2014-11-24 13:06:37 -05:00
Ian Bell
71a5944f51 Added tests for global and fluid params
Closes https://github.com/CoolProp/CoolProp/issues/239

Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
2014-11-24 12:28:29 -05:00
Ian Bell
919d155602 Fixed functions in the dll export to require the length of the output string to be supplied
See https://github.com/CoolProp/CoolProp/issues/228

Should be fixed now

Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
2014-11-20 18:39:33 -05:00
Ian Bell
2f94572dad Fixed (?) bug with get_global_param_string always returning empty string
See https://github.com/CoolProp/CoolProp/issues/228

Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
2014-11-20 17:56:52 -05:00
Ian Bell
7f0764878c Removed error variables to avoid warning
Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
2014-11-19 13:22:24 -05:00
Ian Bell
8327d54ea2 Replaced all tabs with spaces (finally) in C++ files
Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
2014-11-19 12:16:14 -05:00
Ian Bell
82faac7a14 Improve docs for DLL
See https://github.com/CoolProp/CoolProp/issues/222

Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
2014-11-19 12:00:26 -05:00
Ian Bell
70e9e14226 Exported set_reference_stateD through the library
Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
2014-10-27 20:17:38 -04:00
Ian Bell
9299cb8e07 Re-implements HAProps function at the C++ level.
Closes https://github.com/CoolProp/CoolProp/issues/182

Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
2014-10-22 21:32:22 +00:00
Ian Bell
1416f62682 Fixed bug with second linkage problem with CoolPropLib
Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
2014-10-15 21:37:23 +02:00
Ian Bell
3310d1cf11 Fixed (?) splines in critical region
I have no explanation for the broken code that used to be in the solve_cubic function.  Seems it was related to the linear or quadratic cases but it makes no sense. Removed the code.

Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
2014-10-14 14:49:19 +02:00
Ian Bell
199ced3f86 Implemented Phase output again
Added PhaseSI function which will return phase for given input - exposed to DLL
PropsSI can also return phase as double if "Phase" is the input

Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
2014-10-14 11:21:07 +02:00
Ian Bell
2e190f1a9d PropsSI and Props function docs
Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
2014-09-27 18:18:47 +02:00
Ian Bell
f43a0b792b Humid air properties now use string instead of char*
Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
2014-08-19 21:55:23 +02:00
Ian Bell
802495cad3 Last commit before rename of python module to CoolProp
Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
2014-08-12 15:07:57 +02:00
jowr
4f9df69c96 No problems compiling and running the tests... 2014-08-04 17:14:35 +02:00