Ticket #75 (closed: fixed)
Extend basic workspace operations +,-,*,/ to allow hetergenous workspaces
Reported by: | Nick Draper | Owned by: | Nick Draper |
---|---|---|---|
Priority: | major | Milestone: | Iteration 5 |
Component: | Keywords: | ||
Cc: | Blocked By: | ||
Blocking: | Tester: |
Description
This involves extending the iterator class to loop over the smaller workspace repeatedly. You will need to consider and implement sensible rules to control if the operation is valid.
Also consider adding workspace operator overloads as unowned methods in the API namespace that will allow workspaces to be added using code such as W1= W2 + W3;
eg. (note this is not correct but gives an idea)
#include "MantidKernel/System.h" #include "MantidAPI/IAlgorithm.h" #include "MantidAPI/Workspace.h" #include "MantidKernel/Logger.h" #include "boost/shared_ptr.hpp" namespace Mantid { namespace API { // Workspace operator overloads typedef boost::shared_ptr<Workspace> wsp_ptr; wsp_ptr DLLExport operator+(const Workspace& lhs,const Workspace& rhs); wsp_ptr DLLExport operator-(const Workspace& lhs,const Workspace& rhs); wsp_ptr DLLExport operator*(const Workspace& lhs,const Workspace& rhs); wsp_ptr DLLExport operator/(const Workspace& lhs,const Workspace& rhs); } }
The operator overloads would
- Using the algorithmManager to get the correct algorithm as a child algorithm
- Set the input workspaces of the algorithm and execute it
- Extract and return the output workspace.
Change History
comment:9 Changed 13 years ago by Nick Draper
(In [635]) re #75 Altered Plus, Minus, Multiply and Divide to inherit from BinaryOperation and CommutativeBinaryOperation. BinaryOpHelper has been removed. Triple Iterator can now loop iterate in both orientations (although this has imposed a small (<10%) performance hit. The operations can now add heterogenous workspaces in both orientations.
comment:10 Changed 13 years ago by Nick Draper
comment:11 Changed 13 years ago by Nick Draper
comment:12 Changed 13 years ago by Nick Draper
- Status changed from new to closed
- Resolution set to fixed
comment:13 Changed 13 years ago by Nick Draper
- Status changed from closed to reopened
- Resolution fixed deleted
comment:14 Changed 13 years ago by Nick Draper
comment:15 Changed 13 years ago by Nick Draper
comment:16 Changed 13 years ago by Nick Draper
- Status changed from reopened to closed
- Resolution set to fixed
comment:17 Changed 5 years ago by Stuart Campbell
This ticket has been transferred to github issue 923
(In [626]) re #75 +,-,* and / can now take heterogenous workspaces as input