| 306 | } |
| 307 | |
| 308 | double |
| 309 | HierarchyAveragedDataManager::getTimePoint(double time, const double tol) |
| 310 | { |
| 311 | time = map_to_period(d_period_start, d_period_end, time); |
| 312 | auto it_up = d_snapshot_time_pts.upper_bound(time); |
| 313 | double t_low, t_up; |
| 314 | if (it_up == d_snapshot_time_pts.begin()) |
| 315 | { |
| 316 | t_up = *it_up; |
| 317 | // Set the "lower" bound to be the other end of the period. |
| 318 | t_low = *d_snapshot_time_pts.rbegin(); |
| 319 | } |
| 320 | else |
| 321 | { |
| 322 | auto it_low = std::next(it_up, -1); |
| 323 | t_low = *(it_low); |
| 324 | t_up = *(it_up); |
| 325 | } |
| 326 | |
| 327 | if (std::abs(t_low - time) <= tol) |
| 328 | return t_low; |
| 329 | else if (std::abs(t_up - time) <= tol) |
| 330 | return t_up; |
| 331 | else |
| 332 | TBOX_ERROR("Time point: " << time << " is not within the given tolerance " << tol << "!\n"); |
| 333 | return 0.0; |
| 334 | } |
| 335 | |
| 336 | void |
| 337 | HierarchyAveragedDataManager::putToDatabase(Pointer<Database> db) |
nothing calls this directly
no test coverage detected