Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Framework/API/inc/MantidAPI/ExperimentInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
#include "MantidGeometry/Instrument_fwd.h"

#include "MantidKernel/DeltaEMode.h"
#include "MantidKernel/NexusDescriptor.h"
#include "MantidKernel/Unit.h"
#include "MantidKernel/V3D.h"
#include "MantidKernel/cow_ptr.h"
#include "MantidNexus/NexusDescriptor.h"

#include <mutex>

Expand Down Expand Up @@ -125,7 +125,7 @@ class MANTID_API_DLL ExperimentInfo {
void saveExperimentInfoNexus(::NeXus::File *file, bool saveInstrument, bool saveSample, bool saveLogs) const;

void loadExperimentInfoNexus(const std::string &nxFilename, ::NeXus::File *file, std::string &parameterStr,
const Mantid::Kernel::NexusDescriptor &fileInfo, const std::string &prefix);
const Mantid::Nexus::NexusDescriptor &fileInfo, const std::string &prefix);

/// Loads an experiment description from the open NeXus file
void loadExperimentInfoNexus(const std::string &nxFilename, ::NeXus::File *file, std::string &parameterStr);
Expand All @@ -139,7 +139,7 @@ class MANTID_API_DLL ExperimentInfo {

/// Load the sample and log info from an open NeXus file. Overload that uses NexusDescriptor for faster metadata
/// lookup
void loadSampleAndLogInfoNexus(::NeXus::File *file, const Mantid::Kernel::NexusDescriptor &fileInfo,
void loadSampleAndLogInfoNexus(::NeXus::File *file, const Mantid::Nexus::NexusDescriptor &fileInfo,
const std::string &prefix);
/// Load the sample and log info from an open NeXus file.
void loadSampleAndLogInfoNexus(::NeXus::File *file);
Expand Down
4 changes: 2 additions & 2 deletions Framework/API/inc/MantidAPI/FileLoaderRegistry.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#include "MantidAPI/IFileLoader.h"
#include "MantidKernel/FileDescriptor.h"
#include "MantidKernel/LegacyNexusDescriptor.h"
#include "MantidKernel/NexusDescriptor.h"
#include "MantidKernel/SingletonHolder.h"
#include "MantidNexus/NexusDescriptor.h"

#ifndef Q_MOC_RUN
#include <type_traits>
Expand Down Expand Up @@ -97,7 +97,7 @@ class MANTID_API_DLL FileLoaderRegistryImpl {
}
break;
case Nexus:
if (!std::is_base_of<IFileLoader<Kernel::NexusDescriptor>, T>::value) {
if (!std::is_base_of<IFileLoader<Nexus::NexusDescriptor>, T>::value) {
throw std::runtime_error(
std::string("FileLoaderRegistryImpl::subscribe - Class '") + typeid(T).name() +
"' registered as Nexus loader but it does not inherit from API::IFileLoader<Kernel::NexusDescriptor>");
Expand Down
6 changes: 3 additions & 3 deletions Framework/API/inc/MantidAPI/LogManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
#pragma once

#include "MantidAPI/DllConfig.h"
#include "MantidKernel/NexusDescriptor.h"
#include "MantidKernel/PropertyWithValue.h"
#include "MantidKernel/Statistics.h"
#include "MantidNexus/NexusDescriptor.h"

#include <memory>
#include <vector>
Expand Down Expand Up @@ -187,7 +187,7 @@ class MANTID_API_DLL LogManager {
virtual void saveNexus(::NeXus::File *file, const std::string &group, bool keepOpen = false) const;

/// Load the run from a NeXus file with a given group name. Overload that uses NexusDescriptor for faster
virtual void loadNexus(::NeXus::File *file, const std::string &group, const Mantid::Kernel::NexusDescriptor &fileInfo,
virtual void loadNexus(::NeXus::File *file, const std::string &group, const Mantid::Nexus::NexusDescriptor &fileInfo,
const std::string &prefix, bool keepOpen = false);
/// Load the run from a NeXus file with a given group name
virtual void loadNexus(::NeXus::File *file, const std::string &group, bool keepOpen = false);
Expand All @@ -211,7 +211,7 @@ class MANTID_API_DLL LogManager {
bool hasEndTime() const;
bool hasValidProtonChargeLog(std::string &error) const;

void loadNexus(::NeXus::File *file, const Mantid::Kernel::NexusDescriptor &fileInfo, const std::string &prefix);
void loadNexus(::NeXus::File *file, const Mantid::Nexus::NexusDescriptor &fileInfo, const std::string &prefix);
/// Load the run from a NeXus file with a given group name
void loadNexus(::NeXus::File *file, const std::map<std::string, std::string> &entries);
/// A pointer to a property manager
Expand Down
12 changes: 6 additions & 6 deletions Framework/API/inc/MantidAPI/NexusFileLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

#include "MantidAPI/IFileLoader.h"
#include "MantidKernel/DllConfig.h"
#include "MantidKernel/NexusDescriptor.h"
#include "MantidNexus/NexusDescriptor.h"

namespace Mantid::API {

class MANTID_API_DLL NexusFileLoader : public API::IFileLoader<Mantid::Kernel::NexusDescriptor> {
class MANTID_API_DLL NexusFileLoader : public API::IFileLoader<Mantid::Nexus::NexusDescriptor> {
public:
void exec() override final; // makes sure the NexusDescriptor is initialized
virtual void execLoader() = 0; // what would normally be called exec
Expand All @@ -23,16 +23,16 @@ class MANTID_API_DLL NexusFileLoader : public API::IFileLoader<Mantid::Kernel::N
std::shared_ptr<Algorithm> createChildAlgorithm(const std::string &name, const double startProgress = -1.,
const double endProgress = -1., const bool enableLogging = true,
const int &version = -1) override;
virtual void setFileInfo(std::shared_ptr<Mantid::Kernel::NexusDescriptor> fileInfo);
virtual void setFileInfo(std::shared_ptr<Mantid::Nexus::NexusDescriptor> fileInfo);

/// Required to pass m_fileInfo to static functions
/// Keeping it shared_ptr to match setFileInfo signature (although passing
/// ownership is not the main goal).
virtual const std::shared_ptr<Mantid::Kernel::NexusDescriptor> getFileInfo() const noexcept;
virtual const std::shared_ptr<Mantid::Nexus::NexusDescriptor> getFileInfo() const noexcept;

virtual int confidence(Kernel::NexusDescriptor &descriptor) const override = 0;
virtual int confidence(Nexus::NexusDescriptor &descriptor) const override = 0;

private:
std::shared_ptr<Mantid::Kernel::NexusDescriptor> m_fileInfo;
std::shared_ptr<Mantid::Nexus::NexusDescriptor> m_fileInfo;
};
} // namespace Mantid::API
2 changes: 1 addition & 1 deletion Framework/API/inc/MantidAPI/Run.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class MANTID_API_DLL Run : public LogManager {

/// Load the run from a NeXus file with a given group name. Overload that uses NexusDescriptor for faster metadata
/// lookup
void loadNexus(::NeXus::File *file, const std::string &group, const Mantid::Kernel::NexusDescriptor &fileInfo,
void loadNexus(::NeXus::File *file, const std::string &group, const Mantid::Nexus::NexusDescriptor &fileInfo,
const std::string &prefix, bool keepOpen = false) override;
/// Load the run from a NeXus file with a given group name
void loadNexus(::NeXus::File *file, const std::string &group, bool keepOpen = false) override;
Expand Down
4 changes: 2 additions & 2 deletions Framework/API/src/ExperimentInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,7 @@ void ExperimentInfo::saveExperimentInfoNexus(::NeXus::File *file, bool saveInstr
* @param fileInfo :: The file info descriptor corresponding to the provided file
* @param prefix :: The prefix of the file
*/
void ExperimentInfo::loadSampleAndLogInfoNexus(::NeXus::File *file, const Mantid::Kernel::NexusDescriptor &fileInfo,
void ExperimentInfo::loadSampleAndLogInfoNexus(::NeXus::File *file, const Nexus::NexusDescriptor &fileInfo,
const std::string &prefix) {
// First, the sample and then the logs
int sampleVersion = mutableSample().loadNexus(file, "sample");
Expand Down Expand Up @@ -969,7 +969,7 @@ void ExperimentInfo::loadSampleAndLogInfoNexus(::NeXus::File *file) {
}

void ExperimentInfo::loadExperimentInfoNexus(const std::string &nxFilename, ::NeXus::File *file,
std::string &parameterStr, const Mantid::Kernel::NexusDescriptor &fileInfo,
std::string &parameterStr, const Nexus::NexusDescriptor &fileInfo,
const std::string &prefix) {
// TODO
// load sample and log info
Expand Down
8 changes: 4 additions & 4 deletions Framework/API/src/FileLoaderRegistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ template <typename T> struct DescriptorSetter {
// general one does nothing
void apply(std::shared_ptr<NexusFileLoader> & /*unused*/, std::shared_ptr<T> & /*unused*/) {}
};
template <> struct DescriptorSetter<Kernel::NexusDescriptor> {
void apply(std::shared_ptr<NexusFileLoader> &loader, const std::shared_ptr<Kernel::NexusDescriptor> &descriptor) {
template <> struct DescriptorSetter<Nexus::NexusDescriptor> {
void apply(std::shared_ptr<NexusFileLoader> &loader, const std::shared_ptr<Nexus::NexusDescriptor> &descriptor) {
loader->setFileInfo(descriptor);
}
};
Expand Down Expand Up @@ -114,7 +114,7 @@ void FileLoaderRegistryImpl::unsubscribe(const std::string &name, const int vers
const std::shared_ptr<IAlgorithm> FileLoaderRegistryImpl::chooseLoader(const std::string &filename) const {
using Kernel::FileDescriptor;
using Kernel::LegacyNexusDescriptor;
using Kernel::NexusDescriptor;
using Nexus::NexusDescriptor;
m_log.debug() << "Trying to find loader for '" << filename << "'\n";

IAlgorithm_sptr bestLoader;
Expand Down Expand Up @@ -162,7 +162,7 @@ const std::shared_ptr<IAlgorithm> FileLoaderRegistryImpl::chooseLoader(const std
bool FileLoaderRegistryImpl::canLoad(const std::string &algorithmName, const std::string &filename) const {
using Kernel::FileDescriptor;
using Kernel::LegacyNexusDescriptor;
using Kernel::NexusDescriptor;
using Nexus::NexusDescriptor;

// Check if it is in one of our lists
const bool legacynexus = (m_names[LegacyNexus].find(algorithmName) != m_names[LegacyNexus].end());
Expand Down
5 changes: 2 additions & 3 deletions Framework/API/src/LogManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ void LogManager::saveNexus(::NeXus::File *file, const std::string &group, bool k
* load any NXlog in the current open group.
*/
void LogManager::loadNexus(::NeXus::File * /*file*/, const std::string & /*group*/,
const Mantid::Kernel::NexusDescriptor & /*fileInfo*/, const std::string & /*prefix*/,
const Nexus::NexusDescriptor & /*fileInfo*/, const std::string & /*prefix*/,
bool /*keepOpen*/) {
throw std::runtime_error("LogManager::loadNexus should not be used");
}
Expand All @@ -644,8 +644,7 @@ void LogManager::loadNexus(::NeXus::File *file, const std::string &group, bool k
}
}

void LogManager::loadNexus(::NeXus::File *file, const Mantid::Kernel::NexusDescriptor &fileInfo,
const std::string &prefix) {
void LogManager::loadNexus(::NeXus::File *file, const Nexus::NexusDescriptor &fileInfo, const std::string &prefix) {

// Only load from NXlog entries
const auto &allEntries = fileInfo.getAllEntries();
Expand Down
8 changes: 3 additions & 5 deletions Framework/API/src/NexusFileLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ void NexusFileLoader::exec() {
// make sure the descriptor is initialized
if (!m_fileInfo) {
const std::string filename = this->getPropertyValue(this->getFilenamePropertyName());
m_fileInfo = std::make_shared<Mantid::Kernel::NexusDescriptor>(filename);
m_fileInfo = std::make_shared<Mantid::Nexus::NexusDescriptor>(filename);
}

// execute the algorithm as normal
Expand All @@ -29,13 +29,11 @@ NexusFileLoader::createChildAlgorithm(const std::string &name, const double star
}
return child;
}
void NexusFileLoader::setFileInfo(std::shared_ptr<Mantid::Kernel::NexusDescriptor> fileInfo) {
void NexusFileLoader::setFileInfo(std::shared_ptr<Nexus::NexusDescriptor> fileInfo) {
m_fileInfo = std::move(fileInfo);
}

const std::shared_ptr<Mantid::Kernel::NexusDescriptor> NexusFileLoader::getFileInfo() const noexcept {
return m_fileInfo;
}
const std::shared_ptr<Nexus::NexusDescriptor> NexusFileLoader::getFileInfo() const noexcept { return m_fileInfo; }

std::string NexusFileLoader::getFilenamePropertyName() const { return "Filename"; }

Expand Down
2 changes: 1 addition & 1 deletion Framework/API/src/Run.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ void Run::saveNexus(::NeXus::File *file, const std::string &group, bool keepOpen
* @param prefix indicates current group location in file (absolute name)
* @param keepOpen :: If true, then the file is left open after doing to load
*/
void Run::loadNexus(::NeXus::File *file, const std::string &group, const Mantid::Kernel::NexusDescriptor &fileInfo,
void Run::loadNexus(::NeXus::File *file, const std::string &group, const Nexus::NexusDescriptor &fileInfo,
const std::string &prefix, bool keepOpen) {

if (!group.empty()) {
Expand Down
8 changes: 4 additions & 4 deletions Framework/DataHandling/inc/MantidDataHandling/LoadEMU.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "MantidDataObjects/EventWorkspace.h"
#include "MantidGeometry/Instrument.h"
#include "MantidKernel/FileDescriptor.h"
#include "MantidKernel/NexusDescriptor.h"
#include "MantidNexus/NexusDescriptor.h"

namespace Mantid {
namespace DataHandling {
Expand Down Expand Up @@ -93,7 +93,7 @@ template <typename FD> class LoadEMU : public API::IFileLoader<FD> {
// the instantiation and linking did not behave consistently across platforms.

extern template class LoadEMU<Kernel::FileDescriptor>;
extern template class LoadEMU<Kernel::NexusDescriptor>;
extern template class LoadEMU<Nexus::NexusDescriptor>;

/** LoadEMUTar : Loads a merged ANSTO EMU Hdf and event file into a workspace.

Expand Down Expand Up @@ -153,14 +153,14 @@ Optional Properties:
</UL>

*/
class MANTID_DATAHANDLING_DLL LoadEMUHdf : public LoadEMU<Kernel::NexusDescriptor> {
class MANTID_DATAHANDLING_DLL LoadEMUHdf : public LoadEMU<Nexus::NexusDescriptor> {
public:
int version() const override;
const std::vector<std::string> seeAlso() const override;
const std::string category() const override;
const std::string name() const override;
const std::string summary() const override;
int confidence(Kernel::NexusDescriptor &descriptor) const override;
int confidence(Nexus::NexusDescriptor &descriptor) const override;

private:
void exec() override;
Expand Down
18 changes: 9 additions & 9 deletions Framework/DataHandling/inc/MantidDataHandling/LoadEventNexus.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
#include "MantidGeometry/Instrument/ParameterMap.h"
#include "MantidKernel/ConfigService.h"
#include "MantidKernel/Exception.h"
#include "MantidKernel/NexusDescriptor.h"
#include "MantidKernel/OptionalBool.h"
#include "MantidNexus/NexusDescriptor.h"

#include "MantidKernel/TimeSeriesProperty.h"

Expand Down Expand Up @@ -92,7 +92,7 @@ class MANTID_DATAHANDLING_DLL LoadEventNexus : public API::NexusFileLoader {
/// Category
const std::string category() const override { return "DataHandling\\Nexus"; }

int confidence(Kernel::NexusDescriptor &descriptor) const override;
int confidence(Nexus::NexusDescriptor &descriptor) const override;

template <typename T>
static std::shared_ptr<BankPulseTimes>
Expand All @@ -111,12 +111,12 @@ class MANTID_DATAHANDLING_DLL LoadEventNexus : public API::NexusFileLoader {

template <typename T>
static void loadEntryMetadata(const std::string &nexusfilename, T WS, const std::string &entry_name,
const Kernel::NexusDescriptor &descriptor);
const Nexus::NexusDescriptor &descriptor);

/// Load instrument from Nexus file if possible, else from IDF spacified by Nexus file
template <typename T>
static bool loadInstrument(const std::string &nexusfilename, T localWorkspace, const std::string &top_entry_name,
Algorithm *alg, const Kernel::NexusDescriptor *descriptor = nullptr);
Algorithm *alg, const Nexus::NexusDescriptor *descriptor = nullptr);

/// Load instrument for Nexus file
template <typename T>
Expand All @@ -126,7 +126,7 @@ class MANTID_DATAHANDLING_DLL LoadEventNexus : public API::NexusFileLoader {
/// Load instrument from IDF file specified by Nexus file
template <typename T>
static bool runLoadInstrument(const std::string &nexusfilename, T localWorkspace, const std::string &top_entry_name,
Algorithm *alg, const Kernel::NexusDescriptor *descriptor = nullptr);
Algorithm *alg, const Nexus::NexusDescriptor *descriptor = nullptr);

static void loadSampleDataISIScompatibility(::NeXus::File &file, EventWorkspaceCollection &WS);

Expand Down Expand Up @@ -361,7 +361,7 @@ void makeTimeOfFlightDataFuzzy(::NeXus::File &file, T localWorkspace, const std:
*/
template <typename T>
void adjustTimeOfFlightISISLegacy(::NeXus::File &file, T localWorkspace, const std::string &entry_name,
const std::string &classType, const Kernel::NexusDescriptor *descriptor = nullptr) {
const std::string &classType, const Nexus::NexusDescriptor *descriptor = nullptr) {
bool done = false;
// Go to the root, and then top entry
file.openPath("/");
Expand Down Expand Up @@ -474,7 +474,7 @@ void adjustTimeOfFlightISISLegacy(::NeXus::File &file, T localWorkspace, const s
template <typename T>
bool LoadEventNexus::runLoadInstrument(const std::string &nexusfilename, T localWorkspace,
const std::string &top_entry_name, Algorithm *alg,
const Kernel::NexusDescriptor *descriptor) {
const Nexus::NexusDescriptor *descriptor) {
std::string instrument;
std::string instFilename;

Expand Down Expand Up @@ -603,7 +603,7 @@ bool LoadEventNexus::runLoadInstrument(const std::string &nexusfilename, T local
/** Load the run number and other meta data from the given bank */
template <typename T>
void LoadEventNexus::loadEntryMetadata(const std::string &nexusfilename, T WS, const std::string &entry_name,
const Kernel::NexusDescriptor &descriptor) {
const Nexus::NexusDescriptor &descriptor) {
// Open the file
::NeXus::File file(nexusfilename);
file.openGroup(entry_name, "NXentry");
Expand Down Expand Up @@ -736,7 +736,7 @@ void LoadEventNexus::loadEntryMetadata(const std::string &nexusfilename, T WS, c
template <typename T>
bool LoadEventNexus::loadInstrument(const std::string &nexusfilename, T localWorkspace,
const std::string &top_entry_name, Algorithm *alg,
const Kernel::NexusDescriptor *descriptor) {
const Nexus::NexusDescriptor *descriptor) {

bool loadNexusInstrumentXML = true;
if (alg->existsProperty("LoadNexusInstrumentXML"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
#include "MantidAPI/IFileLoader.h"
#include "MantidDataHandling/DllConfig.h"
#include "MantidKernel/DateAndTime.h"
#include "MantidKernel/NexusDescriptor.h"
#include "MantidKernel/V3D.h"
#include "MantidNexus/NexusClasses_fwd.h"
#include "MantidNexus/NexusDescriptor.h"

namespace Mantid {
namespace DataHandling {
Expand All @@ -22,14 +22,14 @@ namespace DataHandling {

@date 15/05/17
*/
class MANTID_DATAHANDLING_DLL LoadILLDiffraction : public API::IFileLoader<Kernel::NexusDescriptor> {
class MANTID_DATAHANDLING_DLL LoadILLDiffraction : public API::IFileLoader<Nexus::NexusDescriptor> {
public:
const std::string name() const override;
int version() const override;
const std::vector<std::string> seeAlso() const override { return {"LoadNexus"}; }
const std::string category() const override;
const std::string summary() const override;
int confidence(Kernel::NexusDescriptor &descriptor) const override;
int confidence(Nexus::NexusDescriptor &descriptor) const override;
LoadILLDiffraction();

private:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@

#include "MantidAPI/IFileLoader.h"
#include "MantidDataHandling/DllConfig.h"
#include "MantidKernel/NexusDescriptor.h"
#include "MantidNexus/NexusClasses_fwd.h"
#include "MantidNexus/NexusDescriptor.h"

namespace Mantid {
namespace DataHandling {

/**
Loads an ILL IN16B nexus file into a Mantid workspace.
*/
class MANTID_DATAHANDLING_DLL LoadILLIndirect2 : public API::IFileLoader<Kernel::NexusDescriptor> {
class MANTID_DATAHANDLING_DLL LoadILLIndirect2 : public API::IFileLoader<Nexus::NexusDescriptor> {
public:
LoadILLIndirect2();
/// Returns a confidence value that this algorithm can load a file
int confidence(Kernel::NexusDescriptor &descriptor) const override;
int confidence(Nexus::NexusDescriptor &descriptor) const override;

/// Algorithm's version for identification. @see Algorithm::version
int version() const override { return 2; }
Expand Down
Loading