Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend basic workspace operations +,-,*,/ to allow hetergenous workspaces #923

Closed
NickDraper opened this issue Jan 9, 2008 · 1 comment
Assignees
Milestone

Comments

@NickDraper
Copy link
Contributor

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`` 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.

@NickDraper
Copy link
Contributor Author

This issue was originally trac ticket 75

@NickDraper NickDraper self-assigned this Jun 3, 2015
@NickDraper NickDraper added this to the Iteration 5 milestone Jun 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant