Skip to content

Commit

Permalink
Refs #4043 more python exposing of BoxController
Browse files Browse the repository at this point in the history
  • Loading branch information
Janik Zikovsky committed Nov 2, 2011
1 parent 683f563 commit 897d228
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 15 deletions.
7 changes: 3 additions & 4 deletions Code/Mantid/Framework/PythonAPI/MantidFramework.py
Original file line number Diff line number Diff line change
Expand Up @@ -1171,14 +1171,13 @@ def _retrieveWorkspace(self, name):
except(RuntimeError):
pass

# IMD and IMDEventWorkspaces are at the same level (lower than MatrixWorkspace).
try:
return self._getRawIMDWorkspacePointer(name)
return self._getRawIMDEventWorkspacePointer(name)
except RuntimeError:
pass

try:
return self._getRawIMDEventWorkspacePointer(name)
return self._getRawIMDWorkspacePointer(name)
except RuntimeError:
pass

Expand Down
43 changes: 32 additions & 11 deletions Code/Mantid/Framework/PythonAPI/src/api_exports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ using namespace boost::python;
.def("getSpectrum", (ISpectrum * (MatrixWorkspace::*)(const size_t))&API::MatrixWorkspace::getSpectrum, return_internal_reference<>() )
.def("getDetector", (Geometry::IDetector_sptr (API::MatrixWorkspace::*) (const size_t) const)&API::MatrixWorkspace::getDetector)
.def("getRun", &API::MatrixWorkspace::mutableRun, return_internal_reference<>() )
.def("getSample", &API::MatrixWorkspace::sample, return_internal_reference<>() )
.def("getSampleInfo", &API::MatrixWorkspace::sample, return_internal_reference<>() )
.def("getNumberAxes", &API::MatrixWorkspace::axes)
.def("getAxis", &API::MatrixWorkspace::getAxis, return_internal_reference<>())
Expand Down Expand Up @@ -327,6 +328,35 @@ using namespace boost::python;
;
}

void export_BoxController()
{
register_ptr_to_python<API::BoxController_sptr>();

class_< BoxController, boost::noncopyable >("BoxController", no_init)
.def("getNDims", &BoxController::getNDims)
.def("getSplitThreshold", &BoxController::getSplitThreshold)
.def("getSplitInto", &BoxController::getSplitInto)
.def("getMaxDepth", &BoxController::getMaxDepth)
.def("getTotalNumMDBoxes", &BoxController::getTotalNumMDBoxes)
.def("getTotalNumMDGridBoxes", &BoxController::getTotalNumMDGridBoxes)
.def("getAverageDepth", &BoxController::getAverageDepth)
.def("isFileBacked", &BoxController::isFileBacked)
.def("getFilename", &BoxController::getFilename, return_value_policy< copy_const_reference >())
.def("useMRU", &BoxController::useMRU)
;
}

void export_IMDEventWorkspace()
{
register_ptr_to_python<API::IMDEventWorkspace_sptr>();

// MDEventWorkspace class
class_< IMDEventWorkspace, bases<API::Workspace>, boost::noncopyable >("IMDEventWorkspace", no_init)
.def("getNPoints", &IMDEventWorkspace::getNPoints)
.def("getNumDims", &IMDEventWorkspace::getNumDims)
.def("getBoxController", (BoxController_sptr(IMDEventWorkspace::*)() ) &IMDEventWorkspace::getBoxController)
;
}
void export_eventworkspace()
{
register_ptr_to_python<IEventWorkspace_sptr>();
Expand Down Expand Up @@ -381,16 +411,6 @@ using namespace boost::python;
;
}

void export_mdeventworkspace()
{
register_ptr_to_python<API::IMDEventWorkspace_sptr>();

// MDEventWorkspace class
class_< IMDEventWorkspace, bases<API::Workspace>, boost::noncopyable >("IMDEventWorkspace", no_init)
.def("getNPoints", &IMDEventWorkspace::getNPoints)
.def("getNumDims", &IMDEventWorkspace::getNumDims)
;
}

void export_tableworkspace()
{
Expand Down Expand Up @@ -614,7 +634,8 @@ using namespace boost::python;
export_matrixworkspace();
export_eventworkspace();
export_IMDWorkspace();
export_mdeventworkspace();
export_IMDEventWorkspace();
export_BoxController();
export_tableworkspace();
export_workspacegroup();
export_axis();
Expand Down

0 comments on commit 897d228

Please sign in to comment.