Skip to content

Commit

Permalink
Re #11386 Added old commits into new branch
Browse files Browse the repository at this point in the history
  • Loading branch information
PranavBahuguna committed Aug 18, 2016
1 parent 6bd025c commit 775a8c5
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions Framework/DataObjects/src/MDBoxFlatTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,7 @@ void MDBoxFlatTree::saveWSGenericInfo(::NeXus::File *const file,
// because those cannot be resized).
file->putAttr("definition", ws->id());
file->putAttr("title", ws->getTitle());
file->putAttr("comment", ws->getComment());
// Save each dimension, as their XML representation
size_t nDim = ws->getNumDims();
for (size_t d = 0; d < nDim; d++) {
Expand Down
30 changes: 30 additions & 0 deletions Framework/MDAlgorithms/src/LoadMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,26 @@ 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"
if (this->getProperty("LoadHistory")) {
ws->history().loadNexus(m_file.get());
Expand Down Expand Up @@ -500,6 +520,16 @@ void LoadMD::doLoad(typename MDEventWorkspace<MDE, nd>::sptr ws) {
}
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"
if (this->getProperty("LoadHistory")) {
ws->history().loadNexus(m_file.get());
Expand Down
3 changes: 3 additions & 0 deletions Framework/MDAlgorithms/src/SaveMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,9 @@ void SaveMD::doSaveHisto(Mantid::DataObjects::MDHistoWorkspace_sptr ws) {
MDBoxFlatTree::saveAffineTransformMatricies(
file, boost::dynamic_pointer_cast<const IMDWorkspace>(ws));

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

// Check that the typedef has not been changed. The NeXus types would need
// changing if it does!
static_assert(sizeof(signal_t) == sizeof(double),
Expand Down
3 changes: 3 additions & 0 deletions Framework/MDAlgorithms/src/SaveMD2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ void SaveMD2::doSaveHisto(Mantid::DataObjects::MDHistoWorkspace_sptr ws) {
MDBoxFlatTree::saveAffineTransformMatricies(
file, boost::dynamic_pointer_cast<const IMDWorkspace>(ws));

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

// Check that the typedef has not been changed. The NeXus types would need
// changing if it does!
assert(sizeof(signal_t) == sizeof(double));
Expand Down

0 comments on commit 775a8c5

Please sign in to comment.