Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mantid
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mantidproject
mantid
Commits
63f873a4
Commit
63f873a4
authored
10 years ago
by
Anton Piccardo-Selg
Browse files
Options
Downloads
Patches
Plain Diff
Refs #10973 Extending box splitting tests to 4D
parent
e0c4ee6f
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Code/Mantid/Framework/API/inc/MantidAPI/BoxController.h
+3
-0
3 additions, 0 deletions
Code/Mantid/Framework/API/inc/MantidAPI/BoxController.h
Code/Mantid/Framework/MDAlgorithms/test/ConvertToMDTest.h
+51
-35
51 additions, 35 deletions
Code/Mantid/Framework/MDAlgorithms/test/ConvertToMDTest.h
with
54 additions
and
35 deletions
Code/Mantid/Framework/API/inc/MantidAPI/BoxController.h
+
3
−
0
View file @
63f873a4
...
...
@@ -264,6 +264,9 @@ public:
/** Return the vector giving the number of MD Boxes as a function of depth */
const
std
::
vector
<
size_t
>
&
getNumMDBoxes
()
const
{
return
m_numMDBoxes
;
}
/** Return the vector giving the number of MD Grid Boxes as a function of depth */
const
std
::
vector
<
size_t
>
&
getNumMDGridBoxes
()
const
{
return
m_numMDGridBoxes
;
}
/** Return the vector giving the MAXIMUM number of MD Boxes as a function of
* depth */
const
std
::
vector
<
double
>
&
getMaxNumMDBoxes
()
const
{
...
...
This diff is collapsed.
Click to expand it.
Code/Mantid/Framework/MDAlgorithms/test/ConvertToMDTest.h
+
51
−
35
View file @
63f873a4
...
...
@@ -13,6 +13,7 @@
#include
"MantidKernel/UnitFactory.h"
#include
"MantidMDEvents/ConvToMDSelector.h"
#include
"MantidMDAlgorithms/PreprocessDetectorsToMD.h"
#include
"MantidAPI/AlgorithmManager.h"
#include
<cxxtest/TestSuite.h>
#include
<iomanip>
#include
<iostream>
...
...
@@ -173,41 +174,51 @@ void testExecQ3D()
}
void
testInitialSplittingEnabled
()
{
Mantid
::
API
::
MatrixWorkspace_sptr
ws2D
=
AnalysisDataService
::
Instance
().
retrieveWS
<
MatrixWorkspace
>
(
"testWSProcessed"
);
API
::
NumericAxis
*
pAxis
=
new
API
::
NumericAxis
(
3
);
pAxis
->
setUnit
(
"DeltaE"
);
ws2D
->
replaceAxis
(
0
,
pAxis
);
pAlg
->
setPropertyValue
(
"OutputWorkspace"
,
"WS5DQ3D"
);
pAlg
->
setPropertyValue
(
"InputWorkspace"
,
"testWSProcessed"
);
pAlg
->
setPropertyValue
(
"OtherDimensions"
,
"phi,chi"
);
pAlg
->
setPropertyValue
(
"PreprocDetectorsWS"
,
""
);
TS_ASSERT_THROWS_NOTHING
(
pAlg
->
setPropertyValue
(
"QDimensions"
,
"Q3D"
));
TS_ASSERT_THROWS_NOTHING
(
pAlg
->
setPropertyValue
(
"dEAnalysisMode"
,
"Direct"
));
pAlg
->
setPropertyValue
(
"MinValues"
,
"-10,-10,-10, 0,-10,-10"
);
pAlg
->
setPropertyValue
(
"MaxValues"
,
" 10, 10, 10, 20, 40, 20"
);
TS_ASSERT_THROWS_NOTHING
(
pAlg
->
setPropertyValue
(
"InitialSplitting"
,
"1"
));
pAlg
->
setRethrows
(
false
);
pAlg
->
execute
();
TSM_ASSERT
(
"Should finish successfully"
,
pAlg
->
isExecuted
());
IMDEventWorkspace_sptr
outputWS
=
AnalysisDataService
::
Instance
().
retrieveWS
<
IMDEventWorkspace
>
(
"WS5DQ3D"
);
Mantid
::
API
::
BoxController_sptr
boxController
=
outputWS
->
getBoxController
();
std
::
vector
<
size_t
>
numMDBoxes
=
boxController
->
getNumMDBoxes
();
// Check depth 0
TSM_ASSERT_EQUALS
(
"Should have no MDBoxes at level 0"
,
0
,
numMDBoxes
[
0
]);
// Check depth 1. The boxController is set to split with 50, 50, 50, 50, 5, 5
TSM_ASSERT_EQUALS
(
"Should have 15625000 MDBoxes at level 1"
,
156250000
,
numMDBoxes
[
1
]);
auto
outWS
=
AnalysisDataService
::
Instance
().
retrieveWS
<
IMDWorkspace
>
(
"WS5DQ3D"
);
TS_ASSERT_EQUALS
(
Mantid
::
Kernel
::
HKL
,
outWS
->
getSpecialCoordinateSystem
());
AnalysisDataService
::
Instance
().
remove
(
"WS5DQ3D"
);
{
// Create workspace
auto
alg
=
Mantid
::
API
::
AlgorithmManager
::
Instance
().
create
(
"CreateSampleWorkspace"
);
alg
->
initialize
();
alg
->
setChild
(
true
);
alg
->
setProperty
(
"WorkspaceType"
,
"Event"
);
alg
->
setPropertyValue
(
"OutputWorkspace"
,
"dummy"
);
alg
->
execute
();
Mantid
::
API
::
MatrixWorkspace_sptr
ws
=
alg
->
getProperty
(
"OutputWorkspace"
);
Mantid
::
API
::
Run
&
run
=
ws
->
mutableRun
();
auto
eiLog
=
new
PropertyWithValue
<
double
>
(
"Ei"
,
12.0
);
run
.
addLogData
(
eiLog
);
ConvertToMD
convertAlg
;
convertAlg
.
setChild
(
true
);
convertAlg
.
initialize
();
convertAlg
.
setPropertyValue
(
"OutputWorkspace"
,
"dummy"
);
convertAlg
.
setProperty
(
"InputWorkspace"
,
ws
);
convertAlg
.
setProperty
(
"QDimensions"
,
"Q3D"
);
convertAlg
.
setProperty
(
"dEAnalysisMode"
,
"Direct"
);
convertAlg
.
setPropertyValue
(
"MinValues"
,
"-10,-10,-10, 0"
);
convertAlg
.
setPropertyValue
(
"MaxValues"
,
" 10, 10, 10, 1"
);
convertAlg
.
setPropertyValue
(
"InitialSplitting"
,
"1"
);
convertAlg
.
execute
();
IMDEventWorkspace_sptr
outEventWS
=
convertAlg
.
getProperty
(
"OutputWorkspace"
);
Mantid
::
API
::
BoxController_sptr
boxController
=
outEventWS
->
getBoxController
();
std
::
vector
<
size_t
>
numMDBoxes
=
boxController
->
getNumMDBoxes
();
std
::
vector
<
size_t
>
numMDGridBoxes
=
boxController
->
getNumMDGridBoxes
();
// Check depth 0
size_t
level0
=
numMDBoxes
[
0
]
+
numMDGridBoxes
[
0
];
TSM_ASSERT_EQUALS
(
"Should have no MDBoxes at level 0"
,
1
,
level0
);
// Check depth 1. The boxController is set to split with 50, 50, 50, 50.
// We need to ensure that the number of Boxes plus the number of Gridboxes is 50^4
size_t
level1
=
numMDBoxes
[
1
]
+
numMDGridBoxes
[
1
];
TSM_ASSERT_EQUALS
(
"Should have 6250000 MDBoxes at level 1"
,
6250000
,
level1
);
// Confirm that the boxcontroller is set to the original settings
TSM_ASSERT_EQUALS
(
"Should be set to 5"
,
5
,
boxController
->
getSplitInto
(
0
));
TSM_ASSERT_EQUALS
(
"Should be set to 5"
,
5
,
boxController
->
getSplitInto
(
1
));
TSM_ASSERT_EQUALS
(
"Should be set to 5"
,
5
,
boxController
->
getSplitInto
(
2
));
TSM_ASSERT_EQUALS
(
"Should be set to 5"
,
5
,
boxController
->
getSplitInto
(
3
));
}
void
testInitialSplittingDisabled
()
...
...
@@ -242,6 +253,11 @@ void testInitialSplittingDisabled()
// Check depth 1. The boxController is set to split with 5, 5, 5, 5, 5, 5
TSM_ASSERT_EQUALS
(
"Should have 15625 MDBoxes at level 1"
,
15625
,
numMDBoxes
[
1
]);
// Confirm that the boxcontroller is set to the original settings
TSM_ASSERT_EQUALS
(
"Should be set to 5"
,
5
,
boxController
->
getSplitInto
(
0
));
TSM_ASSERT_EQUALS
(
"Should be set to 5"
,
5
,
boxController
->
getSplitInto
(
1
));
TSM_ASSERT_EQUALS
(
"Should be set to 5"
,
5
,
boxController
->
getSplitInto
(
2
));
auto
outWS
=
AnalysisDataService
::
Instance
().
retrieveWS
<
IMDWorkspace
>
(
"WS5DQ3D"
);
TS_ASSERT_EQUALS
(
Mantid
::
Kernel
::
HKL
,
outWS
->
getSpecialCoordinateSystem
());
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment