| 260 | } |
| 261 | |
| 262 | void InitTimeGeometry(py::module_& m) |
| 263 | { |
| 264 | py::class_<TimeGeometry, TimeGeometry::Pointer>(m, "TimeGeometry", |
| 265 | R"(Maps discrete time steps to floating-point time points. |
| 266 | |
| 267 | A ``TimeGeometry`` is the temporal counterpart of :py:class:`BaseGeometry`. |
| 268 | It bridges integer time-step indices (used as array indices) and physical |
| 269 | time points (the time values a user sees). For static 3D data the time |
| 270 | geometry has a single time step that covers the full time range. |
| 271 | |
| 272 | Subclasses: |
| 273 | |
| 274 | - :py:class:`ProportionalTimeGeometry`: evenly spaced time points. |
| 275 | - :py:class:`ArbitraryTimeGeometry`: user-defined time points per step. |
| 276 | )") |
| 277 | .def("count_time_steps", &TimeGeometry::CountTimeSteps, |
| 278 | "Return the number of time steps.") |
| 279 | .def("get_min_time_point", py::overload_cast<>(&TimeGeometry::GetMinimumTimePoint, py::const_), |
| 280 | "Return the minimum (earliest) time point covered by this geometry.") |
| 281 | .def("get_max_time_point", py::overload_cast<>(&TimeGeometry::GetMaximumTimePoint, py::const_), |
| 282 | "Return the maximum (latest) time point covered by this geometry.") |
| 283 | .def("get_min_time_point", py::overload_cast<TimeStepType>(&TimeGeometry::GetMinimumTimePoint, py::const_), py::arg("time_step"), |
| 284 | R"(Return the minimum time point of a single time step. |
| 285 | |
| 286 | Args: |
| 287 | time_step: Time-step index. |
| 288 | )") |
| 289 | .def("get_max_time_point", py::overload_cast<TimeStepType>(&TimeGeometry::GetMaximumTimePoint, py::const_), py::arg("time_step"), |
| 290 | R"(Return the maximum time point of a single time step. |
| 291 | |
| 292 | Args: |
| 293 | time_step: Time-step index. |
| 294 | )") |
| 295 | .def("get_time_bounds", |
| 296 | [](const TimeGeometry& tg) { |
| 297 | const auto b = tg.GetTimeBounds(); |
| 298 | return std::make_tuple(b[0], b[1]); |
| 299 | }, |
| 300 | R"(Return the overall ``(min_time_point, max_time_point)`` tuple. |
| 301 | |
| 302 | Returns: |
| 303 | A 2-tuple of floats. |
| 304 | )") |
| 305 | .def("get_time_bounds", |
| 306 | [](const TimeGeometry& tg, TimeStepType t) { |
| 307 | const auto b = tg.GetTimeBounds(t); |
| 308 | return std::make_tuple(b[0], b[1]); |
| 309 | }, |
| 310 | py::arg("time_step"), |
| 311 | R"(Return the ``(min, max)`` time-point tuple for a single time step. |
| 312 | |
| 313 | Args: |
| 314 | time_step: Time-step index. |
| 315 | |
| 316 | Returns: |
| 317 | A 2-tuple of floats. |
| 318 | )") |
| 319 | .def("time_step_to_time_point", &TimeGeometry::TimeStepToTimePoint, py::arg("time_step"), |
no test coverage detected