Ticket #75 (closed: fixed)

Opened 13 years ago

Last modified 5 years ago

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:1 Changed 13 years ago by Nick Draper

(In [626]) re #75 +,-,* and / can now take heterogenous workspaces as input

comment:2 Changed 13 years ago by Nick Draper

(In [627]) re #75 removed compiler warnings in gcc

comment:3 Changed 13 years ago by Nick Draper

  • Owner changed from Russell Taylor to Nick Draper

comment:4 Changed 13 years ago by Nick Draper

(In [628]) re #75 Added operator overloads so that now you can perform workspace +,-,*,/ operations within algoriths using the following syntax.

Worskspace_sptr wsResult = ws1+ws2; This should even be possible (untested) Worskspace_sptr wsResult = (ws1+ws2)/(ws1-ws2);

comment:5 Changed 13 years ago by Nick Draper

(In [629]) re #75 Added some missing files

comment:6 Changed 13 years ago by Nick Draper

(In [630]) re #75 This should even be possible (This is now tested!) Worskspace_sptr wsResult = (ws1+ws2)/(ws1-ws2);

comment:7 Changed 13 years ago by Nick Draper

(In [631]) re #75 build fixed

comment:8 Changed 13 years ago by Nick Draper

(In [633]) re #75 build fixed

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

(In [636]) re #75 removed extra qualification!

comment:11 Changed 13 years ago by Nick Draper

(In [637]) re #75 missed adding a file

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

(In [651]) Re #75 doxygen warning elimination

comment:15 Changed 13 years ago by Nick Draper

(In [652]) re #75 clear warning

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

Note: See TracTickets for help on using tickets.