BornAgain
1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Widget to define a simulation. Contains:
Definition at line 38 of file SimulationView.h.
Public Member Functions | |
SimulationView (QWidget *parent, ProjectDocument *document) | |
void | exportPythonScript () |
void | simulate () |
Protected Member Functions | |
void | hideEvent (QHideEvent *) override |
void | showEvent (QShowEvent *) override |
Private Member Functions | |
QVector< InstrumentItem * > | collectedItems () const |
SimulationOptionsItem * | optionsItem () const |
void | readOptionsFromUI () |
Read the entries in the UI and store in OptionsItem. More... | |
QVector< RealDataItem * > | realDataItems () const |
QVector< MultiLayerItem * > | sampleItems () const |
const InstrumentItem * | selectedInstrument () const |
Returns selected InstrumentItem taking into account that there might be several instruments with the same name. More... | |
const RealDataItem * | selectedRealData () const |
Returns selected real data item taking into account that there might be several items with the same name. More... | |
const MultiLayerItem * | selectedSample () const |
Returns selected sample (MultiLayerItem) taking into account that there might be several samples with the same name. More... | |
void | updateEnabling () |
Update enabling of elements depending on other elements. More... | |
void | updateFunctionalityNarrowing () |
Show/hide UI elements according to settings in current project. More... | |
void | updateSelection (QComboBox *comboBox, QStringList itemList, bool allowNone=false) |
Updates selection combo with string list while preserving previous selection. If allowNone == true, additional "None" item will be added to the combo. More... | |
QString | validateSimulationSetup (bool validateRealData) const |
Checks whether selection is correct for running a simulation. Returns empty string if valid, otherwise the error text. More... | |
void | writeOptionsToUI () |
Write entries in OptionsItem to UI. More... | |
Private Attributes | |
ProjectDocument * | m_document |
Ui::SimulationView * | m_ui |
SimulationView::SimulationView | ( | QWidget * | parent, |
ProjectDocument * | document | ||
) |
Definition at line 34 of file SimulationView.cpp.
References exportPythonScript(), GroupBoxCollapser::installIntoGroupBox(), m_document, m_ui, ProjectDocument::modified(), simulate(), updateEnabling(), and updateFunctionalityNarrowing().
|
private |
Definition at line 238 of file SimulationView.cpp.
References InstrumentCollection::collectedItems(), ProjectDocument::collectedItems(), and m_document.
Referenced by selectedInstrument().
void SimulationView::exportPythonScript | ( | ) |
Definition at line 152 of file SimulationView.cpp.
References ProjectManager::instance(), GUI::Global::mainWindow, optionsItem(), GUI::Project::Utils::projectDir(), readOptionsFromUI(), selectedInstrument(), selectedSample(), validateSimulationSetup(), and GUI::View::Helpers::warning().
Referenced by SimulationView().
|
overrideprotected |
Definition at line 131 of file SimulationView.cpp.
References readOptionsFromUI().
|
private |
Definition at line 248 of file SimulationView.cpp.
References m_document, and ProjectDocument::simulationOptionsItem().
Referenced by exportPythonScript(), readOptionsFromUI(), simulate(), and writeOptionsToUI().
|
private |
Read the entries in the UI and store in OptionsItem.
Definition at line 167 of file SimulationView.cpp.
References m_ui, optionsItem(), SimulationOptionsItem::setIncludeSpecularPeak(), SimulationOptionsItem::setNumberOfThreads(), SimulationOptionsItem::setRunImmediately(), SimulationOptionsItem::setUseAnalytical(), SimulationOptionsItem::setUseAverageMaterials(), and SimulationOptionsItem::setUseMonteCarloIntegration().
Referenced by exportPythonScript(), hideEvent(), and simulate().
|
private |
Definition at line 243 of file SimulationView.cpp.
References m_document, RealDataModel::realDataItems(), and ProjectDocument::realDataModel().
Referenced by selectedRealData().
|
private |
Definition at line 233 of file SimulationView.cpp.
References m_document, ProjectDocument::sampleItems(), and MultiLayerItems::sampleItems().
Referenced by selectedSample().
|
private |
Returns selected InstrumentItem taking into account that there might be several instruments with the same name.
Definition at line 258 of file SimulationView.cpp.
References collectedItems(), and m_ui.
Referenced by exportPythonScript(), simulate(), and validateSimulationSetup().
|
private |
Returns selected real data item taking into account that there might be several items with the same name.
Definition at line 263 of file SimulationView.cpp.
References m_ui, and realDataItems().
Referenced by simulate(), and validateSimulationSetup().
|
private |
Returns selected sample (MultiLayerItem) taking into account that there might be several samples with the same name.
Definition at line 253 of file SimulationView.cpp.
References m_ui, and sampleItems().
Referenced by exportPythonScript(), simulate(), and validateSimulationSetup().
|
overrideprotected |
Definition at line 94 of file SimulationView.cpp.
References writeOptionsToUI().
void SimulationView::simulate | ( | ) |
Definition at line 138 of file SimulationView.cpp.
References JobModel::addJob(), ProjectDocument::jobModel(), m_document, optionsItem(), readOptionsFromUI(), JobModel::runJob(), selectedInstrument(), selectedRealData(), selectedSample(), validateSimulationSetup(), and GUI::View::Helpers::warning().
Referenced by SimulationView(), and MainWindow::onRunSimulationShortcut().
|
private |
Update enabling of elements depending on other elements.
Definition at line 179 of file SimulationView.cpp.
References m_ui.
Referenced by SimulationView(), and writeOptionsToUI().
|
private |
Show/hide UI elements according to settings in current project.
Definition at line 227 of file SimulationView.cpp.
References m_document, m_ui, and ProjectDocument::singleInstrumentMode().
Referenced by SimulationView().
|
private |
Updates selection combo with string list while preserving previous selection. If allowNone == true, additional "None" item will be added to the combo.
Definition at line 184 of file SimulationView.cpp.
Referenced by writeOptionsToUI().
|
private |
Checks whether selection is correct for running a simulation. Returns empty string if valid, otherwise the error text.
Definition at line 203 of file SimulationView.cpp.
References InstrumentItem::alignedWith(), SampleValidator::getValidationMessage(), SampleValidator::isValidMultiLayer(), selectedInstrument(), selectedRealData(), and selectedSample().
Referenced by exportPythonScript(), and simulate().
|
private |
Write entries in OptionsItem to UI.
Definition at line 99 of file SimulationView.cpp.
References ProjectDocument::collectedItems(), InstrumentCollection::instrumentNames(), m_document, m_ui, optionsItem(), ProjectDocument::realDataModel(), RealDataModel::realDataNames(), SimulationOptionsItem::runImmediately(), ProjectDocument::sampleItems(), MultiLayerItems::sampleNames(), updateEnabling(), updateSelection(), SimulationOptionsItem::useAnalytical(), and SimulationOptionsItem::useAverageMaterials().
Referenced by showEvent().
|
private |
Definition at line 92 of file SimulationView.h.
Referenced by SimulationView(), collectedItems(), optionsItem(), realDataItems(), sampleItems(), simulate(), updateFunctionalityNarrowing(), and writeOptionsToUI().
|
private |
Definition at line 91 of file SimulationView.h.
Referenced by SimulationView(), readOptionsFromUI(), selectedInstrument(), selectedRealData(), selectedSample(), updateEnabling(), updateFunctionalityNarrowing(), and writeOptionsToUI().