Commit 8072b97d authored by Karl Palmen's avatar Karl Palmen
Browse files

Merge remote-tracking branch 'origin/master' re #12828



# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.

Merge done to enable documentation be be fixed, because of removal of
alias directive and addition of related algorithms directive.
Signed-off-by: default avatarKarl Palmen <karl.palmen@stfc.ac.uk>
parent 4a81a3c4
......@@ -183,6 +183,9 @@ public:
/// Function to return the separator token for the category string. A default
/// implementation ';' is provided
const std::string categorySeparator() const override { return ";"; }
/// Function to return all of the seeAlso (these are not validated) algorithms
/// related to this algorithm.A default implementation is provided.
const std::vector<std::string> seeAlso() const override { return {}; };
/// function to return any aliases to the algorithm; A default implementation
/// is provided
const std::string alias() const override { return ""; }
......
......@@ -79,11 +79,13 @@ public:
const std::string category() const override { return m_category; }
/// Function to return all of the categories that contain this algorithm
const std::vector<std::string> categories() const override;
/// Function to return the sperator token for the category string. A default
/// Function to return the seperator token for the category string. A default
/// implementation ',' is provided
const std::string categorySeparator() const override {
return m_categorySeparator;
}
/// Function to return all of the seeAlso algorithms related to this algorithm
const std::vector<std::string> seeAlso() const override { return m_seeAlso; };
/// Aliases to the algorithm
const std::string alias() const override { return m_alias; }
/// Optional documentation URL for the real algorithm
......@@ -183,9 +185,10 @@ private:
const std::string m_name; ///< name of the real algorithm
const std::string m_category; ///< category of the real algorithm
const std::string
m_categorySeparator; ///< category seperator of the real algorithm
const std::string m_alias; ///< alias to the algorithm
const std::string m_helpURL; ///< Optional documentation URL
m_categorySeparator; ///< category seperator of the real algorithm
const std::vector<std::string> m_seeAlso; ///< seeAlso of the real algorithm
const std::string m_alias; ///< alias to the algorithm
const std::string m_helpURL; ///< Optional documentation URL
const std::string m_summary; ///<Message to display in GUI and help.
const int m_version; ///< version of the real algorithm
......
......@@ -53,8 +53,8 @@ public:
const FunctionDomain &getDomain(size_t i) const override;
protected:
mutable IMDIterator *m_iterator; ///< IMDIterator
size_t m_totalSize; ///< The total size of the domain
mutable std::unique_ptr<IMDIterator> m_iterator; ///< IMDIterator
size_t m_totalSize; ///< The total size of the domain
mutable std::vector<FunctionDomainMD *>
m_domains; ///< smaller parts of the domain
};
......
......@@ -53,7 +53,7 @@ public:
protected:
/// IMDIterator
mutable IMDIterator *m_iterator;
mutable std::unique_ptr<IMDIterator> m_iterator;
/// start of the domain, 0 <= m_startIndex < m_iterator->getDataSize()
const size_t m_startIndex;
/// track the iterator's index, 0 <= m_currentIndex < m_size.
......
......@@ -56,7 +56,7 @@ public:
/// Bring in the PropertyWithValue assignment operator explicitly (avoids
/// VSC++ warning)
boost::shared_ptr<IFunction> &
FunctionProperty &
operator=(const boost::shared_ptr<IFunction> &value) override;
/// Add the value of another property
......
......@@ -77,6 +77,9 @@ public:
/// Function to return the separator token for the category string
virtual const std::string categorySeparator() const = 0;
/// Function to return all of the seeAlso algorithms related to this algorithm
virtual const std::vector<std::string> seeAlso() const = 0;
/// function to return any aliases of the algorithm.
virtual const std::string alias() const = 0;
......
......@@ -5,7 +5,6 @@
// Includes
//----------------------------------------------------------------------
#include "MantidAPI/DllConfig.h"
#include "MantidAPI/IMDWorkspace.h"
#include "MantidGeometry/MDGeometry/IMDDimension.h"
#include "MantidGeometry/MDGeometry/MDTypes.h"
#include "MantidKernel/VMD.h"
......@@ -14,10 +13,18 @@
namespace Mantid {
namespace API {
//----------------------------------------------------------------------
// Forward declaration
//----------------------------------------------------------------------
class IMDWorkspace;
/** Enum describing different ways to normalize the signal
* in a MDWorkspace.
*/
enum MDNormalization {
/// Don't normalize = return raw counts
NoNormalization = 0,
/// Divide the signal by the volume of the box/bin
VolumeNormalization = 1,
/// Divide the signal by the number of events that contributed to it.
NumEventsNormalization = 2
};
/** This is an interface to an iterator of an IMDWorkspace
......@@ -83,13 +90,14 @@ public:
virtual signal_t getError() const = 0;
/// Return a list of vertexes defining the volume pointed to
virtual coord_t *getVertexesArray(size_t &numVertices) const = 0;
virtual std::unique_ptr<coord_t[]>
getVertexesArray(size_t &numVertices) const = 0;
/// Return a list of vertexes defining the volume pointed to, enable masking
/// of dimensions.
virtual coord_t *getVertexesArray(size_t &numVertices,
const size_t outDimensions,
const bool *maskDim) const = 0;
virtual std::unique_ptr<coord_t[]>
getVertexesArray(size_t &numVertices, const size_t outDimensions,
const bool *maskDim) const = 0;
/// Returns the position of the center of the box pointed to.
virtual Mantid::Kernel::VMD getCenter() const = 0;
......
......@@ -3,6 +3,7 @@
#include <algorithm>
#include <string>
#include <memory>
#include <vector>
#include "MantidKernel/VMD.h"
#include "MantidGeometry/MDGeometry/MDTypes.h"
......@@ -277,10 +278,11 @@ public:
// -------------------------------- Geometry/vertexes-Related
// -------------------------------------------
virtual std::vector<Mantid::Kernel::VMD> getVertexes() const = 0;
virtual coord_t *getVertexesArray(size_t &numVertices) const = 0;
virtual coord_t *getVertexesArray(size_t &numVertices,
const size_t outDimensions,
const bool *maskDim) const = 0;
virtual std::unique_ptr<coord_t[]>
getVertexesArray(size_t &numVertices) const = 0;
virtual std::unique_ptr<coord_t[]>
getVertexesArray(size_t &numVertices, const size_t outDimensions,
const bool *maskDim) const = 0;
virtual void transformDimensions(std::vector<double> &scaling,
std::vector<double> &offset) = 0;
......
#ifndef MANTID_API_IMDWORKSPACE_H_
#define MANTID_API_IMDWORKSPACE_H_
#include "MantidAPI/IMDIterator.h"
#include "MantidAPI/ITableWorkspace_fwd.h"
#include "MantidAPI/MDGeometry.h"
#include "MantidAPI/Workspace.h"
......@@ -16,20 +17,6 @@ class MDImplicitFunction;
namespace API {
class IMDIterator;
/** Enum describing different ways to normalize the signal
* in a MDWorkspace.
*/
enum MDNormalization {
/// Don't normalize = return raw counts
NoNormalization = 0,
/// Divide the signal by the volume of the box/bin
VolumeNormalization = 1,
/// Divide the signal by the number of events that contributed to it.
NumEventsNormalization = 2
};
static const signal_t MDMaskValue = std::numeric_limits<double>::quiet_NaN();
/** Basic MD Workspace Abstract Class.
......@@ -106,7 +93,7 @@ public:
virtual uint64_t getNEvents() const = 0;
/// Creates a new iterator pointing to the first cell in the workspace
virtual std::vector<IMDIterator *> createIterators(
virtual std::vector<std::unique_ptr<IMDIterator>> createIterators(
size_t suggestedNumCores = 1,
Mantid::Geometry::MDImplicitFunction *function = nullptr) const = 0;
......@@ -126,7 +113,7 @@ public:
const Mantid::Kernel::VMD &end,
Mantid::API::MDNormalization normalize) const;
IMDIterator *createIterator(
std::unique_ptr<IMDIterator> createIterator(
Mantid::Geometry::MDImplicitFunction *function = nullptr) const;
std::string getConvention() const;
......
......@@ -57,7 +57,7 @@ public:
bool isDefault() const override;
std::string isValid() const override;
std::string operator=(const std::string &rhs);
IndexProperty &operator=(const std::string &rhs);
operator Indexing::SpectrumIndexSet() const;
Indexing::SpectrumIndexSet getIndices() const;
Indexing::IndexInfo getFilteredIndexInfo() const;
......
......@@ -52,7 +52,7 @@ public:
using PropertyWithValue<std::string>::operator=;
std::string &operator=(API::IndexType type);
IndexTypeProperty &operator=(API::IndexType type);
static std::string generatePropertyName(const std::string &name = "");
......@@ -63,4 +63,4 @@ private:
} // namespace API
} // namespace Mantid
#endif /* MANTID_API_INDEXTYPEPROPERTY_H_ */
\ No newline at end of file
#endif /* MANTID_API_INDEXTYPEPROPERTY_H_ */
......@@ -499,7 +499,7 @@ public:
const Mantid::API::MDNormalization &normalization) const override;
/// Create iterators. Partitions the iterators according to the number of
/// cores.
std::vector<IMDIterator *> createIterators(
std::vector<std::unique_ptr<IMDIterator>> createIterators(
size_t suggestedNumCores = 1,
Mantid::Geometry::MDImplicitFunction *function = nullptr) const override;
......
......@@ -60,10 +60,12 @@ public:
signal_t getError() const override;
coord_t *getVertexesArray(size_t &numVertices) const override;
std::unique_ptr<coord_t[]>
getVertexesArray(size_t &numVertices) const override;
coord_t *getVertexesArray(size_t &numVertices, const size_t outDimensions,
const bool *maskDim) const override;
std::unique_ptr<coord_t[]>
getVertexesArray(size_t &numVertices, const size_t outDimensions,
const bool *maskDim) const override;
Mantid::Kernel::VMD getCenter() const override;
......
......@@ -95,8 +95,7 @@ public:
WorkspaceProperty &operator=(const WorkspaceProperty &right);
boost::shared_ptr<TYPE> &
operator=(const boost::shared_ptr<TYPE> &value) override;
WorkspaceProperty &operator=(const boost::shared_ptr<TYPE> &value) override;
WorkspaceProperty &operator+=(Kernel::Property const *) override;
......
......@@ -107,13 +107,14 @@ operator=(const WorkspaceProperty &right) {
* @return assigned PropertyWithValue
*/
template <typename TYPE>
boost::shared_ptr<TYPE> &WorkspaceProperty<TYPE>::
WorkspaceProperty<TYPE> &WorkspaceProperty<TYPE>::
operator=(const boost::shared_ptr<TYPE> &value) {
std::string wsName = value->getName();
if (this->direction() == Kernel::Direction::Input && !wsName.empty()) {
m_workspaceName = wsName;
}
return Kernel::PropertyWithValue<boost::shared_ptr<TYPE>>::operator=(value);
Kernel::PropertyWithValue<boost::shared_ptr<TYPE>>::operator=(value);
return *this;
}
//--------------------------------------------------------------------------------------
......
......@@ -19,9 +19,10 @@ AlgorithmProxy::AlgorithmProxy(Algorithm_sptr alg)
m_executeAsync(new Poco::ActiveMethod<bool, Poco::Void, AlgorithmProxy>(
this, &AlgorithmProxy::executeAsyncImpl)),
m_name(alg->name()), m_category(alg->category()),
m_categorySeparator(alg->categorySeparator()), m_alias(alg->alias()),
m_summary(alg->summary()), m_version(alg->version()), m_alg(alg),
m_isExecuted(), m_isLoggingEnabled(true), m_loggingOffset(0),
m_categorySeparator(alg->categorySeparator()), m_seeAlso(alg->seeAlso()),
m_alias(alg->alias()), m_summary(alg->summary()),
m_version(alg->version()), m_alg(alg), m_isExecuted(),
m_isLoggingEnabled(true), m_loggingOffset(0),
m_isAlgStartupLoggingEnabled(true), m_rethrow(false), m_isChild(false),
m_setAlwaysStoreInADS(true) {
if (!alg) {
......
......@@ -25,10 +25,10 @@ std::string
EqualBinSizesValidator::checkValidity(const MatrixWorkspace_sptr &value) const {
if (!value)
return "Enter an existing workspace";
if (value->getNumberHistograms() == 0 || value->blocksize() == 0)
return "Enter a workspace with some data in it";
if (!value->isCommonBins())
return "The workspace must have common bin boundaries for all histograms";
if (value->getNumberHistograms() == 0 || value->blocksize() == 0)
return "Enter a workspace with some data in it";
Kernel::EqualBinsChecker checker(value->readX(0), m_errorLevel,
m_warningLevel);
......
......@@ -34,7 +34,7 @@ FunctionDomainMD::FunctionDomainMD(IMDWorkspace_const_sptr ws, size_t start,
/** Destructor.
*/
FunctionDomainMD::~FunctionDomainMD() { delete m_iterator; }
FunctionDomainMD::~FunctionDomainMD() = default;
/// Reset the iterator to point to the start of the domain.
void FunctionDomainMD::reset() const {
......@@ -53,14 +53,14 @@ void FunctionDomainMD::reset() const {
const IMDIterator *FunctionDomainMD::getNextIterator() const {
if (m_justReset) {
m_justReset = false;
return m_iterator;
return m_iterator.get();
}
++m_currentIndex;
if (!m_iterator->next() || m_currentIndex >= m_size) {
m_currentIndex = m_size;
return nullptr;
}
return m_iterator;
return m_iterator.get();
}
/// Returns the pointer to the original workspace
......
......@@ -31,10 +31,10 @@ FunctionProperty &FunctionProperty::operator=(const FunctionProperty &right) {
* @param value :: The value to set to
* @return assigned PropertyWithValue
*/
boost::shared_ptr<IFunction> &FunctionProperty::
FunctionProperty &FunctionProperty::
operator=(const boost::shared_ptr<IFunction> &value) {
return Kernel::PropertyWithValue<boost::shared_ptr<IFunction>>::operator=(
value);
Kernel::PropertyWithValue<boost::shared_ptr<IFunction>>::operator=(value);
return *this;
}
//--------------------------------------------------------------------------------------
......
......@@ -26,15 +26,16 @@ IMDWorkspace::IMDWorkspace(const Parallel::StorageMode storageMode)
* @param function :: Implicit function limiting space to look at
* @return a single IMDIterator pointer
*/
IMDIterator *IMDWorkspace::createIterator(
std::unique_ptr<IMDIterator> IMDWorkspace::createIterator(
Mantid::Geometry::MDImplicitFunction *function) const {
std::vector<IMDIterator *> iterators = this->createIterators(1, function);
std::vector<std::unique_ptr<IMDIterator>> iterators =
this->createIterators(1, function);
if (iterators.empty())
throw std::runtime_error("IMDWorkspace::createIterator(): iterator "
"creation was not successful. No iterators "
"returned by " +
this->id());
return iterators[0];
return std::move(iterators[0]);
}
//---------------------------------------------------------------------------------------------
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment