MCPcopy Create free account
hub / github.com/IBAMR/IBAMR / getTimePoint

Method getTimePoint

ibtk/src/utilities/HierarchyAveragedDataManager.cpp:308–334  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

306}
307
308double
309HierarchyAveragedDataManager::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
336void
337HierarchyAveragedDataManager::putToDatabase(Pointer<Database> db)

Callers

nothing calls this directly

Calls 5

map_to_periodFunction · 0.85
nextFunction · 0.85
absFunction · 0.50
beginMethod · 0.45
rbeginMethod · 0.45

Tested by

no test coverage detected