13#include "MantidAlgorithms/DllConfig.h"
18namespace DataObjects {
43 template <std::size_t...>
struct seq {};
45 template <std::size_t N, std::size_t... S>
47 :
gens<N - 1, N - 1, S...> {
49 template <std::size_t... S>
struct gens<0, S...> {
57 template <
typename Tp,
typename... List>
struct contains : std::true_type {};
58 template <
typename Tp,
typename Head,
typename... Rest>
60 : std::conditional<std::is_same<Tp, Head>::value, std::true_type, contains<Tp, Rest...>>::type {};
61 template <
typename Tp>
struct contains<Tp> : std::false_type {};
64 template <
class... Flags,
class WS,
class T, std::size_t... S,
class OP>
70 indexSet = getWorkspaceIndexSet(
workspace);
71 auto size =
static_cast<int64_t
>(indexSet.
size());
75 for (int64_t i = 0; i < size; ++i) {
79 operation(std::get<S>(getters)(
workspace, indexSet[i])...);
121 template <
class... Flags,
class WS,
class... Args,
class OP>
137 for_each<Flags...>(
workspace, getters,
typename gens<
sizeof...(Args)>::type(), operation);
140 void declareWorkspaceIndexSetProperties(
const std::string &indexMinPropertyName =
"IndexMin",
141 const std::string &indexMaxPropertyName =
"IndexMax",
142 const std::string &indexRangePropertyName =
"WorkspaceIndexList");
IPeaksWorkspace_sptr workspace
#define PARALLEL_START_INTERRUPT_REGION
Begins a block to skip processing is the algorithm has been interupted Note the end of the block if n...
#define PARALLEL_END_INTERRUPT_REGION
Ends a block to skip processing is the algorithm has been interupted Note the start of the block if n...
#define PARALLEL_FOR_IF(condition)
Empty definitions - to enable set your complier to enable openMP.
#define PARALLEL_CHECK_INTERRUPT_REGION
Adds a check after a Parallel region to see if it was interupted.
#define UNUSED_ARG(x)
Function arguments are sometimes unused in certain implmentations but are required for documentation ...
Base class from which all concrete algorithm classes should be derived.
Base MatrixWorkspace Abstract Class.
Helper class for reporting progress from algorithms.
SpectrumAlgorithm is a base class for algorithms that work with MatrixWorkspace.
void for_each(WS &workspace, T getters, seq< S... >, const OP &operation)
Internal implementation of for_each().
void for_each(WS &workspace, std::tuple< Args... > getters, const OP &operation)
Provides a mechanism for looping over spectra in a workspace.
void ifEventWorkspaceClearMRU(const WS &workspace)
Templated function used as 'compile-time conditional', together with specialization.
~SpectrumAlgorithm()=default
std::string m_indexRangePropertyName
std::string m_indexMaxPropertyName
std::string m_indexMinPropertyName
This class is intended to fulfill the design specified in <https://github.com/mantidproject/documents...
IndexSet is a container that can be used to define and access a subset of elements in a larger contai...
size_t size() const
Returns the size of the set.
void report()
Increments the loop counter by 1, then sends the progress notification on behalf of its algorithm.
std::shared_ptr< SpectrumAlgorithm > SpectrumAlgorithm_sptr
Typedef for a shared pointer to a SpectrumAlgorithm.
Helper class which provides the Collimation Length for SANS instruments.
Flag: Include only indices specified via properties in for_each.
Dummy struct holding compile-time flags to for_each().
Helpers for for_each(), struct contains and 2 specializations.
Helpers for for_each(), struct seq and gens with a specialization.