Commit 8b3a215d authored by Samuel Jones's avatar Samuel Jones
Browse files

Clang-format 11 changes

parent 16feca9b
......@@ -40,8 +40,7 @@ class WorkspaceGroup;
Modified to inherit from DataService
*/
class MANTID_API_DLL AnalysisDataServiceImpl final
: public Kernel::DataService<API::Workspace> {
class MANTID_API_DLL AnalysisDataServiceImpl final : public Kernel::DataService<API::Workspace> {
public:
/** @name Extra notifications only applicable to the ADS */
//@{
......@@ -50,12 +49,9 @@ public:
public:
/// Constructor
GroupWorkspacesNotification(const std::vector<std::string> &wsnames)
: DataServiceNotification("", std::shared_ptr<API::Workspace>()),
m_wsnames(wsnames) {}
: DataServiceNotification("", std::shared_ptr<API::Workspace>()), m_wsnames(wsnames) {}
/// returns the workspace names
const std::vector<std::string> &inputworkspacenames() const {
return m_wsnames;
}
const std::vector<std::string> &inputworkspacenames() const { return m_wsnames; }
private:
std::vector<std::string> m_wsnames; ///< cache of ws names
......@@ -66,8 +62,7 @@ public:
class UnGroupingWorkspaceNotification : public DataServiceNotification {
public:
/// Constructor
UnGroupingWorkspaceNotification(const std::string &name,
const std::shared_ptr<Workspace> &obj)
UnGroupingWorkspaceNotification(const std::string &name, const std::shared_ptr<Workspace> &obj)
: DataServiceNotification(name, obj) {}
};
......@@ -95,12 +90,10 @@ public:
const std::string isValid(const std::string &name) const;
/// Overridden add member to attach the name to the workspace when a
/// workspace object is added to the service
void add(const std::string &name,
const std::shared_ptr<API::Workspace> &workspace) override;
void add(const std::string &name, const std::shared_ptr<API::Workspace> &workspace) override;
/// Overridden addOrReplace member to attach the name to the workspace when
/// a workspace object is added to the service
void addOrReplace(const std::string &name,
const std::shared_ptr<API::Workspace> &workspace) override;
void addOrReplace(const std::string &name, const std::shared_ptr<API::Workspace> &workspace) override;
/// Overridden rename member to attach the new name to the workspace when a
/// workspace object is renamed
virtual void rename(const std::string &oldName, const std::string &newName);
......@@ -114,22 +107,19 @@ public:
* Workspace
* @return a shared pointer of WSTYPE
*/
template <typename WSTYPE>
std::shared_ptr<WSTYPE> retrieveWS(const std::string &name) const {
template <typename WSTYPE> std::shared_ptr<WSTYPE> retrieveWS(const std::string &name) const {
// Get as a bare workspace
try {
// Cast to the desired type and return that.
return std::dynamic_pointer_cast<WSTYPE>(
Kernel::DataService<API::Workspace>::retrieve(name));
return std::dynamic_pointer_cast<WSTYPE>(Kernel::DataService<API::Workspace>::retrieve(name));
} catch (Kernel::Exception::NotFoundError &) {
throw;
}
}
std::vector<Workspace_sptr>
retrieveWorkspaces(const std::vector<std::string> &names,
bool unrollGroups = false) const;
std::vector<Workspace_sptr> retrieveWorkspaces(const std::vector<std::string> &names,
bool unrollGroups = false) const;
/** @name Methods to work with workspace groups */
//@{
......@@ -145,8 +135,7 @@ public:
private:
/// Checks the name is valid, throwing if not
void verifyName(const std::string &name,
const std::shared_ptr<API::WorkspaceGroup> &workspace);
void verifyName(const std::string &name, const std::shared_ptr<API::WorkspaceGroup> &workspace);
friend struct Mantid::Kernel::CreateUsingNew<AnalysisDataServiceImpl>;
/// Constructor
......@@ -162,69 +151,52 @@ private:
std::string m_illegalChars;
};
using AnalysisDataService =
Mantid::Kernel::SingletonHolder<AnalysisDataServiceImpl>;
using AnalysisDataService = Mantid::Kernel::SingletonHolder<AnalysisDataServiceImpl>;
using WorkspaceAddNotification =
Mantid::Kernel::DataService<Mantid::API::Workspace>::AddNotification;
using WorkspaceAddNotification_ptr = const Poco::AutoPtr<
Mantid::Kernel::DataService<Mantid::API::Workspace>::AddNotification> &;
using WorkspaceAddNotification = Mantid::Kernel::DataService<Mantid::API::Workspace>::AddNotification;
using WorkspaceAddNotification_ptr =
const Poco::AutoPtr<Mantid::Kernel::DataService<Mantid::API::Workspace>::AddNotification> &;
using WorkspaceBeforeReplaceNotification = Mantid::Kernel::DataService<
Mantid::API::Workspace>::BeforeReplaceNotification;
using WorkspaceBeforeReplaceNotification =
Mantid::Kernel::DataService<Mantid::API::Workspace>::BeforeReplaceNotification;
using WorkspaceBeforeReplaceNotification_ptr =
const Poco::AutoPtr<Mantid::Kernel::DataService<
Mantid::API::Workspace>::BeforeReplaceNotification> &;
const Poco::AutoPtr<Mantid::Kernel::DataService<Mantid::API::Workspace>::BeforeReplaceNotification> &;
using WorkspaceAfterReplaceNotification = Mantid::Kernel::DataService<
Mantid::API::Workspace>::AfterReplaceNotification;
using WorkspaceAfterReplaceNotification = Mantid::Kernel::DataService<Mantid::API::Workspace>::AfterReplaceNotification;
using WorkspaceAfterReplaceNotification_ptr =
const Poco::AutoPtr<Mantid::Kernel::DataService<
Mantid::API::Workspace>::AfterReplaceNotification> &;
using WorkspacePreDeleteNotification =
Mantid::Kernel::DataService<Mantid::API::Workspace>::PreDeleteNotification;
using WorkspacePreDeleteNotification_ptr = const Poco::AutoPtr<
Mantid::Kernel::DataService<Mantid::API::Workspace>::PreDeleteNotification>
&;
using WorkspacePostDeleteNotification =
Mantid::Kernel::DataService<Mantid::API::Workspace>::PostDeleteNotification;
using WorkspacePostDeleteNotification_ptr = const Poco::AutoPtr<
Mantid::Kernel::DataService<Mantid::API::Workspace>::PostDeleteNotification>
&;
using ClearADSNotification =
Mantid::Kernel::DataService<Mantid::API::Workspace>::ClearNotification;
using ClearADSNotification_ptr = const Poco::AutoPtr<
Mantid::Kernel::DataService<Mantid::API::Workspace>::ClearNotification> &;
using WorkspaceRenameNotification =
Mantid::Kernel::DataService<Mantid::API::Workspace>::RenameNotification;
using WorkspaceRenameNotification_ptr = const Poco::AutoPtr<
Mantid::Kernel::DataService<Mantid::API::Workspace>::RenameNotification> &;
using WorkspacesGroupedNotification =
AnalysisDataServiceImpl::GroupWorkspacesNotification;
using WorkspacesGroupedNotification_ptr =
const Poco::AutoPtr<AnalysisDataServiceImpl::GroupWorkspacesNotification> &;
using WorkspaceUnGroupingNotification =
AnalysisDataServiceImpl::UnGroupingWorkspaceNotification;
using WorkspaceUnGroupingNotification_ptr = const Poco::AutoPtr<
AnalysisDataServiceImpl::UnGroupingWorkspaceNotification> &;
using GroupUpdatedNotification =
AnalysisDataServiceImpl::GroupUpdatedNotification;
using GroupUpdatedNotification_ptr =
const Poco::AutoPtr<AnalysisDataServiceImpl::GroupUpdatedNotification> &;
const Poco::AutoPtr<Mantid::Kernel::DataService<Mantid::API::Workspace>::AfterReplaceNotification> &;
using WorkspacePreDeleteNotification = Mantid::Kernel::DataService<Mantid::API::Workspace>::PreDeleteNotification;
using WorkspacePreDeleteNotification_ptr =
const Poco::AutoPtr<Mantid::Kernel::DataService<Mantid::API::Workspace>::PreDeleteNotification> &;
using WorkspacePostDeleteNotification = Mantid::Kernel::DataService<Mantid::API::Workspace>::PostDeleteNotification;
using WorkspacePostDeleteNotification_ptr =
const Poco::AutoPtr<Mantid::Kernel::DataService<Mantid::API::Workspace>::PostDeleteNotification> &;
using ClearADSNotification = Mantid::Kernel::DataService<Mantid::API::Workspace>::ClearNotification;
using ClearADSNotification_ptr =
const Poco::AutoPtr<Mantid::Kernel::DataService<Mantid::API::Workspace>::ClearNotification> &;
using WorkspaceRenameNotification = Mantid::Kernel::DataService<Mantid::API::Workspace>::RenameNotification;
using WorkspaceRenameNotification_ptr =
const Poco::AutoPtr<Mantid::Kernel::DataService<Mantid::API::Workspace>::RenameNotification> &;
using WorkspacesGroupedNotification = AnalysisDataServiceImpl::GroupWorkspacesNotification;
using WorkspacesGroupedNotification_ptr = const Poco::AutoPtr<AnalysisDataServiceImpl::GroupWorkspacesNotification> &;
using WorkspaceUnGroupingNotification = AnalysisDataServiceImpl::UnGroupingWorkspaceNotification;
using WorkspaceUnGroupingNotification_ptr =
const Poco::AutoPtr<AnalysisDataServiceImpl::UnGroupingWorkspaceNotification> &;
using GroupUpdatedNotification = AnalysisDataServiceImpl::GroupUpdatedNotification;
using GroupUpdatedNotification_ptr = const Poco::AutoPtr<AnalysisDataServiceImpl::GroupUpdatedNotification> &;
} // Namespace API
} // Namespace Mantid
namespace Mantid {
namespace Kernel {
EXTERN_MANTID_API template class MANTID_API_DLL
Mantid::Kernel::SingletonHolder<Mantid::API::AnalysisDataServiceImpl>;
EXTERN_MANTID_API template class MANTID_API_DLL Mantid::Kernel::SingletonHolder<Mantid::API::AnalysisDataServiceImpl>;
}
} // namespace Mantid
......@@ -36,8 +36,7 @@ public:
/// @param domain :: The input domain over which the function is to be
/// calculated
/// @param values :: A storage object for the calculated values
void function(const FunctionDomain &domain,
FunctionValues &values) const override;
void function(const FunctionDomain &domain, FunctionValues &values) const override;
/// Derivatives of function with respect to active parameters
void functionDeriv(const FunctionDomain &domain, Jacobian &jacobian) override;
/// Called at the start of each iteration
......@@ -48,15 +47,13 @@ public:
/// Associate a function and a domain
void setDomainIndex(size_t funIndex, size_t domainIndex);
/// Associate a function and a list of domains
void setDomainIndices(size_t funIndex,
const std::vector<size_t> &domainIndices);
void setDomainIndices(size_t funIndex, const std::vector<size_t> &domainIndices);
/// Clear all domain indices
void clearDomainIndices();
/// Get the largest domain index
size_t getMaxIndex() const { return m_maxIndex; }
/// Get domain indices for a member function
void getDomainIndices(size_t i, size_t nDomains,
std::vector<size_t> &domains) const;
void getDomainIndices(size_t i, size_t nDomains, std::vector<size_t> &domains) const;
/// Get number of domains required by this function
size_t getNumberDomains() const override;
/// Create a list of equivalent functions
......@@ -68,19 +65,13 @@ public:
/// of individual member functions.
size_t nLocalAttributes() const override { return 1; }
/// Returns a list of attribute names
std::vector<std::string> getLocalAttributeNames() const override {
return std::vector<std::string>(1, "domains");
}
std::vector<std::string> getLocalAttributeNames() const override { return std::vector<std::string>(1, "domains"); }
/// Return a value of attribute attName
Attribute getLocalAttribute(size_t i,
const std::string &attName) const override;
Attribute getLocalAttribute(size_t i, const std::string &attName) const override;
/// Set a value to attribute attName
void setLocalAttribute(size_t i, const std::string &attName,
const Attribute &) override;
void setLocalAttribute(size_t i, const std::string &attName, const Attribute &) override;
/// Check if attribute attName exists
bool hasLocalAttribute(const std::string &attName) const override {
return attName == "domains";
}
bool hasLocalAttribute(const std::string &attName) const override { return attName == "domains"; }
protected:
/// Counts number of the domains
......
......@@ -16,12 +16,11 @@
* It both registers the algorithm as usual and subscribes it to the
* registry.
*/
#define DECLARE_FILELOADER_ALGORITHM(classname) \
namespace { \
Mantid::Kernel::RegistrationHelper reg_loader_##classname( \
(Mantid::API::FileLoaderRegistry::Instance().subscribe<classname>( \
Mantid::API::FileLoaderRegistryImpl::Generic), \
0)); \
#define DECLARE_FILELOADER_ALGORITHM(classname) \
namespace { \
Mantid::Kernel::RegistrationHelper reg_loader_##classname( \
(Mantid::API::FileLoaderRegistry::Instance().subscribe<classname>(Mantid::API::FileLoaderRegistryImpl::Generic), \
0)); \
}
/**
......@@ -31,12 +30,11 @@
* It both registers the algorithm as usual and subscribes it to the
* registry.
*/
#define DECLARE_NEXUS_FILELOADER_ALGORITHM(classname) \
namespace { \
Mantid::Kernel::RegistrationHelper reg_hdf_loader_##classname( \
(Mantid::API::FileLoaderRegistry::Instance().subscribe<classname>( \
Mantid::API::FileLoaderRegistryImpl::Nexus), \
0)); \
#define DECLARE_NEXUS_FILELOADER_ALGORITHM(classname) \
namespace { \
Mantid::Kernel::RegistrationHelper reg_hdf_loader_##classname( \
(Mantid::API::FileLoaderRegistry::Instance().subscribe<classname>(Mantid::API::FileLoaderRegistryImpl::Nexus), \
0)); \
}
/**
......@@ -46,10 +44,10 @@
* It both registers the algorithm as usual and subscribes it to the
* registry.
*/
#define DECLARE_NEXUS_HDF5_FILELOADER_ALGORITHM(classname) \
namespace { \
Mantid::Kernel::RegistrationHelper reg_hdf_loader_##classname( \
(Mantid::API::FileLoaderRegistry::Instance().subscribe<classname>( \
Mantid::API::FileLoaderRegistryImpl::NexusHDF5), \
0)); \
#define DECLARE_NEXUS_HDF5_FILELOADER_ALGORITHM(classname) \
namespace { \
Mantid::Kernel::RegistrationHelper \
reg_hdf_loader_##classname((Mantid::API::FileLoaderRegistry::Instance().subscribe<classname>( \
Mantid::API::FileLoaderRegistryImpl::NexusHDF5), \
0)); \
}
......@@ -24,8 +24,7 @@ namespace API {
* @param workspacePropertyName : Property name to treat as source of
* multiperiod workspaces.
*/
MultiPeriodGroupWorker::MultiPeriodGroupWorker(
const std::string &workspacePropertyName)
MultiPeriodGroupWorker::MultiPeriodGroupWorker(const std::string &workspacePropertyName)
: m_workspacePropertyName(workspacePropertyName) {}
/**
......@@ -36,11 +35,9 @@ MultiPeriodGroupWorker::MultiPeriodGroupWorker(
* @param vecWorkspaceGroups: Vector of non-multi period workspace groups.
*/
void MultiPeriodGroupWorker::tryAddInputWorkspaceToInputGroups(
const Workspace_sptr &ws,
MultiPeriodGroupWorker::VecWSGroupType &vecMultiPeriodWorkspaceGroups,
const Workspace_sptr &ws, MultiPeriodGroupWorker::VecWSGroupType &vecMultiPeriodWorkspaceGroups,
MultiPeriodGroupWorker::VecWSGroupType &vecWorkspaceGroups) const {
WorkspaceGroup_sptr inputGroup =
std::dynamic_pointer_cast<WorkspaceGroup>(ws);
WorkspaceGroup_sptr inputGroup = std::dynamic_pointer_cast<WorkspaceGroup>(ws);
if (inputGroup) {
if (inputGroup->isMultiperiod()) {
vecMultiPeriodWorkspaceGroups.emplace_back(inputGroup);
......@@ -51,8 +48,7 @@ void MultiPeriodGroupWorker::tryAddInputWorkspaceToInputGroups(
}
MultiPeriodGroupWorker::VecWSGroupType
MultiPeriodGroupWorker::findMultiPeriodGroups(
Algorithm const *const sourceAlg) const {
MultiPeriodGroupWorker::findMultiPeriodGroups(Algorithm const *const sourceAlg) const {
if (!sourceAlg->isInitialized()) {
throw std::invalid_argument("Algorithm must be initialized");
}
......@@ -67,8 +63,7 @@ MultiPeriodGroupWorker::findMultiPeriodGroups(
using WorkspaceNameType = std::vector<std::string>;
// Perform a check that the input property is the correct type.
Property *inputProperty =
sourceAlg->getProperty(this->m_workspacePropertyName);
Property *inputProperty = sourceAlg->getProperty(this->m_workspacePropertyName);
if (!dynamic_cast<ArrayProperty<std::string> *>(inputProperty)) {
throw std::runtime_error("Support for custom input workspaces that are "
......@@ -78,8 +73,7 @@ MultiPeriodGroupWorker::findMultiPeriodGroups(
* types if required, but we don't need that funtionality now.*/
}
WorkspaceNameType workspaces =
sourceAlg->getProperty(this->m_workspacePropertyName);
WorkspaceNameType workspaces = sourceAlg->getProperty(this->m_workspacePropertyName);
// Inspect all the input workspaces in the ArrayProperty input.
for (auto &workspace : workspaces) {
......@@ -87,22 +81,19 @@ MultiPeriodGroupWorker::findMultiPeriodGroups(
if (!ws) {
throw Kernel::Exception::NotFoundError("Workspace", workspace);
}
tryAddInputWorkspaceToInputGroups(ws, vecMultiPeriodWorkspaceGroups,
vecWorkspaceGroups);
tryAddInputWorkspaceToInputGroups(ws, vecMultiPeriodWorkspaceGroups, vecWorkspaceGroups);
}
} else {
using WorkspaceVector = std::vector<std::shared_ptr<Workspace>>;
WorkspaceVector inWorkspaces;
sourceAlg->findWorkspaces(inWorkspaces, Direction::Input);
for (auto &inWorkspace : inWorkspaces) {
tryAddInputWorkspaceToInputGroups(
inWorkspace, vecMultiPeriodWorkspaceGroups, vecWorkspaceGroups);
tryAddInputWorkspaceToInputGroups(inWorkspace, vecMultiPeriodWorkspaceGroups, vecWorkspaceGroups);
}
}
if (!vecMultiPeriodWorkspaceGroups.empty() && !vecWorkspaceGroups.empty()) {
throw std::invalid_argument(
"The input contains a mix of multi-period and other workspaces.");
throw std::invalid_argument("The input contains a mix of multi-period and other workspaces.");
}
validateMultiPeriodGroupInputs(vecMultiPeriodWorkspaceGroups);
......@@ -110,9 +101,7 @@ MultiPeriodGroupWorker::findMultiPeriodGroups(
return vecMultiPeriodWorkspaceGroups;
}
bool MultiPeriodGroupWorker::useCustomWorkspaceProperty() const {
return !this->m_workspacePropertyName.empty();
}
bool MultiPeriodGroupWorker::useCustomWorkspaceProperty() const { return !this->m_workspacePropertyName.empty(); }
/**
* Creates a list of input workspaces as a string for a given period using all
......@@ -134,13 +123,12 @@ bool MultiPeriodGroupWorker::useCustomWorkspaceProperty() const {
* @param vecWorkspaceGroups : Vector of workspace groups
* @return comma separated string of input workspaces.
*/
std::string MultiPeriodGroupWorker::createFormattedInputWorkspaceNames(
const size_t &periodIndex, const VecWSGroupType &vecWorkspaceGroups) const {
std::string MultiPeriodGroupWorker::createFormattedInputWorkspaceNames(const size_t &periodIndex,
const VecWSGroupType &vecWorkspaceGroups) const {
std::string prefix;
std::string inputWorkspaces;
for (const auto &vecWorkspaceGroup : vecWorkspaceGroups) {
inputWorkspaces +=
prefix + vecWorkspaceGroup->getItem(periodIndex)->getName();
inputWorkspaces += prefix + vecWorkspaceGroup->getItem(periodIndex)->getName();
prefix = ",";
}
return inputWorkspaces;
......@@ -159,21 +147,16 @@ std::string MultiPeriodGroupWorker::createFormattedInputWorkspaceNames(
* @param periodNumber: The relevant period number used to index into the group
* workspaces
*/
void MultiPeriodGroupWorker::copyInputWorkspaceProperties(
IAlgorithm *targetAlg, IAlgorithm *sourceAlg,
const int &periodNumber) const {
void MultiPeriodGroupWorker::copyInputWorkspaceProperties(IAlgorithm *targetAlg, IAlgorithm *sourceAlg,
const int &periodNumber) const {
std::vector<Property *> props = sourceAlg->getProperties();
for (auto prop : props) {
if (prop) {
if (prop->direction() == Direction::Input) {
if (const IWorkspaceProperty *wsProp =
dynamic_cast<IWorkspaceProperty *>(prop)) {
if (WorkspaceGroup_sptr inputws =
std::dynamic_pointer_cast<WorkspaceGroup>(
wsProp->getWorkspace())) {
if (const IWorkspaceProperty *wsProp = dynamic_cast<IWorkspaceProperty *>(prop)) {
if (WorkspaceGroup_sptr inputws = std::dynamic_pointer_cast<WorkspaceGroup>(wsProp->getWorkspace())) {
if (inputws->isMultiperiod()) {
targetAlg->setProperty(prop->name(),
inputws->getItem(periodNumber - 1));
targetAlg->setProperty(prop->name(), inputws->getItem(periodNumber - 1));
}
}
}
......@@ -198,9 +181,8 @@ void MultiPeriodGroupWorker::copyInputWorkspaceProperties(
* @param vecMultiPeriodGroups : Vector of pre-identified multiperiod groups.
* @return true - if all the workspace members are executed.
*/
bool MultiPeriodGroupWorker::processGroups(
Algorithm *const sourceAlg,
const VecWSGroupType &vecMultiPeriodGroups) const {
bool MultiPeriodGroupWorker::processGroups(Algorithm *const sourceAlg,
const VecWSGroupType &vecMultiPeriodGroups) const {
// If we are not processing multiperiod groups, use the base behaviour.
if (vecMultiPeriodGroups.empty()) {
return false; // Indicates that this is not a multiperiod group workspace.
......@@ -218,10 +200,9 @@ bool MultiPeriodGroupWorker::processGroups(
for (size_t i = 0; i < nPeriods; ++i) {
const auto periodNumber = static_cast<int>(i + 1);
// use create Child Algorithm that look like this one
Algorithm_sptr alg = sourceAlg->createChildAlgorithm(
sourceAlg->name(), progress_proportion * periodNumber,
progress_proportion * (1 + periodNumber), sourceAlg->isLogging(),
sourceAlg->version());
Algorithm_sptr alg = sourceAlg->createChildAlgorithm(sourceAlg->name(), progress_proportion * periodNumber,
progress_proportion * (1 + periodNumber),
sourceAlg->isLogging(), sourceAlg->version());
if (!alg) {
throw std::runtime_error("Algorithm creation failed.");
}
......@@ -234,8 +215,7 @@ bool MultiPeriodGroupWorker::processGroups(
sourceAlg->copyNonWorkspaceProperties(alg.get(), periodNumber);
if (this->useCustomWorkspaceProperty()) {
const std::string inputWorkspaces =
createFormattedInputWorkspaceNames(i, vecMultiPeriodGroups);
const std::string inputWorkspaces = createFormattedInputWorkspaceNames(i, vecMultiPeriodGroups);
// Set the input workspace property.
alg->setPropertyValue(this->m_workspacePropertyName, inputWorkspaces);
} else {
......@@ -246,8 +226,7 @@ bool MultiPeriodGroupWorker::processGroups(
alg->setPropertyValue("OutputWorkspace", outName_i);
// Run the spawned algorithm.
if (!alg->execute()) {
throw std::runtime_error("Execution of " + sourceAlg->name() +
" for group entry " + Strings::toString(i + 1) +
throw std::runtime_error("Execution of " + sourceAlg->name() + " for group entry " + Strings::toString(i + 1) +
" failed.");
}
// Add the output workpace from the spawned algorithm to the group.
......@@ -264,8 +243,7 @@ bool MultiPeriodGroupWorker::processGroups(
* processing if things don't look right.
* @param vecMultiPeriodGroups : vector of multiperiod groups.
*/
void MultiPeriodGroupWorker::validateMultiPeriodGroupInputs(
const VecWSGroupType &vecMultiPeriodGroups) const {
void MultiPeriodGroupWorker::validateMultiPeriodGroupInputs(const VecWSGroupType &vecMultiPeriodGroups) const {
const size_t multiPeriodGroupsSize = vecMultiPeriodGroups.size();
if (multiPeriodGroupsSize > 0) {
......@@ -278,18 +256,15 @@ void MultiPeriodGroupWorker::validateMultiPeriodGroupInputs(
}
for (size_t j = 0; j < currentGroup->size(); ++j) {
MatrixWorkspace_const_sptr currentNestedWS =
std::dynamic_pointer_cast<const MatrixWorkspace>(
currentGroup->getItem(j));
Property *nPeriodsProperty =
currentNestedWS->run().getLogData("nperiods");
std::dynamic_pointer_cast<const MatrixWorkspace>(currentGroup->getItem(j));
Property *nPeriodsProperty = currentNestedWS->run().getLogData("nperiods");
size_t nPeriods = std::stoul(nPeriodsProperty->value());
if (nPeriods != benchMarkGroupSize) {
throw std::runtime_error("Missmatch between nperiods log and the "
"number of workspaces in the input group: " +
vecMultiPeriodGroups[i]->getName());
}
Property *currentPeriodProperty =
currentNestedWS->run().getLogData("current_period");
Property *currentPeriodProperty = currentNestedWS->run().getLogData("current_period");
size_t currentPeriod = std::stoul(currentPeriodProperty->value());
if (currentPeriod != (j + 1)) {
throw std::runtime_error("Multiperiod group workspaces must be "
......
This diff is collapsed.
......@@ -59,13 +59,9 @@ public:
/// Algorithm's version
int version() const override { return (1); }
const std::vector<std::string> seeAlso() const override {
return {"SumSpectra", "SumNeighbours"};
}
const std::vector<std::string> seeAlso() const override { return {"SumSpectra", "SumNeighbours"}; }
/// Algorithm's category for identification
const std::string category() const override {
return "SANS;Transforms\\Grouping";
}
const std::string category() const override { return "SANS;Transforms\\Grouping"; }
private:
/// Initialisation code
......
......@@ -23,19 +23,14 @@ class TimeAtSampleStrategyDirectTest : public CxxTest::TestSuite {
public:
// This pair of boilerplate methods prevent the suite being created statically
// This means the constructor isn't called when running other tests
static TimeAtSampleStrategyDirectTest *createSuite() {
return new TimeAtSampleStrategyDirectTest();
}
static void destroySuite(TimeAtSampleStrategyDirectTest *suite) {
delete suite;
}
static TimeAtSampleStrategyDirectTest *createSuite() { return new TimeAtSampleStrategyDirectTest(); }
static void destroySuite(TimeAtSampleStrategyDirectTest *suite) { delete suite; }
void test_L2_detector() {
using namespace Mantid;
using namespace Mantid::Geometry;
auto ws =
WorkspaceCreationHelper::create2DWorkspaceWithReflectometryInstrument();
auto ws = WorkspaceCreationHelper::create2DWorkspaceWithReflectometryInstrument();
auto instrument = ws->getInstrument();
......@@ -53,8 +48,7 @@ public:
const double shift = correction.factor;
double expectedShift = L1 / std::sqrt(ei * 2. * PhysicalConstants::meV /
PhysicalConstants::NeutronMass);
double expectedShift = L1 / std::sqrt(ei * 2. * PhysicalConstants::meV / PhysicalConstants::NeutronMass);
TSM_ASSERT_DELTA("L1 / (L1 + L2)", expectedShift, shift, 0.0000001);
}
......
......@@ -31,8 +31,7 @@ namespace Crystal {
@author Ruth Mikkelson, SNS,ORNL
@date 01/26/2013
*/
class MANTID_CRYSTAL_DLL PeakHKLErrors : public API::ParamFunction,
public API::IFunction1D {
class MANTID_CRYSTAL_DLL PeakHKLErrors : public API::ParamFunction, public API::IFunction1D {
public:
PeakHKLErrors();
......@@ -42,11 +41,9 @@ public:
const std::string category() const override { return "Calibration"; };
void function1D(double *out, const double *xValues,
const size_t nData) const override;
void function1D(double *out, const double *xValues, const size_t nData) const override;
void functionDeriv1D(Mantid::API::Jacobian *out, const double *xValues,
const size_t nData) override;
void functionDeriv1D(Mantid::API::Jacobian *out, const double *xValues, const size_t nData) override;
void init() override;
......@@ -67,33 +64,24 @@ public:
* @return The new peak with the new instrument( adjusted with the
*parameters) and time adjusted.
*/
static DataObjects::Peak
createNewPeak(const DataObjects::Peak &peak_old,
const Geometry::Instrument_sptr &instrNew, double T0,
double L0);
static void
cLone(std::shared_ptr<Geometry::ParameterMap> &pmap,