Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add an accessor function to DLL to allow for getting multiple outputs…
- Loading branch information
Showing
6 changed files
with
163 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
value(all): 8339004.432517, 0.59425 us/call | ||
value(all): 8339004.432514, 0.5 us/call |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#include "CoolPropLib.h" | ||
#include "CoolPropTools.h" | ||
#include <vector> | ||
#include <time.h> | ||
|
||
int main(){ | ||
const long buffer_size = 1000, length = 100000; | ||
long ierr; | ||
char herr[buffer_size]; | ||
long handle = AbstractState_factory("BICUBIC&HEOS", "Water", &ierr, herr, buffer_size); | ||
std::vector<double> T(length), p(length), rhomolar(length), hmolar(length), smolar(length); | ||
std::vector<double> input1 = linspace(700000.0, 1500000.0, length); | ||
std::vector<double> input2 = linspace(2.8e6, 3.0e6, length); | ||
long input_pair = get_input_pair_index("HmassP_INPUTS"); | ||
double t1 = clock(); | ||
AbstractState_update_and_common_out(handle, input_pair, &(input1[0]), &(input2[0]), length, | ||
&(T[0]), &(p[0]), &(rhomolar[0]), &(hmolar[0]), &(smolar[0]), | ||
&ierr, herr, buffer_size); | ||
double t2 = clock(); | ||
std::cout << format("value(commons): %g us/call\n", ((double)(t2-t1))/CLOCKS_PER_SEC/double(length)*1e6); | ||
|
||
std::vector<long> outputs(5); | ||
outputs[0] = get_param_index("T"); | ||
outputs[1] = get_param_index("P"); | ||
outputs[2] = get_param_index("Dmolar"); | ||
outputs[3] = get_param_index("Hmolar"); | ||
outputs[4] = get_param_index("Smolar"); | ||
std::vector<double> out1(length), out2(length), out3(length), out4(length), out5(length); | ||
t1 = clock(); | ||
AbstractState_update_and_5_out(handle, input_pair, &(input1[0]), &(input2[0]), length, | ||
&(outputs[0]), &(out1[0]), &(out2[0]), &(out3[0]), &(out4[0]), &(out5[0]), | ||
&ierr, herr, buffer_size); | ||
t2 = clock(); | ||
std::cout << format("value(user-specified): %g us/call\n", ((double)(t2-t1))/CLOCKS_PER_SEC/double(length)*1e6); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
value(commons): 0.57 us/call | ||
value(user-specified): 5.89 us/call |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters