12const double NaN = std::numeric_limits<double>::quiet_NaN();
29const std::map<CoolProp::parameters, std::map<int, IsolineSupported>>
xy_switch = {
30 {
CoolProp::iDmass, {{
TS,
Flipped}, {
PH,
Flipped}, {
HS,
Yes}, {
PS,
Flipped}, {
PD,
No}, {
TD,
No}, {
PT,
Yes}}},
31 {
CoolProp::iHmass, {{
TS,
Yes}, {
PH,
No}, {
HS,
No}, {
PS,
Flipped}, {
PD,
Flipped}, {
TD,
Yes}, {
PT,
Yes}}},
32 {
CoolProp::iP, {{
TS,
Yes}, {
PH,
No}, {
HS,
Yes}, {
PS,
No}, {
PD,
No}, {
TD,
Yes}, {
PT,
No}}},
33 {
CoolProp::iSmass, {{
TS,
No}, {
PH,
Flipped}, {
HS,
No}, {
PS,
No}, {
PD,
Flipped}, {
TD,
Yes}, {
PT,
Flipped}}},
34 {
CoolProp::iT, {{
TS,
No}, {
PH,
Flipped}, {
HS,
Yes}, {
PS,
Yes}, {
PD,
Yes}, {
TD,
No}, {
PT,
No}}},
35 {
CoolProp::iQ, {{
TS,
Flipped}, {
PH,
Flipped}, {
HS,
Flipped}, {
PS,
Flipped}, {
PD,
Flipped}, {
TD,
Flipped}, {
PT,
Yes}}}};
62 std::vector<double> fractions;
68std::shared_ptr<CoolProp::AbstractState>
get_critical_point(
const std::shared_ptr<CoolProp::AbstractState>& state) {
76 crit_state.
T = state->T_critical();
77 crit_state.
p = state->p_critical();
78 crit_state.
rhomolar = state->rhomolar_critical();
83 if (crit_state_tmp.stable && (crit_state_tmp.T > crit_state.
T || !std::isfinite(crit_state.
T))) {
84 crit_state.
T = crit_state_tmp.T;
85 crit_state.
p = crit_state_tmp.p;
86 crit_state.
rhomolar = crit_state_tmp.rhomolar;
87 crit_state.
stable = crit_state_tmp.stable;
96 std::vector<double> masses = state->get_mass_fractions();
97 if (masses.size() > 1) new_state->set_mass_fractions(masses);
103 if (std::isfinite(crit_state.
p) && std::isfinite(crit_state.
T)) {
117 if (std::isfinite(crit_state.
rhomolar) && std::isfinite(crit_state.
T)) {
148 const std::shared_ptr<CoolProp::AbstractState>& state)
149 : key_(key), xkey_(xkey), ykey_(ykey), value(value), state_(state) {
155 double t_small = critical_state_->keyed_output(
CoolProp::iT) * s;
156 double p_small = critical_state_->keyed_output(
CoolProp::iP) * s;
174void Isoline::calc_sat_range(
int count) {
176 std::vector<double> two =
::linspace(t.min, t.max, count);
177 std::vector<double> one(two.size(), value);
180 double t_crit = critical_state_->keyed_output(
CoolProp::iT);
181 double p_crit = critical_state_->keyed_output(
CoolProp::iP);
182 double x_crit = critical_state_->keyed_output(xkey_);
183 double y_crit = critical_state_->keyed_output(ykey_);
184 x.resize(one.size());
185 y.resize(one.size());
186 for (
size_t i = 0; i < one.size(); ++i) {
188 state_->update(input_pair, one[i], two[i]);
189 x[i] = state_->keyed_output(xkey_);
190 y[i] = state_->keyed_output(ykey_);
196 std::cerr <<
"ERROR near critical inputs" <<
'\n';
200 std::cerr <<
"ERROR" <<
'\n';
206void Isoline::update_pair(
int& ipos,
int& xpos,
int& ypos,
int& pair) {
208 double out1 = NAN, out2 = NAN;
216 bool should_swap = (out1 != 0.0);
239void Isoline::calc_range(std::vector<double>& xvals, std::vector<double>& yvals) {
241 calc_sat_range(
static_cast<int>(xvals.size()));
243 int ipos = 0, xpos = 0, ypos = 0, pair = 0;
244 update_pair(ipos, xpos, ypos, pair);
246 std::vector<double> ivals(xvals.size(), value);
247 std::vector<int> order = {ipos, xpos, ypos};
248 std::vector<CoolProp::parameters> idxs(3);
252 std::vector<std::vector<double>> vals(3);
257 for (
size_t i = 0; i < vals[2].size(); ++i) {
260 vals[2][i] = state_->keyed_output(idxs[2]);
266 for (
size_t i = 0; i < idxs.size(); ++i) {
267 if (idxs[i] == xkey_) x = vals[i];
268 if (idxs[i] == ykey_) y = vals[i];
274 : xkey_(xkey), ykey_(ykey) {
284 int out1 = 0, out2 = 0;
286 swap_axis_inputs_for_update_ = (out1 == 1);
288 const double HI_FACTOR = 2.25;
289 const double LO_FACTOR = 1.01;
295 this->Tp_limits_ = {{LO_FACTOR, HI_FACTOR}, {LO_FACTOR, HI_FACTOR}};
298 this->Tp_limits_ = {{173.15, 493.15}, {0.25e5, HI_FACTOR}};
301 this->Tp_limits_ = {{273.15, 673.15}, {0.25e5, HI_FACTOR}};
305 Range2D ranges = get_axis_limits();
322 for (
double val : values) {
323 Isoline line(key, xkey_, ykey_, val, state_);
324 line.calc_range(xvals, yvals);
325 lines.push_back(line);
332 std::vector<CoolProp::parameters> keys;
334 const std::map<int, Detail::IsolineSupported>& supported = it.second;
335 auto supported_xy = supported.find(ykey_ * 10 + xkey_);
342 if (key == xkey_)
return xvalue;
343 if (key == ykey_)
return yvalue;
346 if (swap_axis_inputs_for_update_) std::swap(xvalue, yvalue);
347 state_->specify_phase(phase);
348 state_->update(axis_pair_, xvalue, yvalue);
355 return state_->rhomass();
357 return state_->hmass();
359 return state_->smass();
361 return state_->umass();
374 double t_small = critical_state_->keyed_output(
CoolProp::iT) * s;
375 double p_small = critical_state_->keyed_output(
CoolProp::iP) * s;
393PropertyPlot::Range2D PropertyPlot::get_Tp_limits()
const {
394 Range t = Tp_limits_.T;
395 Range p = Tp_limits_.p;
399 const double ID_FACTOR = 10.0;
400 if (std::isnan(t.min))
402 else if (t.min < ID_FACTOR)
404 if (std::isnan(t.max))
406 else if (t.max < ID_FACTOR)
408 if (std::isnan(p.min))
410 else if (p.min < ID_FACTOR)
412 if (std::isnan(p.max))
414 else if (p.max < ID_FACTOR)
444 if (xkey != this->xkey_ || ykey != this->ykey_ || autoscale) {
445 Range2D tp_limits = get_Tp_limits();
446 Range xrange = {std::numeric_limits<double>::max(), std::numeric_limits<double>::lowest()};
447 Range yrange = {std::numeric_limits<double>::max(), std::numeric_limits<double>::lowest()};
449 for (
double T : {tp_limits.T.min, tp_limits.T.max}) {
450 for (
double p : {tp_limits.p.min, tp_limits.p.max}) {
453 double x = state_->keyed_output(xkey);
454 double y = state_->keyed_output(ykey);
455 xrange.min = std::min(xrange.min, x);
456 xrange.max = std::max(xrange.max, x);
457 yrange.min = std::min(yrange.min, y);
458 yrange.max = std::max(yrange.max, y);
465 return {xrange, yrange};
475# include <catch2/catch_all.hpp>
476# include <catch2/matchers/catch_matchers_floating_point.hpp>
478using Catch::Matchers::WithinAbs;
479using Catch::Matchers::WithinRel;
485TEST_CASE(
"Check value_at for p-h plots",
"[Plot]") {
488 CHECK_THAT(plot.value_at(
CoolProp::iP, 300000 , 200000 ), WithinAbs(200000, 1e-10));
489 CHECK_THAT(plot.value_at(
CoolProp::iHmass, 300000, 200000), WithinAbs(300000, 1e-10));
490 CHECK_THAT(plot.value_at(
CoolProp::iT, 300000, 200000), WithinAbs(263.07372753976784, 1e-10));
491 CHECK_THAT(plot.value_at(
CoolProp::iQ, 300000, 200000), WithinAbs(0.550443478743443, 1e-10));
493TEST_CASE(
"Check that the isolines are the same as from Python",
"[Plot]") {
495 const int isoline_count = 5;
496 const int points_per_isoline = 5;
503 CHECK_THAT(plot.xaxis.min, WithinAbs(75373.12689908473, 1));
504 CHECK_THAT(plot.xaxis.max, WithinAbs(577604.5949752147, 1));
505 CHECK_THAT(plot.yaxis.min, WithinAbs(24999.999999924632, 1));
506 CHECK_THAT(plot.yaxis.max, WithinAbs(9133370.877325172, 1));
508 std::vector<CoolProp::parameters> iso_types = plot.supported_isoline_keys();
509 REQUIRE(iso_types.size() == 4);
520 REQUIRE(q_isolines.size() == isoline_count);
521 CHECK_THAT(q_isolines[0].value, WithinAbs(0.0, 1e-10) || WithinRel(0.0, 1e-8));
522 CHECK_THAT(q_isolines[1].value, WithinAbs(0.25, 1e-10) || WithinRel(0.25, 1e-8));
523 CHECK_THAT(q_isolines[2].value, WithinAbs(0.5, 1e-10) || WithinRel(0.5, 1e-8));
524 CHECK_THAT(q_isolines[3].value, WithinAbs(0.75, 1e-10) || WithinRel(0.75, 1e-8));
525 CHECK_THAT(q_isolines[4].value, WithinAbs(1.0, 1e-10) || WithinRel(1.0, 1e-8));
526 const double expected_x[isoline_count][points_per_isoline] = {
527 {71455.0825704527, 132940.602012992, 198498.370551912, 271578.877763124, 389490.979699808},
528 {137326.831168219, 191267.585241559, 248361.039003664, 309540.80583791, 389563.709352125},
529 {203198.579765986, 249594.568470126, 298223.707455415, 347502.733912697, 389636.439004441},
530 {269070.328363753, 307921.551698693, 348086.375907167, 385464.661987484, 389709.168656758},
531 {334942.07696152, 366248.53492726, 397949.044358919, 423426.59006227, 389781.898309075},
533 const double expected_y[isoline_count][points_per_isoline] = {
534 {389.56705952134, 25851.3343934178, 281115.856001781, 1316960.5263817, 4059273.23696491},
535 {389.56705952134, 25851.3343934178, 281115.856001781, 1316960.5263817, 4059273.23696491},
536 {389.56705952134, 25851.3343934178, 281115.856001781, 1316960.5263817, 4059273.23696491},
537 {389.56705952134, 25851.3343934178, 281115.856001781, 1316960.5263817, 4059273.23696491},
538 {389.56705952134, 25851.3343934178, 281115.856001781, 1316960.5263817, 4059273.23696491},
540 for (
int i = 0; i < q_isolines.size(); ++i) {
541 REQUIRE(q_isolines[i].size() == points_per_isoline);
542 for (
int j = 0; j < q_isolines[i].size(); ++j) {
543 CHECK_THAT(q_isolines[i].x[j], WithinRel(expected_x[i][j], 1e-8));
544 CHECK_THAT(q_isolines[i].y[j], WithinRel(expected_y[i][j], 1e-8));
553 REQUIRE(t_isolines.size() == isoline_count);
554 CHECK_THAT(t_isolines[0].value, WithinAbs(173.15, 1e-10) || WithinRel(173.15, 1e-8));
555 CHECK_THAT(t_isolines[1].value, WithinAbs(243.6125, 1e-10) || WithinRel(243.6125, 1e-8));
556 CHECK_THAT(t_isolines[2].value, WithinAbs(314.07500000000005, 1e-10) || WithinRel(314.07500000000005, 1e-8));
557 CHECK_THAT(t_isolines[3].value, WithinAbs(384.5375, 1e-10) || WithinRel(384.5375, 1e-8));
558 CHECK_THAT(t_isolines[4].value, WithinAbs(455.0, 1e-10) || WithinRel(455.0, 1e-8));
559 const double expected_x[isoline_count][points_per_isoline] = {
560 {75373.1268990847, 75410.9911120364, 75576.5817007017, 76301.4918516847, 79487.8877890133},
561 {382785.230587562, 161389.442353424, 161516.218619861, 162076.984158713, 164637.062378302},
562 {439466.649843278, 438148.172824113, 431912.06623801, 257605.319479567, 257512.83924738},
563 {504550.626065609, 503783.529360494, 500331.593280179, 482707.178357055, 366958.520782669},
564 {577604.594975215, 577097.06504804, 574850.152315428, 564443.78972976, 507875.800623495},
566 const double expected_y[isoline_count][points_per_isoline] = {
567 {24999.9999999246, 109298.142140435, 477843.35501547, 2089095.63750003, 9133370.87732516},
568 {24999.9999999246, 109298.142140435, 477843.35501547, 2089095.63750003, 9133370.87732516},
569 {24999.9999999246, 109298.142140435, 477843.35501547, 2089095.63750003, 9133370.87732516},
570 {24999.9999999246, 109298.142140435, 477843.35501547, 2089095.63750003, 9133370.87732516},
571 {24999.9999999246, 109298.142140435, 477843.35501547, 2089095.63750003, 9133370.87732516},
573 for (
int i = 0; i < t_isolines.size(); ++i) {
574 REQUIRE(t_isolines[i].size() == points_per_isoline);
575 for (
int j = 0; j < t_isolines[i].size(); ++j) {
576 CHECK_THAT(t_isolines[i].x[j], WithinRel(expected_x[i][j], 1e-8));
577 CHECK_THAT(t_isolines[i].y[j], WithinRel(expected_y[i][j], 1e-8));
586 REQUIRE(s_isolines.size() == isoline_count);
587 CHECK_THAT(s_isolines[0].value, WithinAbs(426.0094838589179, 1e-10) || WithinRel(426.0094838589179, 1e-8));
588 CHECK_THAT(s_isolines[1].value, WithinAbs(925.275035740241, 1e-10) || WithinRel(925.275035740241, 1e-8));
589 CHECK_THAT(s_isolines[2].value, WithinAbs(1424.540587621564, 1e-10) || WithinRel(1424.540587621564, 1e-8));
590 CHECK_THAT(s_isolines[3].value, WithinAbs(1923.8061395028872, 1e-10) || WithinRel(1923.8061395028872, 1e-8));
591 CHECK_THAT(s_isolines[4].value, WithinAbs(2423.07169138421, 1e-10) || WithinRel(2423.07169138421, 1e-8));
592 const double expected_x[isoline_count][points_per_isoline] = {
593 {73758.1368332803, 73811.2861610949, 74043.6241895902, 75058.8771715002, 79487.8877891817},
594 {176257.349845128, 179794.80776134, 180290.319046059, 181487.967470984, 186690.959613052},
595 {286286.17581826, 303984.726429065, 321692.362822335, 335551.688988092, 344087.839489012},
596 {399372.560529313, 433400.354293214, 471964.896215781, 513835.931067728, 555824.663129382},
597 {577604.594975103, 635258.237157865, 698999.44597458, 768745.631258105, std::nan(
"")},
599 const double expected_y[isoline_count][points_per_isoline] = {
600 {24999.9999999246, 109298.142140435, 477843.35501547, 2089095.63750003, 9133370.87732516},
601 {24999.9999999246, 109298.142140435, 477843.35501547, 2089095.63750003, 9133370.87732516},
602 {24999.9999999246, 109298.142140435, 477843.35501547, 2089095.63750003, 9133370.87732516},
603 {24999.9999999246, 109298.142140435, 477843.35501547, 2089095.63750003, 9133370.87732516},
604 {24999.9999999246, 109298.142140435, 477843.35501547, 2089095.63750003, 9133370.87732516},
606 for (
int i = 0; i < s_isolines.size(); ++i) {
607 REQUIRE(s_isolines[i].size() == points_per_isoline);
608 for (
int j = 0; j < s_isolines[i].size(); ++j) {
609 if (std::isnan(s_isolines[i].x[j]))
610 CHECK(std::isnan(expected_x[i][j]));
612 CHECK_THAT(s_isolines[i].x[j], WithinRel(expected_x[i][j], 1e-8));
613 CHECK_THAT(s_isolines[i].y[j], WithinRel(expected_y[i][j], 1e-8));
622 REQUIRE(d_isolines.size() == isoline_count);
623 CHECK_THAT(d_isolines[0].value, WithinAbs(0.6749779869915704, 1e-10) || WithinRel(0.6749779869915704, 1e-8));
624 CHECK_THAT(d_isolines[1].value, WithinAbs(4.704765645221012, 1e-10) || WithinRel(4.704765645221012, 1e-8));
625 CHECK_THAT(d_isolines[2].value, WithinAbs(32.793395048494105, 1e-10) || WithinRel(32.793395048494105, 1e-8));
626 CHECK_THAT(d_isolines[3].value, WithinAbs(228.57817793729427, 1e-10) || WithinRel(228.57817793729427, 1e-8));
627 CHECK_THAT(d_isolines[4].value, WithinAbs(1593.2471569921404, 1e-10) || WithinRel(1593.2471569921404, 1e-8));
628 const double expected_x[isoline_count][points_per_isoline] = {
629 {577604.594973719, std::nan(
""), std::nan(
""), std::nan(
""), std::nan(
"")},
630 {202365.843978241, 419230.11212018, std::nan(
""), std::nan(
""), std::nan(
"")},
631 {142114.49128355, 204388.004481049, 351216.809719432, std::nan(
""), std::nan(
"")},
632 {133470.418481179, 172415.768781909, 235383.044878653, 357492.457498284, 669493.626069481},
633 {70518.3287887542, 70601.2088968633, 70963.5807782658, 72548.3591964927, 79487.8877885823},
635 const double expected_y[isoline_count][points_per_isoline] = {
636 {24999.9999999246, 109298.142140435, 477843.35501547, 2089095.63750003, 9133370.87732516},
637 {24999.9999999246, 109298.142140435, 477843.35501547, 2089095.63750003, 9133370.87732516},
638 {24999.9999999246, 109298.142140435, 477843.35501547, 2089095.63750003, 9133370.87732516},
639 {24999.9999999246, 109298.142140435, 477843.35501547, 2089095.63750003, 9133370.87732516},
640 {24999.9999999246, 109298.142140435, 477843.35501547, 2089095.63750003, 9133370.87732516},
642 for (
int i = 0; i < d_isolines.size(); ++i) {
643 REQUIRE(d_isolines[i].size() == points_per_isoline);
644 for (
int j = 0; j < d_isolines[i].size(); ++j) {
645 if (std::isnan(d_isolines[i].x[j]))
646 CHECK(std::isnan(expected_x[i][j]));
648 CHECK_THAT(d_isolines[i].x[j], WithinRel(expected_x[i][j], 1e-8));
649 CHECK_THAT(d_isolines[i].y[j], WithinRel(expected_y[i][j], 1e-8));
655TEST_CASE(
"Basic TS Plot has same output as Python",
"[Plot]") {
657 const int isoline_count = 5;
658 const int points_per_isoline = 5;
665 CHECK_THAT(plot.xaxis.min, WithinAbs(426.0094838589179, 1));
666 CHECK_THAT(plot.xaxis.max, WithinAbs(2423.07169138421, 1));
667 CHECK_THAT(plot.yaxis.min, WithinAbs(173.15, 1));
668 CHECK_THAT(plot.yaxis.max, WithinAbs(455.0, 1));
670 std::vector<CoolProp::parameters> iso_types = plot.supported_isoline_keys();
671 REQUIRE(iso_types.size() == 4);
682 REQUIRE(q_isolines.size() == isoline_count);
683 CHECK_THAT(q_isolines[0].value, WithinAbs(0.0, 1e-10) || WithinRel(0.0, 1e-8));
684 CHECK_THAT(q_isolines[1].value, WithinAbs(0.25, 1e-10) || WithinRel(0.25, 1e-8));
685 CHECK_THAT(q_isolines[2].value, WithinAbs(0.5, 1e-10) || WithinRel(0.5, 1e-8));
686 CHECK_THAT(q_isolines[3].value, WithinAbs(0.75, 1e-10) || WithinRel(0.75, 1e-8));
687 CHECK_THAT(q_isolines[4].value, WithinAbs(1.0, 1e-10) || WithinRel(1.0, 1e-8));
689 const double expected_x[isoline_count][points_per_isoline] = {
690 {412.617538232079, 728.71482941326, 994.524404955042, 1237.31924154895, 1561.70306865236},
691 {800.440438274308, 992.708859865778, 1177.8221470675, 1354.80424987622, 1561.8974228315},
692 {1188.26333831654, 1256.70289031829, 1361.11988917995, 1472.28925820349, 1562.09177701064},
693 {1576.08623835876, 1520.69692077081, 1544.4176312924, 1589.77426653076, 1562.28613118978},
694 {1963.90913840099, 1784.69095122333, 1727.71537340486, 1707.25927485803, 1562.48048536892},
696 const double expected_y[isoline_count][points_per_isoline] = {
697 {169.850074842393, 220.940538422734, 272.031002003074, 323.121465583414, 374.211929163755},
698 {169.850074842393, 220.940538422734, 272.031002003074, 323.121465583414, 374.211929163755},
699 {169.850074842393, 220.940538422734, 272.031002003074, 323.121465583414, 374.211929163755},
700 {169.850074842393, 220.940538422734, 272.031002003074, 323.121465583414, 374.211929163755},
701 {169.850074842393, 220.940538422734, 272.031002003074, 323.121465583414, 374.211929163755},
704 for (
int i = 0; i < q_isolines.size(); ++i) {
705 REQUIRE(q_isolines[i].size() == points_per_isoline);
706 for (
int j = 0; j < q_isolines[i].size(); ++j) {
707 CHECK_THAT(q_isolines[i].x[j], WithinRel(expected_x[i][j], 1e-8));
708 CHECK_THAT(q_isolines[i].y[j], WithinRel(expected_y[i][j], 1e-8));
717 REQUIRE(p_isolines.size() == isoline_count);
718 CHECK_THAT(p_isolines[0].value, WithinAbs(24999.999999924625, 1e-7) || WithinRel(24999.999999924625, 1e-8));
719 CHECK_THAT(p_isolines[1].value, WithinAbs(109298.14214043504, 1e-7) || WithinRel(109298.14214043504, 1e-8));
720 CHECK_THAT(p_isolines[2].value, WithinAbs(477843.35501546983, 1e-7) || WithinRel(477843.35501546983, 1e-8));
721 CHECK_THAT(p_isolines[3].value, WithinAbs(2089095.6375000286, 1e-7) || WithinRel(2089095.6375000286, 1e-8));
722 CHECK_THAT(p_isolines[4].value, WithinAbs(9133370.877325162, 1e-7) || WithinRel(9133370.877325162, 1e-8));
723 const double expected_x[isoline_count][points_per_isoline] = {
724 {426.009483858918, 925.275035740241, 1424.54058762156, 1923.80613950289, 2423.07169138421},
725 {426.009483858918, 925.275035740241, 1424.54058762156, 1923.80613950289, 2423.07169138421},
726 {426.009483858918, 925.275035740241, 1424.54058762156, 1923.80613950289, 2423.07169138421},
727 {426.009483858918, 925.275035740241, 1424.54058762156, 1923.80613950289, 2423.07169138421},
728 {426.009483858918, 925.275035740241, 1424.54058762156, 1923.80613950289, 2423.07169138421},
730 const double expected_y[isoline_count][points_per_isoline] = {
731 {171.786072658977, 220.381369310426, 220.381369310426, 265.36247722467, 454.999999999897},
732 {171.798910666077, 248.745218250597, 248.745218250597, 308.633922578156, 506.387752765209},
733 {171.854988815553, 258.195699077655, 287.473037339606, 355.964867195189, 560.293101205153},
734 {172.099235421019, 258.742471435868, 342.561817266701, 411.323964498156, 618.036314182066},
735 {173.150000000039, 261.02106158166, 371.327173902085, 484.42783162311, std::nan(
"")},
737 for (
int i = 0; i < p_isolines.size(); ++i) {
738 REQUIRE(p_isolines[i].size() == points_per_isoline);
739 for (
int j = 0; j < p_isolines[i].size(); ++j) {
740 if (std::isnan(expected_y[i][j])) {
741 CHECK(std::isnan(p_isolines[i].y[j]));
743 CHECK_THAT(p_isolines[i].x[j], WithinRel(expected_x[i][j], 1e-8));
744 CHECK_THAT(p_isolines[i].y[j], WithinRel(expected_y[i][j], 1e-8));
754 REQUIRE(h_isolines.size() == isoline_count);
755 CHECK_THAT(h_isolines[0].value, WithinAbs(75373.12689908473, 1e-10) || WithinRel(75373.12689908473, 1e-8));
756 CHECK_THAT(h_isolines[1].value, WithinAbs(200930.99391811722, 1e-10) || WithinRel(200930.99391811722, 1e-8));
757 CHECK_THAT(h_isolines[2].value, WithinAbs(326488.86093714973, 1e-10) || WithinRel(326488.86093714973, 1e-8));
758 CHECK_THAT(h_isolines[3].value, WithinAbs(452046.7279561822, 1e-10) || WithinRel(452046.7279561822, 1e-8));
759 CHECK_THAT(h_isolines[4].value, WithinAbs(577604.5949752147, 1e-10) || WithinRel(577604.5949752147, 1e-8));
760 const double expected_x[isoline_count][points_per_isoline] = {
761 {426.009483858918, 925.275035740241, 1424.54058762156, 1923.80613950289, 2423.07169138421},
762 {426.009483858918, 925.275035740241, 1424.54058762156, 1923.80613950289, 2423.07169138421},
763 {426.009483858918, 925.275035740241, 1424.54058762156, 1923.80613950289, 2423.07169138421},
764 {426.009483858918, 925.275035740241, 1424.54058762156, 1923.80613950289, 2423.07169138421},
765 {426.009483858918, 925.275035740241, 1424.54058762156, 1923.80613950289, 2423.07169138421},
767 const double expected_y[isoline_count][points_per_isoline] = {
768 {172.17457530891, std::nan(
""), std::nan(
""), std::nan(
""), std::nan(
"")},
769 {196.074550633801, 266.631159311947, std::nan(
""), std::nan(
""), std::nan(
"")},
770 {213.66468184215, 299.984652703029, 301.726570478677, std::nan(
""), std::nan(
"")},
771 {228.411201679483, 322.843563824883, 426.787882130031, 331.521169967994, 328.042167528594},
772 {241.568258022782, 341.66133891579, 458.593848045217, std::nan(
""), 455.000000000079},
774 for (
int i = 0; i < h_isolines.size(); ++i) {
775 REQUIRE(h_isolines[i].size() == points_per_isoline);
776 for (
int j = 0; j < h_isolines[i].size(); ++j) {
777 if (std::isnan(expected_y[i][j])) {
778 CHECK(std::isnan(h_isolines[i].y[j]));
780 CHECK_THAT(h_isolines[i].x[j], WithinRel(expected_x[i][j], 1e-8));
781 CHECK_THAT(h_isolines[i].y[j], WithinRel(expected_y[i][j], 1e-8));
791 REQUIRE(d_isolines.size() == isoline_count);
792 CHECK_THAT(d_isolines[0].value, WithinAbs(0.6749779869915704, 1e-10) || WithinRel(0.6749779869915704, 1e-8));
793 CHECK_THAT(d_isolines[1].value, WithinAbs(4.704765645221012, 1e-10) || WithinRel(4.704765645221012, 1e-8));
794 CHECK_THAT(d_isolines[2].value, WithinAbs(32.793395048494105, 1e-10) || WithinRel(32.793395048494105, 1e-8));
795 CHECK_THAT(d_isolines[3].value, WithinAbs(228.57817793729427, 1e-10) || WithinRel(228.57817793729427, 1e-8));
796 CHECK_THAT(d_isolines[4].value, WithinAbs(1593.2471569921404, 1e-10) || WithinRel(1593.2471569921404, 1e-8));
797 const double expected_x[isoline_count][points_per_isoline] = {
798 {524.173878302998, 1911.09303197673, 2092.95299735844, 2262.71394473455, 2423.07169138421},
799 {448.103089615505, 1715.11956249458, 1932.46627813425, 2103.15612327652, 2263.90953791769},
800 {437.189451893868, 972.489749676145, 1758.36241052051, 1935.75228615955, 2099.2064319409},
801 {435.623706482598, 865.946977105681, 1292.02339683129, 1720.27746043046, 1899.38158004687},
802 {426.009483858917, 710.877062876878, 946.968704706707, 1151.91782375263, 1335.56507098392},
804 const double expected_y[isoline_count][points_per_isoline] = {
805 {173.15, 243.6125, 314.075, 384.5375, 455}, {173.15, 243.6125, 314.075, 384.5375, 455}, {173.15, 243.6125, 314.075, 384.5375, 455},
806 {173.15, 243.6125, 314.075, 384.5375, 455}, {173.15, 243.6125, 314.075, 384.5375, 455},
808 for (
int i = 0; i < d_isolines.size(); ++i) {
809 REQUIRE(d_isolines[i].size() == points_per_isoline);
810 for (
int j = 0; j < d_isolines[i].size(); ++j) {
811 CHECK_THAT(d_isolines[i].x[j], WithinRel(expected_x[i][j], 1e-8));
812 CHECK_THAT(d_isolines[i].y[j], WithinRel(expected_y[i][j], 1e-8));