Skip to content
Snippets Groups Projects
Commit 7c22fbaa authored by wenqing's avatar wenqing
Browse files

[TimeInterval] Added a creator

parent 5ba81b63
No related branches found
No related tags found
No related merge requests found
/**
* \copyright
* Copyright (c) 2012-2018, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*
* File: TimeInterval.cpp
*
* Created on November 27, 2018, 5:06 PM
*
*/
#include "TimeInterval.h"
#include "BaseLib/ConfigTree.h"
namespace NumLib
{
std::unique_ptr<TimeInterval> createTimeInterval(
BaseLib::ConfigTree const& config)
{
//! \ogs_file_param{prj__time_loop__processes__process__time_interval}
auto const& time_interval_config = config.getConfigSubtree("time_interval");
const double start_time =
//! \ogs_file_param{prj__time_loop__processes__process__time_interval__start_time}
time_interval_config.getConfigParameter<double>("start_time");
const double end_time =
//! \ogs_file_param{prj__time_loop__processes__process__time_interval__end_time}
time_interval_config.getConfigParameter<double>("end_time");
return std::make_unique<NumLib::TimeInterval>(start_time, end_time);
}
} // end of namespace
......@@ -12,6 +12,11 @@
*/
#pragma once
namespace BaseLib
{
class ConfigTree;
}
namespace NumLib
{
/*!
......@@ -36,4 +41,7 @@ private:
const double _end_time;
};
std::unique_ptr<TimeInterval> createTimeInterval(
BaseLib::ConfigTree const& config);
} // end of namespace
......@@ -25,14 +25,13 @@ namespace ProcessLib
{
DirichletBoundaryConditionWithinTimeInterval::
DirichletBoundaryConditionWithinTimeInterval(
double const start_time, double const end_time,
std::unique_ptr<NumLib::TimeInterval> time_interval,
Parameter<double> const& parameter, MeshLib::Mesh const& bc_mesh,
NumLib::LocalToGlobalIndexMap const& dof_table_bulk,
int const variable_id, int const component_id)
: DirichletBoundaryCondition(parameter, bc_mesh, dof_table_bulk,
variable_id, component_id),
_time_interval(
std::make_unique<NumLib::TimeInterval>(start_time, end_time))
_time_interval(std::move(time_interval))
{
}
......@@ -48,8 +47,6 @@ void DirichletBoundaryConditionWithinTimeInterval::getEssentialBCValues(
bc_values.ids.clear();
bc_values.values.clear();
return;
}
std::unique_ptr<DirichletBoundaryCondition>
......@@ -86,17 +83,12 @@ createDirichletBoundaryConditionWithinTimeInterval(
}
#endif // USE_PETSC
const double start_time =
//! \ogs_file_param{prj__process_variables__process_variable__boundary_conditions__boundary_condition__DirichletWithinTimeInterval__start_time}
config.getConfigParameter<double>("start_time");
const double end_time =
//! \ogs_file_param{prj__process_variables__process_variable__boundary_conditions__boundary_condition__DirichletWithinTimeInterval__end_time}
config.getConfigParameter<double>("end_time");
//! \ogs_file_param{prj__process_variables__process_variable__boundary_conditions__boundary_condition__DirichletWithinTimeInterval__time_interval}
config.peekConfigParameter<std::string>("time_interval");
return std::make_unique<DirichletBoundaryConditionWithinTimeInterval>(
start_time, end_time, param, bc_mesh, dof_table_bulk, variable_id,
component_id);
NumLib::createTimeInterval(config), param, bc_mesh,
dof_table_bulk, variable_id, component_id);
}
} // namespace ProcessLib
......@@ -28,7 +28,7 @@ class DirichletBoundaryConditionWithinTimeInterval final
{
public:
DirichletBoundaryConditionWithinTimeInterval(
double const start_time, double const end_time,
std::unique_ptr<NumLib::TimeInterval> time_interval,
Parameter<double> const& parameter, MeshLib::Mesh const& bc_mesh,
NumLib::LocalToGlobalIndexMap const& dof_table_bulk,
int const variable_id, int const component_id);
......
......@@ -136,8 +136,10 @@
<geometry>bottom</geometry>
<type>DirichletWithinTimeInterval</type>
<parameter>bc_bottom</parameter>
<start_time> 0.0 </start_time>
<end_time> 10.0 </end_time>
<time_interval>
<start_time> 0.0 </start_time>
<end_time> 10.0 </end_time>
</time_interval>
</boundary_condition>
</boundary_conditions>
</process_variable>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment