Skip to content

Commit

Permalink
Refs #4024 trying to fix this nexus bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Janik Zikovsky committed Nov 8, 2011
1 parent 53cda40 commit 6ba71bc
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
14 changes: 7 additions & 7 deletions Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,14 @@ namespace MDEvents
*/
static void prepareNexusData(::NeXus::File * file, const uint64_t chunkSize)
{
std::vector<int> dims(2,0);
std::vector<int64_t> dims(2,0);
dims[0] = NX_UNLIMITED;
// One point per dimension, plus signal, plus error, plus runIndex, plus detectorID = nd+4
dims[1] = (nd)+4;

// Now the chunk size.
std::vector<int> chunk(dims);
chunk[0] = int(chunkSize);
std::vector<int64_t> chunk(dims);
chunk[0] = int64_t(chunkSize);

// Make and open the data
file->makeCompData("event_data", ::NeXus::FLOAT64, dims, ::NeXus::NONE, chunk, true);
Expand Down Expand Up @@ -270,11 +270,11 @@ namespace MDEvents
double * data = new double[numEvents*(nd+4)];

// Start/size descriptors
std::vector<int> start(2,0);
start[0] = int(indexStart); //TODO: What if # events > size of int32???
std::vector<int64_t> start(2,0);
start[0] = int64_t(indexStart);

std::vector<int> size(2,0);
size[0] = int(numEvents);
std::vector<int64_t> size(2,0);
size[0] = int64_t(numEvents);
size[1] = nd+4;

// Get the slab into the allocated data
Expand Down
14 changes: 7 additions & 7 deletions Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDLeanEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,13 @@ namespace MDEvents
*/
static void prepareNexusData(::NeXus::File * file, const uint64_t chunkSize)
{
std::vector<int> dims(2,0);
std::vector<int64_t> dims(2,0);
dims[0] = NX_UNLIMITED;
dims[1] = (nd)+2; // One point per dimension, plus signal, plus error = nd+2

// Now the chunk size.
std::vector<int> chunk(dims);
chunk[0] = int(chunkSize);
std::vector<int64_t> chunk(dims);
chunk[0] = int64_t(chunkSize);

// Make and open the data
file->makeCompData("event_data", ::NeXus::FLOAT64, dims, ::NeXus::NONE, chunk, true);
Expand Down Expand Up @@ -349,11 +349,11 @@ namespace MDEvents
double * data = new double[numEvents*(nd+2)];

// Start/size descriptors
std::vector<int> start(2,0);
start[0] = int(indexStart); //TODO: What if # events > size of int32???
std::vector<int64_t> start(2,0);
start[0] = int64_t(indexStart);

std::vector<int> size(2,0);
size[0] = int(numEvents);
std::vector<int64_t> size(2,0);
size[0] = int64_t(numEvents);
size[1] = nd+2;

// Get the slab into the allocated data
Expand Down
2 changes: 2 additions & 0 deletions Code/Mantid/Framework/MDEvents/src/SaveMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ namespace MDEvents
// Save the index
box_event_index[id*2] = mdbox->getFileIndexStart();
box_event_index[id*2+1] = mdbox->getFileNumEvents();
std::cout << file->getInfo().dims[0] << " size of event_data (updating) \n";
}
else
{
Expand All @@ -291,6 +292,7 @@ namespace MDEvents
start += numEvents;
}

std::cout << file->getInfo().dims[0] << " size of event_data (writing) \n";
mdbox->releaseEvents();
}
}
Expand Down
1 change: 1 addition & 0 deletions Code/Mantid/Framework/MDEvents/test/SaveMDTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ class SaveMDTest : public CxxTest::TestSuite
// ws->getBoxController()->closeFile();

// Since there are 330 events, the file needs to be that big (or bigger).
ws->getBoxController()->getFile()->openData("event_data");
TS_ASSERT_LESS_THAN( 330, ws->getBoxController()->getFile()->getInfo().dims[0]);

TSM_ASSERT("File back-end no longer needs updating.", !ws->fileNeedsUpdating() );
Expand Down

0 comments on commit 6ba71bc

Please sign in to comment.