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
7da34a0b
Commit
7da34a0b
authored
9 years ago
by
Matt King
Browse files
Options
Downloads
Patches
Plain Diff
Performance tests now running at .9s
Refs #14011
parent
eb9d172a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Framework/MDAlgorithms/test/CompactMDTest.h
+33
-13
33 additions, 13 deletions
Framework/MDAlgorithms/test/CompactMDTest.h
with
33 additions
and
13 deletions
Framework/MDAlgorithms/test/CompactMDTest.h
+
33
−
13
View file @
7da34a0b
...
@@ -34,9 +34,9 @@ public:
...
@@ -34,9 +34,9 @@ public:
* Input structure:
* Input structure:
*------------------
*------------------
* -------------
* -------------
* | |
///
| |
* | |
|///|
| |
* -------------
* -------------
--------
* -
3-
2-1 0 1 2 3
* -
5-4-3
2-1 0 1 2 3
4 5
*---------------------------
*---------------------------
* Expected output structure:
* Expected output structure:
*----------------------------
*----------------------------
...
@@ -51,13 +51,13 @@ public:
...
@@ -51,13 +51,13 @@ public:
const
size_t
numDims
=
1
;
const
size_t
numDims
=
1
;
const
double
signal
=
0.0
;
const
double
signal
=
0.0
;
const
double
errorSquared
=
1.3
;
const
double
errorSquared
=
1.3
;
size_t
numBins
[
static_cast
<
int
>
(
numDims
)]
=
{
3
};
size_t
numBins
[
static_cast
<
int
>
(
numDims
)]
=
{
5
};
Mantid
::
coord_t
min
[
static_cast
<
int
>
(
numDims
)]
=
{
-
3
};
Mantid
::
coord_t
min
[
static_cast
<
int
>
(
numDims
)]
=
{
-
5
};
Mantid
::
coord_t
max
[
static_cast
<
int
>
(
numDims
)]
=
{
3
};
Mantid
::
coord_t
max
[
static_cast
<
int
>
(
numDims
)]
=
{
5
};
const
std
::
string
name
(
"test"
);
const
std
::
string
name
(
"test"
);
auto
inWS
=
MDEventsTestHelper
::
makeFakeMDHistoWorkspaceGeneral
(
auto
inWS
=
MDEventsTestHelper
::
makeFakeMDHistoWorkspaceGeneral
(
numDims
,
signal
,
errorSquared
,
numBins
,
min
,
max
,
name
);
numDims
,
signal
,
errorSquared
,
numBins
,
min
,
max
,
name
);
inWS
->
setSignalAt
(
1
,
1.0
);
// set middle bin signal to one
inWS
->
setSignalAt
(
2
,
1.0
);
// set middle bin signal to one
CompactMD
alg
;
CompactMD
alg
;
alg
.
setChild
(
true
);
alg
.
setChild
(
true
);
alg
.
setRethrows
(
true
);
alg
.
setRethrows
(
true
);
...
@@ -258,17 +258,37 @@ public:
...
@@ -258,17 +258,37 @@ public:
const
size_t
numDims
=
4
;
const
size_t
numDims
=
4
;
const
double
signal
=
0.0
;
const
double
signal
=
0.0
;
const
double
errorSquared
=
1.2
;
const
double
errorSquared
=
1.2
;
size_t
numBins
[
static_cast
<
int
>
(
numDims
)]
=
{
3
,
3
,
3
,
3
};
size_t
numBins
[
static_cast
<
int
>
(
numDims
)]
=
{
5
,
10
,
5
,
10
};
Mantid
::
coord_t
min
[
static_cast
<
int
>
(
numDims
)]
=
{
-
3
,
-
3
,
-
3
,
-
3
};
Mantid
::
coord_t
min
[
static_cast
<
int
>
(
numDims
)]
=
{
-
5
,
-
10
,
-
5
,
-
10
};
Mantid
::
coord_t
max
[
static_cast
<
int
>
(
numDims
)]
=
{
3
,
3
,
3
,
3
};
Mantid
::
coord_t
max
[
static_cast
<
int
>
(
numDims
)]
=
{
5
,
10
,
5
,
10
};
const
std
::
string
name
(
"test"
);
const
std
::
string
name
(
"test"
);
m_ws
=
MDEventsTestHelper
::
makeFakeMDHistoWorkspaceGeneral
(
m_ws
=
MDEventsTestHelper
::
makeFakeMDHistoWorkspaceGeneral
(
numDims
,
signal
,
errorSquared
,
numBins
,
min
,
max
,
name
);
numDims
,
signal
,
errorSquared
,
numBins
,
min
,
max
,
name
);
}
}
void
test_execute_4d
()
{
void
test_execute_4d
()
{
m_ws
->
setSignalAt
(
0
,
1.0
);
// setting signals like this for variety
m_ws
->
setSignalAt
(
5
,
1.2
);
auto
iter
=
m_ws
->
createIterator
();
m_ws
->
setSignalAt
(
1
,
2.3
);
do
{
auto
index
=
iter
->
getLinearIndex
();
if
(
index
%
2
==
0
)
{
m_ws
->
setSignalAt
(
index
,
1.0
);
}
}
while
(
iter
->
next
());
CompactMD
alg
;
alg
.
setChild
(
true
);
alg
.
setRethrows
(
true
);
alg
.
initialize
();
alg
.
setProperty
(
"InputWorkspace"
,
m_ws
);
alg
.
setProperty
(
"OutputWorkspace"
,
"out"
);
alg
.
execute
();
IMDHistoWorkspace_sptr
outWS
=
alg
.
getProperty
(
"OutputWorkspace"
);
TS_ASSERT
(
outWS
);
}
void
test_on_workspace_where_every_bin_has_non_zero_signal
()
{
auto
iter
=
m_ws
->
createIterator
();
do
{
m_ws
->
setSignalAt
(
iter
->
getLinearIndex
(),
1.0
);
}
while
(
iter
->
next
());
CompactMD
alg
;
CompactMD
alg
;
alg
.
setChild
(
true
);
alg
.
setChild
(
true
);
alg
.
setRethrows
(
true
);
alg
.
setRethrows
(
true
);
...
...
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