Skip to content

Commit

Permalink
refs #4201 Small addition to MDEventsWrapper test
Browse files Browse the repository at this point in the history
  • Loading branch information
abuts committed Jan 2, 2012
1 parent 56b7a02 commit fb25fca
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Code/Mantid/Framework/MDAlgorithms/src/ConvertToMDEvents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -702,10 +702,10 @@ ConvertToMDEvents::getTransfMatrix(API::MatrixWorkspace_sptr inWS,const Kernel::
the particular workspace.
@param Coord -- vector of coordinates for current multidimensional event
@param nd -- number of event's dimensions
@param nd -- number of the event's dimensions
@param n_ws_properties -- number of dimensions, provided by the workspace itself. E.g., processed inelastic matrix
workspace with provides 4 dimensions, matrix workspace in elastic mode -- 3 dimensions, powder
-- 2 for elastic and 3 for inelastic mode. Number of these properties is determined by the deployed algorithm
-- 1 for elastic and 2 for inelastic mode. Number of these properties is determined by the deployed algorithm
The coordinates, obtained from the workspace placed first in the array of coordinates, and the coordinates,
obtained from dimensions placed after them.
*@returns -- true if all coordinates are within the range allowed for the algorithm and false otherwise
Expand Down
32 changes: 32 additions & 0 deletions Code/Mantid/Framework/MDEvents/test/MDEventWSWrapperTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <cxxtest/TestSuite.h>
#include "MantidMDEvents/MDEventWSWrapper.h"
#include "MantidAPI/AnalysisDataService.h"
#include "MantidGeometry/MDGeometry/MDTypes.h"


using namespace Mantid::MDEvents;
Expand Down Expand Up @@ -46,6 +47,37 @@ class MDEventWSWrapperTest : public CxxTest::TestSuite
void test_AddEventsData()
{

const size_t n_dims(5),n_MDev(2);
Mantid::API::BoxController_sptr bc;
Mantid::MDEvents::Strings targ_dim_names(n_dims,"mdn"),targ_dim_units(n_dims,"Momentum");
std::vector<double> dim_min(n_dims,-1),dim_max(n_dims,1);

TSM_ASSERT_THROWS_NOTHING("should be fine",pWSWrap->createEmptyMDWS(5, targ_dim_names,targ_dim_units,dim_min,dim_max));

// Build up the box controller
TSM_ASSERT_THROWS_NOTHING("should be fine", bc = pWSWrap->getBoxController());

// set default BC values
TSM_ASSERT_THROWS_NOTHING("should be fine", bc->setSplitThreshold(5));
TSM_ASSERT_THROWS_NOTHING("should be fine", bc->setMaxDepth( 20 ));
TSM_ASSERT_THROWS_NOTHING("should be fine", bc->setSplitInto(10));

TSM_ASSERT_THROWS_NOTHING("should be fine",pWSWrap->splitBox());

// allocate temporary buffer for MD Events data
std::vector<Mantid::coord_t> allCoord(n_dims*n_MDev,0.5);
allCoord[0]=-0.5;

std::vector<float> sig_err(2*n_MDev,2);
std::vector<uint16_t> run_index(n_MDev,2);
std::vector<uint32_t> det_ids(n_MDev,5);


TSM_ASSERT_THROWS_NOTHING("should be fine",pWSWrap->addMDData(sig_err,run_index,det_ids,allCoord,n_MDev));

TSM_ASSERT_THROWS_NOTHING("should be fine",pWSWrap->refreshCache());

TSM_ASSERT_EQUALS("all points should be added successfully",n_MDev,pWSWrap->pWorkspace()->getNPoints());
}

};
Expand Down

0 comments on commit fb25fca

Please sign in to comment.