From 07d6de3bbc2053ec680b2cda2ca37f5d5c6757cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A5rd=20Skaflestad?= Date: Thu, 4 Nov 2021 18:07:49 +0100 Subject: [PATCH] Switch to Passing VFP Wrapper Tables as References We don't need to copy those mapping tables on each call. --- opm/simulators/wells/VFPHelpers.cpp | 6 +++--- opm/simulators/wells/VFPHelpers.hpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/opm/simulators/wells/VFPHelpers.cpp b/opm/simulators/wells/VFPHelpers.cpp index 0d899f6cc..af191ff18 100644 --- a/opm/simulators/wells/VFPHelpers.cpp +++ b/opm/simulators/wells/VFPHelpers.cpp @@ -590,7 +590,7 @@ T getGFR(const VFPProdTable& table, } template -const T& getTable(const std::map> tables, int table_id) +const T& getTable(const std::map>& tables, int table_id) { auto entry = tables.find(table_id); if (entry == tables.end()) { @@ -628,8 +628,8 @@ VFPInjTable::FLO_TYPE getType(const VFPInjTable& table) return table.getFloType(); } -template const VFPInjTable& getTable(const std::map>, int); -template const VFPProdTable& getTable(const std::map>, int); +template const VFPInjTable& getTable(const std::map>&, int); +template const VFPProdTable& getTable(const std::map>&, int); #define INSTANCE(...) \ template __VA_ARGS__ getFlo(const VFPInjTable&, const __VA_ARGS__&, const __VA_ARGS__&, const __VA_ARGS__&); \ diff --git a/opm/simulators/wells/VFPHelpers.hpp b/opm/simulators/wells/VFPHelpers.hpp index 8cf29b704..b0d8e013e 100644 --- a/opm/simulators/wells/VFPHelpers.hpp +++ b/opm/simulators/wells/VFPHelpers.hpp @@ -149,13 +149,13 @@ VFPEvaluation bhp(const VFPInjTable& table, * Returns the table from the map if found, or throws an exception */ template -const T& getTable(const std::map> tables, int table_id); +const T& getTable(const std::map>& tables, int table_id); /** * Check whether we have a table with the table number */ template -bool hasTable(const std::map> tables, int table_id) { +bool hasTable(const std::map>& tables, int table_id) { const auto entry = tables.find(table_id); return (entry != tables.end() ); }