Commit 4838e45f authored by Simon Heybrock's avatar Simon Heybrock
Browse files

Re #12687 Workspace::clone() fixes for old boost w/o unique_ptr.

Boost < 1.53 does not support construction from a std::unique_ptr, so
for compatibility we must call clone().release() when dropping it to a
boost::shared_ptr.
parent 88769fe5
......@@ -97,11 +97,11 @@ void CloneWorkspace::exec() {
setProperty("OutputWorkspace",
boost::dynamic_pointer_cast<Workspace>(outputWS));
} else if (inputPeaks) {
PeaksWorkspace_sptr outputWS(inputPeaks->clone());
PeaksWorkspace_sptr outputWS(inputPeaks->clone().release());
setProperty("OutputWorkspace",
boost::dynamic_pointer_cast<Workspace>(outputWS));
} else if (tableWS) {
TableWorkspace_sptr outputWS(tableWS->clone());
TableWorkspace_sptr outputWS(tableWS->clone().release());
setProperty("OutputWorkspace",
boost::dynamic_pointer_cast<Workspace>(outputWS));
} else
......
......@@ -72,7 +72,7 @@ void CentroidPeaks::integrate() {
Mantid::DataObjects::PeaksWorkspace_sptr peakWS =
getProperty("OutPeaksWorkspace");
if (peakWS != inPeakWS)
peakWS = inPeakWS->clone();
peakWS.reset(inPeakWS->clone().release());
/// Radius to use around peaks
int PeakRadius = getProperty("PeakRadius");
......@@ -208,7 +208,7 @@ void CentroidPeaks::integrateEvent() {
Mantid::DataObjects::PeaksWorkspace_sptr peakWS =
getProperty("OutPeaksWorkspace");
if (peakWS != inPeakWS)
peakWS = inPeakWS->clone();
peakWS.reset(inPeakWS->clone().release());
/// Radius to use around peaks
int PeakRadius = getProperty("PeakRadius");
......
......@@ -79,7 +79,7 @@ void CombinePeaksWorkspaces::exec() {
}
// Copy the first workspace to our output workspace
PeaksWorkspace_sptr output(LHSWorkspace->clone());
PeaksWorkspace_sptr output(LHSWorkspace->clone().release());
// Get hold of the peaks in the second workspace
auto &rhsPeaks = RHSWorkspace->getPeaks();
......
......@@ -61,7 +61,7 @@ size_t calculateMaxClusters(IMDHistoWorkspace const *const ws,
*/
boost::shared_ptr<Mantid::API::IMDHistoWorkspace>
cloneInputWorkspace(IMDHistoWorkspace_sptr &inWS) {
IMDHistoWorkspace_sptr outWS = inWS->clone();
IMDHistoWorkspace_sptr outWS(inWS->clone().release());
// Initialize to zero.
PARALLEL_FOR_NO_WSP_CHECK()
......
......@@ -72,7 +72,7 @@ void DiffPeaksWorkspaces::exec() {
}
// Copy the first workspace to our output workspace
PeaksWorkspace_sptr output(LHSWorkspace->clone());
PeaksWorkspace_sptr output(LHSWorkspace->clone().release());
// Get hold of the peaks in the second workspace
auto &rhsPeaks = RHSWorkspace->getPeaks();
// Get hold of the peaks in the first workspace as we'll need to examine them
......
......@@ -151,7 +151,7 @@ void OptimizeCrystalPlacement::exec() {
PeaksWorkspace_sptr OutPeaks = getProperty("ModifiedPeaksWorkspace");
if (Peaks != OutPeaks) {
boost::shared_ptr<PeaksWorkspace> X(Peaks->clone());
boost::shared_ptr<PeaksWorkspace> X(Peaks->clone().release());
OutPeaks = X;
}
......
......@@ -122,8 +122,7 @@ void OptimizeLatticeForCellType::exec() {
}
// finally do the optimization
for (size_t i_run = 0; i_run < runWS.size(); i_run++) {
DataObjects::PeaksWorkspace_sptr peakWS(new PeaksWorkspace());
peakWS = runWS[i_run]->clone();
DataObjects::PeaksWorkspace_sptr peakWS(runWS[i_run]->clone().release());
AnalysisDataService::Instance().addOrReplace("_peaks", peakWS);
const DblMatrix UB = peakWS->sample().getOrientedLattice().getUB();
std::vector<double> lat(6);
......
......@@ -73,7 +73,7 @@ void PeakIntegration::exec() {
/// Output peaks workspace, create if needed
PeaksWorkspace_sptr peaksW = getProperty("OutPeaksWorkspace");
if (peaksW != inPeaksW)
peaksW = inPeaksW->clone();
peaksW.reset(inPeaksW->clone().release());
double qspan = 0.12;
m_IC = getProperty("IkedaCarpenterTOF");
......
......@@ -109,7 +109,7 @@ void SaveHKL::exec() {
// HKL will be overwritten by equivalent HKL but never seen by user
PeaksWorkspace_sptr peaksW = getProperty("OutputWorkspace");
if (peaksW != ws)
peaksW = ws->clone();
peaksW.reset(ws->clone().release());
double scaleFactor = getProperty("ScalePeaks");
double dMin = getProperty("MinDSpacing");
double wlMin = getProperty("MinWavelength");
......
......@@ -68,7 +68,7 @@ void SortHKL::exec() {
// HKL will be overwritten by equivalent HKL but never seen by user
PeaksWorkspace_sptr peaksW = getProperty("OutputWorkspace");
if (peaksW != InPeaksW)
peaksW = InPeaksW->clone();
peaksW.reset(InPeaksW->clone().release());
// Init or append to a table workspace
bool append = getProperty("Append");
......
......@@ -90,7 +90,7 @@ void SortPeaksWorkspace::exec() {
inputWS->getColumn(columnToSortBy);
if (inputWS != outputWS) {
outputWS = boost::shared_ptr<PeaksWorkspace>(inputWS->clone());
outputWS = boost::shared_ptr<PeaksWorkspace>(inputWS->clone().release());
}
// Perform the sorting.
......
......@@ -77,7 +77,7 @@ void TOFExtinction::exec() {
/// Output peaks workspace, create if needed
PeaksWorkspace_sptr peaksW = getProperty("OutputWorkspace");
if (peaksW != inPeaksW)
peaksW = inPeaksW->clone();
peaksW.reset(inPeaksW->clone().release());
const Kernel::Material *m_sampleMaterial =
&(inPeaksW->sample().getMaterial());
......
......@@ -60,7 +60,7 @@ public:
{
//Take a copy of the original peaks workspace.
PeaksWorkspace_sptr local = m_masterPeaks->clone();
PeaksWorkspace_sptr local(m_masterPeaks->clone().release());
//Clear the copies hkl values with some invalid values so that we'll know if we fail.
for(int i = 0; i < nPixels; i++)
{
......@@ -115,7 +115,7 @@ public:
void test_colinearPeaksThrows()
{
PeaksWorkspace_sptr temp = m_masterPeaks->clone();
PeaksWorkspace_sptr temp(m_masterPeaks->clone().release());
for(int i = 0; i < m_masterPeaks->getNumberPeaks(); i++)
{
......
......@@ -87,7 +87,7 @@ void SortTableWorkspace::exec() {
crt->second = (*asc) != 0;
}
API::ITableWorkspace_sptr outputWS(ws->clone());
API::ITableWorkspace_sptr outputWS(ws->clone().release());
outputWS->sort(criteria);
setProperty("OutputWorkspace", outputWS);
}
......
......@@ -84,7 +84,7 @@ void CentroidPeaksMD::integrate(typename MDEventWorkspace<MDE, nd>::sptr ws) {
Mantid::DataObjects::PeaksWorkspace_sptr peakWS =
getProperty("OutputWorkspace");
if (peakWS != inPeakWS)
peakWS = inPeakWS->clone();
peakWS.reset(inPeakWS->clone().release());
std::string CoordinatesToUseStr = getPropertyValue("CoordinatesToUse");
int CoordinatesToUse = ws->getSpecialCoordinateSystem();
......
......@@ -81,7 +81,7 @@ void CentroidPeaksMD2::integrate(typename MDEventWorkspace<MDE, nd>::sptr ws) {
Mantid::DataObjects::PeaksWorkspace_sptr peakWS =
getProperty("OutputWorkspace");
if (peakWS != inPeakWS)
peakWS = inPeakWS->clone();
peakWS.reset(inPeakWS->clone().release());
int CoordinatesToUse = ws->getSpecialCoordinateSystem();
......
......@@ -306,7 +306,7 @@ void IntegrateEllipsoids::exec() {
Mantid::DataObjects::PeaksWorkspace_sptr peak_ws =
getProperty("OutputWorkspace");
if (peak_ws != in_peak_ws) {
peak_ws = in_peak_ws->clone();
peak_ws.reset(in_peak_ws->clone().release());
}
double radius = getProperty("RegionRadius");
int numSigmas = getProperty("NumSigmas");
......
......@@ -164,7 +164,7 @@ void IntegratePeaksMD::integrate(typename MDEventWorkspace<MDE, nd>::sptr ws) {
Mantid::DataObjects::PeaksWorkspace_sptr peakWS =
getProperty("OutputWorkspace");
if (peakWS != inPeakWS)
peakWS = inPeakWS->clone();
peakWS.reset(inPeakWS->clone().release());
/// Value of the CoordinatesToUse property.
std::string CoordinatesToUseStr = getPropertyValue("CoordinatesToUse");
......
......@@ -171,7 +171,7 @@ void IntegratePeaksMD2::integrate(typename MDEventWorkspace<MDE, nd>::sptr ws) {
Mantid::DataObjects::PeaksWorkspace_sptr peakWS =
getProperty("OutputWorkspace");
if (peakWS != inPeakWS)
peakWS = inPeakWS->clone();
peakWS.reset(inPeakWS->clone().release());
// This only fails in the unit tests which say that MaskBTP is not registered
try {
runMaskDetectors(inPeakWS, "Tube", "edges");
......
......@@ -117,7 +117,7 @@ SmoothMD::hatSmooth(IMDHistoWorkspace_const_sptr toSmooth,
uint64_t nPoints = toSmooth->getNPoints();
Progress progress(this, 0, 1, size_t(double(nPoints) * 1.1));
// Create the output workspace.
IMDHistoWorkspace_sptr outWS = toSmooth->clone();
IMDHistoWorkspace_sptr outWS(toSmooth->clone().release());
progress.reportIncrement(
size_t(double(nPoints) * 0.1)); // Report ~10% progress
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment