Пример #1
0
void wxStfChildFrame::ShowTable(const stf::Table &table,const wxString& caption) {

    // Create and show notebook if necessary:
    if (m_notebook==NULL && !m_mgr.GetPane(m_notebook).IsOk()) {
        m_notebook=CreateNotebook();
        m_mgr.AddPane( m_notebook, wxAuiPaneInfo().Caption(wxT("Analysis results")).
                       Floatable().Dock().Left().Name( wxT("Notebook") ) );
    } else {
        // Re-open notebook if it has been closed:
        if (!m_mgr.GetPane(m_notebook).IsShown()) {
            m_mgr.GetPane(m_notebook).Show();
        }
    }
    wxStfGrid* pGrid = new wxStfGrid( m_notebook, wxID_ANY, wxPoint(0,20), wxDefaultSize );
    wxStfTable* pTable(new wxStfTable(table));
    pGrid->SetTable(pTable,true); // the grid will take care of the deletion
    pGrid->SetEditable(false);
    pGrid->SetDefaultCellAlignment(wxALIGN_RIGHT,wxALIGN_CENTRE);
    for (std::size_t n_row=0; n_row<=table.nRows()+1; ++n_row) {
        pGrid->SetCellAlignment(wxALIGN_LEFT,(int)n_row,0);
    }
    m_notebook->AddPage( pGrid, caption, true );

    // "commit" all changes made to wxAuiManager
    m_mgr.Update();
    wxStfView* pView=(wxStfView*)GetView();
    if (pView != NULL && pView->GetGraph()!= NULL) { 
        pView->GetGraph()->Enable();
        pView->GetGraph()->SetFocus();
    }
}
Пример #2
0
	void Application::createLevelTable( ddd::LevelWindow* window,
						const unsigned long levelID,
						const unsigned long gameID)
	{
		sBufferBaseWindow = window;
		
		TScript * pScript( TWindowManager::GetInstance()->GetScript() );
		TLuaTable * pTable( TLuaTable::Create( pScript->GetState() ) );
		pTable->Assign( "levelID", static_cast<lua_Number>(levelID) );
		pTable->Assign( "gameID", static_cast<lua_Number>(gameID) );
		executeLuaFunction( 1, pTable );
	}
Пример #3
0
Real
funcSum_all_accel(boost::function<Real(unsigned int i)> f,
                  std::size_t max_i, Real tolerance)
{
    const Real p_0(f(0));
    if (p_0 == 0.0)
    {
        return 0.0;
    }

    std::vector<Real> pTable(max_i);
    pTable[0] = p_0;
    for(std::size_t i=1; i < max_i; ++i)
    {
        pTable[i] = f(i);
    }

    Real sum;
    Real error;
    gsl_sum_levin_utrunc_workspace* workspace(gsl_sum_levin_utrunc_alloc(max_i));
    gsl_sum_levin_utrunc_accel(
            pTable.data(), pTable.size(), workspace, &sum, &error);

#ifdef ECELL_GREENS_FUNCTIONS_DEBUG_OUTPUT
    if (std::abs(error) >= std::abs(sum * tolerance))
    {
        std::cerr << (boost::format("series acceleration error: %.16g"
                " (rel error: %.16g), terms_used = %d (%d given)") %
                std::abs(error) % std::abs(error / sum) %
                workspace->terms_used % pTable.size()
            ).str() << std::endl;
    }
#endif // ECELL_GREENS_FUNCTIONS_DEBUG_OUTPUT

    gsl_sum_levin_utrunc_free(workspace);

    return sum;
}