Commit 9300ffa4 authored by Russell Taylor's avatar Russell Taylor
Browse files

Eradicate IInstrument. Instrument's the one to talk to now (it was the only...

Eradicate IInstrument. Instrument's the one to talk to now (it was the only descendent class anyway). Re #2041.
parent 3e45ea53
......@@ -4,9 +4,7 @@
#include "MantidKernel/System.h"
#include "MantidAPI/Sample.h"
#include "MantidAPI/Run.h"
#include "MantidGeometry/Instrument/Instrument.h"
#include "MantidGeometry/IInstrument.h"
#include "MantidGeometry/Instrument.h"
namespace Mantid
{
......@@ -34,8 +32,8 @@ namespace API
ExperimentInfo * cloneExperimentInfo();
/// Instrument accessors
void setInstrument(const Geometry::IInstrument_sptr&);
Geometry::IInstrument_sptr getInstrument() const;
void setInstrument(const Geometry::Instrument_sptr&);
Geometry::Instrument_sptr getInstrument() const;
boost::shared_ptr<Geometry::Instrument> getBaseInstrument() const;
/// Returns the set of parameters modifying the base instrument
......
......@@ -2,12 +2,10 @@
#define MANTID_API_IPEAK_H_
#include "MantidAPI/DllConfig.h"
#include "MantidGeometry/IInstrument.h"
#include "MantidGeometry/Instrument.h"
#include "MantidKernel/Matrix.h"
#include "MantidKernel/V3D.h"
#include "MantidKernel/PhysicalConstants.h"
//#include "MantidKernel/System.h"
namespace Mantid
{
......@@ -25,12 +23,12 @@ namespace API
virtual ~IPeak();
virtual void setInstrument(Mantid::Geometry::IInstrument_const_sptr inst) = 0;
virtual void setInstrument(Geometry::Instrument_const_sptr inst) = 0;
virtual int getDetectorID() const = 0;
virtual void setDetectorID(int m_DetectorID) = 0;
virtual Mantid::Geometry::IDetector_const_sptr getDetector() const = 0;
virtual Mantid::Geometry::IInstrument_const_sptr getInstrument() const = 0;
virtual Geometry::IDetector_const_sptr getDetector() const = 0;
virtual Geometry::Instrument_const_sptr getInstrument() const = 0;
virtual int getRunNumber() const = 0;
virtual void setRunNumber(int m_RunNumber) = 0;
......
......@@ -58,7 +58,7 @@ namespace API
virtual ~IPeaksWorkspace();
//boost::shared_ptr<IPeaksWorkspace> clone() = 0;
//void appendFile( std::string filename, Mantid::Geometry::IInstrument_sptr inst) = 0;
//void appendFile( std::string filename, Mantid::Geometry::Instrument_sptr inst) = 0;
//---------------------------------------------------------------------------------------------
/** @return the number of peaks
......
......@@ -3,7 +3,7 @@
#include "MantidAPI/DllConfig.h"
#include "MantidKernel/DataService.h"
#include "MantidGeometry/Instrument/Instrument.h"
#include "MantidGeometry/Instrument.h"
#include "MantidKernel/SingletonHolder.h"
namespace Mantid
......
......@@ -15,7 +15,7 @@
#include "MantidAPI/WorkspaceHistory.h"
#include "MantidAPI/WorkspaceIterator.h"
#include "MantidGeometry/IDetector.h"
#include "MantidGeometry/Instrument/Instrument.h"
#include "MantidGeometry/Instrument.h"
#include "MantidGeometry/Instrument/NearestNeighbours.h"
#include "MantidKernel/cow_ptr.h"
#include "MantidKernel/Exception.h"
......
#include "MantidAPI/ExperimentInfo.h"
#include "MantidAPI/MatrixWorkspace.h"
#include "MantidGeometry/IInstrument.h"
#include "MantidGeometry/Instrument/Instrument.h"
#include "MantidGeometry/Instrument.h"
#include "MantidGeometry/Instrument/ParameterMap.h"
#include "MantidGeometry/Instrument/ParComponentFactory.h"
#include "MantidGeometry/Instrument/XMLlogfile.h"
......@@ -64,17 +63,16 @@ namespace API
*
* @param instr :: Shared pointer to an instrument.
*/
void ExperimentInfo::setInstrument(const IInstrument_sptr& instr)
void ExperimentInfo::setInstrument(const Instrument_sptr& instr)
{
boost::shared_ptr<Instrument> tmp = boost::dynamic_pointer_cast<Instrument>(instr);
if (tmp->isParametrized())
if (instr->isParametrized())
{
sptr_instrument = tmp->baseInstrument();
m_parmap = tmp->getParameterMap();
sptr_instrument = instr->baseInstrument();
m_parmap = instr->getParameterMap();
}
else
{
sptr_instrument=tmp;
sptr_instrument = instr;
}
}
......@@ -84,7 +82,7 @@ namespace API
*
* @return The instrument class
*/
IInstrument_sptr ExperimentInfo::getInstrument()const
Instrument_sptr ExperimentInfo::getInstrument()const
{
return Geometry::ParComponentFactory::createInstrument(sptr_instrument, m_parmap);
}
......
......@@ -268,7 +268,7 @@ void IFunctionMW::setMatrixWorkspace(boost::shared_ptr<const API::MatrixWorkspac
// the detector returned by det->getID()
if ( boost::dynamic_pointer_cast<Geometry::DetectorGroup>(det) )
{
IInstrument_sptr inst = m_workspace->getInstrument();
Instrument_sptr inst = m_workspace->getInstrument();
det = inst->getDetector(det->getID());
}
......@@ -436,7 +436,7 @@ double IFunctionMW::convertValue(double value, Kernel::Unit_sptr& outUnit,
double l1,l2,twoTheta;
// Get l1, l2 and theta (see also RemoveBins.calculateDetectorPosition())
IInstrument_const_sptr instrument = ws->getInstrument();
Instrument_const_sptr instrument = ws->getInstrument();
Geometry::IObjComponent_const_sptr sample = instrument->getSample();
if (sample == NULL)
{
......@@ -498,7 +498,7 @@ void IFunctionMW::convertValue(std::vector<double>& values, Kernel::Unit_sptr& o
double l1,l2,twoTheta;
// Get l1, l2 and theta (see also RemoveBins.calculateDetectorPosition())
IInstrument_const_sptr instrument = ws->getInstrument();
Instrument_const_sptr instrument = ws->getInstrument();
Geometry::IObjComponent_const_sptr sample = instrument->getSample();
if (sample == NULL)
{
......
......@@ -7,7 +7,7 @@
#include "MantidAPI/WorkspaceIterator.h"
#include "MantidAPI/WorkspaceIteratorCode.h"
#include "MantidAPI/SpectraDetectorMap.h"
#include "MantidGeometry/Instrument/Instrument.h"
#include "MantidGeometry/Instrument.h"
#include "MantidGeometry/Instrument/ParameterMap.h"
#include "MantidGeometry/Instrument/ParComponentFactory.h"
#include "MantidGeometry/Instrument/XMLlogfile.h"
......@@ -709,7 +709,7 @@ namespace Mantid
throw Kernel::Exception::NotFoundError("MatrixWorkspace::getDetector(): NULL spectrum found at the given workspace index.", "");
const std::set<detid_t> dets = spec->getDetectorIDs();
IInstrument_sptr localInstrument = getInstrument();
Instrument_sptr localInstrument = getInstrument();
if( !localInstrument )
{
g_log.debug() << "No instrument defined.\n";
......
......@@ -19,7 +19,7 @@ public:
void test_GetInstrument_default()
{
ExperimentInfo ws;
boost::shared_ptr<IInstrument> i = ws.getInstrument();
boost::shared_ptr<Instrument> i = ws.getInstrument();
TSM_ASSERT( "ExperimentInfo gets a default, empty Instrument.", i);
TS_ASSERT_EQUALS( ws.getInstrument()->type(), "Instrument" );
}
......@@ -27,16 +27,16 @@ public:
void test_GetSetInstrument_default()
{
ExperimentInfo ws;
boost::shared_ptr<IInstrument> inst1(new Instrument());
boost::shared_ptr<Instrument> inst1(new Instrument());
inst1->setName("MyTestInst");
ws.setInstrument(inst1);
// Instruments don't point to the same base place since they
boost::shared_ptr<IInstrument> inst2 = ws.getInstrument();
boost::shared_ptr<Instrument> inst2 = ws.getInstrument();
TS_ASSERT_EQUALS( inst2->getName(), "MyTestInst");
// But the base instrument does!
boost::shared_ptr<IInstrument> inst3 = ws.getBaseInstrument();
boost::shared_ptr<Instrument> inst3 = ws.getBaseInstrument();
TS_ASSERT_EQUALS( inst3.get(), inst1.get());
TS_ASSERT_EQUALS( inst3->getName(), "MyTestInst");
}
......@@ -89,7 +89,7 @@ public:
ws.mutableRun().setProtonCharge(1.234);
ws.mutableSample().setName("test");
ws.mutableSample().setOrientedLattice( new OrientedLattice(1,2,3,90,90,90) );
boost::shared_ptr<IInstrument> inst1(new Instrument());
boost::shared_ptr<Instrument> inst1(new Instrument());
inst1->setName("MyTestInst");
ws.setInstrument(inst1);
......@@ -104,7 +104,7 @@ public:
ws.mutableRun().setProtonCharge(1.234);
ws.mutableSample().setName("test");
ws.mutableSample().setOrientedLattice( new OrientedLattice(1,2,3,90,90,90) );
boost::shared_ptr<IInstrument> inst1(new Instrument());
boost::shared_ptr<Instrument> inst1(new Instrument());
inst1->setName("MyTestInst");
ws.setInstrument(inst1);
......
......@@ -8,7 +8,7 @@
#include "MantidAPI/WorkspaceFactory.h"
#include "MantidAPI/NumericAxis.h"
#include "MantidAPI/SpectraAxis.h"
#include "MantidGeometry/IInstrument.h"
#include "MantidGeometry/Instrument.h"
#include "MantidGeometry/MDGeometry/IMDDimension.h"
#include "MantidGeometry/MDGeometry/MDPoint.h"
#include "MantidGeometry/MDGeometry/MDCell.h"
......
......@@ -4,7 +4,7 @@
#include <cxxtest/TestSuite.h>
#include "MantidAPI/FrameworkManager.h"
#include "MantidAPI/InstrumentDataService.h"
#include "MantidGeometry/Instrument/Instrument.h"
#include "MantidGeometry/Instrument.h"
#include "MantidKernel/Exception.h"
#include <iostream>
......
......@@ -8,7 +8,7 @@
#include "MantidAPI/SpectraAxis.h"
#include "MantidAPI/SpectraDetectorMap.h"
#include "MantidAPI/WorkspaceFactory.h"
#include "MantidGeometry/Instrument/Instrument.h"
#include "MantidGeometry/Instrument.h"
#include "MantidGeometry/Instrument/OneToOneSpectraDetectorMap.h"
#include <boost/scoped_ptr.hpp>
#include <cxxtest/TestSuite.h>
......
......@@ -57,7 +57,7 @@ namespace Mantid
/// following the example MaskDetectors write to this version of the instrument
boost::shared_ptr<Geometry::Instrument> m_WInstru;
/// when we read need to read from here
Geometry::IInstrument_sptr m_RInstru;
Geometry::Instrument_const_sptr m_RInstru;
/// pointer to the map that links detectors to their masking with the input workspace
Geometry::ParameterMap* m_Pmap;
};
......
......@@ -30,7 +30,7 @@ private:
void getTminData(const bool);
double m_DIFCref; ///< The reference value for DIFC to filter with
double m_K; ///< Mystery variable that I'm not sure what it is for
Geometry::IInstrument_const_sptr m_instrument; //< The instrument
Geometry::Instrument_const_sptr m_instrument; //< The instrument
double m_L1; ///< The instrument initial flightpath
double m_Tmin; ///< The start of the time-of-flight frame
std::size_t m_numberOfSpectra; ///< The number of spectra in the workspace
......
......@@ -60,7 +60,7 @@ std::map<detid_t, double> * AlignDetectors::calcTofToD_ConversionMap(Mantid::API
bool vulcancorrection)
{
// Get a pointer to the instrument contained in the workspace
IInstrument_const_sptr instrument = inputWS->getInstrument();
Instrument_const_sptr instrument = inputWS->getInstrument();
double l1;
Kernel::V3D beamline,samplePos;
......
......@@ -8,7 +8,7 @@
#include "MantidAPI/WorkspaceValidators.h"
#include "MantidDataObjects/EventWorkspace.h"
#include "MantidDataObjects/OffsetsWorkspace.h"
#include "MantidGeometry/Instrument/Instrument.h"
#include "MantidGeometry/Instrument.h"
#include "MantidKernel/V3D.h"
#include "MantidKernel/BinaryFile.h"
#include "MantidKernel/PhysicalConstants.h"
......@@ -36,7 +36,6 @@ void CaltoDspacemap::initDocs()
using namespace Kernel;
using namespace API;
using namespace DataObjects;
using Geometry::IInstrument_const_sptr;
using DataObjects::EventList;
using DataObjects::EventWorkspace;
using DataObjects::EventWorkspace_sptr;
......
......@@ -332,7 +332,7 @@ void ConvertUnits::convertViaTOF(Kernel::Unit_const_sptr fromUnit, API::MatrixWo
int64_t numberOfSpectra_i = static_cast<int64_t>(m_numberOfSpectra); // cast to make openmp happy
// Get a pointer to the instrument contained in the workspace
IInstrument_const_sptr instrument = outputWS->getInstrument();
Instrument_const_sptr instrument = outputWS->getInstrument();
// Get the parameter map
const ParameterMap& pmap = outputWS->constInstrumentParameters();
......
......@@ -6,7 +6,6 @@
#include "MantidAPI/InstrumentDataService.h"
#include "MantidAPI/MatrixWorkspace.h"
#include "MantidAPI/WorkspaceProperty.h"
#include "MantidGeometry/IInstrument.h"
#include "MantidKernel/ConfigService.h"
#include <boost/algorithm/string/detail/classification.hpp>
#include <boost/algorithm/string/split.hpp>
......@@ -37,7 +36,7 @@ namespace Mantid
using namespace Kernel;
using API::Progress;
using API::FileProperty;
using Geometry::IInstrument_sptr;
using Geometry::Instrument_sptr;
CreateCalFileByNames::CreateCalFileByNames():API::Algorithm(),group_no(0)
{
......@@ -75,7 +74,7 @@ namespace Mantid
throw std::runtime_error("Workspace not found!");
// Get the instrument.
IInstrument_sptr inst = ws->getInstrument();
Instrument_sptr inst = ws->getInstrument();
if (!inst)
throw std::runtime_error("No instrument found in the workspace " + ws->getName());
......
......@@ -6,7 +6,6 @@
#include "MantidDataObjects/Workspace2D.h"
#include "MantidKernel/ConfigService.h"
#include "MantidAPI/InstrumentDataService.h"
#include "MantidGeometry/IInstrument.h"
#include <queue>
#include <fstream>
......@@ -84,7 +83,7 @@ namespace Mantid
throw std::invalid_argument("No InputWorkspace");
//Get some stuff from the input workspace
IInstrument_sptr inst = inputW->getInstrument();
Instrument_sptr inst = inputW->getInstrument();
std::string instname = inst->getName();
// Check that the instrument is in store
......
......@@ -129,7 +129,7 @@ namespace Algorithms
* @param detIDtoGroup :: output: map of detID: to group number
* @param prog :: progress report
*/
void makeGroupingByNames(std::string GroupNames, IInstrument_sptr inst, std::map<detid_t, int> & detIDtoGroup, Progress & prog)
void makeGroupingByNames(std::string GroupNames, Instrument_sptr inst, std::map<detid_t, int> & detIDtoGroup, Progress & prog)
{
// Split the names of the group and insert in a vector
std::vector<std::string> vgroups;
......@@ -232,7 +232,7 @@ namespace Algorithms
throw std::invalid_argument("You must specify either to use the OldCalFilename parameter OR GroupNames but not both!");
// ---------- Get the instrument one of 3 ways ---------------------------
IInstrument_sptr inst;
Instrument_sptr inst;
if (inWS)
{
inst = inWS->getInstrument();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment