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
a07ebc58
Commit
a07ebc58
authored
9 years ago
by
Federico Montesino Pouzols
Browse files
Options
Downloads
Patches
Plain Diff
check Increment and next() retvals, 1292909, 1295474, re #13951
parent
7898e200
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/DataObjects/src/MDHistoWorkspaceIterator.cpp
+16
-4
16 additions, 4 deletions
Framework/DataObjects/src/MDHistoWorkspaceIterator.cpp
with
16 additions
and
4 deletions
Framework/DataObjects/src/MDHistoWorkspaceIterator.cpp
+
16
−
4
View file @
a07ebc58
...
@@ -199,8 +199,17 @@ void MDHistoWorkspaceIterator::init(
...
@@ -199,8 +199,17 @@ void MDHistoWorkspaceIterator::init(
for
(
size_t
d
=
0
;
d
<
m_nd
;
d
++
)
for
(
size_t
d
=
0
;
d
<
m_nd
;
d
++
)
m_center
[
d
]
=
m_origin
[
d
]
+
0.5
f
*
m_binWidth
[
d
];
m_center
[
d
]
=
m_origin
[
d
]
+
0.5
f
*
m_binWidth
[
d
];
// Skip on if the first point is NOT contained
// Skip on if the first point is NOT contained
if
(
!
m_function
->
isPointContained
(
m_center
))
if
(
!
m_function
->
isPointContained
(
m_center
))
{
next
();
bool
didNext
=
next
();
if
(
!
didNext
&&
this
->
valid
())
{
throw
std
::
runtime_error
(
"Inconsistency found initializing "
"MDHistoWorkspace iterator: this iterator should be valid, but "
"when tried to skip the "
"first point (not contained) could not iterate to "
"next point."
);
}
}
}
}
// --- Calculate index permutations for neighbour finding face touching ---
// --- Calculate index permutations for neighbour finding face touching ---
...
@@ -293,9 +302,11 @@ bool MDHistoWorkspaceIterator::valid() const { return (m_pos < m_max); }
...
@@ -293,9 +302,11 @@ bool MDHistoWorkspaceIterator::valid() const { return (m_pos < m_max); }
/// @return true if you can continue iterating
/// @return true if you can continue iterating
bool
MDHistoWorkspaceIterator
::
next
()
{
bool
MDHistoWorkspaceIterator
::
next
()
{
if
(
m_function
)
{
if
(
m_function
)
{
bool
allIncremented
=
false
;
do
{
do
{
m_pos
++
;
m_pos
++
;
Utils
::
NestedForLoop
::
Increment
(
m_nd
,
m_index
,
m_indexMax
);
allIncremented
=
Utils
::
NestedForLoop
::
Increment
(
m_nd
,
m_index
,
m_indexMax
);
// Calculate the center
// Calculate the center
for
(
size_t
d
=
0
;
d
<
m_nd
;
d
++
)
{
for
(
size_t
d
=
0
;
d
<
m_nd
;
d
++
)
{
m_center
[
d
]
=
m_center
[
d
]
=
...
@@ -304,7 +315,8 @@ bool MDHistoWorkspaceIterator::next() {
...
@@ -304,7 +315,8 @@ bool MDHistoWorkspaceIterator::next() {
}
}
// std::cout<<std::endl;
// std::cout<<std::endl;
// Keep incrementing until you are in the implicit function
// Keep incrementing until you are in the implicit function
}
while
(
!
m_function
->
isPointContained
(
m_center
)
&&
m_pos
<
m_max
);
}
while
(
!
allIncremented
&&
!
m_function
->
isPointContained
(
m_center
)
&&
m_pos
<
m_max
);
}
else
{
}
else
{
++
m_pos
;
++
m_pos
;
}
}
...
...
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