Skip to content

Commit

Permalink
refs #5710 this mainly fixes the issue.
Browse files Browse the repository at this point in the history
The performance of the new code is not worth and even better (multithreading part) wrt the old code.
  • Loading branch information
abuts committed Aug 21, 2012
1 parent 2202e03 commit 71fe488
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class ConvertToMDEventsWS<ConvertToMD::EventWSType,Q,MODE,CONV,Sample>: public C
//ts->push( new FunctionTask( func, cost) );

// Keep a running total of how many events we've added
if (bc->shouldSplitBoxes(n_added_events,nEventsInWS,lastNumBoxes))
if (bc->shouldSplitBoxes(nEventsInWS,n_added_events,lastNumBoxes))
{
// Do all the adding tasks
// tp.joinAll();
Expand All @@ -126,6 +126,7 @@ class ConvertToMDEventsWS<ConvertToMD::EventWSType,Q,MODE,CONV,Sample>: public C

// Count the new # of boxes.
lastNumBoxes = pWSWrapper->pWorkspace()->getBoxController()->getTotalNumMDBoxes();
n_added_events=0;
pProg->report(wi);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class ConvertToMDEventsWS<ConvertToMD::Ws2DHistoType,Q,MODE,CONV,Sample>: public
// reset buffer counts
n_coordinates=0;
n_buf_events=0;
if (bc->shouldSplitBoxes(n_added_events,nEventsInWS,lastNumBoxes))
if (bc->shouldSplitBoxes(nEventsInWS,n_added_events,lastNumBoxes))
{
// Do all the adding tasks
// tp.joinAll();
Expand All @@ -166,8 +166,9 @@ class ConvertToMDEventsWS<ConvertToMD::Ws2DHistoType,Q,MODE,CONV,Sample>: public
//if (ts->size() > 0) tp.joinAll();
// Count the new # of boxes.
lastNumBoxes = pWSWrapper->pWorkspace()->getBoxController()->getTotalNumMDBoxes();
n_added_events=0;
pProg->report(i);
}
pProg->report(i);
}
#else
n_coordinates=0;
Expand Down
1 change: 1 addition & 0 deletions Code/Mantid/Framework/MDEvents/src/ConvToMDEventsWS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ namespace Mantid

// Count the new # of boxes.
lastNumBoxes = m_OutWSWrapper->pWorkspace()->getBoxController()->getTotalNumMDBoxes();
eventsAdded = 0;
pProgress->report(wi);
}

Expand Down
12 changes: 7 additions & 5 deletions Code/Mantid/Framework/MDEvents/src/ConvToMDHistoWS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ size_t ConvToMDHistoWS::conversionChunk(size_t startSpectra)
void ConvToMDHistoWS::runConversion(API::Progress *pProgress)
{
// counder for the number of events
size_t n_added_events(0);
size_t nAddedEvents(0);
//
Mantid::API::BoxController_sptr bc = m_OutWSWrapper->pWorkspace()->getBoxController();
size_t lastNumBoxes = bc->getTotalNumMDBoxes();
Expand Down Expand Up @@ -157,10 +157,10 @@ void ConvToMDHistoWS::runConversion(API::Progress *pProgress)
for (size_t i = 0; i < nValidSpectra; i+=m_spectraChunk)
{
size_t n_thread_ev = this->conversionChunk(i);
n_added_events+=n_thread_ev;
nEventsInWS +=n_thread_ev;
nAddedEvents+=n_thread_ev;
nEventsInWS +=n_thread_ev;

if (bc->shouldSplitBoxes(nEventsInWS,n_added_events, lastNumBoxes))
if (bc->shouldSplitBoxes(nEventsInWS,nAddedEvents,lastNumBoxes))
{
// Do all the adding tasks
tp.joinAll();
Expand All @@ -169,8 +169,10 @@ void ConvToMDHistoWS::runConversion(API::Progress *pProgress)
if (ts->size() > 0) tp.joinAll();
// Count the new # of boxes.
lastNumBoxes = m_OutWSWrapper->pWorkspace()->getBoxController()->getTotalNumMDBoxes();
nAddedEvents = 0;
pProgress->report(i);
}
pProgress->report(i);

//if (m_OutWSWrapper->ifNeedsSplitting())
//{
// // Do all the adding tasks
Expand Down

0 comments on commit 71fe488

Please sign in to comment.