Skip to content

Commit

Permalink
Refs #4043 : Moved BoxController to API.
Browse files Browse the repository at this point in the history
  • Loading branch information
Janik Zikovsky committed Nov 2, 2011
1 parent 9065a70 commit 85621bc
Show file tree
Hide file tree
Showing 20 changed files with 51 additions and 38 deletions.
3 changes: 3 additions & 0 deletions Code/Mantid/Framework/API/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ set ( SRC_FILES
src/AnalysisDataService.cpp
src/ArchiveSearchFactory.cpp
src/Axis.cpp
src/BoxController.cpp
src/CatalogFactory.cpp
src/CloneableAlgorithm.cpp
src/Column.cpp
Expand Down Expand Up @@ -99,6 +100,7 @@ set ( INC_FILES
inc/MantidAPI/AnalysisDataService.h
inc/MantidAPI/ArchiveSearchFactory.h
inc/MantidAPI/Axis.h
inc/MantidAPI/BoxController.h
inc/MantidAPI/CatalogFactory.h
inc/MantidAPI/CloneableAlgorithm.h
inc/MantidAPI/Column.h
Expand Down Expand Up @@ -199,6 +201,7 @@ set ( TEST_FILES
test/AlgorithmTest.h
test/AnalysisDataServiceTest.h
test/AsynchronousTest.h
test/BoxControllerTest.h
test/CompositeFunctionTest.h
test/CoordTransformTest.h
test/CostFunctionFactoryTest.h
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace Mantid
{
namespace MDEvents
namespace API
{


Expand Down Expand Up @@ -492,7 +492,10 @@ namespace MDEvents
/// Shared ptr to BoxController
typedef boost::shared_ptr<BoxController> BoxController_sptr;

}//namespace MDEvents
/// Shared ptr to a const BoxController
typedef boost::shared_ptr<const BoxController> BoxController_const_sptr;

}//namespace API

}//namespace Mantid

Expand Down
6 changes: 5 additions & 1 deletion Code/Mantid/Framework/API/inc/MantidAPI/IMDEventWorkspace.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef IMDEVENTWORKSPACE_H_
#define IMDEVENTWORKSPACE_H_

#include "MantidAPI/BoxController.h"
#include "MantidAPI/DllConfig.h"
#include "MantidAPI/ExperimentInfo.h"
#include "MantidAPI/IMDWorkspace.h"
Expand All @@ -10,8 +11,8 @@
#include "MantidGeometry/MDGeometry/MDDimensionExtents.h"
#include "MantidGeometry/MDGeometry/MDHistoDimension.h"
#include "MantidKernel/ProgressBase.h"
#include <boost/shared_ptr.hpp>
#include "MantidKernel/ThreadScheduler.h"
#include <boost/shared_ptr.hpp>

namespace Mantid
{
Expand Down Expand Up @@ -42,6 +43,9 @@ namespace API
/// Returns some information about the box controller, to be displayed in the GUI, for example
virtual std::vector<std::string> getBoxControllerStats() const = 0;

virtual Mantid::API::BoxController_sptr getBoxController() = 0;
virtual Mantid::API::BoxController_const_sptr getBoxController() const = 0;

/// Helper method that makes a table workspace with some box data
virtual Mantid::API::ITableWorkspace_sptr makeBoxTable(size_t start, size_t num) = 0;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "MantidKernel/Strings.h"
#include "MantidKernel/System.h"
#include "MantidKernel/VectorHelper.h"
#include "MantidMDEvents/BoxController.h"
#include "MantidAPI/BoxController.h"
#include <boost/algorithm/string.hpp>
#include <boost/format.hpp>
#include <Poco/DOM/Attr.h>
Expand All @@ -20,7 +20,7 @@ using Mantid::Kernel::VectorHelper::splitStringIntoVector;

namespace Mantid
{
namespace MDEvents
namespace API
{

//-----------------------------------------------------------------------------------
Expand Down Expand Up @@ -158,7 +158,7 @@ namespace MDEvents

} // namespace Mantid

} // namespace MDEvents
} // namespace API



Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
#define BOXPLITCONTROLLER_TEST_H

#include "MantidKernel/DiskMRU.h"
#include "MantidMDEvents/BoxController.h"
#include "MantidAPI/BoxController.h"
#include <cxxtest/TestSuite.h>
#include <map>
#include <memory>

using namespace Mantid;
using namespace Mantid::API;
using namespace Mantid::Kernel;
using namespace Mantid::MDEvents;

class BoxControllerTest : public CxxTest::TestSuite
{
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/MDAlgorithms/src/ConvertToQ3DdE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ boost::shared_ptr<MDEvents::MDEventWorkspace<MDE,4> > create_empty4DEventWS(cons
ws->initialize();

// Build up the box controller
MDEvents::BoxController_sptr bc = ws->getBoxController();
Mantid::API::BoxController_sptr bc = ws->getBoxController();
bc->setSplitInto(5);
// bc->setSplitThreshold(1500);
bc->setSplitThreshold(10);
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/MDAlgorithms/src/ConvertToQNDany.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ boost::shared_ptr<MDEvents::MDEventWorkspace<MDEvents::MDEvent<nd>, nd> > create
ws->initialize();

// Build up the box controller
MDEvents::BoxController_sptr bc = ws->getBoxController();
Mantid::API::BoxController_sptr bc = ws->getBoxController();
bc->setSplitInto(5);
// bc->setSplitThreshold(1500);
bc->setSplitThreshold(10);
Expand Down
3 changes: 0 additions & 3 deletions Code/Mantid/Framework/MDEvents/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ set ( SRC_FILES
src/AffineMatrixParameter.cpp
src/AffineMatrixParameterParser.cpp
src/BinToMDHistoWorkspace.cpp
src/BoxController.cpp
src/BoxControllerSettingsAlgorithm.cpp
src/CentroidPeaksMD.cpp
src/CloneMDWorkspace.cpp
Expand Down Expand Up @@ -51,7 +50,6 @@ set ( INC_FILES
inc/MantidMDEvents/AffineMatrixParameter.h
inc/MantidMDEvents/AffineMatrixParameterParser.h
inc/MantidMDEvents/BinToMDHistoWorkspace.h
inc/MantidMDEvents/BoxController.h
inc/MantidMDEvents/BoxControllerSettingsAlgorithm.h
inc/MantidMDEvents/CentroidPeaksMD.h
inc/MantidMDEvents/CloneMDWorkspace.h
Expand Down Expand Up @@ -92,7 +90,6 @@ set ( TEST_FILES
test/AffineMatrixParameterParserTest.h
test/AffineMatrixParameterTest.h
test/BoxControllerSettingsAlgorithmTest.h
test/BoxControllerTest.h
test/CentroidPeaksMDTest.h
test/CloneMDWorkspaceTest.h
test/ConvertToDiffractionMDWorkspaceTest.h
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "MantidKernel/System.h"
#include "MantidAPI/Algorithm.h"
#include "MantidMDEvents/BoxController.h"
#include "MantidAPI/BoxController.h"

namespace Mantid
{
Expand Down Expand Up @@ -49,7 +49,7 @@ namespace MDEvents
void initBoxControllerProps();

/// Set the settings in the given box controller
void setBoxController(BoxController_sptr bc);
void setBoxController(Mantid::API::BoxController_sptr bc);

};

Expand Down
10 changes: 5 additions & 5 deletions Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/IMDBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "MantidGeometry/MDGeometry/MDImplicitFunction.h"
#include "MantidKernel/ISaveable.h"
#include "MantidKernel/System.h"
#include "MantidMDEvents/BoxController.h"
#include "MantidAPI/BoxController.h"
#include "MantidAPI/CoordTransform.h"
#include "MantidMDEvents/MDBin.h"
#include "MantidMDEvents/MDLeanEvent.h"
Expand Down Expand Up @@ -209,13 +209,13 @@ namespace MDEvents

// -------------------------------------------------------------------------------------------
/// @return the box controller saved.
BoxController_sptr getBoxController() const
Mantid::API::BoxController_sptr getBoxController() const
{ return m_BoxController; }

/** Set the box controller used.
* @param controller :: BoxController_sptr
* @param controller :: Mantid::API::BoxController_sptr
*/
void setBoxController(BoxController_sptr controller)
void setBoxController(Mantid::API::BoxController_sptr controller)
{ m_BoxController = controller; }

//-----------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -411,7 +411,7 @@ namespace MDEvents
coord_t m_inverseVolume;

/// The box splitting controller, shared with all boxes in the hierarchy
BoxController_sptr m_BoxController;
Mantid::API::BoxController_sptr m_BoxController;

/// Recursion depth
size_t m_depth;
Expand Down
6 changes: 3 additions & 3 deletions Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "MantidGeometry/MDGeometry/MDDimensionExtents.h"
#include "MantidKernel/MultiThreaded.h"
#include "MantidKernel/System.h"
#include "MantidMDEvents/BoxController.h"
#include "MantidAPI/BoxController.h"
#include "MantidMDEvents/IMDBox.h"
#include "MantidMDEvents/MDDimensionStats.h"
#include "MantidMDEvents/MDLeanEvent.h"
Expand Down Expand Up @@ -41,9 +41,9 @@ namespace MDEvents
public:
MDBox();

MDBox(BoxController_sptr splitter, const size_t depth = 0);
MDBox(Mantid::API::BoxController_sptr splitter, const size_t depth = 0);

MDBox(BoxController_sptr splitter, const size_t depth, const std::vector<Mantid::Geometry::MDDimensionExtents> & extentsVector);
MDBox(Mantid::API::BoxController_sptr splitter, const size_t depth, const std::vector<Mantid::Geometry::MDDimensionExtents> & extentsVector);

MDBox(const MDBox & other);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#include "MantidDataObjects/Peak.h"
#include "MantidKernel/ProgressBase.h"
#include "MantidKernel/System.h"
#include "MantidMDEvents/BoxController.h"
#include "MantidMDEvents/BoxController.h"
#include "MantidAPI/BoxController.h"
#include "MantidAPI/BoxController.h"
#include "MantidAPI/CoordTransform.h"
#include "MantidMDEvents/IMDBox.h"
#include "MantidMDEvents/MDLeanEvent.h"
Expand Down Expand Up @@ -68,7 +68,11 @@ namespace MDEvents
//------------------------ IMDEventWorkspace Methods -----------------------------------------

/// Returns the BoxController used in this workspace
BoxController_sptr getBoxController()
Mantid::API::BoxController_sptr getBoxController()
{ return m_BoxController; }

/// Returns the BoxController used in this workspace
Mantid::API::BoxController_const_sptr getBoxController() const
{ return m_BoxController; }

virtual std::vector<std::string> getBoxControllerStats() const;
Expand Down Expand Up @@ -130,7 +134,7 @@ namespace MDEvents
IMDBox<MDE, nd> * data;

/// Box controller in use
BoxController_sptr m_BoxController;
Mantid::API::BoxController_sptr m_BoxController;

public:
/// Typedef for a shared pointer of this kind of event workspace
Expand Down
4 changes: 2 additions & 2 deletions Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDGridBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "MantidKernel/System.h"
#include "MantidKernel/Task.h"
#include "MantidKernel/ThreadScheduler.h"
#include "MantidMDEvents/BoxController.h"
#include "MantidAPI/BoxController.h"
#include "MantidMDEvents/IMDBox.h"
#include "MantidMDEvents/MDBox.h"
#include "MantidMDEvents/MDLeanEvent.h"
Expand Down Expand Up @@ -41,7 +41,7 @@ namespace MDEvents
public:
MDGridBox();

MDGridBox(BoxController_sptr bc, const size_t depth, const std::vector<Mantid::Geometry::MDDimensionExtents> & extentsVector);
MDGridBox(Mantid::API::BoxController_sptr bc, const size_t depth, const std::vector<Mantid::Geometry::MDDimensionExtents> & extentsVector);

MDGridBox(MDBox<MDE, nd> * box);

Expand Down
1 change: 1 addition & 0 deletions Code/Mantid/Framework/MDEvents/src/MDBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "MantidKernel/DiskMRU.h"

using Mantid::Kernel::DiskMRU;
using namespace Mantid::API;

namespace Mantid
{
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/MDEvents/test/MDBoxTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "MantidKernel/CPUTimer.h"
#include "MantidKernel/DiskMRU.h"
#include "MantidKernel/MultiThreaded.h"
#include "MantidMDEvents/BoxController.h"
#include "MantidAPI/BoxController.h"
#include "MantidMDEvents/CoordTransformDistance.h"
#include "MantidMDEvents/MDBin.h"
#include "MantidMDEvents/MDBox.h"
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/MDEvents/test/MDEventWorkspaceTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "MantidGeometry/MDGeometry/MDHistoDimension.h"
#include "MantidKernel/ProgressText.h"
#include "MantidKernel/Timer.h"
#include "MantidMDEvents/BoxController.h"
#include "MantidAPI/BoxController.h"
#include "MantidMDEvents/CoordTransformDistance.h"
#include "MantidMDEvents/MDBox.h"
#include "MantidMDEvents/MDEventFactory.h"
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/MDEvents/test/MDGridBoxTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "MantidKernel/ThreadScheduler.h"
#include "MantidKernel/Timer.h"
#include "MantidKernel/Utils.h"
#include "MantidMDEvents/BoxController.h"
#include "MantidAPI/BoxController.h"
#include "MantidMDEvents/CoordTransformDistance.h"
#include "MantidMDEvents/MDBox.h"
#include "MantidMDEvents/MDLeanEvent.h"
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/MDEvents/test/PlusMDTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class PlusMDTest : public CxxTest::TestSuite
"InputWorkspace", outWSName.c_str(),
"UpdateFileBackEnd", "1");

BoxController_sptr bc = ws->getBoxController();
Mantid::API::BoxController_sptr bc = ws->getBoxController();
std::cout << bc->getDiskMRU().getFreeSpaceMap().size() << " entries in the free space map" << std::endl;
::NeXus::File * file = bc->getFile();
// The file should have an entry of 20000 points too (with some error due to the free space blocks). This means the file back-end was updated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "MantidDataObjects/EventWorkspace.h"
#include "MantidKernel/DateAndTime.h"
#include "MantidKernel/Utils.h"
#include "MantidMDEvents/BoxController.h"
#include "MantidAPI/BoxController.h"
#include "MantidMDEvents/MDEventFactory.h"
#include "MantidMDEvents/MDEventWorkspace.h"
#include "MantidMDEvents/MDLeanEvent.h"
Expand Down Expand Up @@ -62,7 +62,7 @@ namespace MDEventsTestHelper
{
boost::shared_ptr<Mantid::MDEvents::MDEventWorkspace<MDE,nd> >
out(new Mantid::MDEvents::MDEventWorkspace<MDE,nd>());
Mantid::MDEvents::BoxController_sptr bc = out->getBoxController();
Mantid::API::BoxController_sptr bc = out->getBoxController();
bc->setSplitThreshold(100);
bc->setSplitInto(splitInto);

Expand Down Expand Up @@ -134,7 +134,7 @@ namespace MDEventsTestHelper
static MDGridBox<MDLeanEvent<nd>,nd> * makeMDGridBox(size_t split0=10, size_t split1=10, coord_t dimensionMin=0.0, coord_t dimensionMax=10.0)
{
// Split at 5 events
BoxController_sptr splitter(new BoxController(nd));
Mantid::API::BoxController_sptr splitter(new Mantid::API::BoxController(nd));
splitter->setSplitThreshold(5);
// Splits into 10x10x.. boxes
splitter->setSplitInto(split0);
Expand Down Expand Up @@ -228,7 +228,7 @@ namespace MDEventsTestHelper
static MDGridBox<MDLeanEvent<nd>,nd> * makeRecursiveMDGridBox(size_t splitInto, size_t levels)
{
// Split at 5 events
BoxController_sptr splitter(new BoxController(nd));
Mantid::API::BoxController_sptr splitter(new Mantid::API::BoxController(nd));
splitter->setSplitThreshold(5);
splitter->resetNumBoxes();
splitter->setMaxDepth(levels+1);
Expand Down
3 changes: 2 additions & 1 deletion Code/Mantid/Framework/TestHelpers/src/MDEventsTestHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "MantidKernel/cow_ptr.h"
#include "MantidKernel/DateAndTime.h"
#include "MantidKernel/Utils.h"
#include "MantidMDEvents/BoxController.h"
#include "MantidAPI/BoxController.h"
#include "MantidMDEvents/MDEventWorkspace.h"
#include "MantidTestHelpers/DLLExport.h"
#include "MantidTestHelpers/MDEventsTestHelper.h"
Expand All @@ -22,6 +22,7 @@ using Mantid::DataObjects::EventWorkspace;
using Mantid::API::FrameworkManager;
using Mantid::Geometry::MDHistoDimension_sptr;
using Mantid::Geometry::MDHistoDimension;
using namespace Mantid::API;

namespace Mantid
{
Expand Down

0 comments on commit 85621bc

Please sign in to comment.