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

Classes in DataObjects/MDEVents layers need exposing to Python #10649

Closed
1 task done
martyngigg opened this issue Jul 3, 2014 · 1 comment · Fixed by #12839
Closed
1 task done

Classes in DataObjects/MDEVents layers need exposing to Python #10649

martyngigg opened this issue Jul 3, 2014 · 1 comment · Fixed by #12839
Assignees
Milestone

Comments

@martyngigg
Copy link
Member

This issue was originally TRAC 9807

This ticket is blocked by :

This ticket is blocks : TRAC8943

When trying to implement http://trac.mantidproject.org/mantid/ticket/8943 it was found that the current mechanism for trying to get boost python to return the correct type for the actual workspace type was flawed, as it can never handle multiple inheritance.

The only way to get the correct type back in Python is to expose all of the concrete Workspace types and just let boost.python do the heavy lifting. This will currently require classes from DataObjects & MDEvents to be exported

The only question is whether to have a single compiled Python _plugins module that exports all from each of the C++ libraries or one Python module for each plugin.


Keywords: Maintenance

@martyngigg
Copy link
Member Author

@NickDraper (2014-12-08T10:25:34):
Moved to the backlog at the code freeze of R3.3


@martyngigg (2015-05-01T15:10:06):
Now that MDEvents no longer exists we only need to do this for DataObjects


@martyngigg (2015-05-02T22:12:11):
Added DataObjects as a submodule for the Python package

This will allow boost.python to take care of automatically downcasting
Workspace objects to the correct type without manual intervention
Refs http://trac.mantidproject.org/mantid/ticket/9807

e6d750d


@martyngigg (2015-05-25T20:45:25):
Checkpoint removing downcasting policies

The tests still don't work yet.
Refs http://trac.mantidproject.org/mantid/ticket/9807

2167ec8


@martyngigg (2015-06-01T10:57:59):
Added DataObjects as a submodule for the Python package

This will allow boost.python to take care of automatically downcasting
Workspace objects to the correct type without manual intervention
Refs http://trac.mantidproject.org/mantid/ticket/9807

e6d750d


@martyngigg (2015-06-01T10:57:59):
Checkpoint removing downcasting policies

The tests still don't work yet.
Refs http://trac.mantidproject.org/mantid/ticket/9807

2167ec8


@martyngigg (2015-06-01T10:57:59):
Remove all of the Python downcasting framework

This should now happen behind the scenes in Boost Python.
Refs http://trac.mantidproject.org/mantid/ticket/9807

12df5ed


@martyngigg (2015-06-01T10:57:59):
Add a simple ToWeakPtr return value policy

Improve WorkspaceGroup test to cover the use case.
Refs http://trac.mantidproject.org/mantid/ticket/9807

0a6b102

@martyngigg martyngigg added Python Maintenance Unassigned issues to be addressed in the next maintenance period. labels Jun 3, 2015
@martyngigg martyngigg self-assigned this Jun 3, 2015
@martyngigg martyngigg added this to the Release 3.5 milestone Jun 3, 2015
@martyngigg martyngigg removed the Maintenance Unassigned issues to be addressed in the next maintenance period. label Jun 16, 2015
martyngigg added a commit that referenced this issue Jun 16, 2015
Conflicts:
	Code/Mantid/Framework/PythonInterface/mantid/api/src/Algorithms/RunPythonScript.cpp
	Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/AnalysisDataService.cpp
	Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/BinaryOperations.cpp
	Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/IEventWorkspace.cpp
	Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/IMDEventWorkspace.cpp
	Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/IMDHistoWorkspace.cpp
	Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/IPeaksWorkspace.cpp
	Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/ITableWorkspace.cpp
	Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/MDGeometry.cpp
	Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/MatrixWorkspace.cpp
	Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/Workspace.cpp
	Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/WorkspaceFactory.cpp
	Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/WorkspaceGroup.cpp
	Code/Mantid/Framework/PythonInterface/mantid/kernel/src/Exports/PropertyWithValue.cpp
	Code/Mantid/Framework/PythonInterface/mantid/kernel/src/Registry/DowncastRegistry.cpp

Refs #10649
martyngigg added a commit that referenced this issue Jun 16, 2015
martyngigg added a commit that referenced this issue Jun 16, 2015
martyngigg added a commit that referenced this issue Jun 16, 2015
martyngigg added a commit that referenced this issue Jun 17, 2015
By default boost will try to construct a new pointer type when extracting
a C++ type from a Python object. We need to ensure we get back the same
pointer object so we use a reference type in ExtractWorkspace. This then
requires that all return types that convert to a Python object return
a common Workspace_sptr or the reference extraction fails.
Refs #10649
martyngigg added a commit that referenced this issue Jun 17, 2015
martyngigg added a commit that referenced this issue Jun 17, 2015
Clang and MSVC won't compile with the additional dependencies.
Gcc does though...
Refs #10649
martyngigg added a commit that referenced this issue Jun 17, 2015
martyngigg added a commit that referenced this issue Jun 17, 2015
Changes are mainly due to the end types in Python being
slightly different.
Refs #10649
martyngigg added a commit that referenced this issue Jun 17, 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

Successfully merging a pull request may close this issue.

1 participant