Commit 400df480 authored by Karl Palmen's avatar Karl Palmen
Browse files

Rename Geometry::Object class to Geometry::CSGObject re #12827



The files are yet to be renamed
Signed-off-by: default avatarKarl Palmen <karl.palmen@stfc.ac.uk>
parent a2d24486
......@@ -69,9 +69,9 @@ public:
/// Set the name of the sample
void setName(const std::string &name);
/// Return the sample shape
const Geometry::Object &getShape() const;
const Geometry::CSGObject &getShape() const;
/// Update the shape of the object
void setShape(const Geometry::Object &shape);
void setShape(const Geometry::CSGObject &shape);
/** @name Material properties.*/
//@{
......@@ -138,7 +138,7 @@ private:
/// The sample name
std::string m_name;
/// The sample shape object
Geometry::Object m_shape;
Geometry::CSGObject m_shape;
/// An owned pointer to the SampleEnvironment object
boost::shared_ptr<Geometry::SampleEnvironment> m_environment;
/// Pointer to the OrientedLattice of the sample, NULL if not set.
......
......@@ -16,7 +16,7 @@ namespace Mantid {
namespace API {
using namespace Mantid::Kernel;
using Geometry::Object;
using Geometry::CSGObject;
using Geometry::OrientedLattice;
using Geometry::SampleEnvironment;
using Geometry::ShapeFactory;
......@@ -101,13 +101,13 @@ void Sample::setName(const std::string &name) { m_name = name; }
* its own coordinate system with its centre at [0,0,0]
* @return A reference to the object describing the shape
*/
const Object &Sample::getShape() const { return m_shape; }
const CSGObject &Sample::getShape() const { return m_shape; }
/** Set the object that describes the sample shape. The object is defined within
* its own coordinate system
* @param shape :: The object describing the shape
*/
void Sample::setShape(const Object &shape) { m_shape = shape; }
void Sample::setShape(const CSGObject &shape) { m_shape = shape; }
/** Return the material.
* @return A reference to the material the sample is composed of
......
......@@ -34,13 +34,13 @@ public:
0.0127, 1.0, V3D(), V3D(0.0, 1.0, 0.0), "cyl");
Sample sample;
TS_ASSERT_THROWS_NOTHING(sample.setShape(*shape_sptr))
const Object &sampleShape = sample.getShape();
const CSGObject &sampleShape = sample.getShape();
TS_ASSERT_EQUALS(shape_sptr->getName(), sampleShape.getName());
}
void test_Setting_Default_Shape_Is_Accepted() {
Sample sample;
Object object;
CSGObject object;
TS_ASSERT_EQUALS(object.hasValidShape(), false);
TS_ASSERT_THROWS_NOTHING(sample.setShape(object));
}
......@@ -56,7 +56,7 @@ public:
const std::string envName("TestKit");
SampleEnvironment *kit =
new SampleEnvironment(envName, boost::make_shared<const Container>(""));
kit->add(boost::make_shared<const Object>());
kit->add(boost::make_shared<const CSGObject>());
TS_ASSERT_THROWS_NOTHING(sample.setEnvironment(kit));
......@@ -259,7 +259,7 @@ public:
Material vanBlock("vanBlock",
Mantid::PhysicalConstants::getNeutronAtom(23, 0), 0.072);
Sample sample;
Object shape;
CSGObject shape;
shape.setMaterial(vanBlock);
sample.setShape(shape);
......
......@@ -13,7 +13,7 @@ class Sample;
}
namespace Geometry {
class IDetector;
class Object;
class CSGObject;
}
namespace Algorithms {
......@@ -114,7 +114,7 @@ protected:
virtual void initialiseCachedDistances() = 0;
API::MatrixWorkspace_sptr m_inputWS; ///< A pointer to the input workspace
const Geometry::Object *m_sampleObject; ///< Local cache of sample object.
const Geometry::CSGObject *m_sampleObject; ///< Local cache of sample object.
Kernel::V3D m_beamDirection; ///< The direction of the beam.
std::vector<double> m_L1s, ///< Cached L1 distances
m_elementVolumes; ///< Cached element volumes
......
......@@ -12,7 +12,7 @@ class Material;
class V3D;
}
namespace Geometry {
class Object;
class CSGObject;
}
namespace Algorithms {
......
......@@ -106,7 +106,7 @@ private:
std::string sampleXML() override;
void initialiseCachedDistances() override;
/// Create the gague volume for the correction
Geometry::Object constructGaugeVolume();
Geometry::CSGObject constructGaugeVolume();
double m_cubeSide; ///< The length of the side of an element cube in m
};
......
......@@ -114,7 +114,7 @@ private:
Kernel::V3D &detAxis);
/// Computes the distance to the given shape from a starting point
double distToSurface(const Kernel::V3D &start,
const Geometry::Object *shape) const;
const Geometry::CSGObject *shape) const;
/// Computes the detector efficiency for a given paramater
double detectorEfficiency(const double alpha) const;
/// Computes an approximate expansion of a Chebysev polynomial
......@@ -138,7 +138,7 @@ private:
/// A lookup of previously seen shape objects used to save calculation time as
/// most detectors have the same shape
std::map<const Geometry::Object *, std::pair<double, Kernel::V3D>>
std::map<const Geometry::CSGObject *, std::pair<double, Kernel::V3D>>
m_shapeCache;
/// Sample position
Kernel::V3D m_samplePos;
......
......@@ -11,7 +11,7 @@ namespace Mantid {
// forward declarations
namespace Geometry {
class IDetector;
class Object;
class CSGObject;
class ParameterMap;
}
......@@ -92,7 +92,7 @@ private:
Kernel::V3D &detAxis);
/// Computes the distance to the given shape from a starting point
double distToSurface(const Kernel::V3D start,
const Geometry::Object *shape) const;
const Geometry::CSGObject *shape) const;
/// Calculate the detector efficiency
double detectorEfficiency(const double alpha,
const double scale_factor = 1.0) const;
......@@ -115,7 +115,7 @@ private:
const Geometry::ParameterMap *paraMap;
/// A lookup of previously seen shape objects used to save calculation time as
/// most detectors have the same shape
std::map<const Geometry::Object *, std::pair<double, Kernel::V3D>> shapeCache;
std::map<const Geometry::CSGObject *, std::pair<double, Kernel::V3D>> shapeCache;
/// Sample position
Kernel::V3D samplePos;
/// The spectra numbers that were skipped
......
......@@ -9,7 +9,7 @@ namespace API {
class Sample;
}
namespace Geometry {
class Object;
class CSGObject;
class SampleEnvironment;
}
namespace Kernel {
......@@ -62,7 +62,7 @@ public:
double lambdaAfter) const;
private:
const Geometry::Object &m_sample;
const Geometry::CSGObject &m_sample;
const Geometry::SampleEnvironment *m_env;
const Geometry::BoundingBox m_activeRegion;
const size_t m_maxScatterAttempts;
......
......@@ -19,7 +19,7 @@ class V3D;
}
namespace Geometry {
class Object;
class CSGObject;
}
namespace Algorithms {
......@@ -99,7 +99,7 @@ public:
protected:
API::MatrixWorkspace_sptr m_inputWS; ///< A pointer to the input workspace
const Geometry::Object *m_sampleObject; ///< Local cache of sample object.
const Geometry::CSGObject *m_sampleObject; ///< Local cache of sample object.
Kernel::V3D m_beamDirection; ///< The direction of the beam.
std::vector<double> m_L1s, ///< Cached L1 distances
m_elementVolumes; ///< Cached element volumes
......
......@@ -244,7 +244,7 @@ void AbsorptionCorrection::retrieveBaseProperties() {
static_cast<uint16_t>(0), 0.0, 0.0, sigma_s, 0.0,
sigma_s, sigma_atten);
Object shape = m_inputWS->sample().getShape(); // copy
CSGObject shape = m_inputWS->sample().getShape(); // copy
shape.setMaterial(Material("SetInAbsorptionCorrection", neutron, rho));
m_inputWS->mutableSample().setShape(shape);
}
......@@ -296,7 +296,7 @@ void AbsorptionCorrection::constructSample(API::Sample &sample) {
throw std::invalid_argument(mess);
}
} else {
boost::shared_ptr<Object> shape = ShapeFactory().createShape(xmlstring);
boost::shared_ptr<CSGObject> shape = ShapeFactory().createShape(xmlstring);
sample.setShape(*shape);
m_sampleObject = &sample.getShape();
......
......@@ -43,7 +43,7 @@ std::string AnyShapeAbsorption::sampleXML() {
void AnyShapeAbsorption::initialiseCachedDistances() {
// First, check if a 'gauge volume' has been defined. If not, it's the same as
// the sample.
Object integrationVolume = *m_sampleObject;
CSGObject integrationVolume = *m_sampleObject;
if (m_inputWS->run().hasProperty("GaugeVolume")) {
integrationVolume = constructGaugeVolume();
}
......@@ -120,12 +120,12 @@ void AnyShapeAbsorption::initialiseCachedDistances() {
YSliceThickness * ZSliceThickness;
}
Geometry::Object AnyShapeAbsorption::constructGaugeVolume() {
Geometry::CSGObject AnyShapeAbsorption::constructGaugeVolume() {
g_log.information("Calculating scattering within the gauge volume defined on "
"the input workspace");
// Retrieve and create the gauge volume shape
boost::shared_ptr<const Geometry::Object> volume = ShapeFactory().createShape(
boost::shared_ptr<const Geometry::CSGObject> volume = ShapeFactory().createShape(
m_inputWS->run().getProperty("GaugeVolume")->value());
// Although DefineGaugeVolume algorithm will have checked validity of XML, do
// so again here
......
......@@ -565,14 +565,14 @@ Instrument_sptr CreateSampleWorkspace::createTestInstrumentRectangular(
// Define a source component
ObjComponent *source =
new ObjComponent("moderator", Object_sptr(new Object), testInst.get());
new ObjComponent("moderator", Object_sptr(new CSGObject), testInst.get());
source->setPos(V3D(0.0, 0.0, -sourceSampleDistance));
testInst->add(source);
testInst->markAsSource(source);
// Add chopper
ObjComponent *chopper = new ObjComponent(
"chopper-position", Object_sptr(new Object), testInst.get());
"chopper-position", Object_sptr(new CSGObject), testInst.get());
chopper->setPos(V3D(0.0, 0.0, -0.25 * sourceSampleDistance));
testInst->add(chopper);
......
......@@ -304,12 +304,12 @@ double DetectorEfficiencyCor::calculateOneOverK(double loBinBound,
void DetectorEfficiencyCor::getDetectorGeometry(const Geometry::IDetector &det,
double &detRadius,
V3D &detAxis) {
boost::shared_ptr<const Object> shape_sptr = det.shape();
boost::shared_ptr<const CSGObject> shape_sptr = det.shape();
if (!shape_sptr->hasValidShape()) {
throw Exception::NotFoundError("Shape", "Detector has no shape");
}
std::map<const Geometry::Object *,
std::map<const Geometry::CSGObject *,
std::pair<double, Kernel::V3D>>::const_iterator it =
m_shapeCache.find(shape_sptr.get());
if (it == m_shapeCache.end()) {
......@@ -369,7 +369,7 @@ void DetectorEfficiencyCor::getDetectorGeometry(const Geometry::IDetector &det,
* @returns The distance to the surface in meters
*/
double DetectorEfficiencyCor::distToSurface(const V3D &start,
const Object *shape) const {
const CSGObject *shape) const {
// get a vector from the point that was passed to the origin
V3D direction = V3D(0.0, 0.0, 0.0) - start;
// it needs to be a unit vector
......
......@@ -167,7 +167,7 @@ API::MatrixWorkspace_sptr HRPDSlabCanAbsorption::runFlatPlateAbsorption() {
NeutronAtom neutron(static_cast<uint16_t>(EMPTY_DBL()),
static_cast<uint16_t>(0), 0.0, 0.0, sigma_s, 0.0,
sigma_s, sigma_atten);
Object shape = m_inputWS->sample().getShape(); // copy
CSGObject shape = m_inputWS->sample().getShape(); // copy
shape.setMaterial(Material("SetInSphericalAbsorption", neutron, rho));
m_inputWS->mutableSample().setShape(shape);
}
......
......@@ -258,7 +258,7 @@ He3TubeEfficiency::calculateExponential(std::size_t spectraIndex,
void He3TubeEfficiency::getDetectorGeometry(const Geometry::IDetector &det,
double &detRadius,
Kernel::V3D &detAxis) {
boost::shared_ptr<const Geometry::Object> shape_sptr = det.shape();
boost::shared_ptr<const Geometry::CSGObject> shape_sptr = det.shape();
if (!shape_sptr) {
throw std::runtime_error(
"Detector geometry error: detector with id: " +
......@@ -267,7 +267,7 @@ void He3TubeEfficiency::getDetectorGeometry(const Geometry::IDetector &det,
"The algorithm works for instruments with one-to-one "
"spectra-to-detector maps only!");
}
std::map<const Geometry::Object *,
std::map<const Geometry::CSGObject *,
std::pair<double, Kernel::V3D>>::const_iterator it =
this->shapeCache.find(shape_sptr.get());
if (it == this->shapeCache.end()) {
......@@ -281,7 +281,7 @@ void He3TubeEfficiency::getDetectorGeometry(const Geometry::IDetector &det,
// assume radii in z and x and the axis is in the y
PARALLEL_CRITICAL(deteff_shapecachea) {
this->shapeCache.insert(
std::pair<const Geometry::Object *, std::pair<double, Kernel::V3D>>(
std::pair<const Geometry::CSGObject *, std::pair<double, Kernel::V3D>>(
shape_sptr.get(),
std::pair<double, Kernel::V3D>(detRadius, detAxis)));
}
......@@ -296,7 +296,7 @@ void He3TubeEfficiency::getDetectorGeometry(const Geometry::IDetector &det,
// and the axis is perpendicular, in the x direction
PARALLEL_CRITICAL(deteff_shapecacheb) {
this->shapeCache.insert(
std::pair<const Geometry::Object *, std::pair<double, Kernel::V3D>>(
std::pair<const Geometry::CSGObject *, std::pair<double, Kernel::V3D>>(
shape_sptr.get(),
std::pair<double, Kernel::V3D>(detRadius, detAxis)));
}
......@@ -308,7 +308,7 @@ void He3TubeEfficiency::getDetectorGeometry(const Geometry::IDetector &det,
detAxis = Kernel::V3D(0, 0, 1);
PARALLEL_CRITICAL(deteff_shapecachec) {
this->shapeCache.insert(
std::pair<const Geometry::Object *, std::pair<double, Kernel::V3D>>(
std::pair<const Geometry::CSGObject *, std::pair<double, Kernel::V3D>>(
shape_sptr.get(),
std::pair<double, Kernel::V3D>(detRadius, detAxis)));
}
......@@ -333,7 +333,7 @@ void He3TubeEfficiency::getDetectorGeometry(const Geometry::IDetector &det,
* @returns The distance to the surface in metres
*/
double He3TubeEfficiency::distToSurface(const Kernel::V3D start,
const Geometry::Object *shape) const {
const Geometry::CSGObject *shape) const {
// get a vector from the point that was passed to the origin
Kernel::V3D direction = Kernel::V3D(0.0, 0.0, 0.0) - start;
// it needs to be a unit vector
......
......@@ -140,7 +140,7 @@ void MultipleScatteringCylinderAbsorption::exec() {
NeutronAtom neutron(static_cast<uint16_t>(EMPTY_DBL()),
static_cast<uint16_t>(0), 0.0, 0.0, coeff3, 0.0, coeff3,
coeff1);
Object shape = in_WS->sample().getShape(); // copy
CSGObject shape = in_WS->sample().getShape(); // copy
shape.setMaterial(Material("SetInMultipleScattering", neutron, coeff2));
in_WS->mutableSample().setShape(shape);
}
......
......@@ -287,7 +287,7 @@ void SofQWNormalisedPolygon::initAngularCachesNonPSD(
* The angular width is computed using the l2 distance from the sample
*/
Kernel::V3D pos;
boost::shared_ptr<const Object>
boost::shared_ptr<const CSGObject>
shape; // Defined in its own reference frame with centre at 0,0,0
Kernel::Quat rot;
......
......@@ -124,7 +124,7 @@ void SphericalAbsorption::retrieveBaseProperties() {
NeutronAtom neutron(static_cast<uint16_t>(EMPTY_DBL()),
static_cast<uint16_t>(0), 0.0, 0.0, sigma_s, 0.0,
sigma_s, sigma_atten);
Object shape = m_inputWS->sample().getShape(); // copy
CSGObject shape = m_inputWS->sample().getShape(); // copy
shape.setMaterial(Material("SetInSphericalAbsorption", neutron, rho));
m_inputWS->mutableSample().setShape(shape);
}
......
......@@ -121,7 +121,7 @@ private:
// convert into a Geometry object
bool addTypeTag = true;
boost::shared_ptr<Object> shape =
boost::shared_ptr<CSGObject> shape =
ShapeFactory().createShape(xmlShape, addTypeTag);
boost::shared_ptr<Instrument> instrument = boost::make_shared<Instrument>();
......
Markdown is supported
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