本文整理汇总了C++中ProgressBar::Progressed方法的典型用法代码示例。如果您正苦于以下问题:C++ ProgressBar::Progressed方法的具体用法?C++ ProgressBar::Progressed怎么用?C++ ProgressBar::Progressed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProgressBar
的用法示例。
在下文中一共展示了ProgressBar::Progressed方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main_index
//.........这里部分代码省略.........
// We need reference mappings from the last
// variant up until the first actually
// variable ref base in this site
append_reference_mappings_until(sample_number * 2 + phase_offset, first_ref_base);
for (size_t i = 0; (alt_path_iter != alt_paths.end() &&
i < alt_path_iter->second.mapping_size()); i++) {
// Then blit mappings from the alt over to the phase thread
append_mapping(sample_number * 2 + phase_offset,
mapping_to_thread_mapping(alt_path_iter->second.mapping(i)));
}
// Say we've accounted for the reference on
// this path through the end of the variable
// region, which we have.
nonvariant_starts[sample_number * 2 + phase_offset] = last_ref_base;
}
}
}
// Now we have processed both phasings for this sample.
}
};
// Look for variants only on this path
variant_file.setRegion(vcf_contig_name);
// Set up progress bar
ProgressBar* progress = nullptr;
// Message needs to last as long as the bar itself.
string progress_message = "loading variants for " + vcf_contig_name;
if (show_progress) {
progress = new ProgressBar(path_length, progress_message.c_str());
progress->Progressed(0);
}
// Allocate a place to store actual variants
vcflib::Variant var(variant_file);
// How many variants have we done?
size_t variants_processed = 0;
while (variant_file.is_open() && variant_file.getNextVariant(var) && var.sequenceName == vcf_contig_name) {
// this ... maybe we should remove it as for when we have calls against N
bool isDNA = allATGC(var.ref);
for (vector<string>::iterator a = var.alt.begin(); a != var.alt.end(); ++a) {
if (!allATGC(*a)) isDNA = false;
}
// only work with DNA sequences
if (!isDNA) {
continue;
}
var.position -= 1; // convert to 0-based
// Handle the variant
handle_variant(var);
if (variants_processed++ % 1000 == 0 && progress != nullptr) {
// Say we made progress
progress->Progressed(var.position);
}
}
if (variants_processed > 0) {
// There were actually some variants on this path. We only
示例2: 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;
}