From 79a01a589379bd6c1e9445c37be75090ca385dc5 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov <github@naumov.de> Date: Wed, 31 Mar 2021 22:30:49 +0200 Subject: [PATCH] [PL/DS] Explain copy of a curve. Move time intvl. --- .../BoundaryCondition/DeactivatedSubdomainDirichlet.cpp | 2 +- ProcessLib/CreateDeactivatedSubdomain.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ProcessLib/BoundaryCondition/DeactivatedSubdomainDirichlet.cpp b/ProcessLib/BoundaryCondition/DeactivatedSubdomainDirichlet.cpp index 1157f26d47e..8848b9d6116 100644 --- a/ProcessLib/BoundaryCondition/DeactivatedSubdomainDirichlet.cpp +++ b/ProcessLib/BoundaryCondition/DeactivatedSubdomainDirichlet.cpp @@ -28,7 +28,7 @@ DeactivatedSubdomainDirichlet::DeactivatedSubdomainDirichlet( _subdomain(subdomain), _variable_id(variable_id), _component_id(component_id), - _time_interval(time_interval), + _time_interval(std::move(time_interval)), _active_element_ids(active_element_ids) { config(dof_table_bulk); diff --git a/ProcessLib/CreateDeactivatedSubdomain.cpp b/ProcessLib/CreateDeactivatedSubdomain.cpp index 3e6a80d99c6..74fb1ef0429 100644 --- a/ProcessLib/CreateDeactivatedSubdomain.cpp +++ b/ProcessLib/CreateDeactivatedSubdomain.cpp @@ -119,6 +119,8 @@ static MathLib::PiecewiseLinearInterpolation parseTimeIntervalOrCurve( if (curve_name) { DBUG("Using curve '{:s}'", *curve_name); + // Return a copy of the curve because the time interval in the other + // branch returns a temporary. return *BaseLib::getOrError(curves, *curve_name, "Could not find curve."); } @@ -174,7 +176,7 @@ std::unique_ptr<DeactivatedSubdomain const> createDeactivatedSubdomain( auto const& curve_name = //! \ogs_file_param{prj__process_variables__process_variable__deactivated_subdomains__deactivated_subdomain__time_curve} config.getConfigParameterOptional<std::string>("time_curve"); - auto const time_interval = + auto time_interval = parseTimeIntervalOrCurve(time_interval_config, curve_name, curves); auto const line_segment_config = -- GitLab