MCPcopy Create free account
hub / github.com/CoolProp/CoolProp / testObject

Function testObject

dev/Tickets/60.cpp:234–588  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

232}
233
234std::map<std::string, double> testObject(IncompressibleTest* fluid, std::vector<std::vector<double>> coeffs, int exponent, bool print) {
235
236 std::map<std::string, double> results;
237
238 uint64_t runs = 10;
239 for (int i = 1; i < exponent; i++) {
240 runs *= 10;
241 }
242
243 if (print) std::cout << "Runs: " << runs << std::endl;
244
245 std::vector<double> simCoeffs;
246 if (coeffs.size() > 0) {
247 simCoeffs = coeffs[1];
248 } else {
249 results["error"] = -_HUGE;
250 return results;
251 }
252
253 if (print) {
254 std::cout << "simCoeffs: " << simCoeffs[0];
255 for (int i = 1; i < simCoeffs.size(); i++) {
256 std::cout << ", " << simCoeffs[i];
257 }
258 std::cout << std::endl;
259 }
260
261 uint64_t start;
262 uint64_t end;
263 double time;
264
265 double Tin = 280;
266 double T0 = Tin - 10;
267 double xin = 0.25;
268
269 // Testing the 1D functions first
270 fluid->setDebug(false);
271 start = getTimeValue();
272 for (int i = 0; i < runs; i++) {
273 fluid->testSi(simCoeffs, Tin + i / runs);
274 }
275 end = getTimeValue();
276 time = (end - start) * 1e3 / runs;
277 results["1D std sim simple"] = time;
278 fluid->setDebug(print);
279 fluid->testSi(simCoeffs, Tin);
280
281 fluid->setDebug(false);
282 start = getTimeValue();
283 for (int i = 0; i < runs; i++) {
284 fluid->testHo(simCoeffs, Tin + i / runs);
285 }
286 end = getTimeValue();
287 time = (end - start) * 1e3 / runs;
288 results["1D std sim Horner"] = time;
289 fluid->setDebug(print);
290 fluid->testHo(simCoeffs, Tin);
291

Callers 1

mainFunction · 0.85

Calls 10

getTimeValueFunction · 0.85
testSiMethod · 0.80
testHoMethod · 0.80
testSiIntMethod · 0.80
testHoIntMethod · 0.80
test2sIntMethod · 0.80
testSiFraMethod · 0.80
testHoFraMethod · 0.80
test2sFraMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected