Skip to content

Commit

Permalink
refs #6449 Warnings and avoid read/write empty NeXus
Browse files Browse the repository at this point in the history
  • Loading branch information
abuts committed Apr 16, 2013
1 parent 3824183 commit c5c6005
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Code/Mantid/Framework/MDAlgorithms/src/MergeMDFiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ namespace MDAlgorithms

uint64_t MergeMDFiles::loadEventsFromSubBoxes(API::IMDNode *TargetBox)
{
/// the events which are in the
/// get rid of the events and averages which are in the memory erroneously (from clonning)
TargetBox->clear();

uint64_t nBoxEvents(0);
Expand All @@ -184,11 +184,11 @@ namespace MDAlgorithms

uint64_t fileLocation = m_fileComponentsStructure[iw].getEventIndex()[2*ID+0];
size_t numFileEvents = static_cast<size_t>(m_fileComponentsStructure[iw].getEventIndex()[2*ID+1]);
if(numFileEvents==0)continue;
//TODO: it is possible to avoid the reallocation of the memory at each load
TargetBox->loadAndAddFrom(m_EventLoader[iw],fileLocation,numFileEvents);

if (numFileEvents == 0) continue;
nBoxEvents += numFileEvents;
nBoxEvents += numFileEvents;
}

return nBoxEvents;
Expand Down
5 changes: 4 additions & 1 deletion Code/Mantid/Framework/MDEvents/src/MDBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -841,6 +841,8 @@ namespace MDEvents
TMDE(
void MDBox)::saveAt(API::IBoxControllerIO *const FileSaver, uint64_t position)const
{
if(data.empty())return;

if(!FileSaver)
throw(std::invalid_argument(" Needs defined file saver to save data to it"));
if(!FileSaver->isOpened())
Expand Down Expand Up @@ -870,12 +872,13 @@ namespace MDEvents
TMDE(
void MDBox)::loadAndAddFrom(API::IBoxControllerIO *const FileSaver, uint64_t filePosition, size_t nEvents)
{
if(nEvents==0)return;

if(!FileSaver)
throw(std::invalid_argument(" Needs defined file saver to load data using it"));
if(!FileSaver->isOpened())
throw(std::invalid_argument(" The data file has to be opened to use box loadAndAddFrom function"));


std::vector<coord_t> TableData;
FileSaver->loadBlock(TableData,filePosition,nEvents);
this->m_dataMutex.lock();
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/MDEvents/src/MDEventFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include "MantidMDEvents/MDBoxIterator.h"
#include "MantidMDEvents/MDEvent.h"
#include "MantidMDEvents/MDLeanEvent.h"
#include "MantidMDEvents/MDBoxToChange.h"
//#include "MantidMDEvents/MDBoxToChange.h"

// We need to include the .cpp files so that the declarations are picked up correctly. Weird, I know.
// See http://www.parashift.com/c++-faq-lite/templates.html#faq-35.13
Expand Down

0 comments on commit c5c6005

Please sign in to comment.