Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
mantidproject
mantid
Commits
f05e1455
Commit
f05e1455
authored
May 10, 2017
by
Samuel Jackson
Browse files
Refs #19522 Add cleaner implementation
This removes the memory leak and adds a move method to PeaksWorkspace
parent
6f6c5afe
Changes
3
Hide whitespace changes
Inline
Side-by-side
Framework/DataHandling/src/LoadNexusProcessed.cpp
View file @
f05e1455
...
...
@@ -15,6 +15,7 @@
#include
"MantidDataObjects/PeakShapeEllipsoidFactory.h"
#include
"MantidDataObjects/PeakShapeSphericalFactory.h"
#include
"MantidDataObjects/PeaksWorkspace.h"
#include
"MantidDataObjects/Peak.h"
#include
"MantidDataObjects/RebinnedOutput.h"
#include
"MantidGeometry/Instrument/Goniometer.h"
#include
"MantidKernel/ArrayProperty.h"
...
...
@@ -1068,12 +1069,12 @@ API::Workspace_sptr LoadNexusProcessed::loadPeaksEntry(NXEntry &entry) {
// below this one) is set before QLabFrame as this causes Peak to ray trace
// to find the location of the detector, which significantly increases
// loading times.
Geometry
::
IPeak
*
peak
=
new
Peak
();
const
auto
goniometer
=
peakWS
->
run
().
getGoniometer
();
peak
->
setInstrument
(
peakWS
->
getInstrument
());
peak
->
setGoniometerMatrix
(
goniometer
.
getR
());
peak
->
setRunNumber
(
peakWS
->
getRunNumber
());
peakWS
->
addPeak
(
*
peak
);
Peak
peak
;
peak
.
setInstrument
(
peakWS
->
getInstrument
());
peak
.
setGoniometerMatrix
(
goniometer
.
getR
());
peak
.
setRunNumber
(
peakWS
->
getRunNumber
());
peakWS
->
addPeak
(
std
::
move
(
peak
));
}
for
(
const
auto
&
str
:
columnNames
)
{
...
...
Framework/DataObjects/inc/MantidDataObjects/PeaksWorkspace.h
View file @
f05e1455
...
...
@@ -94,6 +94,8 @@ public:
std
::
string
getConvention
()
const
override
;
void
removePeak
(
int
peakNum
)
override
;
void
addPeak
(
const
Geometry
::
IPeak
&
ipeak
)
override
;
/// Move a peak object into this peaks workspace
void
addPeak
(
Peak
&&
ipeak
);
Peak
&
getPeak
(
int
peakNum
)
override
;
const
Peak
&
getPeak
(
int
peakNum
)
const
override
;
...
...
Framework/DataObjects/src/PeaksWorkspace.cpp
View file @
f05e1455
...
...
@@ -161,6 +161,14 @@ void PeaksWorkspace::addPeak(const Geometry::IPeak &ipeak) {
}
}
//---------------------------------------------------------------------------------------------
/** Add a peak to the list
* @param ipeak :: Peak object to add (move) into this.
*/
void
PeaksWorkspace
::
addPeak
(
Peak
&&
ipeak
)
{
peaks
.
push_back
(
ipeak
);
}
//---------------------------------------------------------------------------------------------
/** Return a reference to the Peak
* @param peakNum :: index of the peak to get.
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment