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
90184eed
Commit
90184eed
authored
9 years ago
by
Alex Buts
Browse files
Options
Downloads
Patches
Plain Diff
Re #13566 Little niceness suggested by reviewer
parent
62abba24
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/Kernel/src/VectorHelper.cpp
+20
-21
20 additions, 21 deletions
Framework/Kernel/src/VectorHelper.cpp
with
20 additions
and
21 deletions
Framework/Kernel/src/VectorHelper.cpp
+
20
−
21
View file @
90184eed
...
@@ -535,8 +535,8 @@ void linearlyInterpolateY(const std::vector<double> &x, std::vector<double> &y,
...
@@ -535,8 +535,8 @@ void linearlyInterpolateY(const std::vector<double> &x, std::vector<double> &y,
}
}
namespace
{
namespace
{
/** internal function converted from Lambda to identify interval around
/** internal function converted from Lambda to identify interval around
*specified
*
specified
point and run average around this point
*
point and run average around this point
*
*@param index -- index to average around
*@param index -- index to average around
*@param startIndex -- index in the array of data (input to start average
*@param startIndex -- index in the array of data (input to start average
* from) should be: index>=startIndex>=0
* from) should be: index>=startIndex>=0
...
@@ -559,39 +559,39 @@ double runAverage(size_t index, size_t startIndex, size_t endIndex,
...
@@ -559,39 +559,39 @@ double runAverage(size_t index, size_t startIndex, size_t endIndex,
// between start and end bin and shift of
// between start and end bin and shift of
// the interpolating function into the center
// the interpolating function into the center
// of each bin
// of each bin
auto
&
rBndrs
=
*
binBndrs
;
// bin0 = binBndrs->operator[](index + 1) - binBndrs->operator[](index);
// bin0 = binBndrs->operator[](index + 1) - binBndrs->operator[](index);
double
binC
=
0.5
*
(
bin
Bndrs
->
operator
[](
index
+
1
)
+
bin
Bndrs
->
operator
[](
index
)
);
double
binC
=
0.5
*
(
r
Bndrs
[
index
+
1
]
+
r
Bndrs
[
index
]
);
start
=
binC
-
halfWidth
;
start
=
binC
-
halfWidth
;
end
=
binC
+
halfWidth
;
end
=
binC
+
halfWidth
;
if
(
start
<=
bin
Bndrs
->
operator
[](
startIndex
)
)
{
if
(
start
<=
r
Bndrs
[
startIndex
]
)
{
iStart
=
startIndex
;
iStart
=
startIndex
;
start
=
bin
Bndrs
->
operator
[](
iStart
)
;
start
=
r
Bndrs
[
iStart
]
;
}
else
{
}
else
{
iStart
=
getBinIndex
(
*
binBndrs
,
start
);
iStart
=
getBinIndex
(
*
binBndrs
,
start
);
weight0
=
weight0
=
(
rBndrs
[
iStart
+
1
]
-
start
)
/
(
binBndrs
->
operator
[](
iStart
+
1
)
-
start
)
/
(
rBndrs
[
iStart
+
1
]
-
rBndrs
[
iStart
]);
(
binBndrs
->
operator
[](
iStart
+
1
)
-
binBndrs
->
operator
[](
iStart
));
iStart
++
;
iStart
++
;
}
}
if
(
end
>=
bin
Bndrs
->
operator
[](
endIndex
)
)
{
if
(
end
>=
r
Bndrs
[
endIndex
]
)
{
iEnd
=
endIndex
;
// the signal defined up to i<iEnd
iEnd
=
endIndex
;
// the signal defined up to i<iEnd
end
=
bin
Bndrs
->
operator
[](
endIndex
)
;
end
=
r
Bndrs
[
endIndex
]
;
}
else
{
}
else
{
iEnd
=
getBinIndex
(
*
binBndrs
,
end
);
iEnd
=
getBinIndex
(
*
binBndrs
,
end
);
weight1
=
(
end
-
bin
Bndrs
->
operator
[](
iEnd
)
)
/
weight1
=
(
end
-
r
Bndrs
[
iEnd
]
)
/
(
bin
Bndrs
->
operator
[](
iEnd
+
1
)
-
bin
Bndrs
->
operator
[](
iEnd
)
);
(
r
Bndrs
[
iEnd
+
1
]
-
r
Bndrs
[
iEnd
]
);
}
}
if
(
iStart
>
iEnd
)
{
// start and end get into the same bin
if
(
iStart
>
iEnd
)
{
// start and end get into the same bin
weight1
=
0
;
weight1
=
0
;
weight0
=
(
end
-
start
)
/
weight0
=
(
end
-
start
)
/
(
rBndrs
[
iStart
]
-
rBndrs
[
iStart
-
1
]);
(
binBndrs
->
operator
[](
iStart
)
-
binBndrs
->
operator
[](
iStart
-
1
));
}
}
}
else
{
// integer indexes and functions defined in the bin centers
}
else
{
// integer indexes and functions defined in the bin centers
iStart
=
index
-
static_cast
<
size_t
>
(
halfWidth
);
auto
iHalfWidth
=
static_cast
<
size_t
>
(
halfWidth
);
if
(
startIndex
+
static_cast
<
size_t
>
(
halfWidth
)
>
index
)
iStart
=
index
-
iHalfWidth
;
if
(
startIndex
+
iHalfWidth
>
index
)
iStart
=
startIndex
;
iStart
=
startIndex
;
iEnd
=
index
+
static_cast
<
size_t
>
(
h
alfWidth
)
;
iEnd
=
index
+
iH
alfWidth
;
if
(
iEnd
>
endIndex
)
if
(
iEnd
>
endIndex
)
iEnd
=
endIndex
;
iEnd
=
endIndex
;
}
}
...
@@ -667,9 +667,8 @@ void smoothInRange(const std::vector<double> &input,
...
@@ -667,9 +667,8 @@ void smoothInRange(const std::vector<double> &input,
double
halfWidth
=
avrgInterval
/
2
;
double
halfWidth
=
avrgInterval
/
2
;
if
(
!
binBndrs
)
{
if
(
!
binBndrs
)
{
if
(
std
::
fabs
(
double
(
static_cast
<
size_t
>
(
halfWidth
))
*
2
-
avrgInterval
)
>
if
(
std
::
floor
(
halfWidth
)
*
2
-
avrgInterval
>
1.e-6
)
{
1.e-6
)
{
halfWidth
=
std
::
floor
(
halfWidth
)
+
1
;
halfWidth
=
static_cast
<
double
>
(
static_cast
<
size_t
>
(
halfWidth
)
+
1
);
}
}
}
}
...
...
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