20#include <boost/lambda/lambda.hpp>
29using namespace Geometry;
44 throw std::invalid_argument(
"Workspace has a wrong type (not a IMDWorkspace)");
54 for (; it != end; ++it) {
55 std::shared_ptr<const Mantid::Geometry::IMDDimension> dim =
workspace->getDimensionWithId(it->first);
57 throw std::invalid_argument(
"Dimension " + it->first +
" dos not exist in workspace " + ws->getName());
62 }
catch (std::exception &) {
74 throw std::invalid_argument(
"Unexpected domain in IFunctionMD");
105 throw std::invalid_argument(
"Dimension " +
id +
" has already been used.");
118 throw std::runtime_error(
"Method IFunctionMD::useAllDimensions() can only "
119 "be called after setting the workspace");
121 for (
size_t i = 0; i <
workspace->getNumDims(); ++i) {
IPeaksWorkspace_sptr workspace
Implements a domain for MD functions (IFunctionMD).
const IMDIterator * getNextIterator() const
Next iterator.
void reset() const override
Reset the iterator to point to the start of the domain.
Base class that represents the domain of a function.
A class to store values calculated by a function.
void setCalculated(double value)
set all calculated values to same number
void function(const FunctionDomain &domain, FunctionValues &values) const override
void evaluateFunction(const FunctionDomainMD &domain, FunctionValues &values) const
Performs the function evaluations on the MD domain.
std::shared_ptr< IFunction > clone() const override
Virtual copy constructor.
std::vector< std::shared_ptr< const Mantid::Geometry::IMDDimension > > m_dimensions
dimensions used in this function in the expected order
virtual double functionMD(const IMDIterator &r) const =0
Does the function evaluation. Must be implemented in derived classes.
virtual void useDimension(const std::string &id)
User functions call this method in their constructors to set up the order of the dimensions.
std::map< std::string, size_t > m_dimensionIndexMap
maps dimension id to its index in m_dimensions
virtual void initDimensions()
Do finction initialization after useAllDimensions() was called.
virtual void useAllDimensions(std::shared_ptr< const IMDWorkspace > workspace)
Use all the dimensions in the workspace.
void setWorkspace(std::shared_ptr< const Workspace > ws) override
Set the workspace.
virtual std::shared_ptr< IFunction > clone() const
Virtual copy constructor.
void reportProgress(const std::string &msg="") const
Reports progress with an optional message.
This is an interface to an iterator of an IMDWorkspace.
std::shared_ptr< const IMDWorkspace > IMDWorkspace_const_sptr
Shared pointer to the IMDWorkspace base class (const version)
std::string to_string(const wide_integer< Bits, Signed > &n)