本文整理汇总了C++中ProgressBar::SetStyle方法的典型用法代码示例。如果您正苦于以下问题:C++ ProgressBar::SetStyle方法的具体用法?C++ ProgressBar::SetStyle怎么用?C++ ProgressBar::SetStyle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProgressBar
的用法示例。
在下文中一共展示了ProgressBar::SetStyle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RunBody
double Simulation::RunBody(double maxSimTime)
{
//needed to control the execution time PART 1
//in the case you want to run in no faster than realtime
//time_t starttime, endtime;
//time(&starttime);
//take the current time from the pedestrian
double t = Pedestrian::GetGlobalTime();
//frame number. This function can be called many times,
static int frameNr = (int) (1+t/_deltaT); // Frame Number
//##########
//PROBLEMATIC: time when frame should be printed out
// possibly skipped when using the following lines
// NEEDS TO BE FIXED!
int writeInterval = (int) ((1./_fps)/_deltaT+0.5);
writeInterval = (writeInterval<=0) ? 1 : writeInterval; // mustn't be <= 0
// ##########
//process the queue for incoming pedestrians
//important since the number of peds is used
//to break the main simulation loop
ProcessAgentsQueue();
_nPeds = _building->GetAllPedestrians().size();
std::cout << "\n";
std::string description = "Evacutation ";
ProgressBar *bar = new ProgressBar(_nPeds, description);
// bar->SetFrequencyUpdate(10);
#ifdef _WINDOWS
bar->SetStyle("|","-");
#else
bar->SetStyle("\u2588", "-"); //for linux
#endif
int initialnPeds = _nPeds;
// main program loop
while ((_nPeds || (!_agentSrcManager.IsCompleted()&& _gotSources) ) && t<maxSimTime) {
t = 0+(frameNr-1)*_deltaT;
//process the queue for incoming pedestrians
ProcessAgentsQueue();
if (t>Pedestrian::GetMinPremovementTime()) {
//update the linked cells
_building->UpdateGrid();
// update the positions
_operationalModel->ComputeNextTimeStep(t, _deltaT, _building.get(), _periodic);
//update the events
_em->ProcessEvent();
//here we could place router-tasks (calc new maps) that can use multiple cores AND we have 't'
//update quickestRouter
if (_routingEngine.get()->GetRouter(ROUTING_FF_QUICKEST)) {
FFRouter* ffrouter = dynamic_cast<FFRouter*>(_routingEngine.get()->GetRouter(ROUTING_FF_QUICKEST));
if (ffrouter->MustReInit()) {
ffrouter->ReInit();
ffrouter->SetRecalc(t);
}
}
//update the routes and locations
UpdateRoutesAndLocations();
//other updates
//someone might have left the building
_nPeds = _building->GetAllPedestrians().size();
}
// update the global time
Pedestrian::SetGlobalTime(t);
// write the trajectories
if (0==frameNr%writeInterval) {
_iod->WriteFrame(frameNr/writeInterval, _building.get());
}
if(!_gotSources && !_periodic && _config->print_prog_bar())
// Log->ProgressBar(initialnPeds, initialnPeds-_nPeds, t);
bar->Progressed(initialnPeds-_nPeds);
else
if ((!_gotSources) &&
((frameNr < 100 && frameNr % 10 == 0) ||
(frameNr > 100 && frameNr % 100 == 0)))
printf("time: %6.2f (%4.0f) | Agents: %6ld / %d [%4.1f%%]\n", t , maxSimTime, _nPeds, initialnPeds, (double)(initialnPeds-_nPeds)/initialnPeds*100);
// needed to control the execution time PART 2
// time(&endtime);
// double timeToWait=t-difftime(endtime, starttime);
// clock_t goal = timeToWait*1000 + clock();
// while (goal > clock());
++frameNr;
}
return t;
}