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
00bbd9a4
Commit
00bbd9a4
authored
9 years ago
by
Federico Montesino Pouzols
Browse files
Options
Downloads
Patches
Plain Diff
coverity - resource leak, 1324912, re #13918
parent
fed3593f
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Framework/MDAlgorithms/inc/MantidMDAlgorithms/Integrate3DEvents.h
+4
-4
4 additions, 4 deletions
...k/MDAlgorithms/inc/MantidMDAlgorithms/Integrate3DEvents.h
Framework/MDAlgorithms/src/Integrate3DEvents.cpp
+18
-14
18 additions, 14 deletions
Framework/MDAlgorithms/src/Integrate3DEvents.cpp
with
22 additions
and
18 deletions
Framework/MDAlgorithms/inc/MantidMDAlgorithms/Integrate3DEvents.h
+
4
−
4
View file @
00bbd9a4
...
...
@@ -127,10 +127,10 @@ private:
double
detectorQ
(
std
::
vector
<
Kernel
::
V3D
>
E1Vec
,
const
Mantid
::
Kernel
::
V3D
QLabFrame
,
std
::
vector
<
double
>
&
r
);
// Private data members
PeakQMap
peak_qs
;
// hashtable with peak Q-vectors
EventListMap
event_lists
;
// hashtable with lists of events for each peak
Kernel
::
DblMatrix
UBinv
;
// matrix mapping from Q to h,k,l
double
radius
;
// size of sphere to use for events around a peak
PeakQMap
m_
peak_qs
;
// hashtable with peak Q-vectors
EventListMap
m_
event_lists
;
// hashtable with lists of events for each peak
Kernel
::
DblMatrix
m_
UBinv
;
// matrix mapping from Q to h,k,l
double
m_
radius
;
// size of sphere to use for events around a peak
};
}
// namespace MDAlgorithms
...
...
This diff is collapsed.
Click to expand it.
Framework/MDAlgorithms/src/Integrate3DEvents.cpp
+
18
−
14
View file @
00bbd9a4
...
...
@@ -35,14 +35,14 @@ using Mantid::Kernel::V3D;
Integrate3DEvents
::
Integrate3DEvents
(
std
::
vector
<
std
::
pair
<
double
,
V3D
>>
const
&
peak_q_list
,
DblMatrix
const
&
UBinv
,
double
radius
)
{
this
->
UBinv
=
UBinv
;
this
->
radius
=
radius
;
m_
UBinv
=
UBinv
;
m_
radius
=
radius
;
int64_t
hkl_key
;
for
(
size_t
it
=
0
;
it
!=
peak_q_list
.
size
();
++
it
)
{
hkl_key
=
getHklKey
(
peak_q_list
[
it
].
second
);
if
(
hkl_key
!=
0
)
// only save if hkl != (0,0,0)
peak_qs
[
hkl_key
]
=
peak_q_list
[
it
].
second
;
m_
peak_qs
[
hkl_key
]
=
peak_q_list
[
it
].
second
;
}
}
...
...
@@ -124,7 +124,11 @@ Integrate3DEvents::ellipseIntegrateEvents(
return
boost
::
make_shared
<
NoShape
>
();
}
std
::
vector
<
std
::
pair
<
double
,
V3D
>>
&
some_events
=
event_lists
[
hkl_key
];
auto
pos
=
m_event_lists
.
find
(
hkl_key
);
if
(
m_event_lists
.
end
()
==
pos
)
return
;
std
::
vector
<
std
::
pair
<
double
,
V3D
>>
&
some_events
=
pos
->
second
;
if
(
some_events
.
size
()
<
3
)
// if there are not enough events to
{
// find covariance matrix, return
...
...
@@ -132,14 +136,14 @@ Integrate3DEvents::ellipseIntegrateEvents(
}
DblMatrix
cov_matrix
(
3
,
3
);
makeCovarianceMatrix
(
some_events
,
cov_matrix
,
radius
);
makeCovarianceMatrix
(
some_events
,
cov_matrix
,
m_
radius
);
std
::
vector
<
V3D
>
eigen_vectors
;
getEigenVectors
(
cov_matrix
,
eigen_vectors
);
std
::
vector
<
double
>
sigmas
;
for
(
int
i
=
0
;
i
<
3
;
i
++
)
{
sigmas
.
push_back
(
stdDev
(
some_events
,
eigen_vectors
[
i
],
radius
));
sigmas
.
push_back
(
stdDev
(
some_events
,
eigen_vectors
[
i
],
m_
radius
));
}
bool
invalid_peak
=
false
;
...
...
@@ -392,7 +396,7 @@ int64_t Integrate3DEvents::getHklKey2(V3D const &hkl) {
* @param q_vector The q_vector to be mapped to h,k,l
*/
int64_t
Integrate3DEvents
::
getHklKey
(
V3D
const
&
q_vector
)
{
V3D
hkl
=
UBinv
*
q_vector
;
V3D
hkl
=
m_
UBinv
*
q_vector
;
int
h
=
boost
::
math
::
iround
<
double
>
(
hkl
[
0
]);
int
k
=
boost
::
math
::
iround
<
double
>
(
hkl
[
1
]);
int
l
=
boost
::
math
::
iround
<
double
>
(
hkl
[
2
]);
...
...
@@ -424,15 +428,15 @@ void Integrate3DEvents::addEvent(std::pair<double, V3D> event_Q,
if
(
hkl_key
==
0
)
// don't keep events associated with 0,0,0
return
;
auto
peak_it
=
peak_qs
.
find
(
hkl_key
);
if
(
peak_it
!=
peak_qs
.
end
())
{
auto
peak_it
=
m_
peak_qs
.
find
(
hkl_key
);
if
(
peak_it
!=
m_
peak_qs
.
end
())
{
if
(
!
peak_it
->
second
.
nullVector
())
{
if
(
hkl_integ
)
event_Q
.
second
=
event_Q
.
second
-
UBinv
*
peak_it
->
second
;
event_Q
.
second
=
event_Q
.
second
-
m_
UBinv
*
peak_it
->
second
;
else
event_Q
.
second
=
event_Q
.
second
-
peak_it
->
second
;
if
(
event_Q
.
second
.
norm
()
<
radius
)
{
event_lists
[
hkl_key
].
push_back
(
event_Q
);
if
(
event_Q
.
second
.
norm
()
<
m_
radius
)
{
m_
event_lists
[
hkl_key
].
push_back
(
event_Q
);
}
}
}
...
...
@@ -511,8 +515,8 @@ PeakShapeEllipsoid_const_sptr Integrate3DEvents::ellipseIntegrateEvents(
// if necessary restrict the background ellipsoid
// to lie within the specified sphere, and adjust
// the other sizes, proportionally
if
(
r3
*
max_sigma
>
radius
)
{
r3
=
radius
/
max_sigma
;
if
(
r3
*
max_sigma
>
m_
radius
)
{
r3
=
m_
radius
/
max_sigma
;
r1
=
r3
*
0.79370053
f
;
// This value for r1 and r2 makes the background
r2
=
r1
;
// shell volume equal to the peak region volume.
}
...
...
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