From 4f9e66253ff7cfde5f5f4c7700d73137aa0d9351 Mon Sep 17 00:00:00 2001 From: Max Luebke Date: Tue, 1 Aug 2023 23:19:16 +0200 Subject: [PATCH] fix: remove mass balance check --- .../SurrogateModels/InterpolationModule.cpp | 47 +------------------ 1 file changed, 1 insertion(+), 46 deletions(-) diff --git a/src/ChemistryModule/SurrogateModels/InterpolationModule.cpp b/src/ChemistryModule/SurrogateModels/InterpolationModule.cpp index 0d139ac3e..e5c36fa0c 100644 --- a/src/ChemistryModule/SurrogateModels/InterpolationModule.cpp +++ b/src/ChemistryModule/SurrogateModels/InterpolationModule.cpp @@ -1,4 +1,4 @@ -// Time-stamp: "Last modified 2023-08-01 17:54:53 mluebke" +// Time-stamp: "Last modified 2023-08-01 23:18:45 mluebke" #include "poet/DHT_Wrapper.hpp" #include "poet/HashFunctions.hpp" @@ -115,55 +115,10 @@ void InterpolationModule::tryInterpolation( // } // mean_water /= pht_result.size; - auto calcMassBalance = [](const std::vector &input) { - double C, Ca, Mg; - C = input[3] + input[7] + 2 * input[9]; - Ca = input[4] + input[7] + input[9]; - Mg = input[6] + input[9]; - - return std::array{C, Ca, Mg}; - }; - - auto mass_in = calcMassBalance(dht_results.results[i]); - - const auto DHT_inputElements = dht_instance.getKeyElements(); - - // HACK: transform input elements to uint, as there shall no any user - // defined key species present yet - - // std::vector interp_inputElements; - // std::transform(DHT_inputElements.begin(), DHT_inputElements.end(), - // interp_inputElements.begin(), [](std::int32_t x) { - // if (x < 0) { - // x = 0; - // } - // return x; - // }); - interp_result.results[i] = f_interpolate(dht_instance.getKeyElements(), dht_results.results[i], pht_result.in_values, pht_result.out_values); - auto mass_out = calcMassBalance(interp_result.results[i]); - - double diff[3]; - - std::transform(mass_in.begin(), mass_in.end(), mass_out.begin(), diff, - std::minus<>()); - - bool exceeding = false; - for (const auto comp : diff) { - if (std::abs(comp) > 1e-10) { - exceeding = true; - break; - } - } - - if (exceeding) { - interp_result.status[i] = INSUFFICIENT_DATA; - continue; - } - if (interp_result.results[i][7] < 0 || interp_result.results[i][9] < 0) { interp_result.status[i] = INSUFFICIENT_DATA; continue;