Clear cached variables for tabular methods

Signed-off-by: Ian Bell <ian.h.bell@gmail.com>
This commit is contained in:
Ian Bell
2015-03-14 20:30:00 -06:00
parent c934bae64b
commit 77653643d5
2 changed files with 6 additions and 1 deletions

View File

@@ -135,6 +135,9 @@ void CoolProp::BicubicBackend::build_coeffs(SinglePhaseGriddedTableData &table,
void CoolProp::BicubicBackend::update(CoolProp::input_pairs input_pair, double val1, double val2)
{
// Clear cached values
clear();
// Flush the cached indices (set to large number)
cached_single_phase_i = std::numeric_limits<std::size_t>::max();
cached_single_phase_j = std::numeric_limits<std::size_t>::max();
@@ -236,7 +239,7 @@ double CoolProp::BicubicBackend::evaluate_single_phase_transport(SinglePhaseGrid
}
double x1 = table.xvec[i], x2 = table.xvec[i+1], y1 = table.yvec[j], y2 = table.yvec[j+1];
double f11 = (*f)[i][j], f12 = (*f)[i][j+1], f21 = (*f)[i+1][j], f22 = (*f)[i+1][j+1];
double val = 1/((x2-x1)*(y2-y1))*( f11*(x2- x1)*(y2 - y)
double val = 1/((x2-x1)*(y2-y1))*( f11*(x2 - x)*(y2 - y)
+f21*(x - x1)*(y2 - y)
+f12*(x2 - x)*(y - y1)
+f22*(x - x1)*(y - y1));

View File

@@ -6,6 +6,8 @@
void CoolProp::TTSEBackend::update(CoolProp::input_pairs input_pair, double val1, double val2)
{
// Clear cached variables
clear();
// Flush the cached indices (set to large number)
cached_single_phase_i = std::numeric_limits<std::size_t>::max();
cached_single_phase_j = std::numeric_limits<std::size_t>::max();