Skip to content

Commit

Permalink
Be slightly more const-correct/safe. Re #3801.
Browse files Browse the repository at this point in the history
  • Loading branch information
RussellTaylor committed Nov 29, 2011
1 parent ef6d4db commit a6eaff3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include <map>
#else
#include <tr1/unordered_map>
#include "MantidDataObjects/GroupingWorkspace.h"
#endif

namespace Mantid
Expand Down Expand Up @@ -109,14 +108,14 @@ class DLLExport DiffractionFocussing2: public API::Algorithm
void determineRebinParameters();
int validateSpectrumInGroup(size_t wi);

/// Shared pointer to a mutable input workspace
API::MatrixWorkspace_sptr m_matrixInputW;
/// Shared pointer to the input workspace
API::MatrixWorkspace_const_sptr m_matrixInputW;

/// Grouping workspace with groups to build
Mantid::DataObjects::GroupingWorkspace_sptr groupWS;

/// Shared pointer to the event workspace
DataObjects::EventWorkspace_sptr m_eventW;
DataObjects::EventWorkspace_const_sptr m_eventW;


// This map does not need to be ordered, just a lookup for udet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ void DiffractionFocussing2::exec()
{
progress(0.01, "Reading grouping file");
IAlgorithm_sptr childAlg = createSubAlgorithm("CreateGroupingWorkspace");
childAlg->setProperty("InputWorkspace", m_matrixInputW);
childAlg->setProperty("InputWorkspace", boost::const_pointer_cast<MatrixWorkspace>(m_matrixInputW));
childAlg->setProperty("OldCalFilename", groupingFileName);
childAlg->executeAsSubAlg();
groupWS = childAlg->getProperty("OutputWorkspace");
Expand All @@ -148,7 +148,7 @@ void DiffractionFocussing2::exec()
double eventXMin = 0.;
double eventXMax = 0.;

m_eventW = boost::dynamic_pointer_cast<EventWorkspace>( m_matrixInputW );
m_eventW = boost::dynamic_pointer_cast<const EventWorkspace>( m_matrixInputW );
if (m_eventW != NULL)
{
if (getProperty("PreserveEvents"))
Expand Down Expand Up @@ -503,7 +503,7 @@ void DiffractionFocussing2::execEvent()
// When focussing in place, you can clear out old memory from the input one!
if (inPlace)
{
m_eventW->getEventList(wi).clear();
boost::const_pointer_cast<EventWorkspace>(m_eventW)->getEventList(wi).clear();
Mantid::API::MemoryManager::Instance().releaseFreeMemory();
}
}
Expand Down

0 comments on commit a6eaff3

Please sign in to comment.