diff --git a/include/DataStructures.h b/include/DataStructures.h index d9a94789..085ee700 100644 --- a/include/DataStructures.h +++ b/include/DataStructures.h @@ -16,7 +16,10 @@ namespace CoolProp { struct SimpleState { double rhomolar, T, p, hmolar, smolar, umolar, Q; - SimpleState() : rhomolar(_HUGE), T(_HUGE), p(_HUGE), hmolar(_HUGE), smolar(_HUGE), umolar(_HUGE), Q(_HUGE) {} + SimpleState() { fill(_HUGE); } + void fill(double v){ + rhomolar = v; T = v; p = v; hmolar = v; smolar = v; umolar = v; Q = v; + } bool is_valid(){return ValidNumber(rhomolar) && ValidNumber(T) && ValidNumber(hmolar) && ValidNumber(p);} }; diff --git a/src/AbstractState.cpp b/src/AbstractState.cpp index 2e14f161..9b4ba17b 100644 --- a/src/AbstractState.cpp +++ b/src/AbstractState.cpp @@ -112,17 +112,8 @@ bool AbstractState::clear() { this->_TVanc.clear(); this->_TLanc.clear(); - this->_critical.T = -_HUGE; - this->_critical.hmolar = -_HUGE; - this->_critical.p = -_HUGE; - this->_critical.rhomolar = -_HUGE; - this->_critical.smolar = -_HUGE; - - this->_reducing.T = -_HUGE; - this->_reducing.hmolar = -_HUGE; - this->_reducing.p = -_HUGE; - this->_reducing.rhomolar = -_HUGE; - this->_reducing.smolar = -_HUGE; + this->_critical.fill(_HUGE); + this->_reducing.fill(_HUGE); /// Bulk values this->_rhomolar = -_HUGE;