Ticket #6257 (assigned)

Opened 8 years ago

Last modified 5 years ago

WorkspaceGroup pointer cannot be used as input to an algorithm

Reported by: Martyn Gigg Owned by: Martyn Gigg
Priority: major Milestone: Backlog
Component: Framework Keywords: Maintenance
Cc: Blocked By:
Blocking: #8856 Tester:

Description (last modified by Russell Taylor) (diff)

Basically this means that you can't use a pointer to a WorkspaceGroup in a child algorithms the WorkspaceProperty won't accept it.

Sample code that won't work:

    Mantid::API::FrameworkManager::Instance().exec("Load", 4, "Filename", "CSP79590.raw", "OutputWorkspace", "test_ws");

    auto ws = Mantid::API::AnalysisDataService::Instance().retrieveWS<Mantid::API::Workspace>("test_ws");

    Mantid::API::IAlgorithm * alg = Mantid::API::FrameworkManager::Instance().createAlgorithm("Scale");
    alg->initialize();
    alg->setChild(true);
    alg->setProperty("InputWorkspace",ws);
    alg->setPropertyValue("OutputWorkspace","__anonymous");
    alg->execute();

The problem lies with the WorkspaceProperty around these lines (253-261):

            try 
            {
              wksp = AnalysisDataService::Instance().retrieve(m_workspaceName);
            }
            catch( Kernel::Exception::NotFoundError &)
            {
              // Check to see if the workspace is not logged with the ADS because it is optional.
              return isOptionalWs();
            }

They correctly check for a group but the only way to satisfy the property is to have a string value, which it won't have if its been set by pointer.

Change History

comment:1 Changed 8 years ago by Nick Draper

  • Status changed from new to assigned
  • Owner set to Martyn Gigg

comment:2 Changed 8 years ago by Martyn Gigg

  • Milestone changed from Release 2.4 to Release 2.5

comment:3 Changed 7 years ago by Nick Draper

  • Milestone changed from Release 2.5 to Release 2.6

Moved to r2.6 at the end of r2.5

comment:4 Changed 7 years ago by Martyn Gigg

  • Milestone changed from Release 2.6 to Release 2.7

Batch move to 2.7

comment:5 Changed 7 years ago by Nick Draper

  • Status changed from assigned to new

comment:6 Changed 7 years ago by Nick Draper

  • Milestone changed from Release 2.7 to Backlog

comment:7 Changed 7 years ago by Nick Draper

  • Component changed from Mantid to Framework

comment:8 Changed 7 years ago by Russell Taylor

  • Description modified (diff)

I came across this while looking at #8226 and really not liking the specific rather than general solution implemented there.

It seems like what we need to do here is somehow enable the WorkspaceProperty to hold the value as a base class pointer. I guess this is either by changing the type of PropertyWithValue::m_value (very tricky) or by adding a member (which then leads to holding the value in two places and having to keep them synchronized).

comment:9 Changed 7 years ago by Russell Taylor

  • Blocking 8856 added

comment:10 Changed 7 years ago by Nick Draper

  • Status changed from new to assigned

Bulk move to assigned at the introduction of the triage step

comment:11 Changed 6 years ago by Martyn Gigg

  • Keywords Maintenance added
  • Milestone changed from Backlog to Release 3.3

comment:12 Changed 6 years ago by Nick Draper

Moved to the backlog at the code freeze of R3.3

comment:13 Changed 6 years ago by Nick Draper

  • Milestone changed from Release 3.3 to Backlog

comment:14 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 7103

Note: See TracTickets for help on using tickets.