From 990542b56c77be64b6e26569bb0c7a0450e8541c Mon Sep 17 00:00:00 2001 From: Christoph Lehmann <christoph.lehmann@ufz.de> Date: Thu, 4 Aug 2016 11:36:24 +0200 Subject: [PATCH] removed call(std::string, ...) method --- NumLib/NamedFunctionCaller.cpp | 15 --------------- NumLib/NamedFunctionCaller.h | 6 ------ Tests/NumLib/TestNamedFunction.cpp | 3 ++- 3 files changed, 2 insertions(+), 22 deletions(-) diff --git a/NumLib/NamedFunctionCaller.cpp b/NumLib/NamedFunctionCaller.cpp index eeab28cef3f..6015c96a438 100644 --- a/NumLib/NamedFunctionCaller.cpp +++ b/NumLib/NamedFunctionCaller.cpp @@ -191,21 +191,6 @@ void NamedFunctionCaller::applyPlugs() } } -double NamedFunctionCaller::call( - const std::string& function_name, - const std::vector<double>& unbound_arguments) const -{ - assert(unbound_arguments.size() == getNumberOfUnboundArguments()); - - auto it = _map_name_idx.find(function_name); - if (it == _map_name_idx.end()) { - OGS_FATAL("A function with the name `%s' has not been found.", - function_name.c_str()); - } - - return call(it->second, unbound_arguments); -} - double NamedFunctionCaller::call( std::size_t function_idx, const std::vector<double>& unbound_arguments) const diff --git a/NumLib/NamedFunctionCaller.h b/NumLib/NamedFunctionCaller.h index 10276269106..6aee7086464 100644 --- a/NumLib/NamedFunctionCaller.h +++ b/NumLib/NamedFunctionCaller.h @@ -48,12 +48,6 @@ public: //! \pre All functions involved must have been added. void applyPlugs(); - //! Calls the function with the given name with the given unbound arguments. - //! - //! \pre applyPlugs() must have been called before. - double call(std::string const& function_name, - std::vector<double> const& unbound_arguments) const; - //! Creates a function caller that is able to call the function with the //! given name. SpecialFunctionCaller getSpecialFunction(std::string const& function_name); diff --git a/Tests/NumLib/TestNamedFunction.cpp b/Tests/NumLib/TestNamedFunction.cpp index da526595c65..1f046265ad8 100644 --- a/Tests/NumLib/TestNamedFunction.cpp +++ b/Tests/NumLib/TestNamedFunction.cpp @@ -100,8 +100,9 @@ TEST(NumLib, NamedFunctionCaller) double x = 1.0; double y = 2.0; + auto const g_caller = caller.getSpecialFunction("g"); DBUG("calling %s", caller.getCallExpression("g").c_str()); - EXPECT_EQ(g_inst.g(x), caller.call("g", {x, y})); + EXPECT_EQ(g_inst.g(x), g_caller.call({x, y})); auto const f_caller = caller.getSpecialFunction("f"); DBUG("calling %s", caller.getCallExpression("f").c_str()); -- GitLab