BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
SimulationOptionsItem Class Reference

Description

The SimulationOptionsItem class holds simulation status (run policy, number of threads, integration flag). Used in SimulationView to define job settings. When job is started, item is copied to the job.

Definition at line 25 of file SimulationOptionsItem.h.

Public Member Functions

 SimulationOptionsItem ()
 
bool includeSpecularPeak () const
 
unsigned numberOfMonteCarloPoints () const
 
unsigned numberOfThreads () const
 
void readContentFrom (QXmlStreamReader *reader)
 
bool runImmediately () const
 
bool runInBackground () const
 
void setIncludeSpecularPeak (bool includeSpecularPeak)
 
void setNumberOfThreads (unsigned n)
 
void setRunImmediately (bool runImmediately)
 
void setUseAnalytical ()
 
void setUseAverageMaterials (bool useAverageMaterials)
 
void setUseMonteCarloIntegration (unsigned numberOfPoints)
 
bool useAnalytical () const
 
bool useAverageMaterials () const
 
bool useMonteCarloIntegration () const
 
void writeContentTo (QXmlStreamWriter *writer) const
 

Private Attributes

bool m_computationMethodAnalytical
 
bool m_includeSpecularPeak
 
unsigned m_numberOfMonteCarloPoints
 
unsigned m_numberOfThreads
 
bool m_runImmediately
 
bool m_useAverageMaterials
 

Constructor & Destructor Documentation

◆ SimulationOptionsItem()

SimulationOptionsItem::SimulationOptionsItem ( )
explicit

Member Function Documentation

◆ includeSpecularPeak()

bool SimulationOptionsItem::includeSpecularPeak ( ) const

Definition at line 113 of file SimulationOptionsItem.cpp.

114 {
115  return m_includeSpecularPeak;
116 }

References m_includeSpecularPeak.

Referenced by setIncludeSpecularPeak().

◆ numberOfMonteCarloPoints()

unsigned SimulationOptionsItem::numberOfMonteCarloPoints ( ) const

Definition at line 93 of file SimulationOptionsItem.cpp.

94 {
96 }

References m_numberOfMonteCarloPoints.

◆ numberOfThreads()

unsigned SimulationOptionsItem::numberOfThreads ( ) const

Definition at line 47 of file SimulationOptionsItem.cpp.

48 {
49  return m_numberOfThreads;
50 }

References m_numberOfThreads.

◆ readContentFrom()

void SimulationOptionsItem::readContentFrom ( QXmlStreamReader *  reader)

Definition at line 130 of file SimulationOptionsItem.cpp.

131 {
132  const int version = reader->attributes().value(GUI::Session::XML::Version).toInt();
133 
134  if (version < 1)
136 
137  if (version > 1)
139 
140  m_runImmediately = GUI::Session::XML::readBoolAttribute(reader, Tags::RunImmediately);
141  m_numberOfThreads = GUI::Session::XML::readUIntAttribute(reader, Tags::NumberOfThreads);
144  GUI::Session::XML::readUIntAttribute(reader, Tags::NumberOfMonteCarloPoints);
145  m_useAverageMaterials = GUI::Session::XML::readBoolAttribute(reader, Tags::UseAverageMaterials);
146  m_includeSpecularPeak = GUI::Session::XML::readBoolAttribute(reader, Tags::IncludeSpecularPeak);
147 }
static DeserializationException tooOld()
static DeserializationException tooNew()
bool readBoolAttribute(QXmlStreamReader *reader, const QString &attributeName)
Definition: UtilXML.cpp:149
constexpr auto Version("Version")
unsigned readUIntAttribute(QXmlStreamReader *reader, const QString &attributeName)
Definition: UtilXML.cpp:154

References m_computationMethodAnalytical, m_includeSpecularPeak, m_numberOfMonteCarloPoints, m_numberOfThreads, m_runImmediately, m_useAverageMaterials, GUI::Session::XML::readBoolAttribute(), GUI::Session::XML::readUIntAttribute(), DeserializationException::tooNew(), DeserializationException::tooOld(), and GUI::Session::XML::Version().

Referenced by JobItem::readNonSessionItems(), and ProjectDocument::readProject().

Here is the call graph for this function:

◆ runImmediately()

bool SimulationOptionsItem::runImmediately ( ) const

◆ runInBackground()

bool SimulationOptionsItem::runInBackground ( ) const

Definition at line 62 of file SimulationOptionsItem.cpp.

63 {
64  return !runImmediately();
65 }

References runImmediately().

Referenced by JobItem::runInBackground().

Here is the call graph for this function:

◆ setIncludeSpecularPeak()

void SimulationOptionsItem::setIncludeSpecularPeak ( bool  includeSpecularPeak)

Definition at line 108 of file SimulationOptionsItem.cpp.

References includeSpecularPeak(), and m_includeSpecularPeak.

Referenced by SimulationView::readOptionsFromUI().

Here is the call graph for this function:

◆ setNumberOfThreads()

void SimulationOptionsItem::setNumberOfThreads ( unsigned  n)

Definition at line 52 of file SimulationOptionsItem.cpp.

53 {
54  m_numberOfThreads = number;
55 }

References m_numberOfThreads.

Referenced by SimulationView::readOptionsFromUI().

◆ setRunImmediately()

void SimulationOptionsItem::setRunImmediately ( bool  runImmediately)

Definition at line 67 of file SimulationOptionsItem.cpp.

68 {
70 }

References m_runImmediately, and runImmediately().

Referenced by SimulationView::readOptionsFromUI().

Here is the call graph for this function:

◆ setUseAnalytical()

void SimulationOptionsItem::setUseAnalytical ( )

Definition at line 78 of file SimulationOptionsItem.cpp.

79 {
81 }

References m_computationMethodAnalytical.

Referenced by SimulationView::readOptionsFromUI().

◆ setUseAverageMaterials()

void SimulationOptionsItem::setUseAverageMaterials ( bool  useAverageMaterials)

Definition at line 98 of file SimulationOptionsItem.cpp.

References m_useAverageMaterials, and useAverageMaterials().

Referenced by SimulationView::readOptionsFromUI().

Here is the call graph for this function:

◆ setUseMonteCarloIntegration()

void SimulationOptionsItem::setUseMonteCarloIntegration ( unsigned  numberOfPoints)

◆ useAnalytical()

bool SimulationOptionsItem::useAnalytical ( ) const

◆ useAverageMaterials()

bool SimulationOptionsItem::useAverageMaterials ( ) const

Definition at line 103 of file SimulationOptionsItem.cpp.

104 {
105  return m_useAverageMaterials;
106 }

References m_useAverageMaterials.

Referenced by setUseAverageMaterials(), and SimulationView::writeOptionsToUI().

◆ useMonteCarloIntegration()

bool SimulationOptionsItem::useMonteCarloIntegration ( ) const

Definition at line 83 of file SimulationOptionsItem.cpp.

84 {
85  return !useAnalytical();
86 }

References useAnalytical().

Here is the call graph for this function:

◆ writeContentTo()

void SimulationOptionsItem::writeContentTo ( QXmlStreamWriter *  writer) const

Definition at line 118 of file SimulationOptionsItem.cpp.

119 {
121  GUI::Session::XML::writeAttribute(writer, Tags::RunImmediately, m_runImmediately);
122  GUI::Session::XML::writeAttribute(writer, Tags::NumberOfThreads, m_numberOfThreads);
124  GUI::Session::XML::writeAttribute(writer, Tags::NumberOfMonteCarloPoints,
126  GUI::Session::XML::writeAttribute(writer, Tags::UseAverageMaterials, m_useAverageMaterials);
127  GUI::Session::XML::writeAttribute(writer, Tags::IncludeSpecularPeak, m_includeSpecularPeak);
128 }
void writeAttribute(QXmlStreamWriter *writer, const QString &attributeName, const QVariant &variant)
Write the variant's value as an attribute.
Definition: UtilXML.cpp:65

References m_computationMethodAnalytical, m_includeSpecularPeak, m_numberOfMonteCarloPoints, m_numberOfThreads, m_runImmediately, m_useAverageMaterials, GUI::Session::XML::Version(), and GUI::Session::XML::writeAttribute().

Referenced by JobItem::writeNonSessionItems(), and ProjectDocument::writeTo().

Here is the call graph for this function:

Member Data Documentation

◆ m_computationMethodAnalytical

bool SimulationOptionsItem::m_computationMethodAnalytical
private

◆ m_includeSpecularPeak

bool SimulationOptionsItem::m_includeSpecularPeak
private

◆ m_numberOfMonteCarloPoints

unsigned SimulationOptionsItem::m_numberOfMonteCarloPoints
private

◆ m_numberOfThreads

unsigned SimulationOptionsItem::m_numberOfThreads
private

◆ m_runImmediately

bool SimulationOptionsItem::m_runImmediately
private

◆ m_useAverageMaterials

bool SimulationOptionsItem::m_useAverageMaterials
private

The documentation for this class was generated from the following files: