int get_number_of_frames(const ::npctransport_proto::Assignment& a,
                         double time_step) {
  int ret = get_frames_from_ns(a.simulation_time_ns(), time_step);
  if (ret > a.maximal_number_of_frames()) {
    IMP_THROW(
        "number of frames " << ret << ", which is required for simulation time"
                            << a.simulation_time_ns()
                            << " exceeds the specified maximal value "
                            << a.maximal_number_of_frames(),
        IMP::ValueException);
  }
  return ret;
}
Esempio n. 2
0
int get_number_of_frames
(const ::npctransport_proto::Assignment& config, double time_step)
{
  const double fs_in_ns = 1000000;
  int ret = std::ceil(config.simulation_time_ns() * fs_in_ns / time_step);
  if(ret == 0) ret = 1; // make sure at least every frame
  if(ret > config.maximal_number_of_frames()){
    IMP_THROW("number of frames " << ret
              << ", which is required for simulation time"
              << config.simulation_time_ns()
              << " exceeds the specified maximal value "
              << config.maximal_number_of_frames() ,
              IMP::base::ValueException);
  }
  return ret;
}