Commit 74056912 authored by Thibault Hallouin's avatar Thibault Hallouin
Browse files

isolate evalp-specific utils in their own namespace

No related merge requests found
Pipeline #38636 passed with stages
in 2 minutes and 32 seconds
Showing with 26 additions and 23 deletions
+26 -23
......@@ -100,7 +100,7 @@ namespace evalhyd
);
// check that optional parameters are given as arguments
eh::utils::check_optionals(metrics, q_thr);
eh::utils::evalp::check_optionals(metrics, q_thr);
// check that data dimensions are compatible
// > time
......
......@@ -92,30 +92,33 @@ namespace evalhyd
}
}
/// Procedure to check that optional parameters are provided
/// as arguments when required metrics need them.
///
/// \param [in] metrics:
/// Vector of strings for the metric(s) to be computed.
/// \param [in] thresholds:
/// Array of thresholds for metrics based on exceedance events.
inline void check_optionals (
const std::vector<std::string>& metrics,
const xt::xtensor<double, 1>& thresholds
)
namespace evalp
{
std::vector<std::string>threshold_metrics =
{"BS", "BS_CRD", "BS_LBD", "BSS"};
for (const auto& metric : metrics)
/// Procedure to check that optional parameters are provided
/// as arguments when required metrics need them.
///
/// \param [in] metrics:
/// Vector of strings for the metric(s) to be computed.
/// \param [in] thresholds:
/// Array of thresholds for metrics based on exceedance events.
inline void check_optionals (
const std::vector<std::string>& metrics,
const xt::xtensor<double, 1>& thresholds
)
{
if (std::find(threshold_metrics.begin(), threshold_metrics.end(),
metric) != threshold_metrics.end())
if (thresholds.size() < 1)
throw std::runtime_error(
"missing thresholds *q_thr* required to "
"compute " + metric
);
std::vector<std::string>threshold_metrics =
{"BS", "BS_CRD", "BS_LBD", "BSS"};
for (const auto& metric : metrics)
{
if (std::find(threshold_metrics.begin(), threshold_metrics.end(),
metric) != threshold_metrics.end())
if (thresholds.size() < 1)
throw std::runtime_error(
"missing thresholds *q_thr* required to "
"compute " + metric
);
}
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment