Do not recreate the simulator every time simulation is run

This commit is contained in:
Maciej Suminski 2016-08-11 14:42:17 +02:00
parent eeeb3e0a9a
commit 8227cd6d80
1 changed files with 7 additions and 6 deletions

View File

@ -145,6 +145,7 @@ SIM_PLOT_FRAME::SIM_PLOT_FRAME( KIWAY* aKiway, wxWindow* aParent )
m_toolBar->Realize();
m_plotNotebook->SetPageText( 0, _( "Welcome!" ) );
m_simulator.reset( SPICE_SIMULATOR::CreateInstance( "ngspice" ) );
}
@ -158,6 +159,12 @@ void SIM_PLOT_FRAME::StartSimulation()
STRING_FORMATTER formatter;
SIM_PLOT_PANEL* plotPanel = CurrentPlot();
if( !m_simulator )
{
DisplayError( this, wxT( "Could not create simulator instance" ) );
return;
}
m_simConsole->Clear();
updateNetlistExporter();
@ -176,12 +183,6 @@ void SIM_PLOT_FRAME::StartSimulation()
return;
}
/// @todo is it necessary to recreate simulator every time?
m_simulator.reset( SPICE_SIMULATOR::CreateInstance( "ngspice" ) );
if( !m_simulator )
return;
m_simulator->SetReporter( new SIM_THREAD_REPORTER( this ) );
m_simulator->Init();
m_simulator->LoadNetlist( formatter.GetString() );