Commit 424fc625 authored by Martyn Gigg's avatar Martyn Gigg
Browse files

Accept OrientedLattice by unique_ptr

The overwhelming use case for this method is to
take ownership of a lattice object into Sample.
Using unique_ptr clarifies that this is happening
at the call site and forces a caller to make copy
if that is truly the desired behaviour. The old code
make a copy internally but this was not obvious
from the method call.
parent 65dd5716
......@@ -78,11 +78,9 @@ public:
const Geometry::OrientedLattice &getOrientedLattice() const;
/// Get a reference to the sample's OrientedLattice
Geometry::OrientedLattice &getOrientedLattice();
/** Set the pointer to OrientedLattice defining the sample's lattice and
orientation.
No copying is done in the class, but the class deletes pointer on
destruction so the application, providing the pointer should not do it*/
void setOrientedLattice(Geometry::OrientedLattice *latt);
/// Set the pointer to OrientedLattice defining the sample's lattice and
/// orientation
void setOrientedLattice(std::unique_ptr<Geometry::OrientedLattice> lattice);
bool hasOrientedLattice() const;
//@}
......
......@@ -173,13 +173,11 @@ OrientedLattice &Sample::getOrientedLattice() {
/** Attach an OrientedLattice onto this sample
*
* @param latt :: A pointer to a OrientedLattice.
* @param lattice :: A pointer to a OrientedLattice.
*/
void Sample::setOrientedLattice(OrientedLattice *latt) {
if (latt != nullptr)
m_lattice = std::make_unique<OrientedLattice>(*latt);
else
m_lattice.reset(nullptr);
void Sample::setOrientedLattice(
std::unique_ptr<Geometry::OrientedLattice> lattice) {
m_lattice = std::move(lattice);
}
/** @return true if the sample has an OrientedLattice */
......
......@@ -210,8 +210,8 @@ public:
ExperimentInfo ws;
ws.mutableRun().setProtonCharge(1.234);
ws.mutableSample().setName("test");
OrientedLattice latt(1, 2, 3, 90, 90, 90);
ws.mutableSample().setOrientedLattice(&latt);
ws.mutableSample().setOrientedLattice(
std::make_unique<OrientedLattice>(1, 2, 3, 90, 90, 90));
boost::shared_ptr<Instrument> inst1 = boost::make_shared<Instrument>();
inst1->setName("MyTestInst");
ws.setInstrument(inst1);
......@@ -225,8 +225,8 @@ public:
ExperimentInfo ws;
ws.mutableRun().setProtonCharge(1.234);
ws.mutableSample().setName("test");
OrientedLattice latt(1, 2, 3, 90, 90, 90);
ws.mutableSample().setOrientedLattice(&latt);
ws.mutableSample().setOrientedLattice(
std::make_unique<OrientedLattice>(1, 2, 3, 90, 90, 90));
boost::shared_ptr<Instrument> inst1 = boost::make_shared<Instrument>();
inst1->setName("MyTestInst");
ws.setInstrument(inst1);
......@@ -240,8 +240,8 @@ public:
ExperimentInfo ws;
ws.mutableRun().setProtonCharge(1.234);
ws.mutableSample().setName("test");
OrientedLattice latt(1, 2, 3, 90, 90, 90);
ws.mutableSample().setOrientedLattice(&latt);
ws.mutableSample().setOrientedLattice(
std::make_unique<OrientedLattice>(1, 2, 3, 90, 90, 90));
boost::shared_ptr<Instrument> inst1 = boost::make_shared<Instrument>();
inst1->setName("MyTestInst");
ws.setInstrument(inst1);
......
......@@ -2377,9 +2377,8 @@ public:
ws->hasOrientedLattice(), false);
// add an oriented lattice
OrientedLattice *latt = new OrientedLattice(1.0, 2.0, 3.0, 90, 90, 90);
ws->mutableSample().setOrientedLattice(latt);
delete latt;
ws->mutableSample().setOrientedLattice(
std::make_unique<OrientedLattice>(1.0, 2.0, 3.0, 90, 90, 90));
TSM_ASSERT_EQUALS("A workspace with an oriented lattice should report true",
ws->hasOrientedLattice(), true);
......
......@@ -51,13 +51,12 @@ public:
MultipleExperimentInfos mei;
TS_ASSERT_EQUALS(mei.hasOrientedLattice(), false);
OrientedLattice *latt = new OrientedLattice(1.0, 2.0, 3.0, 90, 90, 90);
// add some oriented lattices to the multiple experiment info
for (uint16_t i = 0; i < nExperimentInfosToAdd; ++i) {
ExperimentInfo_sptr experimentInfo = boost::make_shared<ExperimentInfo>();
mei.addExperimentInfo(experimentInfo);
mei.getExperimentInfo(i)->mutableSample().setOrientedLattice(latt);
mei.getExperimentInfo(i)->mutableSample().setOrientedLattice(
std::make_unique<OrientedLattice>(1.0, 2.0, 3.0, 90, 90, 90));
TS_ASSERT_EQUALS(mei.hasOrientedLattice(), true);
}
......@@ -72,8 +71,6 @@ public:
->mutableSample()
.clearOrientedLattice();
TS_ASSERT_EQUALS(mei.hasOrientedLattice(), false);
delete latt;
}
};
......
......@@ -33,9 +33,9 @@ public:
}
void test_isValid_is_valid_when_latticeDefined() {
OrientedLattice lattice;
auto info = boost::make_shared<ExperimentInfo>();
info->mutableSample().setOrientedLattice(&lattice);
info->mutableSample().setOrientedLattice(
std::make_unique<OrientedLattice>());
OrientedLatticeValidator validator;
TS_ASSERT_EQUALS(validator.isValid(info), "");
......
......@@ -76,26 +76,23 @@ public:
void test_OrientedLattice() {
Sample sample;
OrientedLattice *latt = new OrientedLattice(1.0, 2.0, 3.0, 90, 90, 90);
TS_ASSERT_THROWS_NOTHING(sample.setOrientedLattice(latt));
auto lattice = std::make_unique<OrientedLattice>(1.0, 2.0, 3.0, 90, 90, 90);
auto latticeAddress = lattice.get();
TS_ASSERT_THROWS_NOTHING(sample.setOrientedLattice(std::move(lattice)));
const OrientedLattice &retLatt = sample.getOrientedLattice();
// Test that this references the correct object
// TS_ASSERT_EQUALS(&retLatt, latt);//This is no longer correct.
// setOrientedLattice makes a copy of the OrientedLattice object
TS_ASSERT_EQUALS(retLatt.a(), 1.0);
// Test that this takes ownership of the lattice
TS_ASSERT_EQUALS(&retLatt, latticeAddress);
TS_ASSERT_EQUALS(retLatt.b(), 2.0);
TS_ASSERT_EQUALS(retLatt.c(), 3.0);
delete latt;
}
void test_OrientedLattice_and_theCopyconstructor() {
Sample sample;
// const std::string envName("TestKit");
OrientedLattice *latt = new OrientedLattice(1.0, 2.0, 3.0, 90, 90, 90);
auto lattice = std::make_unique<OrientedLattice>(1.0, 2.0, 3.0, 90, 90, 90);
auto latticeAddress = lattice.get();
TS_ASSERT_THROWS_NOTHING(sample.setOrientedLattice(latt));
TS_ASSERT_THROWS_NOTHING(sample.setOrientedLattice(std::move(lattice)));
// Copy constructor
Sample sample2(sample);
......@@ -111,17 +108,16 @@ public:
const OrientedLattice &retLatt = sample2.getOrientedLattice();
// The copy does NOT refer to the same object
TS_ASSERT_DIFFERS(&retLatt, latt);
TS_ASSERT_DIFFERS(&retLatt, latticeAddress);
TS_ASSERT_EQUALS(retLatt.a(), 1.0);
TS_ASSERT_EQUALS(retLatt.b(), 2.0);
TS_ASSERT_EQUALS(retLatt.c(), 3.0);
delete latt;
}
void test_clearOrientedLattice() {
Sample sample;
OrientedLattice *latt = new OrientedLattice(1.0, 2.0, 3.0, 90, 90, 90);
TS_ASSERT_THROWS_NOTHING(sample.setOrientedLattice(latt));
TS_ASSERT_THROWS_NOTHING(sample.setOrientedLattice(
std::make_unique<OrientedLattice>(1.0, 2.0, 3.0, 90, 90, 90)));
TS_ASSERT(sample.hasOrientedLattice())
TS_ASSERT_THROWS_NOTHING(sample.getOrientedLattice())
......@@ -131,14 +127,13 @@ public:
TS_ASSERT(!sample.hasOrientedLattice())
TS_ASSERT_THROWS(sample.getOrientedLattice(), std::runtime_error &)
delete latt;
}
void test_clearOrientedLattice_and_the_copy_constructor() {
// Create a sample with an oriented lattice.
Sample sampleA;
OrientedLattice *latticeA = new OrientedLattice(1.0, 2.0, 3.0, 90, 90, 90);
TS_ASSERT_THROWS_NOTHING(sampleA.setOrientedLattice(latticeA));
TS_ASSERT_THROWS_NOTHING(sampleA.setOrientedLattice(
std::make_unique<OrientedLattice>(1.0, 2.0, 3.0, 90, 90, 90)));
// Copy the sample.
Sample sampleB(sampleA);
......@@ -154,7 +149,7 @@ public:
// One should be cleared, the other should not.
TS_ASSERT(!sampleA.hasOrientedLattice())
TS_ASSERT_THROWS(sampleA.getOrientedLattice(), std::runtime_error &)
TS_ASSERT_THROWS(sampleA.getOrientedLattice(), const std::runtime_error &)
TS_ASSERT(sampleB.hasOrientedLattice())
TS_ASSERT_THROWS_NOTHING(sampleB.getOrientedLattice())
......@@ -165,17 +160,16 @@ public:
// Both should be cleared.
TS_ASSERT(!sampleA.hasOrientedLattice())
TS_ASSERT_THROWS(sampleA.getOrientedLattice(), std::runtime_error &)
TS_ASSERT_THROWS(sampleA.getOrientedLattice(), const std::runtime_error &)
TS_ASSERT(!sampleB.hasOrientedLattice())
TS_ASSERT_THROWS(sampleB.getOrientedLattice(), std::runtime_error &)
delete latticeA;
TS_ASSERT_THROWS(sampleB.getOrientedLattice(), const std::runtime_error &)
}
void test_clearOrientedLattice_and_assignment() {
// Create a sample with an oriented lattice.
Sample sampleA;
OrientedLattice *latticeA = new OrientedLattice(1.0, 2.0, 3.0, 90, 90, 90);
TS_ASSERT_THROWS_NOTHING(sampleA.setOrientedLattice(latticeA));
TS_ASSERT_THROWS_NOTHING(sampleA.setOrientedLattice(
std::make_unique<OrientedLattice>(1.0, 2.0, 3.0, 90, 90, 90)));
// Create and then assign to the sample.
Sample sampleB;
......@@ -192,7 +186,7 @@ public:
// One should be cleared, the other should not.
TS_ASSERT(!sampleA.hasOrientedLattice())
TS_ASSERT_THROWS(sampleA.getOrientedLattice(), std::runtime_error &)
TS_ASSERT_THROWS(sampleA.getOrientedLattice(), const std::runtime_error &)
TS_ASSERT(sampleB.hasOrientedLattice())
TS_ASSERT_THROWS_NOTHING(sampleB.getOrientedLattice())
......@@ -203,10 +197,9 @@ public:
// Both should be cleared.
TS_ASSERT(!sampleA.hasOrientedLattice())
TS_ASSERT_THROWS(sampleA.getOrientedLattice(), std::runtime_error &)
TS_ASSERT_THROWS(sampleA.getOrientedLattice(), const std::runtime_error &)
TS_ASSERT(!sampleB.hasOrientedLattice())
TS_ASSERT_THROWS(sampleB.getOrientedLattice(), std::runtime_error &)
delete latticeA;
TS_ASSERT_THROWS(sampleB.getOrientedLattice(), const std::runtime_error &)
}
void test_setCrystalStructure() {
......@@ -322,8 +315,8 @@ public:
sample.setShape(shape_sptr);
sample.setName("NameOfASample");
sample.setWidth(1.234);
OrientedLattice latt(4, 5, 6, 90, 91, 92);
sample.setOrientedLattice(&latt);
sample.setOrientedLattice(
std::make_unique<OrientedLattice>(4, 5, 6, 90, 91, 92));
auto sample2 = boost::make_shared<Sample>();
sample2->setName("test name for test_Multiple_Sample - 2");
sample.addSample(sample2);
......
......@@ -10,7 +10,7 @@
#include "MantidGeometry/Instrument/SampleEnvironment.h"
#include "MantidKernel/EnabledWhenProperty.h"
#include "MantidKernel/Material.h"
#include "MantidKernel/System.h"
namespace Mantid {
namespace Algorithms {
......@@ -20,6 +20,7 @@ DECLARE_ALGORITHM(CopySample)
using namespace Mantid::API;
using namespace Mantid::Kernel;
using Geometry::IObject;
using Geometry::OrientedLattice;
using Geometry::SampleEnvironment;
//----------------------------------------------------------------------------------------------
......@@ -196,7 +197,9 @@ void CopySample::copyParameters(Sample &from, Sample &to, bool nameFlag,
if (to.hasOrientedLattice() && orientationOnlyFlag) {
to.getOrientedLattice().setU(from.getOrientedLattice().getU());
} else {
to.setOrientedLattice(&from.getOrientedLattice());
// copy over
to.setOrientedLattice(
std::make_unique<OrientedLattice>(from.getOrientedLattice()));
}
}
}
......
......@@ -51,9 +51,8 @@ public:
envName,
boost::make_shared<Container>(ShapeFactory().createShape(canShape)));
sample.setEnvironment(std::move(kit));
OrientedLattice *latt = new OrientedLattice(1.0, 2.0, 3.0, 90, 90, 90);
sample.setOrientedLattice(latt);
delete latt;
sample.setOrientedLattice(
std::make_unique<OrientedLattice>(1.0, 2.0, 3.0, 90, 90, 90));
auto shape_sptr = ComponentCreationHelper::createCappedCylinder(
0.0127, 1.0, V3D(), V3D(0.0, 1.0, 0.0), "cyl");
shape_sptr->setMaterial(Material(
......@@ -238,9 +237,8 @@ public:
ExperimentInfo_sptr ei1(new ExperimentInfo);
Sample s = createsample();
Sample s1;
OrientedLattice *latt = new OrientedLattice(6.0, 7.0, 8.0, 90, 90, 90);
s1.setOrientedLattice(latt);
delete latt;
s1.setOrientedLattice(
std::make_unique<OrientedLattice>(6.0, 7.0, 8.0, 90, 90, 90));
s1.setName("newsample");
ei->mutableSample() = s;
TS_ASSERT_EQUALS(ew->addExperimentInfo(ei), 0);
......
......@@ -56,8 +56,8 @@ void CalculateUMatrix::exec() {
double alpha = this->getProperty("alpha");
double beta = this->getProperty("beta");
double gamma = this->getProperty("gamma");
OrientedLattice o(a, b, c, alpha, beta, gamma);
Matrix<double> B = o.getB();
auto lattice = std::make_unique<OrientedLattice>(a, b, c, alpha, beta, gamma);
Matrix<double> B = lattice->getB();
PeaksWorkspace_sptr ws = this->getProperty("PeaksWorkspace");
if (!ws)
......@@ -135,9 +135,9 @@ void CalculateUMatrix::exec() {
Eval[0][0], Eval[1][0], Eval[2][0],
Eval[3][0]); // the first column corresponds to the highest eigenvalue
DblMatrix U(qR.getRotation());
o.setU(U);
lattice->setU(U);
ws->mutableSample().setOrientedLattice(&o);
ws->mutableSample().setOrientedLattice(std::move(lattice));
}
} // namespace Crystal
......
......@@ -102,15 +102,13 @@ void FindUBUsingFFT::exec() {
<< n_peaks << " with tolerance of " << std::setprecision(3)
<< std::setw(5) << tolerance << "\n";
OrientedLattice o_lattice;
o_lattice.setUB(UB);
o_lattice.setError(sigabc[0], sigabc[1], sigabc[2], sigabc[3], sigabc[4],
sigabc[5]);
auto lattice = std::make_unique<OrientedLattice>();
lattice->setUB(UB);
lattice->setError(sigabc[0], sigabc[1], sigabc[2], sigabc[3], sigabc[4],
sigabc[5]);
// Show the modified lattice parameters
g_log.notice() << o_lattice << "\n";
ws->mutableSample().setOrientedLattice(&o_lattice);
g_log.notice() << *lattice << "\n";
ws->mutableSample().setOrientedLattice(std::move(lattice));
}
}
......
......@@ -195,22 +195,22 @@ void FindUBUsingIndexedPeaks::exec() {
<< satetolerance << " ,out of " << n_peaks << " Peaks \n";
g_log.notice(stream.str());
OrientedLattice o_lattice;
o_lattice.setUB(UB);
o_lattice.setModUB(modUB);
o_lattice.setError(sigabc[0], sigabc[1], sigabc[2], sigabc[3], sigabc[4],
sigabc[5]);
auto o_lattice = std::make_unique<OrientedLattice>();
o_lattice->setUB(UB);
o_lattice->setModUB(modUB);
o_lattice->setError(sigabc[0], sigabc[1], sigabc[2], sigabc[3], sigabc[4],
sigabc[5]);
double ind_count_inv = 1. / static_cast<double>(indexed_count);
errorHKL *= ind_count_inv;
o_lattice.setErrorModHKL(errorHKL);
o_lattice->setErrorModHKL(errorHKL);
o_lattice.setMaxOrder(MaxOrder);
o_lattice.setCrossTerm(CrossTerm);
o_lattice->setMaxOrder(MaxOrder);
o_lattice->setCrossTerm(CrossTerm);
// Show the modified lattice parameters
logLattice(o_lattice, ModDim);
logLattice(*o_lattice, ModDim);
ws->mutableSample().setOrientedLattice(&o_lattice);
ws->mutableSample().setOrientedLattice(std::move(o_lattice));
}
}
void FindUBUsingIndexedPeaks::logLattice(OrientedLattice &o_lattice,
......
......@@ -78,13 +78,13 @@ void FindUBUsingLatticeParameters::exec() {
if (!ws)
throw std::runtime_error("Could not read the peaks workspace");
std::vector<Peak> &peaks = ws->getPeaks();
size_t n_peaks = ws->getNumberPeaks();
const std::vector<Peak> &peaks = ws->getPeaks();
const int n_peaks = ws->getNumberPeaks();
std::vector<V3D> q_vectors;
q_vectors.reserve(n_peaks);
for (size_t i = 0; i < n_peaks; i++)
for (int i = 0; i < n_peaks; i++)
q_vectors.emplace_back(peaks[i].getQSampleFrame());
Matrix<double> UB(3, 3, false);
......@@ -104,11 +104,11 @@ void FindUBUsingLatticeParameters::exec() {
} else // tell user how many would be indexed
{ // and save the UB in the sample
char logInfo[200];
int num_indexed = IndexingUtils::NumberIndexed(UB, q_vectors, tolerance);
const int num_indexed =
IndexingUtils::NumberIndexed(UB, q_vectors, tolerance);
sprintf(logInfo,
std::string(
"New UB will index %1d Peaks out of %1d with tolerance %5.3f")
.c_str(),
"New UB will index %1d Peaks out of %1d with tolerance "
"%5.3f",
num_indexed, n_peaks, tolerance);
g_log.notice(std::string(logInfo));
......@@ -122,13 +122,13 @@ void FindUBUsingLatticeParameters::exec() {
g_log.notice() << lattice << "\n";
sprintf(logInfo,
std::string("Lattice Parameters (Refined - Input): %11.6f "
"%11.6f %11.6f %11.6f %11.6f %11.6f")
.c_str(),
"Lattice Parameters (Refined - Input): %11.6f "
"%11.6f %11.6f %11.6f %11.6f %11.6f",
calc_a - a, calc_b - b, calc_c - c, calc_alpha - alpha,
calc_beta - beta, calc_gamma - gamma);
g_log.notice(std::string(logInfo));
ws->mutableSample().setOrientedLattice(&lattice);
ws->mutableSample().setOrientedLattice(
std::make_unique<OrientedLattice>(lattice));
}
}
......
......@@ -130,15 +130,13 @@ void FindUBUsingMinMaxD::exec() {
num_indexed, n_peaks, tolerance);
g_log.notice(std::string(logInfo));
OrientedLattice o_lattice;
o_lattice.setUB(UB);
o_lattice.setError(sigabc[0], sigabc[1], sigabc[2], sigabc[3], sigabc[4],
sigabc[5]);
auto lattice = std::make_unique<OrientedLattice>();
lattice->setUB(UB);
lattice->setError(sigabc[0], sigabc[1], sigabc[2], sigabc[3], sigabc[4],
sigabc[5]);
// Show the modified lattice parameters
g_log.notice() << o_lattice << "\n";
ws->mutableSample().setOrientedLattice(&o_lattice);
g_log.notice() << *lattice << "\n";
ws->mutableSample().setOrientedLattice(std::move(lattice));
}
}
......
......@@ -190,10 +190,10 @@ void GoniometerAnglesFromPhiRotation::exec() {
//----------------------------------------------
Geometry::OrientedLattice lat2 = PeaksRun1->sample().getOrientedLattice();
lat2.setUB(UB1);
PeaksRun2->mutableSample().setOrientedLattice(&lat2);
auto lat2 = std::make_unique<OrientedLattice>(
PeaksRun1->sample().getOrientedLattice());
lat2->setUB(UB1);
PeaksRun2->mutableSample().setOrientedLattice(std::move(lat2));
if (!Run1HasOrientedLattice)
PeaksRun1->mutableSample().setOrientedLattice(nullptr);
......@@ -366,13 +366,13 @@ void GoniometerAnglesFromPhiRotation::exec() {
PeaksRun2->getPeak(i).setGoniometerMatrix(Gon2a);
}
OrientedLattice latt2(PeaksRun2->mutableSample().getOrientedLattice());
// Kernel::Matrix<double> UB = latt2.getUB();
auto latt2 = std::make_unique<OrientedLattice>(
PeaksRun2->mutableSample().getOrientedLattice());
Rot.Invert();
Gon2a.Invert();
latt2.setUB(Gon2a * Mk * UB1);
latt2->setUB(Gon2a * Mk * UB1);
PeaksRun2->mutableSample().setOrientedLattice(&latt2);
PeaksRun2->mutableSample().setOrientedLattice(std::move(latt2));
}
/**
......
......@@ -190,16 +190,16 @@ void LoadIsawUB::readModulatedUB(std::ifstream &in, DblMatrix &ub) {
throw std::invalid_argument("Must specify either a MatrixWorkspace or a "
"PeaksWorkspace or a MDWorkspace.");
// Save it into the workspace
ws->mutableSample().setOrientedLattice(latt.get());
// Save it to every experiment info in MD workspaces
// Save a copy of it to every experiment info in MD workspaces
if ((MDWS != nullptr) && (MDWS->getNumExperimentInfo() > 1)) {
for (uint16_t i = 1; i < MDWS->getNumExperimentInfo(); i++) {
ws = MDWS->getExperimentInfo(i);
ws->mutableSample().setOrientedLattice(latt.get());
ws->mutableSample().setOrientedLattice(
std::make_unique<OrientedLattice>(*latt));
}
}
// Save it into the main workspace
ws->mutableSample().setOrientedLattice(std::move(latt));
this->setProperty("InputWorkspace", ws1);
}
......
......@@ -173,23 +173,24 @@ void OptimizeLatticeForCellType::exec() {
ub_alg->setProperty("gamma", refinedCell.gamma());
ub_alg->executeAsChildAlg();
DblMatrix UBnew = peakWS->mutableSample().getOrientedLattice().getUB();
OrientedLattice o_lattice;
o_lattice.setUB(UBnew);
auto o_lattice = std::make_unique<OrientedLattice>();
o_lattice->setUB(UBnew);
if (maxOrder > 0) {
o_lattice.setModUB(modUB);
o_lattice.setMaxOrder(maxOrder);
o_lattice.setCrossTerm(crossTerms);
o_lattice->setModUB(modUB);
o_lattice->setMaxOrder(maxOrder);
o_lattice->setCrossTerm(crossTerms);
}
o_lattice.set(refinedCell.a(), refinedCell.b(), refinedCell.c(),
refinedCell.alpha(), refinedCell.beta(), refinedCell.gamma());
o_lattice.setError(refinedCell.errora(), refinedCell.errorb(),
refinedCell.errorc(), refinedCell.erroralpha(),
refinedCell.errorbeta(), refinedCell.errorgamma());
o_lattice->set(refinedCell.a(), refinedCell.b(), refinedCell.c(),
refinedCell.alpha(), refinedCell.beta(),
refinedCell.gamma());
o_lattice->setError(refinedCell.errora(), refinedCell.errorb(),
refinedCell.errorc(), refinedCell.erroralpha(),
refinedCell.errorbeta(), refinedCell.errorgamma());
// Show the modified lattice parameters
g_log.notice() << i_run->getName() << " " << o_lattice << "\n";
g_log.notice() << i_run->getName() << " " << *o_lattice << "\n";
i_run->mutableSample().setOrientedLattice(&o_lattice);
i_run->mutableSample().setOrientedLattice(std::move(o_lattice));
setProperty("OutputChi2", chisq);
......
......@@ -152,23 +152,22 @@ void PredictSatellitePeaks::exec() {
}
API::Sample sample = Peaks->mutableSample();
OrientedLattice lattice = sample.getOrientedLattice();
auto lattice = std::make_unique<OrientedLattice>(sample.getOrientedLattice());
bool fromUB = getProperty("GetModVectorsFromUB");
if (fromUB) {
offsets1 = lattice.getModVec(0);
offsets2 = lattice.getModVec(1);
offsets3 = lattice.getModVec(2);
offsets1 = lattice->getModVec(0);
offsets2 = lattice->getModVec(1);
offsets3 = lattice->getModVec(2);
if (maxOrder == 0)