mantidproject / mantid

Main repository for Mantid code
https://www.mantidproject.org
GNU General Public License v3.0
211 stars 124 forks source link

Algorithms testing for input/output workspace equivalence via name instead of pointer #6710

Closed mantid-builder closed 9 years ago

mantid-builder commented 12 years ago

Original Reporter: Russell Taylor

Generally, algorithms should test whether the user has requested that the output workspace be the same as the input one via the pointer, not the name, as when called as a sub-algorithm the name may not be there. I recently fixed (http://trac.mantidproject.org/mantid/ticket/5860) SaveNexus, which was doing it wrong, and thought I'd look for other instances.

A search on ''getPropertyValue("InputWorkspace'' in algorithm source code finds the following. Not all these instances are necessarily incorrect, but I'm pretty sure some will be:

Algorithms/src/ChangeBinOffset.cpp:      if (getPropertyValue("InputWorkspace") == getPropertyValue("OutputWorkspace"))
Algorithms/src/ChangeLogTime.cpp:    msg `<< "InputWorkspace \'" << this->`getPropertyValue("InputWorkspace")
Algorithms/src/ConjoinWorkspaces.cpp:  AnalysisDataService::Instance().remove(getPropertyValue("InputWorkspace2"));
Algorithms/src/ConjoinWorkspaces.cpp:  AnalysisDataService::Instance().remove(getPropertyValue("InputWorkspace1"));
Algorithms/src/ConjoinWorkspaces.cpp:  AnalysisDataService::Instance().remove(getPropertyValue("InputWorkspace2"));
Algorithms/src/ConjoinWorkspaces.cpp:  declareProperty(new WorkspaceProperty`<>`("Output",getPropertyValue("InputWorkspace1"),Direction::Output));
Algorithms/src/ConjoinWorkspaces.cpp:  if (retval) AnalysisDataService::Instance().remove(getPropertyValue("InputWorkspace2"));
Algorithms/src/DiffractionEventCalibrateDetectors.cpp:      alg2->setPropertyValue("InputWorkspace", getPropertyValue("InputWorkspace"));
Algorithms/src/DiffractionFocussing2.cpp:  bool inPlace = (this->getPropertyValue("InputWorkspace") == this->getPropertyValue("OutputWorkspace"));
Algorithms/src/FilterByLogValue.cpp:  if (getPropertyValue("InputWorkspace") == getPropertyValue("OutputWorkspace"))
Algorithms/src/FindDeadDetectors.cpp:        childAlg->setPropertyValue( "InputWorkspace", getPropertyValue("InputWorkspace") );
Algorithms/src/GetEi.cpp:                              getPropertyValue("InputWorkspace") );
Algorithms/src/MaskBinsFromTable.cpp:        maskbins->setPropertyValue("InputWorkspace", this->getPropertyValue("InputWorkspace"));
Algorithms/src/ModeratorTzero.cpp:  if (getPropertyValue("InputWorkspace") == getPropertyValue("OutputWorkspace"))
Algorithms/src/MuonRemoveExpDecay.cpp:    if (getPropertyValue("InputWorkspace") != getPropertyValue("OutputWorkspace"))
Algorithms/src/NormaliseByCurrent.cpp:  if (getPropertyValue("InputWorkspace") != getPropertyValue("OutputWorkspace"))
Algorithms/src/Rebin.cpp:          subAlg->setPropertyValue("InputWorkspace", getPropertyValue("InputWorkspace"));
Algorithms/src/RenameWorkspace.cpp:  if (getPropertyValue("InputWorkspace") == getPropertyValue("OutputWorkspace"))
Algorithms/src/ResetNegatives.cpp:    alg->setPropertyValue("InputWorkspace", this->getPropertyValue("InputWorkspace"));
Algorithms/src/ResetNegatives.cpp:      if (this->getPropertyValue("InputWorkspace") == this->getPropertyValue("OutputWorkspace"))
Algorithms/src/ResetNegatives.cpp:        setPropertyValue("OutputWorkspace", this->getPropertyValue("InputWorkspace"));
Algorithms/src/ResetNegatives.cpp:        alg->setPropertyValue("InputWorkspace", this->getPropertyValue("InputWorkspace"));
Algorithms/src/SassenaFFT.cpp:  const std::string gwsName = this->getPropertyValue("InputWorkspace");
Algorithms/src/ScaleX.cpp:      if (getPropertyValue("InputWorkspace") == getPropertyValue("OutputWorkspace"))
Algorithms/src/ShiftLogTime.cpp:      msg `<< "InputWorkspace \'" << this->`getPropertyValue("InputWorkspace")
Algorithms/src/StripVanadiumPeaks.cpp:  if (inputEvent && (getPropertyValue("InputWorkspace") == getPropertyValue("OutputWorkspace")))
Algorithms/src/SumRowColumn.cpp:  childAlg->setPropertyValue( "InputWorkspace", getPropertyValue("InputWorkspace") );
Crystal/src/AnvredCorrection.cpp:  bool inPlace = (this->getPropertyValue("InputWorkspace") == this->getPropertyValue("OutputWorkspace"));
DataHandling/src/LoadLOQDistancesFromRaw.cpp:    alg->setPropertyValue("Workspace", getPropertyValue("InputWorkspace"));
DataHandling/src/LoadSampleDetailsFromRaw.cpp:    g_log.error() << "Cannot retrieve InputWorkspace " << getPropertyValue("InputWorkspace");
DataHandling/src/LoadSampleDetailsFromRaw.cpp:    throw Exception::NotFoundError("Cannot retrieve InputWorkspace", getPropertyValue("InputWorkspace"));
DataHandling/src/SaveRKH.cpp:    << " Workspace: " << getPropertyValue("InputWorkspace") << "\n";
DataHandling/src/SaveToSNSHistogramNexus.cpp:    m_inputWorkspaceName = getPropertyValue("InputWorkspace");
MPIAlgorithms/src/BroadcastWorkspace.cpp:      g_log.fatal("InputWorkspace '" + getPropertyValue("InputWorkspace") + "' not found in root process");
WorkflowAlgorithms/src/EQSANSReduce.cpp:  const std::string inputWSName = getPropertyValue("InputWorkspace");
WorkflowAlgorithms/src/SANSSensitivityCorrection.cpp:  const std::string inputWSName = getPropertyValue("InputWorkspace");
mantid-builder commented 9 years ago

This issue was originally trac ticket 5864