Skip to content

Commit

Permalink
refs #7386. Rename functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
OwenArnold committed Jul 4, 2013
1 parent b2d1be3 commit 597dc38
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/API/inc/MantidAPI/IPeak.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ namespace API
virtual void setHKL(double H, double K, double L) = 0;
virtual void setHKL(Mantid::Kernel::V3D HKL) = 0;
virtual Mantid::Kernel::V3D getDetectorPosition() const = 0;
virtual Mantid::Kernel::V3D getDetectorPositionSafe() const = 0;
virtual Mantid::Kernel::V3D getDetectorPositionNoCheck() const = 0;

virtual Mantid::Kernel::V3D getQLabFrame() const = 0;
virtual Mantid::Kernel::V3D getQSampleFrame() const = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ namespace DataObjects
Mantid::Kernel::V3D getQLabFrame() const;
Mantid::Kernel::V3D getQSampleFrame() const;
Mantid::Kernel::V3D getDetectorPosition() const;
Mantid::Kernel::V3D getDetectorPositionSafe() const;
Mantid::Kernel::V3D getDetectorPositionNoCheck() const;

void setQSampleFrame(Mantid::Kernel::V3D QSampleFrame, double detectorDistance=1.0);
void setQLabFrame(Mantid::Kernel::V3D QLabFrame, double detectorDistance=1.0);
Expand Down
4 changes: 2 additions & 2 deletions Code/Mantid/Framework/DataObjects/src/Peak.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ namespace DataObjects
/**
Forwarding function. Exposes the detector position directly.
*/
Mantid::Kernel::V3D Peak::getDetectorPosition() const
Mantid::Kernel::V3D Peak::getDetectorPositionNoCheck() const
{
return getDetector()->getPos();
}
Expand All @@ -816,7 +816,7 @@ namespace DataObjects
Forwarding function. Exposes the detector position directly, but checks that the detector is not null before
accessing its position. Throws if null.
*/
Mantid::Kernel::V3D Peak::getDetectorPositionSafe() const
Mantid::Kernel::V3D Peak::getDetectorPosition() const
{
auto det = getDetector();
if(det == NULL)
Expand Down
8 changes: 4 additions & 4 deletions Code/Mantid/Framework/DataObjects/test/PeakTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -330,14 +330,14 @@ class PeakTest : public CxxTest::TestSuite
TS_ASSERT_EQUALS( p2.getDetectorID(), 19999);
}

void test_getDetectorPositionSafe()
void test_getDetectorPosition()
{
const int detectorId = 19999;
const double wavelength = 2;
Peak p(inst, detectorId, wavelength);

V3D a = p.getDetectorPosition();
V3D b = p.getDetectorPositionSafe();
V3D b = p.getDetectorPositionNoCheck();

TSM_ASSERT_EQUALS("Results should be the same", a, b);
}
Expand All @@ -347,9 +347,9 @@ class PeakTest : public CxxTest::TestSuite
const int detectorId = 19999;
const double wavelength = 2;
Peak p(inst, detectorId, wavelength);
TSM_ASSERT_THROWS_NOTHING("Nothing wrong here, detector is valid", p.getDetectorPositionSafe());
TSM_ASSERT_THROWS_NOTHING("Nothing wrong here, detector is valid", p.getDetectorPosition());
p.setQLabFrame(V3D(1,1,1), 1); // This sets the detector pointer to null and detector id to -1;
TSM_ASSERT_THROWS("Detector is not valid", p.getDetectorPositionSafe(), Mantid::Kernel::Exception::NotFoundError&);
TSM_ASSERT_THROWS("Detector is not valid", p.getDetectorPosition(), Mantid::Kernel::Exception::NotFoundError&);
}

private:
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/MantidQt/SliceViewer/test/MockObjects.h
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ class MockPeakTransformFactory : public PeakTransformFactory
double());
MOCK_CONST_METHOD0(getDetectorPosition,
Mantid::Kernel::V3D());
MOCK_CONST_METHOD0(getDetectorPositionSafe,
MOCK_CONST_METHOD0(getDetectorPositionNoCheck,
Mantid::Kernel::V3D());
};

Expand Down

0 comments on commit 597dc38

Please sign in to comment.