Skip to content

Commit

Permalink
title & comment read/write for MDHistoWorkspace in progress
Browse files Browse the repository at this point in the history
Refs #11386
  • Loading branch information
tgrbrooks committed Sep 9, 2015
1 parent 25634be commit 7959991
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Code/Mantid/Framework/MDAlgorithms/src/LoadMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,24 @@ void LoadMD::loadHisto() {
// Coordinate system
ws->setCoordinateSystem(m_coordSystem);

std::string title;
try{
m_file->getAttr("title", title);
} catch (std::exception&)
{
//Leave the title blank if error on loading
}
ws->setTitle(title);

std::string comment;
try{
m_file->getAttr("comment", comment);
} catch (std::exception&)
{
//Leave the comment blank if error on loading
}
ws->setComment(comment);

// Load the WorkspaceHistory "process"
ws->history().loadNexus(m_file.get());

Expand Down
3 changes: 3 additions & 0 deletions Code/Mantid/Framework/MDAlgorithms/src/SaveMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@ void SaveMD::doSaveHisto(Mantid::DataObjects::MDHistoWorkspace_sptr ws) {
// Save the algorithm history under "process"
ws->getHistory().saveNexus(file);

file->putAttr("title", ws->getTitle());
file->putAttr("comment", ws->getComment());

// Save all the ExperimentInfos
for (uint16_t i = 0; i < ws->getNumExperimentInfo(); i++) {
ExperimentInfo_sptr ei = ws->getExperimentInfo(i);
Expand Down

0 comments on commit 7959991

Please sign in to comment.