Mantid
|
Base Workspace Abstract Class. More...
#include <Workspace.h>
Public Member Functions | |
Workspace_uptr | clone () const |
Returns a clone (copy) of the workspace with covariant return type in all derived classes. More... | |
Workspace_uptr | cloneEmpty () const |
Returns a default-initialized clone of the workspace. More... | |
const std::string & | getComment () const |
Get the workspace comment. More... | |
const WorkspaceHistory & | getHistory () const |
Returns a reference to the WorkspaceHistory const. More... | |
virtual size_t | getMemorySize () const =0 |
Get the footprint in memory in bytes. More... | |
std::string | getMemorySizeAsStr () const |
Returns the memory footprint in sensible units. More... | |
const std::string & | getName () const override |
Get the workspace name. More... | |
virtual const std::string | getTitle () const |
Get the workspace title. More... | |
WorkspaceHistory & | history () |
Returns a reference to the WorkspaceHistory. More... | |
bool | isDirty (const int n=1) const |
Check whether other algorithms have been applied to the workspace by checking the history length. More... | |
virtual bool | isGroup () const |
Workspace & | operator= (const Workspace &other)=delete |
void | setComment (const std::string &) |
Set the comment field of the workspace. More... | |
virtual void | setTitle (const std::string &) |
Set the title of the workspace. More... | |
Parallel::StorageMode | storageMode () const |
Returns the storage mode (used for MPI runs) More... | |
bool | threadSafe () const override |
Marks the workspace as safe for multiple threads to edit data simutaneously. More... | |
Workspace (const Parallel::StorageMode storageMode=Parallel::StorageMode::Cloned) | |
~Workspace () | |
Public Member Functions inherited from Mantid::Kernel::DataItem | |
DataItem () | |
Default constructor. More... | |
DataItem (const DataItem &other) | |
Copy constructor Always makes a unique lock. More... | |
virtual | ~DataItem () |
Destructor. More... | |
virtual const std::string | id () const =0 |
A string ID for the class. More... | |
virtual const std::string | toString () const =0 |
Serializes the object to a string. More... | |
void | readLock () |
Acquires a read lock. More... | |
void | unlock () |
Protected Member Functions | |
void | setStorageMode (Parallel::StorageMode mode) |
Sets the storage mode (used for MPI runs) More... | |
Workspace (const Workspace &) | |
Protected copy constructor. May be used by childs for cloning. More... | |
Protected Member Functions inherited from Mantid::Kernel::DataItem | |
Poco::RWLock * | getLock () const |
Private method to access the RWLock object. More... | |
Private Member Functions | |
virtual Workspace * | doClone () const =0 |
Virtual clone method. Not implemented to force implementation in children. More... | |
virtual Workspace * | doCloneEmpty () const =0 |
Virtual cloneEmpty method. More... | |
void | setName (const std::string &) |
Set the name field of the workspace. More... | |
Private Attributes | |
std::string | m_comment |
A user-provided comment that is attached to the workspace. More... | |
std::unique_ptr< WorkspaceHistory > | m_history |
The history of the workspace, algorithm and environment. More... | |
std::string | m_name |
The name associated with the object within the ADS (This is required for workspace algebra. More... | |
Parallel::StorageMode | m_storageMode |
Storage mode of the Workspace (used for MPI runs) More... | |
std::string | m_title |
The title of the workspace. More... | |
Friends | |
class | AnalysisDataServiceImpl |
Mantid::API::Workspace::Workspace | ( | const Parallel::StorageMode | storageMode = Parallel::StorageMode::Cloned | ) |
Definition at line 14 of file Workspace.cpp.
|
default |
|
protected |
Protected copy constructor. May be used by childs for cloning.
Definition at line 20 of file Workspace.cpp.
|
inline |
Returns a clone (copy) of the workspace with covariant return type in all derived classes.
Note that this public function is not virtual. This has two reasons:
Definition at line 54 of file Workspace.h.
|
inline |
Returns a default-initialized clone of the workspace.
Definition at line 57 of file Workspace.h.
|
privatepure virtual |
Virtual clone method. Not implemented to force implementation in children.
Implemented in Mantid::Algorithms::SparseWorkspace, Mantid::API::ITableWorkspace, Mantid::API::WorkspaceGroup, Mantid::DataObjects::EventWorkspace, Mantid::DataObjects::GroupingWorkspace, Mantid::DataObjects::LeanElasticPeaksWorkspace, Mantid::DataObjects::MaskWorkspace, Mantid::DataObjects::MDEventWorkspace, Mantid::DataObjects::MDHistoWorkspace, Mantid::DataObjects::MementoTableWorkspace, Mantid::DataObjects::OffsetsWorkspace, Mantid::DataObjects::PeaksWorkspace, Mantid::DataObjects::RebinnedOutput, Mantid::DataObjects::SpecialWorkspace2D, Mantid::DataObjects::SplittersWorkspace, Mantid::DataObjects::TableWorkspace, Mantid::DataObjects::Workspace2D, Mantid::DataObjects::WorkspaceSingleValue, FakeWorkspace, AxeslessWorkspaceTester, WorkspaceTester, TableWorkspaceTester, MDHistoWorkspaceTester, Mantid::API::HistoWorkspace, Mantid::API::IEventWorkspace, Mantid::API::IMDEventWorkspace, Mantid::API::IMDHistoWorkspace, Mantid::API::IMDWorkspace, Mantid::API::IPeaksWorkspace, and Mantid::API::MatrixWorkspace.
|
privatepure virtual |
Virtual cloneEmpty method.
Not implemented to force implementation in children.
Implemented in Mantid::API::WorkspaceGroup, Mantid::DataObjects::EventWorkspace, Mantid::DataObjects::GroupingWorkspace, Mantid::DataObjects::LeanElasticPeaksWorkspace, Mantid::DataObjects::MaskWorkspace, Mantid::DataObjects::MDEventWorkspace, Mantid::DataObjects::MDHistoWorkspace, Mantid::DataObjects::MementoTableWorkspace, Mantid::DataObjects::OffsetsWorkspace, Mantid::DataObjects::PeaksWorkspace, Mantid::DataObjects::RebinnedOutput, Mantid::DataObjects::SpecialWorkspace2D, Mantid::DataObjects::SplittersWorkspace, Mantid::DataObjects::TableWorkspace, Mantid::DataObjects::Workspace2D, Mantid::DataObjects::WorkspaceSingleValue, FakeWorkspace, AxeslessWorkspaceTester, WorkspaceTester, TableWorkspaceTester, MDHistoWorkspaceTester, Mantid::API::HistoWorkspace, Mantid::API::IEventWorkspace, Mantid::API::IMDEventWorkspace, Mantid::API::IMDHistoWorkspace, Mantid::API::IMDWorkspace, Mantid::API::ITableWorkspace, and Mantid::API::MatrixWorkspace.
const std::string & Mantid::API::Workspace::getComment | ( | ) | const |
Get the workspace comment.
Definition at line 52 of file Workspace.cpp.
References m_comment.
Referenced by export_Workspace(), and Mantid::API::WorkspaceFactoryImpl::initializeFromParent().
|
inline |
Returns a reference to the WorkspaceHistory const.
Definition at line 84 of file Workspace.h.
Referenced by Mantid::Algorithms::ConjoinWorkspaces::conjoinEvents(), Mantid::Algorithms::ConjoinWorkspaces::conjoinHistograms(), export_Workspace(), and Mantid::API::Algorithm::fillHistory().
|
pure virtual |
Get the footprint in memory in bytes.
Implemented in Mantid::API::MatrixWorkspace, Mantid::API::WorkspaceGroup, Mantid::DataObjects::EventWorkspace, Mantid::DataObjects::LeanElasticPeaksWorkspace, Mantid::DataObjects::MDEventWorkspace, Mantid::DataObjects::MDHistoWorkspace, Mantid::DataObjects::PeaksWorkspace, Mantid::DataObjects::TableWorkspace, FakeWorkspace, TableWorkspaceTester, and MDHistoWorkspaceTester.
Referenced by export_Workspace(), and getMemorySizeAsStr().
std::string Mantid::API::Workspace::getMemorySizeAsStr | ( | ) | const |
Returns the memory footprint in sensible units.
Definition at line 77 of file Workspace.cpp.
References getMemorySize(), and Mantid::Kernel::memToString< uint64_t >().
Referenced by Mantid::API::ITableWorkspace::toString().
|
overridevirtual |
Get the workspace name.
Implements Mantid::Kernel::DataItem.
Reimplemented in MDHistoWorkspaceTester.
Definition at line 58 of file Workspace.cpp.
References m_name.
Referenced by Mantid::DataObjects::FakeMD::addFakeUniformData(), Mantid::API::WorkspaceGroup::areNamesSimilar(), Mantid::Algorithms::SampleLogsBehaviour::checkErrorProperty(), Mantid::Algorithms::SampleLogsBehaviour::checkWarnProperty(), Mantid::DataHandling::LoadMask::convertSpMasksToDetIDs(), Mantid::DataObjects::MaskWorkspace::getNumberMasked(), Mantid::DataObjects::SpecialWorkspace2D::getValue(), Mantid::DataObjects::MaskWorkspace::isMasked(), Mantid::Algorithms::CalculateEfficiency2::mergeGroup(), Mantid::API::ITableWorkspace::modified(), Mantid::API::WorkspaceGroup::removeItem(), Mantid::MDAlgorithms::SliceMD::slice(), Mantid::Algorithms::ConjoinXRuns::validateInputs(), and Mantid::API::WorkspaceGroup::workspaceDeleteHandle().
|
virtual |
Get the workspace title.
Reimplemented in Mantid::API::MatrixWorkspace.
Definition at line 46 of file Workspace.cpp.
References m_title.
Referenced by export_Workspace(), Mantid::API::MatrixWorkspace::getTitle(), and Mantid::API::IMDWorkspace::toString().
|
inline |
Returns a reference to the WorkspaceHistory.
Definition at line 82 of file Workspace.h.
Referenced by Mantid::MDAlgorithms::LoadMD::doLoad().
bool Mantid::API::Workspace::isDirty | ( | const int | n = 1 | ) | const |
Check whether other algorithms have been applied to the workspace by checking the history length.
By default a workspace is called dirty if its history is longer than one. This default can be changed to allow for workspace creation processes that necessitate more than a single algorithm.
n | number of algorithms defining a clean workspace |
Definition at line 71 of file Workspace.cpp.
Referenced by export_Workspace().
|
inlinevirtual |
Reimplemented in Mantid::API::WorkspaceGroup.
Definition at line 75 of file Workspace.h.
Referenced by export_Workspace().
void Mantid::API::Workspace::setComment | ( | const std::string & | c | ) |
Set the comment field of the workspace.
c | :: The comment |
Definition at line 34 of file Workspace.cpp.
References m_comment.
Referenced by export_Workspace(), and Mantid::API::WorkspaceFactoryImpl::initializeFromParent().
|
private |
Set the name field of the workspace.
name | :: The name |
Definition at line 40 of file Workspace.cpp.
References m_name.
|
protected |
Sets the storage mode (used for MPI runs)
Definition at line 85 of file Workspace.cpp.
References m_storageMode, and storageMode().
Referenced by Mantid::API::MatrixWorkspace::initialize(), and Mantid::API::MatrixWorkspace::setIndexInfoWithoutISpectrumUpdate().
|
virtual |
Set the title of the workspace.
t | :: The title |
Reimplemented in Mantid::API::MatrixWorkspace.
Definition at line 28 of file Workspace.cpp.
References m_title.
Referenced by Mantid::MDAlgorithms::LoadMD::doLoad(), export_Workspace(), and Mantid::API::MatrixWorkspace::setTitle().
Parallel::StorageMode Mantid::API::Workspace::storageMode | ( | ) | const |
Returns the storage mode (used for MPI runs)
Definition at line 82 of file Workspace.cpp.
References m_storageMode.
Referenced by Mantid::DataObjects::Workspace2D::doCloneEmpty(), WorkspaceTester::doCloneEmpty(), Mantid::API::MatrixWorkspace::invalidateCachedSpectrumNumbers(), Mantid::API::MatrixWorkspace::setIndexInfo(), and setStorageMode().
|
inlineoverridevirtual |
Marks the workspace as safe for multiple threads to edit data simutaneously.
Workspace creation is always considered to be a single threaded operation.
Implements Mantid::Kernel::DataItem.
Reimplemented in Mantid::DataObjects::EventWorkspace, Mantid::DataObjects::LeanElasticPeaksWorkspace, Mantid::DataObjects::PeaksWorkspace, and MDHistoWorkspaceTester.
Definition at line 67 of file Workspace.h.
Referenced by Mantid::API::MatrixWorkspace::createIterators(), Mantid::DataObjects::MDHistoWorkspace::createIterators(), and Mantid::API::MatrixWorkspace::getIntegratedSpectra().
|
friend |
Definition at line 113 of file Workspace.h.
|
private |
A user-provided comment that is attached to the workspace.
Definition at line 98 of file Workspace.h.
Referenced by getComment(), and setComment().
|
private |
The history of the workspace, algorithm and environment.
Definition at line 103 of file Workspace.h.
Referenced by isDirty().
|
private |
The name associated with the object within the ADS (This is required for workspace algebra.
Definition at line 101 of file Workspace.h.
|
private |
Storage mode of the Workspace (used for MPI runs)
Definition at line 105 of file Workspace.h.
Referenced by setStorageMode(), and storageMode().
|
private |
The title of the workspace.
Definition at line 96 of file Workspace.h.
Referenced by getTitle(), and setTitle().