From bdeb6f3ef0da16d81259f2a3a4232885105c2c85 Mon Sep 17 00:00:00 2001 From: Anton Piccardo-Selg <anton.piccardo-selg@tessella.com> Date: Fri, 16 Oct 2015 14:03:14 +0100 Subject: [PATCH] Refs #13872 Fix non-orthogonal with hkl --- Vates/VatesAPI/test/LoadVTKTest.h | 30 ++++++++++++++----- .../vtkDataSetToNonOrthogonalDataSetTest.h | 21 ++++++++----- 2 files changed, 36 insertions(+), 15 deletions(-) diff --git a/Vates/VatesAPI/test/LoadVTKTest.h b/Vates/VatesAPI/test/LoadVTKTest.h index ee748126b01..f8f04bb3837 100644 --- a/Vates/VatesAPI/test/LoadVTKTest.h +++ b/Vates/VatesAPI/test/LoadVTKTest.h @@ -5,6 +5,7 @@ #include "MantidVatesAPI/LoadVTK.h" #include "MantidAPI/IMDHistoWorkspace.h" #include "MantidGeometry/MDGeometry/IMDDimension.h" +#include "MantidGeometry/MDGeometry/UnknownFrame.h" #include "MantidAPI/AlgorithmManager.h" using namespace Mantid::API; @@ -129,14 +130,29 @@ public: outWSName); TS_ASSERT_EQUALS(3, outWS->getNumDims()); - do_check_dimension(outWS->getDimension(0), "X", 0, 67, 68); // These numbers are expected min, max, and nbins known from the input file for dim x. - do_check_dimension(outWS->getDimension(1), "Y", 0, 67, 68); // These numbers are expected min, max, and nbins known from the input file for dim y. - do_check_dimension(outWS->getDimension(2), "Z", 0, 67, 68); // These numbers are expected min, max, and nbins known from the input file for dim z. + do_check_dimension(outWS->getDimension(0), "X", 0, 67, + 68); // These numbers are expected min, max, and nbins + // known from the input file for dim x. + do_check_dimension(outWS->getDimension(1), "Y", 0, 67, + 68); // These numbers are expected min, max, and nbins + // known from the input file for dim y. + do_check_dimension(outWS->getDimension(2), "Z", 0, 67, + 68); // These numbers are expected min, max, and nbins + // known from the input file for dim z. + + TSM_ASSERT_THROWS_NOTHING( + "Should be an UnknownFrame", + dynamic_cast<const Mantid::Geometry::UnknownFrame &>( + outWS->getDimension(0)->getMDFrame())) + TSM_ASSERT_THROWS_NOTHING( + "Should be an UnknownFrame", + dynamic_cast<const Mantid::Geometry::UnknownFrame &>( + outWS->getDimension(1)->getMDFrame())) + TSM_ASSERT_THROWS_NOTHING( + "Should be an UnknownFrame", + dynamic_cast<const Mantid::Geometry::UnknownFrame &>( + outWS->getDimension(2)->getMDFrame())) - TSM_ASSERT_THROWS_NOTHING("Should be an UnknownFrame", dynamic_cast<const Mantid::Geometry::UnknownFrame&>(outWS->getDimension(0))) - TSM_ASSERT_THROWS_NOTHING("Should be an UnknownFrame", dynamic_cast<const Mantid::Geometry::UnknownFrame&>(outWS->getDimension(1))) - TSM_ASSERT_THROWS_NOTHING("Should be an UnknownFrame", dynamic_cast<const Mantid::Geometry::UnknownFrame&>(outWS->getDimension(2))) - double topPercent = loadVTK.getProperty("KeepTopPercent"); TSM_ASSERT_EQUALS("Should default to 25%", 25, topPercent); diff --git a/Vates/VatesAPI/test/vtkDataSetToNonOrthogonalDataSetTest.h b/Vates/VatesAPI/test/vtkDataSetToNonOrthogonalDataSetTest.h index 6e2790dc311..a3061c905be 100644 --- a/Vates/VatesAPI/test/vtkDataSetToNonOrthogonalDataSetTest.h +++ b/Vates/VatesAPI/test/vtkDataSetToNonOrthogonalDataSetTest.h @@ -10,6 +10,9 @@ #include "MantidKernel/PropertyWithValue.h" #include "MantidDataObjects/CoordTransformAffine.h" #include "MantidTestHelpers/MDEventsTestHelper.h" +#include "MantidGeometry/MDGeometry/QSample.h" +#include "MantidGeometry/MDGeometry/HKL.h" +#include "MantidKernel/MDUnit.h" #include <vtkDataArray.h> #include <vtkFieldData.h> @@ -38,15 +41,17 @@ private: // Creating an MDEventWorkspace as the content is not germain to the // information necessary for the non-orthogonal axes std::string wsName = "simpleWS"; - IMDEventWorkspace_sptr ws = makeAnyMDEW<MDEvent<4>, 4>(1, 0.0, 1.0, 1, wsName); + IMDEventWorkspace_sptr ws; // Set the coordinate system - if (!wrongCoords) - { - ws->setCoordinateSystem(Mantid::Kernel::HKL); - } - else - { - ws->setCoordinateSystem(QSample); + if (wrongCoords) { + Mantid::Geometry::QSample frame; + ws = MDEventsTestHelper::makeAnyMDEWWithFrames<MDEvent<4>, 4>( + 1, 0.0, 1.0, frame, 1, wsName); + + } else { + Mantid::Geometry::HKL frame(new Mantid::Kernel::ReciprocalLatticeUnit); + ws = MDEventsTestHelper::makeAnyMDEWWithFrames<MDEvent<4>, 4>( + 1, 0.0, 1.0, frame, 1, wsName); } // Set the UB matrix -- GitLab