mirror of
https://github.com/CoolProp/CoolProp.git
synced 2026-01-23 04:47:57 -05:00
* As a consequence, made update function take CoolProp::input_pairs enum as first input (thanks @jowr for the idea) * Decoupled the pre_update and post_update functions in order to allow for more creative update functions using guess values, etc. Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
38 lines
1.0 KiB
C++
38 lines
1.0 KiB
C++
#include <memory>
|
|
#include "SpeedTest.h"
|
|
#include "AbstractState.h"
|
|
#include "DataStructures.h"
|
|
#include "crossplatform_shared_ptr.h"
|
|
|
|
#include <time.h>
|
|
|
|
namespace CoolProp{
|
|
|
|
void compare_REFPROP_and_CoolProp(std::string fluid, CoolProp::input_pairs inputs, double val1, double val2, std::size_t N, double d1, double d2)
|
|
{
|
|
time_t t1,t2;
|
|
|
|
shared_ptr<AbstractState> State(AbstractState::factory("HEOS", fluid));
|
|
t1 = clock();
|
|
for (std::size_t ii = 0; ii < N; ++ii)
|
|
{
|
|
State->update(inputs, val1 + ii*d1, val2 + ii*d2);
|
|
}
|
|
t2 = clock();
|
|
|
|
double elap = ((double)(t2-t1))/CLOCKS_PER_SEC/((double)N)*1e6;
|
|
printf("Elapsed time for CoolProp is %g us/call\n",elap);
|
|
|
|
State.reset(AbstractState::factory("REFPROP", fluid));
|
|
t1 = clock();
|
|
for (std::size_t ii = 0; ii < N; ++ii)
|
|
{
|
|
State->update(inputs, val1 + ii*d1, val2 + ii*d2);
|
|
}
|
|
t2 = clock();
|
|
elap = ((double)(t2-t1))/CLOCKS_PER_SEC/((double)N)*1e6;
|
|
printf("Elapsed time for REFPROP is %g us/call\n",elap);
|
|
}
|
|
|
|
} /* namespace CoolProp */
|