@@ -130,34 +130,13 @@ ResultType performBinaryOp(const LHSType lhs, const RHSType rhs, const std::stri
130
130
template <typename LHSType, typename ResultType>
131
131
ResultType performBinaryOpWithDouble (const LHSType inputWS, const double value, const std::string &op,
132
132
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
+
152
134
auto alg = API::AlgorithmManager::Instance ().createUnmanaged (" CreateSingleValuedWorkspace" );
153
135
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
156
136
alg->setAlwaysStoreInADS (false );
157
137
alg->initialize ();
158
138
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" );
161
140
{ // instantiate releaseGIL in limited scope to allow for repeat in 'performBinaryOp'
162
141
ReleaseGlobalInterpreterLock releaseGIL;
163
142
alg->execute ();
@@ -170,7 +149,6 @@ ResultType performBinaryOpWithDouble(const LHSType inputWS, const double value,
170
149
throw std::runtime_error (" performBinaryOp: Error in execution of "
171
150
" CreateSingleValuedWorkspace" );
172
151
}
173
- ScopedADSEntry removeOnExit (tmpName, singleValue);
174
152
ResultType result =
175
153
performBinaryOp<LHSType, MatrixWorkspace_sptr, ResultType>(inputWS, singleValue, op, name, inplace, reverse);
176
154
return result;
0 commit comments