Skip to content

Commit

Permalink
Pass filename instead of pointer to FileBackedExperimentInfo
Browse files Browse the repository at this point in the history
Refs #11220
  • Loading branch information
martyngigg committed Mar 4, 2015
1 parent 3e342c6 commit 8fb0da1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Code/Mantid/Framework/MDAlgorithms/src/LoadMD.cpp
Expand Up @@ -180,7 +180,7 @@ void LoadMD::exec() {

// Now the ExperimentInfo
bool lazyLoadExpt = fileBacked;
MDBoxFlatTree::loadExperimentInfos(m_file.get(), ws, lazyLoadExpt);
MDBoxFlatTree::loadExperimentInfos(m_file.get(), m_filename, ws, lazyLoadExpt);

// Wrapper to cast to MDEventWorkspace then call the function
CALL_MDEVENT_FUNCTION(this->doLoad, ws);
Expand Down Expand Up @@ -231,7 +231,7 @@ void LoadMD::loadHisto() {
MDHistoWorkspace_sptr ws(new MDHistoWorkspace(m_dims));

// Now the ExperimentInfo
MDBoxFlatTree::loadExperimentInfos(m_file.get(), ws);
MDBoxFlatTree::loadExperimentInfos(m_file.get(), m_filename, ws);

// Load the WorkspaceHistory "process"
ws->history().loadNexus(m_file.get());
Expand Down
Expand Up @@ -122,7 +122,7 @@ class DLLExport MDBoxFlatTree {
/// name of the event type
std::string m_eventType;
/// shared pointer to multiple experiment info stored within the workspace
boost::shared_ptr<Mantid::API::MultipleExperimentInfos> m_mEI;
boost::shared_ptr<API::MultipleExperimentInfos> m_mEI;

public:
static ::NeXus::File *createOrOpenMDWSgroup(const std::string &fileName,
Expand All @@ -137,7 +137,8 @@ class DLLExport MDBoxFlatTree {
// function
static void loadExperimentInfos(
::NeXus::File *const file,
boost::shared_ptr<Mantid::API::MultipleExperimentInfos> ei,
const std::string & filename,
boost::shared_ptr<API::MultipleExperimentInfos> ei,
bool lazy = false);

static void saveAffineTransformMatricies(::NeXus::File *const file,
Expand Down
8 changes: 4 additions & 4 deletions Code/Mantid/Framework/MDEvents/src/MDBoxFlatTree.cpp
Expand Up @@ -285,7 +285,7 @@ void MDBoxFlatTree::loadBoxStructure(const std::string &fileName, int &nDim,
m_mEI = boost::make_shared<Mantid::API::MultipleExperimentInfos>(
Mantid::API::MultipleExperimentInfos());

loadExperimentInfos(hFile.get(), m_mEI);
loadExperimentInfos(hFile.get(), fileName, m_mEI);
}

// close workspace group
Expand Down Expand Up @@ -395,13 +395,13 @@ void MDBoxFlatTree::saveExperimentInfos(::NeXus::File *const file,
*
* @param file :: the pointer to the properly opened nexus data file where the
*experiment info groups can be found.
* @param filename :: the filename of the opened NeXus file. Use for the file-backed case
* @param mei :: MDEventWorkspace/MDHisto to load experiment infos to or rather
*pointer to the base class of this workspaces (which is an experimentInfo)
* @param lazy :: If true, use the FileBackedExperimentInfo class to only load
* the data from the file when it is requested
*/
void MDBoxFlatTree::loadExperimentInfos(
::NeXus::File *const file,
void MDBoxFlatTree::loadExperimentInfos(::NeXus::File *const file, const std::string &filename,
boost::shared_ptr<Mantid::API::MultipleExperimentInfos> mei,
bool lazy) {
// First, find how many experimentX blocks there are
Expand Down Expand Up @@ -449,7 +449,7 @@ void MDBoxFlatTree::loadExperimentInfos(
std::string groupName = "experiment" + Kernel::Strings::toString(*itr);
if (lazy) {
auto ei = boost::make_shared<API::FileBackedExperimentInfo>(
file, file->getPath() + "/" + groupName);
filename, file->getPath() + "/" + groupName);
// And add it to the mutliple experiment info.
mei->addExperimentInfo(ei);
}
Expand Down

0 comments on commit 8fb0da1

Please sign in to comment.