Skip to content

Commit cea1d64

Browse files
Merge release-next into ornl-next
2 parents f933de7 + 6b3f244 commit cea1d64

File tree

1 file changed

+2
-24
lines changed

1 file changed

+2
-24
lines changed

Framework/PythonInterface/mantid/api/src/Exports/BinaryOperations.cpp

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -130,34 +130,13 @@ ResultType performBinaryOp(const LHSType lhs, const RHSType rhs, const std::stri
130130
template <typename LHSType, typename ResultType>
131131
ResultType performBinaryOpWithDouble(const LHSType inputWS, const double value, const std::string &op,
132132
const std::string &name, bool inplace, bool reverse) {
133-
// RAII struct to add/remove workspace from ADS
134-
struct ScopedADSEntry {
135-
ScopedADSEntry(const std::string &entryName, const MatrixWorkspace_sptr &value) : name(entryName) {
136-
ads.addOrReplace(entryName, value);
137-
}
138-
~ScopedADSEntry() { ads.remove(name); }
139-
140-
const std::string &name;
141-
API::AnalysisDataServiceImpl &ads = API::AnalysisDataService::Instance();
142-
};
143-
144-
// In order to recreate a history record of the final binary operation
145-
// there must be a record of the creation of the single value workspace used
146-
// on the RHS here. This is achieved by running CreateSingleValuedWorkspace
147-
// algorithm and adding the output workspace to the ADS. Adding the output
148-
// to the ADS is critical so that workspace.name() is updated, by the ADS, to
149-
// return the same string. WorkspaceProperty<TYPE>::createHistory() then
150-
// records the correct workspace name for input into the final binary
151-
// operation rather than creating a temporary name.
133+
152134
auto alg = API::AlgorithmManager::Instance().createUnmanaged("CreateSingleValuedWorkspace");
153135
alg->setChild(false);
154-
// we manually store the workspace as it's easier to retrieve the correct
155-
// type from alg->getProperty rather than calling the ADS again and casting
156136
alg->setAlwaysStoreInADS(false);
157137
alg->initialize();
158138
alg->setProperty<double>("DataValue", value);
159-
const std::string tmpName("__python_binary_op_single_value");
160-
alg->setPropertyValue("OutputWorkspace", tmpName);
139+
alg->setPropertyValue("OutputWorkspace", "python_binary_op_single_value");
161140
{ // instantiate releaseGIL in limited scope to allow for repeat in 'performBinaryOp'
162141
ReleaseGlobalInterpreterLock releaseGIL;
163142
alg->execute();
@@ -170,7 +149,6 @@ ResultType performBinaryOpWithDouble(const LHSType inputWS, const double value,
170149
throw std::runtime_error("performBinaryOp: Error in execution of "
171150
"CreateSingleValuedWorkspace");
172151
}
173-
ScopedADSEntry removeOnExit(tmpName, singleValue);
174152
ResultType result =
175153
performBinaryOp<LHSType, MatrixWorkspace_sptr, ResultType>(inputWS, singleValue, op, name, inplace, reverse);
176154
return result;

0 commit comments

Comments
 (0)