当前位置: 首页>>代码示例>>C++>>正文


C++ Statistic::compute方法代码示例

本文整理汇总了C++中Statistic::compute方法的典型用法代码示例。如果您正苦于以下问题:C++ Statistic::compute方法的具体用法?C++ Statistic::compute怎么用?C++ Statistic::compute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Statistic的用法示例。


在下文中一共展示了Statistic::compute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: tick

void NoGUI::tick()
{
    if(!isValid()) {
        for(QVariant &variant : m_statistics) {
            Statistic *statistic = variant.value<Statistic*>();
            statistic->compute(m_geometry, m_timestep);
        }

        for(QVariant &variant : m_models) {
            Statistic *statistic = variant.value<Statistic*>();
            statistic->compute(m_geometry, m_timestep);
        }

        for(QVariant &variant : m_datas) {
            Statistic *statistic = variant.value<Statistic*>();
            statistic->compute(m_geometry, m_timestep);
        }
        if(!isValid()) {
            qDebug() << "Error, NoGUI or children not ready...";
            exit(1);
        }
    }
    if(!m_timer.isValid()) m_timer.start();
    if(m_monteCarlo) m_monteCarlo->tick(m_timestep);

    if( m_monteCarlo && (m_timestep % m_printEvery) == 0) {
        double timeLeft = m_timer.elapsed() / ( double(m_timestep+1)) * (m_timesteps-m_timestep) / 1000.; // seconds
        QTextStream logStream(&m_log);
        qDebug() << "MC step " << m_timestep << "/" << m_timesteps << ". χ^2: " << QString::number( m_monteCarlo->chiSquared(), 'f', 10 ) << ", T=" << m_monteCarlo->temperature() << " with acceptance ratio " << m_monteCarlo->acceptanceRatio() << " (" << m_monteCarlo->accepted() << " / " << m_monteCarlo->steps() << ") and random walk fraction " << m_geometry->randomWalkFraction() << ". Estimated time left: " << timeLeft << " seconds.";
        logStream << "MC step " << m_timestep << "/" << m_timesteps << ". χ^2: " << QString::number( m_monteCarlo->chiSquared(), 'f', 10 ) << ", T=" << m_monteCarlo->temperature() << " with acceptance ratio " << m_monteCarlo->acceptanceRatio() << " (" << m_monteCarlo->accepted() << " / " << m_monteCarlo->steps() << ") and random walk fraction " << m_geometry->randomWalkFraction() << ". Estimated time left: " << timeLeft << " seconds.\n";
        if(m_visualize) {
            for(QVariant &variant : m_statistics) {
                Statistic *statistic = variant.value<Statistic*>();
                statistic->compute(m_geometry, m_timestep);
                if(m_visualize) {
                    statistic->updateQML();
                }
            }
        }
    }

    m_timestep++;

    if(m_timestep >= m_timesteps) {
        setFinished(true);
    }
}
开发者ID:andeplane,项目名称:zsm-5-pore-generator,代码行数:47,代码来源:nogui.cpp

示例2: compute

void NoGUI::compute() {
    qDebug() << "Doing compute";
    m_timestep++;
    for(QVariant &variant : m_models) {
        Statistic *statistic = variant.value<Statistic*>();
        statistic->compute(m_geometry, m_timestep);
    }

    for(QVariant &variant : m_datas) {
        Statistic *statistic = variant.value<Statistic*>();
        statistic->compute(m_geometry, m_timestep);
    }

    for(QVariant &variant : m_statistics) {
        Statistic *statistic = variant.value<Statistic*>();
        statistic->compute(m_geometry, m_timestep);
        if(m_visualize) {
            statistic->updateQML();
        }
    }
}
开发者ID:andeplane,项目名称:zsm-5-pore-generator,代码行数:21,代码来源:nogui.cpp


注:本文中的Statistic::compute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。