16 #include "Base/Util/Assert.h"
35 const QString SimulationOptions(
"SimulationOptions");
36 const QString Materials(
"Materials");
37 const QString ParameterContainer(
"ParameterContainer");
38 const QString Sample(
"Sample");
116 if (intensityItem->getDatafield())
117 intensityItem->getDatafield()->setAllTo(0.0);
118 emit intensityItem->emitDataChanged();
184 QDateTime end_time =
endTime();
185 if (begin_time.isValid() && end_time.isValid() && begin_time < end_time)
186 return begin_time.msecsTo(end_time);
265 throw Error(
"JobItem::createFitSuiteItem() -> Error. Attempt to create "
266 "a second FitSuiteItem.");
285 return item->fitParameterContainerItem();
351 writer->writeStartElement(Tags::SimulationOptions);
353 writer->writeEndElement();
357 writer->writeStartElement(Tags::Sample);
359 writer->writeEndElement();
361 writer->writeStartElement(Tags::ParameterContainer);
363 writer->writeEndElement();
376 while (reader->readNextStartElement()) {
377 if (reader->name() == Tags::SimulationOptions) {
380 }
else if (reader->name() == Tags::Instrument) {
384 }
else if (reader->name() == Tags::ParameterContainer) {
387 }
else if (reader->name() == Tags::Sample) {
Defines class Data1DViewItem.
Defines class DeserializationException.
Defines class FitSuiteItem.
Defines class InstrumentItemCatalog.
Defines class InstrumentItem and all its children.
Defines class IntensityDataItem.
Defines namespace GUI::Model::FilenameUtils.
Defines abstract item with a material property.
Defines namespace GUI::Model::JobItemUtils.
QString jobStatusToString(JobStatus status)
get a string representation of the status
JobStatus jobStatusFromString(const QString &name)
get status value for given string representation
JobStatus
The JobStatus enum lists the possible states of a job.
@ Completed
the job was successfully completed
@ Canceled
the job was stopped by the user
@ Running
the job is busy calculating
@ Failed
the job aborted because it hit an error
@ Idle
the job has not been started yet
@ Fitting
the job is busy fitting
Defines class RealDataItem.
Defines class SpecularDataItem.
View model for 1D DataItem. Can represent several items at once. In current implementation the first ...
static constexpr auto M_TYPE
Abstract base class for IntensityDataItem and SpecularDataItem. Owns one simulated data set of type D...
static DeserializationException tooOld()
static DeserializationException tooNew()
The FitParameterContainerItem class is a collection of all defined fit parameters in JobItem.
static constexpr auto M_TYPE
Abstract base class for instrument-specific item classes.
InstrumentItem * createCopy() const
Creates an exact copy; also ID is the same!
Assembles beam, detector and their relative positions with respect to the sample.
static constexpr auto M_TYPE
void jobStatusChanged(const JobStatus status)
void setComments(const QString &comments)
QString getComments() const
void jobCommentsChanged(const QString &comments)
void setEndTime(const QDateTime &end_time)
QString instrumentName() const
void jobEndTimeChanged(const QDateTime &end_time)
static constexpr auto P_END_TIME
static constexpr auto M_TYPE
const SimulationOptionsItem & simulationOptionsItem() const
void setJobName(const QString &name)
static constexpr auto T_REALDATA
void readNonSessionItems(QXmlStreamReader *reader) override
QDateTime endTime() const
ParameterContainerItem m_parameterContainer
void writeNonSessionItems(QXmlStreamWriter *writer) const override
void jobBeginTimeChanged(const QDateTime &begin_time)
QString sampleName() const
Instrument2DItem * instrument2DItem()
static constexpr auto P_BEGIN_TIME
void setStatus(JobStatus status)
static constexpr auto P_INSTRUMENT_NAME
void jobProgressChanged(int progress)
static constexpr auto P_STATUS
void setResults(const SimulationResult &result)
bool runImmediately() const
void setPresentationType(const QString &type)
SimulationOptionsItem m_simulationOptionsItem
void jobNameChanged(const QString &name)
MultiLayerItem * sampleItem()
void setProgress(int progress)
void copySimulationOptionsIntoJob(const SimulationOptionsItem &options)
void addDataViewItem(Data1DViewItem *data_view)
FitParameterContainerItem * fitParameterContainerItem()
void updateIntensityDataFileName()
Updates the name of file to store intensity data.
void jobPresentationTypeChanged(const QString &type)
Data1DViewItem * dataItemView()
void jobIdentifierChanged(const QString &identifier)
static constexpr auto T_DATAVIEW
void setInstrumentName(const QString &name)
static constexpr auto T_OUTPUT
FitSuiteItem * fitSuiteItem()
InstrumentItem * instrumentItem() const
QString presentationType() const
void setIdentifier(const QString &identifier)
RealDataItem * realDataItem()
static constexpr auto T_FIT_SUITE
RealDataItem * copyRealDataIntoJob(const RealDataItem *real_data)
void jobInstrumentNameChanged(const QString &name)
static constexpr auto P_IDENTIFIER
QString getIdentifier() const
FitSuiteItem * createFitSuiteItem()
QDateTime beginTime() const
MultiLayerItem * copySampleIntoJob(const MultiLayerItem *sample)
ParameterContainerItem * parameterContainerItem()
bool isSpecularJob() const
static constexpr auto P_PROGRESS
IntensityDataItem * intensityDataItem()
bool runInBackground() const
MultiLayerItem m_sampleItem
JobStatus getStatus() const
std::unique_ptr< InstrumentItem > m_instrument
RealDataItem * createRealDataItem()
InstrumentItem * copyInstrumentIntoJob(const InstrumentItem *instrument)
static constexpr auto P_PRESENTATION_TYPE
void setBeginTime(const QDateTime &begin_time)
std::optional< size_t > duration() const
if begin and end time are both available the duration in ms, otherwise empty
static constexpr auto P_COMMENTS
static constexpr auto P_WITH_FITTING
Data1DViewItem * createDataViewItem()
QString sampleName() const
void initFrom(const MultiLayerItem *other)
void writeContentTo(QXmlStreamWriter *writer) const
void readContentFrom(QXmlStreamReader *reader)
The ParameterContainerItem is a top item to hold all ParameterItem, represents an entry point to para...
void readContentFrom(QXmlStreamReader *reader)
void writeContentTo(QXmlStreamWriter *writer) const
Provides access to experimental data, for display and fitting. Owns an AbstractDataLoader.
static constexpr auto M_TYPE
Base class for a GUI data item.
bool isTag(const QString &name) const
Returns true if tag is available.
QString itemName() const
Get item name, return display name if no name is set.
void setItemName(const QString &name)
Set item name, add property if necessary.
SessionItem * addProperty(const QString &name, const QVariant &variant)
Add new property item and register new tag. name is the tag name and the display name....
bool registerTag(const QString &name, int min=0, int max=-1, QStringList modelTypes={})
Add new tag to this item with given name, min, max and types. max = -1 -> unlimited,...
void insertChild(int row, SessionItem *item, const QString &tag="")
Insert item into given tag into given row.
QVariant getItemValue(const QString &tag) const
Directly access value of item under given tag.
void setItemValue(const QString &tag, const QVariant &variant) const
Directly set value of item under given tag.
SessionModel * model() const
Returns model of this item.
T * item(const QString &tag) const
void setEditable(bool enabled)
SessionItem * getItem(const QString &tag="", int row=0) const
Returns item in given row of given tag.
T * insertItem(SessionItem *parent=nullptr, int row=-1, QString tag="")
T * copyItem(const T *item_to_copy, SessionItem *new_parent=nullptr, const QString &tag="")
The SimulationOptionsItem class holds simulation status (run policy, number of threads,...
bool runImmediately() const
void writeContentTo(QXmlStreamWriter *writer) const
void readContentFrom(QXmlStreamReader *reader)
bool runInBackground() const
static constexpr auto M_TYPE
Supports serialization to or deserialization from QXmlStream.
void write(const QString &tag, typename Catalog::CatalogedType *p)
void read(const QString &tag, typename Catalog::CatalogedType *&p, Args... argsForConstructor)
QString jobReferenceFileName(const QString &itemName)
Constructs the name of the file with reference data.
QString jobResultsFileName(const QString &itemName)
Constructs the name of the file with simulated intensities.
QString jobNativeDataFileName(const QString &id)
void setResults(DataItem *intensityItem, const SimulationResult &result)
Sets simulation results into the DataItem.
QString const & name(EShape k)
constexpr auto Version("Version")
void writeAttribute(QXmlStreamWriter *writer, const QString &attributeName, const QVariant &variant)
Write the variant's value as an attribute.
void gotoEndElementOfTag(QXmlStreamReader *reader, const QString &tag)
QString toString(const QModelIndex &index)
Provides string representation of index data.