diff --git a/ProcessLib/BoundaryCondition/DeactivatedSubdomainDirichlet.cpp b/ProcessLib/BoundaryCondition/DeactivatedSubdomainDirichlet.cpp index 3a6a0e20b23909aa0beff840152028d9fe41f7f4..1157f26d47e9fa384c57c64315449dce891d27b4 100644 --- a/ProcessLib/BoundaryCondition/DeactivatedSubdomainDirichlet.cpp +++ b/ProcessLib/BoundaryCondition/DeactivatedSubdomainDirichlet.cpp @@ -6,10 +6,8 @@ * See accompanying file LICENSE.txt or * http://www.opengeosys.org/project/license */ - #include "DeactivatedSubdomainDirichlet.h" -#include "BaseLib/TimeInterval.h" #include "DirichletBoundaryCondition.h" #include "DirichletBoundaryConditionAuxiliaryFunctions.h" #include "NumLib/DOF/LocalToGlobalIndexMap.h" @@ -21,7 +19,7 @@ namespace ProcessLib { DeactivatedSubdomainDirichlet::DeactivatedSubdomainDirichlet( std::vector<std::size_t> const* const active_element_ids, - BaseLib::TimeInterval const& time_interval, + MathLib::PiecewiseLinearInterpolation time_interval, ParameterLib::Parameter<double> const& parameter, DeactivatedSubdomainMesh const& subdomain, NumLib::LocalToGlobalIndexMap const& dof_table_bulk, int const variable_id, @@ -75,7 +73,12 @@ void DeactivatedSubdomainDirichlet::getEssentialBCValues( return std::all_of(begin(connected_elements), end(connected_elements), is_inactive); }); - if (_time_interval.contains(t)) + + auto time_interval_contains = [&](double const t) { + return _time_interval.getSupportMin() <= t && + t <= _time_interval.getSupportMax(); + }; + if (time_interval_contains(t)) { getEssentialBCValuesLocal(_parameter, *_subdomain.mesh, inactive_nodes_in_bc_mesh, *_dof_table_boundary, diff --git a/ProcessLib/BoundaryCondition/DeactivatedSubdomainDirichlet.h b/ProcessLib/BoundaryCondition/DeactivatedSubdomainDirichlet.h index cadfba543ada14510b674c2581da5fc0bde4aa3f..bbdd987f0d50b63020e2357569e6e2b2e49570d5 100644 --- a/ProcessLib/BoundaryCondition/DeactivatedSubdomainDirichlet.h +++ b/ProcessLib/BoundaryCondition/DeactivatedSubdomainDirichlet.h @@ -11,8 +11,8 @@ #include <memory> #include <vector> -#include "BaseLib/TimeInterval.h" #include "BoundaryCondition.h" +#include "MathLib/InterpolationAlgorithms/PiecewiseLinearInterpolation.h" namespace BaseLib { @@ -42,7 +42,7 @@ class DeactivatedSubdomainDirichlet final : public BoundaryCondition public: DeactivatedSubdomainDirichlet( std::vector<std::size_t> const* active_element_ids, - BaseLib::TimeInterval const& time_interval, + MathLib::PiecewiseLinearInterpolation time_interval, ParameterLib::Parameter<double> const& parameter, DeactivatedSubdomainMesh const& subdomain, NumLib::LocalToGlobalIndexMap const& dof_table_bulk, @@ -64,7 +64,7 @@ private: int const _variable_id; int const _component_id; - BaseLib::TimeInterval const _time_interval; + MathLib::PiecewiseLinearInterpolation const _time_interval; std::vector<std::size_t> const* _active_element_ids = nullptr; }; } // namespace ProcessLib diff --git a/ProcessLib/DeactivatedSubdomain.cpp b/ProcessLib/DeactivatedSubdomain.cpp index 4aa7e563ceca4d468671ed965e4451691bb6001a..3425d570da37ca3437e03eea5a6541f3e6efe055 100644 --- a/ProcessLib/DeactivatedSubdomain.cpp +++ b/ProcessLib/DeactivatedSubdomain.cpp @@ -33,11 +33,11 @@ DeactivatedSubdomainMesh::DeactivatedSubdomainMesh( } DeactivatedSubdomain::DeactivatedSubdomain( - BaseLib::TimeInterval const& time_interval_, + MathLib::PiecewiseLinearInterpolation time_interval_, std::vector<int>&& materialIDs_, std::vector<std::unique_ptr<DeactivatedSubdomainMesh>>&& deactivated_subdomain_meshes_) - : time_interval(time_interval_), + : time_interval(std::move(time_interval_)), materialIDs(std::move(materialIDs_)), deactivated_subdomain_meshes(std::move(deactivated_subdomain_meshes_)) { @@ -45,7 +45,8 @@ DeactivatedSubdomain::DeactivatedSubdomain( bool DeactivatedSubdomain::includesTimeOf(double const t) const { - return time_interval.contains(t); + return time_interval.getSupportMin() <= t && + t <= time_interval.getSupportMax(); } template <typename IsActive> @@ -112,8 +113,17 @@ std::unique_ptr<DeactivatedSubdomain const> createDeactivatedSubdomain( BaseLib::ConfigTree const& config, MeshLib::Mesh const& mesh) { //! \ogs_file_param{prj__process_variables__process_variable__deactivated_subdomains__deactivated_subdomain__time_interval} - config.peekConfigParameter<std::string>("time_interval"); - auto time_interval = BaseLib::createTimeInterval(config); + auto const& time_interval_config = config.getConfigSubtree("time_interval"); + + auto const start_time = + //! \ogs_file_param{prj__process_variables__process_variable__deactivated_subdomains__deactivated_subdomain__time_interval__start} + time_interval_config.getConfigParameter<double>("start"); + + auto const end_time = + //! \ogs_file_param{prj__process_variables__process_variable__deactivated_subdomains__deactivated_subdomain__time_interval__end} + time_interval_config.getConfigParameter<double>("end"); + MathLib::PiecewiseLinearInterpolation time_interval{ + {start_time, end_time}, {1, 1}, false}; auto deactivated_subdomain_material_ids = //! \ogs_file_param{prj__process_variables__process_variable__deactivated_subdomains__deactivated_subdomain__material_ids} @@ -149,7 +159,7 @@ std::unique_ptr<DeactivatedSubdomain const> createDeactivatedSubdomain( } return std::make_unique<DeactivatedSubdomain const>( - time_interval, + std::move(time_interval), std::move(deactivated_subdomain_material_ids), std::move(deactivated_subdomain_meshes)); } diff --git a/ProcessLib/DeactivatedSubdomain.h b/ProcessLib/DeactivatedSubdomain.h index a752bb44e12616600bdb89a27552197b3f6651f3..3c043ad9f6c24f7bcf46374f4e3f8cf5a2d7777b 100644 --- a/ProcessLib/DeactivatedSubdomain.h +++ b/ProcessLib/DeactivatedSubdomain.h @@ -17,7 +17,7 @@ #include <string> #include <vector> -#include "BaseLib/TimeInterval.h" +#include "MathLib/InterpolationAlgorithms/PiecewiseLinearInterpolation.h" namespace BaseLib { @@ -45,14 +45,14 @@ struct DeactivatedSubdomainMesh struct DeactivatedSubdomain { DeactivatedSubdomain( - BaseLib::TimeInterval const& time_interval_, + MathLib::PiecewiseLinearInterpolation time_interval_, std::vector<int>&& materialIDs_, std::vector<std::unique_ptr<DeactivatedSubdomainMesh>>&& deactivated_subdomain_meshes_); bool includesTimeOf(double const t) const; - BaseLib::TimeInterval const time_interval; + MathLib::PiecewiseLinearInterpolation const time_interval; /// The material IDs of the deactivated the subdomains std::vector<int> const materialIDs; diff --git a/ProcessLib/ProcessVariable.cpp b/ProcessLib/ProcessVariable.cpp index 310d9937d4f8d7abfad8fc3f919877d39769ec52..8bb2524353b5e25f1ff6dc3ac870cd7a6087a4d8 100644 --- a/ProcessLib/ProcessVariable.cpp +++ b/ProcessLib/ProcessVariable.cpp @@ -15,7 +15,6 @@ #include "BaseLib/Algorithm.h" #include "BaseLib/Logging.h" -#include "BaseLib/TimeInterval.h" #include "MeshGeoToolsLib/ConstructMeshesFromGeometries.h" #include "MeshLib/Mesh.h" #include "MeshLib/Node.h"