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
518e245e
Commit
518e245e
authored
11 years ago
by
Zhou, Wenduo
Browse files
Options
Downloads
Patches
Plain Diff
Added check on some input vectors size. Refs #7336.
parent
dcfb9967
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Code/Mantid/Framework/WorkflowAlgorithms/src/AlignAndFocusPowder.cpp
+42
-5
42 additions, 5 deletions
.../Framework/WorkflowAlgorithms/src/AlignAndFocusPowder.cpp
with
42 additions
and
5 deletions
Code/Mantid/Framework/WorkflowAlgorithms/src/AlignAndFocusPowder.cpp
+
42
−
5
View file @
518e245e
...
...
@@ -529,12 +529,24 @@ namespace WorkflowAlgorithms
if
(
l1
>
0
)
{
size_t
numreg
=
m_outputW
->
getNumberHistograms
();
size_t
numlow
=
0
;
// Check size
if
(
tths
.
size
()
<
numreg
)
throw
std
::
runtime_error
(
"Input number of 2thetas is smaller than number of histogram."
);
if
(
l2s
.
size
()
<
numreg
)
throw
std
::
runtime_error
(
"Input number of L2s is smaller than number of histogram."
);
if
(
phis
.
size
()
<
numreg
)
throw
std
::
runtime_error
(
"Input number of azimuthals is smaller than number of histogram."
);
std
::
vector
<
int32_t
>
vec_specid_reg
;
if
(
specids
.
size
()
>=
numreg
)
{
vec_specid_reg
.
resize
(
numreg
,
0
);
std
::
copy
(
specids
.
begin
(),
(
specids
.
begin
()
+
numreg
),
vec_specid_reg
.
begin
());
}
std
::
vector
<
double
>
vec_polar_reg
(
numreg
,
0.
);
std
::
copy
(
tths
.
begin
(),
(
tths
.
begin
()
+
numreg
),
vec_polar_reg
.
begin
());
std
::
vector
<
int32_t
>
vec_specid_reg
(
numreg
,
0
);
std
::
copy
(
specids
.
begin
(),
(
specids
.
begin
()
+
numreg
),
vec_specid_reg
.
begin
());
std
::
vector
<
double
>
vec_l2_reg
(
numreg
,
0.
);
std
::
copy
(
l2s
.
begin
(),
(
l2s
.
begin
()
+
numreg
),
vec_l2_reg
.
begin
());
std
::
vector
<
double
>
vec_azimuthal_reg
(
numreg
,
0.
);
...
...
@@ -558,10 +570,35 @@ namespace WorkflowAlgorithms
if
(
m_processLowResTOF
)
{
size_t
numlow
=
m_lowResW
->
getNumberHistograms
();
// Check size
if
(
tths
.
size
()
<
numreg
+
numlow
)
throw
std
::
runtime_error
(
"Input number of 2thetas is smaller than number of histogram (low)."
);
if
(
l2s
.
size
()
<
numreg
+
numlow
)
throw
std
::
runtime_error
(
"Input number of L2s is smaller than number of histogram (low)."
);
if
(
phis
.
size
()
<
numreg
+
numlow
)
throw
std
::
runtime_error
(
"Input number of azimuthals is smaller than number of histogram (low)."
);
std
::
vector
<
int32_t
>
vec_specid_low
;
if
(
specids
.
size
()
==
numreg
+
numlow
)
{
vec_specid_low
.
resize
(
numlow
,
0
);
std
::
copy
((
specids
.
begin
()
+
numreg
),
specids
.
end
(),
vec_specid_low
.
begin
());
}
else
if
(
specids
.
size
()
==
0
)
{
;
}
else
{
std
::
stringstream
errss
;
errss
<<
"SpecIDs has a weird size = "
<<
specids
.
size
()
<<
", OutputW's size = "
<<
numreg
<<
", LowResW's size = "
<<
numlow
<<
".
\n
"
;
}
std
::
vector
<
double
>
vec_polar_low
(
numlow
,
0.
);
std
::
copy
((
tths
.
begin
()
+
numreg
),
tths
.
end
(),
vec_polar_low
.
begin
());
std
::
vector
<
int32_t
>
vec_specid_low
(
numlow
,
0
);
std
::
copy
((
specids
.
begin
()
+
numreg
),
specids
.
end
(),
vec_specid_low
.
begin
());
std
::
vector
<
double
>
vec_l2_low
(
numlow
,
0.
);
std
::
copy
((
l2s
.
begin
()
+
numreg
),
l2s
.
end
(),
vec_l2_low
.
begin
());
std
::
vector
<
double
>
vec_azimuthal_low
(
numlow
,
0.
);
...
...
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