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

Method get_axis_limits

src/CoolPropPlot.cpp:440–469  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

438}
439
440PropertyPlot::Range2D PropertyPlot::get_axis_limits(CoolProp::parameters xkey, CoolProp::parameters ykey, bool autoscale) const {
441 if (xkey == CoolProp::parameters::iundefined_parameter) xkey = this->xkey_;
442 if (ykey == CoolProp::parameters::iundefined_parameter) ykey = this->ykey_;
443
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()};
448
449 for (double T : {tp_limits.T.min, tp_limits.T.max}) {
450 for (double p : {tp_limits.p.min, tp_limits.p.max}) {
451 try {
452 state_->update(CoolProp::PT_INPUTS, p, T);
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);
459 } catch (...) { // NOLINT(bugprone-empty-catch)
460 // (T, p) outside the backend's valid region — this
461 // corner doesn't contribute to the bounding box.
462 }
463 }
464 }
465 return {xrange, yrange};
466 } else {
467 return {xaxis.range, yaxis.range};
468 }
469}
470
471} /* namespace Plot */
472} /* namespace CoolProp */

Callers 4

__init__Method · 0.95
calc_isolinesMethod · 0.95
draw_isolinesMethod · 0.95
drawMethod · 0.95

Calls 2

keyed_outputMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected