Mantid
Loading...
Searching...
No Matches
ParallelAlgorithmCreation.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
11
12namespace Mantid {
13namespace Parallel {
14class Communicator;
15}
16} // namespace Mantid
17
19
29template <class T> std::unique_ptr<T> create(const Mantid::Parallel::Communicator &comm) {
30 using namespace Mantid;
31 auto alg = std::make_unique<T>();
32 alg->setChild(true);
33 alg->setCommunicator(comm);
34 alg->initialize();
35 const auto &props = alg->getProperties();
36 for (auto prop : props) {
37 auto wsProp = dynamic_cast<API::IWorkspaceProperty *>(prop);
38 if (prop->direction() == Kernel::Direction::Output && wsProp) {
39 if (prop->value().empty()) {
40 prop->createTemporaryValue();
41 }
42 }
43 }
44 return alg;
45}
46
47} // namespace ParallelTestHelpers
An interface that is implemented by WorkspaceProperty.
Helper class which provides the Collimation Length for SANS instruments.