OGS
TimeInterval.cpp
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2
// SPDX-License-Identifier: BSD-3-Clause
3
4
#include "
TimeInterval.h
"
5
6
#include "
BaseLib/ConfigTree.h
"
7
#include "
Time.h
"
8
9
namespace
NumLib
10
{
11
bool
TimeInterval::contains
(
double
const
current_time)
const
12
{
13
Time
const
time{current_time};
14
return
Time
{
start_time
} <= time && time <=
Time
{
end_time
};
15
}
16
17
TimeInterval
createTimeInterval
(
BaseLib::ConfigTree
const
& config)
18
{
20
auto
const
& time_interval_config = config.
getConfigSubtree
(
"time_interval"
);
21
22
const
auto
start_time =
24
time_interval_config.
getConfigParameter
<
double
>(
"start"
);
25
26
const
auto
end_time =
28
time_interval_config.getConfigParameter<
double
>(
"end"
);
29
30
return
{start_time, end_time};
31
}
32
}
// namespace NumLib
ConfigTree.h
TimeInterval.h
Time.h
BaseLib::ConfigTree
Definition
ConfigTree.h:101
BaseLib::ConfigTree::getConfigParameter
T getConfigParameter(std::string const ¶m) const
Definition
ConfigTree-impl.h:113
BaseLib::ConfigTree::getConfigSubtree
ConfigTree getConfigSubtree(std::string const &root) const
Definition
ConfigTree.cpp:178
NumLib
Definition
ProjectData.h:31
NumLib::createTimeInterval
TimeInterval createTimeInterval(BaseLib::ConfigTree const &config)
Definition
TimeInterval.cpp:17
NumLib::TimeInterval
Definition
TimeInterval.h:18
NumLib::TimeInterval::contains
bool contains(double const current_time) const
Definition
TimeInterval.cpp:11
NumLib::TimeInterval::end_time
double end_time
Definition
TimeInterval.h:28
NumLib::TimeInterval::start_time
double start_time
Definition
TimeInterval.h:27
NumLib::Time
Definition
Time.h:27
NumLib
TimeStepping
TimeInterval.cpp
Generated by
1.14.0