| 274 | */ |
| 275 | template<typename ItType, typename ValType> |
| 276 | AMREX_GPU_HOST_DEVICE |
| 277 | ItType lower_bound (ItType first, ItType last, const ValType& val) |
| 278 | { |
| 279 | AMREX_IF_ON_DEVICE(( |
| 280 | std::ptrdiff_t count = last-first; |
| 281 | while(count>0) |
| 282 | { |
| 283 | auto it = first; |
| 284 | const auto step = count/2; |
| 285 | it += step; |
| 286 | if (*it < val){ |
| 287 | first = ++it; |
| 288 | count -= step + 1; |
| 289 | } |
| 290 | else{ |
| 291 | count = step; |
| 292 | } |
| 293 | } |
| 294 | |
| 295 | return first; |
| 296 | )) |
| 297 | AMREX_IF_ON_HOST(( |
| 298 | return std::lower_bound(first, last, val); |
| 299 | )) |
| 300 | } |
| 301 | |
| 302 | /** |
| 303 | * \brief Fill a range with linearly spaced values over a closed interval. |
no outgoing calls
no test coverage detected