From bc9f33dd2286344eb0919240a1b2721009e80ccf Mon Sep 17 00:00:00 2001 From: Janik Zikovsky <zikovskyjl@ornl.gov> Date: Thu, 31 Mar 2011 18:46:11 +0000 Subject: [PATCH] Refs #2660: Commented-out everything because PythonAPI can't refer to DataObjects. --- .../Mantid/Framework/PythonAPI/CMakeLists.txt | 4 +- .../Framework/PythonAPI/MantidFramework.py | 17 ++- .../MantidPythonAPI/FrameworkManagerProxy.h | 13 ++- .../PythonAPI/src/FrameworkManagerProxy.cpp | 71 ++++++------ .../Framework/PythonAPI/src/api_exports.cpp | 105 +++++++++--------- 5 files changed, 105 insertions(+), 105 deletions(-) diff --git a/Code/Mantid/Framework/PythonAPI/CMakeLists.txt b/Code/Mantid/Framework/PythonAPI/CMakeLists.txt index b6ba4cc2c3b..0f0a2b59410 100644 --- a/Code/Mantid/Framework/PythonAPI/CMakeLists.txt +++ b/Code/Mantid/Framework/PythonAPI/CMakeLists.txt @@ -106,9 +106,9 @@ endif () # to ensure that the stdc++ library appears as early in the link list as possible so that it # is loaded first, hence the hard coding of it here rather than leaving it to be implicitly defined. if ( UNIX ) - set ( PYTHON_DEPS stdc++ ${MANTIDLIBS} ${Boost_LIBRARIES} ${PYTHON_LIBRARIES} DataObjects ) + set ( PYTHON_DEPS stdc++ ${MANTIDLIBS} ${Boost_LIBRARIES} ${PYTHON_LIBRARIES} ) else () - set ( PYTHON_DEPS ${MANTIDLIBS} ${Boost_LIBRARIES} ${PYTHON_LIBRARIES} DataObjects ) + set ( PYTHON_DEPS ${MANTIDLIBS} ${Boost_LIBRARIES} ${PYTHON_LIBRARIES} ) endif () ########################################################################### diff --git a/Code/Mantid/Framework/PythonAPI/MantidFramework.py b/Code/Mantid/Framework/PythonAPI/MantidFramework.py index 4f666ac82a6..7159d7ebffe 100644 --- a/Code/Mantid/Framework/PythonAPI/MantidFramework.py +++ b/Code/Mantid/Framework/PythonAPI/MantidFramework.py @@ -894,11 +894,10 @@ class MantidPyFramework(FrameworkManager): # Try each workspace type in order, from more specialised to less specialised. - # Try each workspace type in order, from more specialised to less specialised. - try: - return self._getRawEventWorkspacePointer(name) - except RuntimeError: - pass +# try: +# return self._getRawEventWorkspacePointer(name) +# except RuntimeError: +# pass try: return self._getRawIEventWorkspacePointer(name) @@ -926,10 +925,10 @@ class MantidPyFramework(FrameworkManager): except RuntimeError: pass - try: - return self._getRawPeaksWorkspacePointer(name) - except RuntimeError: - return None +# try: +# return self._getRawPeaksWorkspacePointer(name) +# except RuntimeError: +# return None try: return self._getRawTableWorkspacePointer(name) diff --git a/Code/Mantid/Framework/PythonAPI/inc/MantidPythonAPI/FrameworkManagerProxy.h b/Code/Mantid/Framework/PythonAPI/inc/MantidPythonAPI/FrameworkManagerProxy.h index 99491fe8c29..d143dcff0f8 100644 --- a/Code/Mantid/Framework/PythonAPI/inc/MantidPythonAPI/FrameworkManagerProxy.h +++ b/Code/Mantid/Framework/PythonAPI/inc/MantidPythonAPI/FrameworkManagerProxy.h @@ -14,11 +14,12 @@ #include <MantidAPI/AnalysisDataService.h> #include <MantidAPI/AlgorithmFactory.h> #include <MantidAPI/IEventWorkspace.h> -#include <MantidDataObjects/EventWorkspace.h> -#include <MantidDataObjects/PeaksWorkspace.h> #include <MantidAPI/IMDWorkspace.h> #include <MantidAPI/IMDEventWorkspace.h> +//#include <MantidDataObjects/EventWorkspace.h> +//#include <MantidDataObjects/PeaksWorkspace.h> + #include <Poco/NObserver.h> @@ -113,10 +114,10 @@ public: /// Returns a pointer to the IEventWorkpace requested boost::shared_ptr<API::IEventWorkspace> retrieveIEventWorkspace(const std::string& wsName); /// Returns a pointer to the Workpace requested - boost::shared_ptr<DataObjects::PeaksWorkspace> retrievePeaksWorkspace(const std::string& wsName); - /// Returns a pointer to the IEventWorkpace requested - boost::shared_ptr<DataObjects::EventWorkspace> retrieveEventWorkspace(const std::string& wsName); - /// Returns a pointer to the IMDWorkspace requested +// boost::shared_ptr<DataObjects::PeaksWorkspace> retrievePeaksWorkspace(const std::string& wsName); +// /// Returns a pointer to the IEventWorkpace requested +// boost::shared_ptr<DataObjects::EventWorkspace> retrieveEventWorkspace(const std::string& wsName); +// /// Returns a pointer to the IMDWorkspace requested boost::shared_ptr<API::IMDWorkspace> retrieveIMDWorkspace(const std::string& wsName); /// Returns a pointer to the IMDEventWorkspace requested boost::shared_ptr<API::IMDEventWorkspace> retrieveIMDEventWorkspace(const std::string& wsName); diff --git a/Code/Mantid/Framework/PythonAPI/src/FrameworkManagerProxy.cpp b/Code/Mantid/Framework/PythonAPI/src/FrameworkManagerProxy.cpp index fb6b8e03654..299b5b5b5f2 100644 --- a/Code/Mantid/Framework/PythonAPI/src/FrameworkManagerProxy.cpp +++ b/Code/Mantid/Framework/PythonAPI/src/FrameworkManagerProxy.cpp @@ -7,7 +7,6 @@ #include "MantidAPI/ITableWorkspace.h" #include "MantidAPI/MatrixWorkspace.h" #include "MantidAPI/MemoryManager.h" -#include "MantidDataObjects/EventWorkspace.h" #include "MantidKernel/ConfigService.h" #include "MantidKernel/Strings.h" #include "MantidPythonAPI/FrameworkManagerProxy.h" @@ -252,41 +251,41 @@ boost::shared_ptr<API::IEventWorkspace> FrameworkManagerProxy::retrieveIEventWor } } -/** Return pointer to PeaksWorkspace - * @param wsName :: The name of the workspace to retrieve. - * @return Shared pointer to workspace. - * @throw runtime_error if not of the right type - */ -boost::shared_ptr<DataObjects::PeaksWorkspace> FrameworkManagerProxy::retrievePeaksWorkspace(const std::string& wsName) -{ - DataObjects::PeaksWorkspace_sptr event = boost::dynamic_pointer_cast<DataObjects::PeaksWorkspace>(retrieveWorkspace(wsName)); - if (event != NULL) - { - return event; - } - else - { - throw std::runtime_error("\"" + wsName + "\" is not an peaks workspace. "); - } -} - -/** Return pointer to EventWorkspace - * @param wsName :: The name of the workspace to retrieve. - * @return Shared pointer to workspace. - * @throw runtime_error if not of the right type - */ -boost::shared_ptr<DataObjects::EventWorkspace> FrameworkManagerProxy::retrieveEventWorkspace(const std::string& wsName) -{ - DataObjects::EventWorkspace_sptr event = boost::dynamic_pointer_cast<DataObjects::EventWorkspace>(retrieveWorkspace(wsName)); - if (event != NULL) - { - return event; - } - else - { - throw std::runtime_error("\"" + wsName + "\" is not an event workspace. "); - } -} +///** Return pointer to PeaksWorkspace +// * @param wsName :: The name of the workspace to retrieve. +// * @return Shared pointer to workspace. +// * @throw runtime_error if not of the right type +// */ +//boost::shared_ptr<DataObjects::PeaksWorkspace> FrameworkManagerProxy::retrievePeaksWorkspace(const std::string& wsName) +//{ +// DataObjects::PeaksWorkspace_sptr event = boost::dynamic_pointer_cast<DataObjects::PeaksWorkspace>(retrieveWorkspace(wsName)); +// if (event != NULL) +// { +// return event; +// } +// else +// { +// throw std::runtime_error("\"" + wsName + "\" is not an peaks workspace. "); +// } +//} +// +///** Return pointer to EventWorkspace +// * @param wsName :: The name of the workspace to retrieve. +// * @return Shared pointer to workspace. +// * @throw runtime_error if not of the right type +// */ +//boost::shared_ptr<DataObjects::EventWorkspace> FrameworkManagerProxy::retrieveEventWorkspace(const std::string& wsName) +//{ +// DataObjects::EventWorkspace_sptr event = boost::dynamic_pointer_cast<DataObjects::EventWorkspace>(retrieveWorkspace(wsName)); +// if (event != NULL) +// { +// return event; +// } +// else +// { +// throw std::runtime_error("\"" + wsName + "\" is not an event workspace. "); +// } +//} /** Return pointer to IMDWorkspace * @param wsName :: The name of the workspace to retrieve. diff --git a/Code/Mantid/Framework/PythonAPI/src/api_exports.cpp b/Code/Mantid/Framework/PythonAPI/src/api_exports.cpp index e9e820db98c..8489ceb1a01 100644 --- a/Code/Mantid/Framework/PythonAPI/src/api_exports.cpp +++ b/Code/Mantid/Framework/PythonAPI/src/api_exports.cpp @@ -18,8 +18,10 @@ #include <MantidAPI/WorkspaceProperty.h> #include <MantidAPI/WorkspaceValidators.h> #include <MantidGeometry/MDGeometry/IMDDimension.h> -#include <MantidDataObjects/EventWorkspace.h> -#include <MantidDataObjects/EventList.h> + +//#include <MantidDataObjects/EventWorkspace.h> +//#include <MantidDataObjects/EventList.h> +//using namespace Mantid::DataObjects; #include <MantidPythonAPI/PyAlgorithmWrapper.h> @@ -27,7 +29,6 @@ namespace Mantid { namespace PythonAPI { -using namespace DataObjects; using namespace API; using namespace Geometry; using namespace boost::python; @@ -68,8 +69,8 @@ using namespace boost::python; .def("getConfigProperty", &FrameworkManagerProxy::getConfigProperty) .def("releaseFreeMemory", &FrameworkManagerProxy::releaseFreeMemory) .def("_getRawIEventWorkspacePointer", &FrameworkManagerProxy::retrieveIEventWorkspace) - .def("_getRawEventWorkspacePointer", &FrameworkManagerProxy::retrieveEventWorkspace) - .def("_getRawPeaksWorkspacePointer", &FrameworkManagerProxy::retrievePeaksWorkspace) +// .def("_getRawEventWorkspacePointer", &FrameworkManagerProxy::retrieveEventWorkspace) +// .def("_getRawPeaksWorkspacePointer", &FrameworkManagerProxy::retrievePeaksWorkspace) .def("_getRawIMDWorkspacePointer", &FrameworkManagerProxy::retrieveIMDWorkspace) .def("_getRawIMDEventWorkspacePointer", &FrameworkManagerProxy::retrieveIMDEventWorkspace) .def("_getRawMatrixWorkspacePointer", &FrameworkManagerProxy::retrieveMatrixWorkspace) @@ -288,59 +289,59 @@ using namespace boost::python; ; } - void export_PeaksWorkspace() - { - register_ptr_to_python<PeaksWorkspace_sptr>(); - - // PeaksWorkspace class - class_< PeaksWorkspace, bases<Workspace>, boost::noncopyable >("PeaksWorkspace", no_init) - ; - } +// void export_PeaksWorkspace() +// { +// register_ptr_to_python<PeaksWorkspace_sptr>(); +// +// // PeaksWorkspace class +// class_< PeaksWorkspace, bases<Workspace>, boost::noncopyable >("PeaksWorkspace", no_init) +// ; +// } void export_eventworkspace() { - register_ptr_to_python<EventWorkspace_sptr>(); + register_ptr_to_python<IEventWorkspace_sptr>(); // EventWorkspace class - class_< EventWorkspace, bases<API::MatrixWorkspace>, boost::noncopyable >("EventWorkspace", no_init) - .def("getNumberEvents", &EventWorkspace::getNumberEvents) - .def("getEventList", (EventList&(EventWorkspace::*)(const int) ) &EventWorkspace::getEventList, return_internal_reference<>()) + class_< IEventWorkspace, bases<API::MatrixWorkspace>, boost::noncopyable >("EventWorkspace", no_init) + .def("getNumberEvents", &IEventWorkspace::getNumberEvents) +// .def("getEventList", (EventList&(EventWorkspace::*)(const int) ) &EventWorkspace::getEventList, return_internal_reference<>()) ; } - void export_EventList() - { - register_ptr_to_python<EventList *>(); - - class_< EventList, boost::noncopyable >("EventList", no_init) - .def("getEventType", &EventList::getEventType) - .def("addDetectorID", &EventList::addDetectorID) - .def("hasDetectorID", &EventList::hasDetectorID) - .def("clear", &EventList::clear) - .def("reserve", &EventList::reserve) - .def("sort", &EventList::sort) - .def("isSortedByTof", &EventList::isSortedByTof) - .def("getSortType", &EventList::getSortType) - .def("getNumberEvents", &EventList::getNumberEvents) - .def("getMemorySize", &EventList::getMemorySize) - .def("compressEvents", &EventList::compressEvents) - .def("integrate", &EventList::integrate) - .def("convertTof", &EventList::convertTof) - .def("scaleTof", &EventList::scaleTof) - .def("addTof", &EventList::addTof) - .def("addPulsetime", &EventList::addPulsetime) - .def("maskTof", &EventList::maskTof) - .def("getTofs", &EventList::getTofs) - .def("getTofMin", &EventList::getTofMin) - .def("getTofMax", &EventList::getTofMax) - .def("setTofs", &EventList::setTofs) - .def("filterByPulseTime", &EventList::filterByPulseTime) - .def("multiply", (void(EventList::*)(const double,const double)) &EventList::multiply) - .def("divide", (void(EventList::*)(const double,const double)) &EventList::multiply) - .def("switchTo", &EventList::switchTo) -// .def("add", (EventList&(EventList::*)(const EventList&))&EventList::operator+=) - ; - } +// void export_EventList() +// { +// register_ptr_to_python<EventList *>(); +// +// class_< EventList, boost::noncopyable >("EventList", no_init) +// .def("getEventType", &EventList::getEventType) +// .def("addDetectorID", &EventList::addDetectorID) +// .def("hasDetectorID", &EventList::hasDetectorID) +// .def("clear", &EventList::clear) +// .def("reserve", &EventList::reserve) +// .def("sort", &EventList::sort) +// .def("isSortedByTof", &EventList::isSortedByTof) +// .def("getSortType", &EventList::getSortType) +// .def("getNumberEvents", &EventList::getNumberEvents) +// .def("getMemorySize", &EventList::getMemorySize) +// .def("compressEvents", &EventList::compressEvents) +// .def("integrate", &EventList::integrate) +// .def("convertTof", &EventList::convertTof) +// .def("scaleTof", &EventList::scaleTof) +// .def("addTof", &EventList::addTof) +// .def("addPulsetime", &EventList::addPulsetime) +// .def("maskTof", &EventList::maskTof) +// .def("getTofs", &EventList::getTofs) +// .def("getTofMin", &EventList::getTofMin) +// .def("getTofMax", &EventList::getTofMax) +// .def("setTofs", &EventList::setTofs) +// .def("filterByPulseTime", &EventList::filterByPulseTime) +// .def("multiply", (void(EventList::*)(const double,const double)) &EventList::multiply) +// .def("divide", (void(EventList::*)(const double,const double)) &EventList::multiply) +// .def("switchTo", &EventList::switchTo) +//// .def("add", (EventList&(EventList::*)(const EventList&))&EventList::operator+=) +// ; +// } void export_mdeventworkspace() { @@ -565,8 +566,8 @@ using namespace boost::python; export_apivalidators(); export_file_finder(); export_IMDDimension(); - export_EventList(); - export_PeaksWorkspace(); +// export_EventList(); +// export_PeaksWorkspace(); } //@endcond -- GitLab