Commit cf55d9f2 authored by Roman Tolchenov's avatar Roman Tolchenov
Browse files

Apply clang format patch. Re #12827

parent 81c5b9af
...@@ -353,7 +353,7 @@ int Sample::loadNexus(::NeXus::File *file, const std::string &group) { ...@@ -353,7 +353,7 @@ int Sample::loadNexus(::NeXus::File *file, const std::string &group) {
if (!shape_xml.empty()) { if (!shape_xml.empty()) {
ShapeFactory shapeMaker; ShapeFactory shapeMaker;
m_shape = shapeMaker.createShape(shape_xml, m_shape = shapeMaker.createShape(shape_xml,
false /*Don't wrap with <type> tag*/); false /*Don't wrap with <type> tag*/);
} }
Kernel::Material material; Kernel::Material material;
material.loadNexus(file, "material"); material.loadNexus(file, "material");
......
...@@ -114,11 +114,11 @@ protected: ...@@ -114,11 +114,11 @@ protected:
*/ */
virtual void initialiseCachedDistances() = 0; virtual void initialiseCachedDistances() = 0;
API::MatrixWorkspace_sptr m_inputWS; ///< A pointer to the input workspace API::MatrixWorkspace_sptr m_inputWS; ///< A pointer to the input workspace
const Geometry::IObject *m_sampleObject; ///< Local cache of sample object. const Geometry::IObject *m_sampleObject; ///< Local cache of sample object.
Kernel::V3D m_beamDirection; ///< The direction of the beam. Kernel::V3D m_beamDirection; ///< The direction of the beam.
std::vector<double> m_L1s, ///< Cached L1 distances std::vector<double> m_L1s, ///< Cached L1 distances
m_elementVolumes; ///< Cached element volumes m_elementVolumes; ///< Cached element volumes
std::vector<Kernel::V3D> m_elementPositions; ///< Cached element positions std::vector<Kernel::V3D> m_elementPositions; ///< Cached element positions
size_t m_numVolumeElements; ///< The number of volume elements size_t m_numVolumeElements; ///< The number of volume elements
double m_sampleVolume; ///< The total volume of the sample double m_sampleVolume; ///< The total volume of the sample
......
...@@ -71,11 +71,11 @@ private: ...@@ -71,11 +71,11 @@ private:
double pixelSpacing, const double bankDistanceFromSample, double pixelSpacing, const double bankDistanceFromSample,
const double sourceSampleDistance); const double sourceSampleDistance);
Geometry::IObject_sptr createCappedCylinder(double radius, double height, Geometry::IObject_sptr createCappedCylinder(double radius, double height,
const Kernel::V3D &baseCentre, const Kernel::V3D &baseCentre,
const Kernel::V3D &axis, const Kernel::V3D &axis,
const std::string &id); const std::string &id);
Geometry::IObject_sptr createSphere(double radius, const Kernel::V3D &centre, Geometry::IObject_sptr createSphere(double radius, const Kernel::V3D &centre,
const std::string &id); const std::string &id);
std::vector<double> evalFunction(const std::string &functionString, std::vector<double> evalFunction(const std::string &functionString,
const std::vector<double> &xVal, const std::vector<double> &xVal,
double noiseScale); double noiseScale);
......
...@@ -244,7 +244,8 @@ void AbsorptionCorrection::retrieveBaseProperties() { ...@@ -244,7 +244,8 @@ void AbsorptionCorrection::retrieveBaseProperties() {
static_cast<uint16_t>(0), 0.0, 0.0, sigma_s, 0.0, static_cast<uint16_t>(0), 0.0, 0.0, sigma_s, 0.0,
sigma_s, sigma_atten); sigma_s, sigma_atten);
auto shape = boost::shared_ptr<IObject>(m_inputWS->sample().getShape().clone()); auto shape =
boost::shared_ptr<IObject>(m_inputWS->sample().getShape().clone());
shape->setMaterial(Material("SetInAbsorptionCorrection", neutron, rho)); shape->setMaterial(Material("SetInAbsorptionCorrection", neutron, rho));
m_inputWS->mutableSample().setShape(shape); m_inputWS->mutableSample().setShape(shape);
} }
......
...@@ -43,7 +43,8 @@ std::string AnyShapeAbsorption::sampleXML() { ...@@ -43,7 +43,8 @@ std::string AnyShapeAbsorption::sampleXML() {
void AnyShapeAbsorption::initialiseCachedDistances() { void AnyShapeAbsorption::initialiseCachedDistances() {
// First, check if a 'gauge volume' has been defined. If not, it's the same as // First, check if a 'gauge volume' has been defined. If not, it's the same as
// the sample. // the sample.
auto integrationVolume = boost::shared_ptr<const IObject>(m_sampleObject->clone()); auto integrationVolume =
boost::shared_ptr<const IObject>(m_sampleObject->clone());
if (m_inputWS->run().hasProperty("GaugeVolume")) { if (m_inputWS->run().hasProperty("GaugeVolume")) {
integrationVolume = constructGaugeVolume(); integrationVolume = constructGaugeVolume();
} }
...@@ -120,7 +121,8 @@ void AnyShapeAbsorption::initialiseCachedDistances() { ...@@ -120,7 +121,8 @@ void AnyShapeAbsorption::initialiseCachedDistances() {
YSliceThickness * ZSliceThickness; YSliceThickness * ZSliceThickness;
} }
boost::shared_ptr<const Geometry::IObject> AnyShapeAbsorption::constructGaugeVolume() { boost::shared_ptr<const Geometry::IObject>
AnyShapeAbsorption::constructGaugeVolume() {
g_log.information("Calculating scattering within the gauge volume defined on " g_log.information("Calculating scattering within the gauge volume defined on "
"the input workspace"); "the input workspace");
......
...@@ -504,9 +504,9 @@ Instrument_sptr CreateSampleWorkspace::createTestInstrumentRectangular( ...@@ -504,9 +504,9 @@ Instrument_sptr CreateSampleWorkspace::createTestInstrumentRectangular(
const double cylRadius(pixelSpacing / 2); const double cylRadius(pixelSpacing / 2);
const double cylHeight(0.0002); const double cylHeight(0.0002);
// One object // One object
auto pixelShape = createCappedCylinder( auto pixelShape = createCappedCylinder(cylRadius, cylHeight,
cylRadius, cylHeight, V3D(0.0, -cylHeight / 2.0, 0.0), V3D(0., 1.0, 0.), V3D(0.0, -cylHeight / 2.0, 0.0),
"pixel-shape"); V3D(0., 1.0, 0.), "pixel-shape");
for (int banknum = 1; banknum <= numBanks; banknum++) { for (int banknum = 1; banknum <= numBanks; banknum++) {
// Make a new bank // Make a new bank
...@@ -577,8 +577,7 @@ Instrument_sptr CreateSampleWorkspace::createTestInstrumentRectangular( ...@@ -577,8 +577,7 @@ Instrument_sptr CreateSampleWorkspace::createTestInstrumentRectangular(
testInst->add(chopper); testInst->add(chopper);
// Define a sample as a simple sphere // Define a sample as a simple sphere
auto sampleSphere = auto sampleSphere = createSphere(0.001, V3D(0.0, 0.0, 0.0), "sample-shape");
createSphere(0.001, V3D(0.0, 0.0, 0.0), "sample-shape");
ObjComponent *sample = ObjComponent *sample =
new ObjComponent("sample", sampleSphere, testInst.get()); new ObjComponent("sample", sampleSphere, testInst.get());
testInst->setPos(0.0, 0.0, 0.0); testInst->setPos(0.0, 0.0, 0.0);
...@@ -592,11 +591,9 @@ Instrument_sptr CreateSampleWorkspace::createTestInstrumentRectangular( ...@@ -592,11 +591,9 @@ Instrument_sptr CreateSampleWorkspace::createTestInstrumentRectangular(
/** /**
* Create a capped cylinder object * Create a capped cylinder object
*/ */
IObject_sptr CreateSampleWorkspace::createCappedCylinder(double radius, IObject_sptr CreateSampleWorkspace::createCappedCylinder(
double height, double radius, double height, const V3D &baseCentre, const V3D &axis,
const V3D &baseCentre, const std::string &id) {
const V3D &axis,
const std::string &id) {
std::ostringstream xml; std::ostringstream xml;
xml << "<cylinder id=\"" << id << "\">" xml << "<cylinder id=\"" << id << "\">"
<< "<centre-of-bottom-base x=\"" << baseCentre.X() << "\" y=\"" << "<centre-of-bottom-base x=\"" << baseCentre.X() << "\" y=\""
...@@ -617,8 +614,8 @@ IObject_sptr CreateSampleWorkspace::createCappedCylinder(double radius, ...@@ -617,8 +614,8 @@ IObject_sptr CreateSampleWorkspace::createCappedCylinder(double radius,
* Create a sphere object * Create a sphere object
*/ */
IObject_sptr CreateSampleWorkspace::createSphere(double radius, IObject_sptr CreateSampleWorkspace::createSphere(double radius,
const V3D &centre, const V3D &centre,
const std::string &id) { const std::string &id) {
ShapeFactory shapeMaker; ShapeFactory shapeMaker;
std::ostringstream xml; std::ostringstream xml;
xml << "<sphere id=\"" << id << "\">" xml << "<sphere id=\"" << id << "\">"
......
...@@ -167,7 +167,8 @@ API::MatrixWorkspace_sptr HRPDSlabCanAbsorption::runFlatPlateAbsorption() { ...@@ -167,7 +167,8 @@ API::MatrixWorkspace_sptr HRPDSlabCanAbsorption::runFlatPlateAbsorption() {
NeutronAtom neutron(static_cast<uint16_t>(EMPTY_DBL()), NeutronAtom neutron(static_cast<uint16_t>(EMPTY_DBL()),
static_cast<uint16_t>(0), 0.0, 0.0, sigma_s, 0.0, static_cast<uint16_t>(0), 0.0, 0.0, sigma_s, 0.0,
sigma_s, sigma_atten); sigma_s, sigma_atten);
auto shape = boost::shared_ptr<IObject>(m_inputWS->sample().getShape().clone()); auto shape =
boost::shared_ptr<IObject>(m_inputWS->sample().getShape().clone());
shape->setMaterial(Material("SetInSphericalAbsorption", neutron, rho)); shape->setMaterial(Material("SetInSphericalAbsorption", neutron, rho));
m_inputWS->mutableSample().setShape(shape); m_inputWS->mutableSample().setShape(shape);
} }
......
...@@ -140,7 +140,7 @@ void MultipleScatteringCylinderAbsorption::exec() { ...@@ -140,7 +140,7 @@ void MultipleScatteringCylinderAbsorption::exec() {
NeutronAtom neutron(static_cast<uint16_t>(EMPTY_DBL()), NeutronAtom neutron(static_cast<uint16_t>(EMPTY_DBL()),
static_cast<uint16_t>(0), 0.0, 0.0, coeff3, 0.0, coeff3, static_cast<uint16_t>(0), 0.0, 0.0, coeff3, 0.0, coeff3,
coeff1); coeff1);
auto shape = boost::shared_ptr<IObject>(in_WS->sample().getShape().clone()); auto shape = boost::shared_ptr<IObject>(in_WS->sample().getShape().clone());
shape->setMaterial(Material("SetInMultipleScattering", neutron, coeff2)); shape->setMaterial(Material("SetInMultipleScattering", neutron, coeff2));
in_WS->mutableSample().setShape(shape); in_WS->mutableSample().setShape(shape);
} }
......
...@@ -40,8 +40,8 @@ double attenuation(double rho, double sigma, double length) { ...@@ -40,8 +40,8 @@ double attenuation(double rho, double sigma, double length) {
MCInteractionVolume::MCInteractionVolume( MCInteractionVolume::MCInteractionVolume(
const API::Sample &sample, const Geometry::BoundingBox &activeRegion, const API::Sample &sample, const Geometry::BoundingBox &activeRegion,
const size_t maxScatterAttempts) const size_t maxScatterAttempts)
: m_sample(sample.getShape().clone()), m_env(nullptr), m_activeRegion(activeRegion), : m_sample(sample.getShape().clone()), m_env(nullptr),
m_maxScatterAttempts(maxScatterAttempts) { m_activeRegion(activeRegion), m_maxScatterAttempts(maxScatterAttempts) {
if (!m_sample->hasValidShape()) { if (!m_sample->hasValidShape()) {
throw std::invalid_argument( throw std::invalid_argument(
"MCInteractionVolume() - Sample shape does not have a valid shape."); "MCInteractionVolume() - Sample shape does not have a valid shape.");
...@@ -93,7 +93,7 @@ double MCInteractionVolume::calculateAbsorption( ...@@ -93,7 +93,7 @@ double MCInteractionVolume::calculateAbsorption(
m_env->generatePoint(rng, m_activeRegion, m_maxScatterAttempts); m_env->generatePoint(rng, m_activeRegion, m_maxScatterAttempts);
} else { } else {
scatterPos = m_sample->generatePointInObject(rng, m_activeRegion, scatterPos = m_sample->generatePointInObject(rng, m_activeRegion,
m_maxScatterAttempts); m_maxScatterAttempts);
} }
auto toStart = startPos - scatterPos; auto toStart = startPos - scatterPos;
toStart.normalize(); toStart.normalize();
......
...@@ -124,7 +124,8 @@ void SphericalAbsorption::retrieveBaseProperties() { ...@@ -124,7 +124,8 @@ void SphericalAbsorption::retrieveBaseProperties() {
NeutronAtom neutron(static_cast<uint16_t>(EMPTY_DBL()), NeutronAtom neutron(static_cast<uint16_t>(EMPTY_DBL()),
static_cast<uint16_t>(0), 0.0, 0.0, sigma_s, 0.0, static_cast<uint16_t>(0), 0.0, 0.0, sigma_s, 0.0,
sigma_s, sigma_atten); sigma_s, sigma_atten);
auto shape = boost::shared_ptr<IObject>(m_inputWS->sample().getShape().clone()); auto shape =
boost::shared_ptr<IObject>(m_inputWS->sample().getShape().clone());
shape->setMaterial(Material("SetInSphericalAbsorption", neutron, rho)); shape->setMaterial(Material("SetInSphericalAbsorption", neutron, rho));
m_inputWS->mutableSample().setShape(shape); m_inputWS->mutableSample().setShape(shape);
} }
......
...@@ -682,9 +682,8 @@ private: ...@@ -682,9 +682,8 @@ private:
// Geometry::ReferenceFrame(Geometry::PointingAlong::Y,Geometry::X,Geometry::Left,""))); // Geometry::ReferenceFrame(Geometry::PointingAlong::Y,Geometry::X,Geometry::Left,"")));
const double pixelRadius(0.05); const double pixelRadius(0.05);
auto pixelShape = auto pixelShape = ComponentCreationHelper::createCappedCylinder(
ComponentCreationHelper::createCappedCylinder( pixelRadius, 0.02, V3D(0.0, 0.0, 0.0), V3D(0., 1.0, 0.), "tube");
pixelRadius, 0.02, V3D(0.0, 0.0, 0.0), V3D(0., 1.0, 0.), "tube");
const double detXPos(5.0); const double detXPos(5.0);
for (int i = 0; i < ndets; ++i) { for (int i = 0; i < ndets; ++i) {
......
...@@ -43,7 +43,8 @@ public: ...@@ -43,7 +43,8 @@ public:
auto canShape = ComponentCreationHelper::cappedCylinderXML( auto canShape = ComponentCreationHelper::cappedCylinderXML(
0.5, 1.5, V3D(0.0, 0.0, 0.0), V3D(0., 1.0, 0.), "tube"); 0.5, 1.5, V3D(0.0, 0.0, 0.0), V3D(0., 1.0, 0.), "tube");
SampleEnvironment *kit = new SampleEnvironment( SampleEnvironment *kit = new SampleEnvironment(
envName, boost::make_shared<Container>(ShapeFactory().createShape(canShape))); envName,
boost::make_shared<Container>(ShapeFactory().createShape(canShape)));
sample.setEnvironment(kit); sample.setEnvironment(kit);
OrientedLattice *latt = new OrientedLattice(1.0, 2.0, 3.0, 90, 90, 90); OrientedLattice *latt = new OrientedLattice(1.0, 2.0, 3.0, 90, 90, 90);
sample.setOrientedLattice(latt); sample.setOrientedLattice(latt);
......
...@@ -96,8 +96,7 @@ public: ...@@ -96,8 +96,7 @@ public:
testWS->getAxis(0)->unit() = testWS->getAxis(0)->unit() =
Mantid::Kernel::UnitFactory::Instance().create("Wavelength"); Mantid::Kernel::UnitFactory::Instance().create("Wavelength");
// Define a sample shape // Define a sample shape
auto sampleShape = auto sampleShape = ComponentCreationHelper::createCuboid(0.025, 0.03, 0.02);
ComponentCreationHelper::createCuboid(0.025, 0.03, 0.02);
testWS->mutableSample().setShape(sampleShape); testWS->mutableSample().setShape(sampleShape);
TS_ASSERT_THROWS_NOTHING( TS_ASSERT_THROWS_NOTHING(
......
...@@ -121,8 +121,7 @@ private: ...@@ -121,8 +121,7 @@ private:
// convert into a Geometry object // convert into a Geometry object
bool addTypeTag = true; bool addTypeTag = true;
auto shape = auto shape = ShapeFactory().createShape(xmlShape, addTypeTag);
ShapeFactory().createShape(xmlShape, addTypeTag);
boost::shared_ptr<Instrument> instrument = boost::make_shared<Instrument>(); boost::shared_ptr<Instrument> instrument = boost::make_shared<Instrument>();
const int ndets(2); const int ndets(2);
......
...@@ -52,9 +52,9 @@ void addSample(Mantid::API::MatrixWorkspace_sptr ws, ...@@ -52,9 +52,9 @@ void addSample(Mantid::API::MatrixWorkspace_sptr ws,
const V3D axis(0.0, 1.0, 0.0); const V3D axis(0.0, 1.0, 0.0);
ShapeFactory shapeMaker; ShapeFactory shapeMaker;
auto can = boost::make_shared<Container>(shapeMaker.createShape( auto can = boost::make_shared<Container>(
ComponentCreationHelper::cappedCylinderXML(radius, height, baseCentre, shapeMaker.createShape(ComponentCreationHelper::cappedCylinderXML(
axis, id))); radius, height, baseCentre, axis, id)));
can->setMaterial(Material("CanMaterial", can->setMaterial(Material("CanMaterial",
PhysicalConstants::getNeutronAtom(26, 0), 0.01)); PhysicalConstants::getNeutronAtom(26, 0), 0.01));
SampleEnvironment *env = new SampleEnvironment("can", can); SampleEnvironment *env = new SampleEnvironment("can", can);
......
...@@ -359,7 +359,8 @@ void AnvredCorrection::retrieveBaseProperties() { ...@@ -359,7 +359,8 @@ void AnvredCorrection::retrieveBaseProperties() {
NeutronAtom neutron(static_cast<uint16_t>(EMPTY_DBL()), NeutronAtom neutron(static_cast<uint16_t>(EMPTY_DBL()),
static_cast<uint16_t>(0), 0.0, 0.0, m_smu, 0.0, m_smu, static_cast<uint16_t>(0), 0.0, 0.0, m_smu, 0.0, m_smu,
m_amu); m_amu);
auto shape = boost::shared_ptr<IObject>(m_inputWS->sample().getShape().clone()); auto shape =
boost::shared_ptr<IObject>(m_inputWS->sample().getShape().clone());
shape->setMaterial(Material("SetInAnvredCorrection", neutron, 1.0)); shape->setMaterial(Material("SetInAnvredCorrection", neutron, 1.0));
m_inputWS->mutableSample().setShape(shape); m_inputWS->mutableSample().setShape(shape);
} }
......
...@@ -168,7 +168,7 @@ void LoadHKL::exec() { ...@@ -168,7 +168,7 @@ void LoadHKL::exec() {
mrun.addProperty<double>("Radius", radius, true); mrun.addProperty<double>("Radius", radius, true);
NeutronAtom neutron(static_cast<uint16_t>(EMPTY_DBL()), NeutronAtom neutron(static_cast<uint16_t>(EMPTY_DBL()),
static_cast<uint16_t>(0), 0.0, 0.0, smu, 0.0, smu, amu); static_cast<uint16_t>(0), 0.0, 0.0, smu, 0.0, smu, amu);
auto shape = boost::shared_ptr<IObject>(ws->sample().getShape().clone()); auto shape = boost::shared_ptr<IObject>(ws->sample().getShape().clone());
shape->setMaterial(Material("SetInLoadHKL", neutron, 1.0)); shape->setMaterial(Material("SetInLoadHKL", neutron, 1.0));
ws->mutableSample().setShape(shape); ws->mutableSample().setShape(shape);
......
...@@ -258,7 +258,8 @@ void SaveHKL::exec() { ...@@ -258,7 +258,8 @@ void SaveHKL::exec() {
NeutronAtom neutron(static_cast<uint16_t>(EMPTY_DBL()), NeutronAtom neutron(static_cast<uint16_t>(EMPTY_DBL()),
static_cast<uint16_t>(0), 0.0, 0.0, m_smu, 0.0, m_smu, static_cast<uint16_t>(0), 0.0, 0.0, m_smu, 0.0, m_smu,
m_amu); m_amu);
auto shape = boost::shared_ptr<IObject>(peaksW->sample().getShape().clone()); auto shape =
boost::shared_ptr<IObject>(peaksW->sample().getShape().clone());
shape->setMaterial(Material("SetInSaveHKL", neutron, 1.0)); shape->setMaterial(Material("SetInSaveHKL", neutron, 1.0));
peaksW->mutableSample().setShape(shape); peaksW->mutableSample().setShape(shape);
} }
......
...@@ -40,7 +40,7 @@ public: ...@@ -40,7 +40,7 @@ public:
double amu = 0.011; double amu = 0.011;
NeutronAtom neutron(static_cast<uint16_t>(EMPTY_DBL()), NeutronAtom neutron(static_cast<uint16_t>(EMPTY_DBL()),
static_cast<uint16_t>(0), 0.0, 0.0, smu, 0.0, smu, amu); static_cast<uint16_t>(0), 0.0, 0.0, smu, 0.0, smu, amu);
auto sampleShape = boost::make_shared<CSGObject>(); auto sampleShape = boost::make_shared<CSGObject>();
sampleShape->setMaterial(Material("SetInSaveHKLTest", neutron, 1.0)); sampleShape->setMaterial(Material("SetInSaveHKLTest", neutron, 1.0));
ws->mutableSample().setShape(sampleShape); ws->mutableSample().setShape(sampleShape);
......
...@@ -139,7 +139,7 @@ private: ...@@ -139,7 +139,7 @@ private:
double m_srcR2; // beam penumbra radius (m) double m_srcR2; // beam penumbra radius (m)
double m_halfSampleHeight, m_halfSampleWidth, m_halfSampleThick; // (m) double m_halfSampleHeight, m_halfSampleWidth, m_halfSampleThick; // (m)
Geometry::IObject const *m_sampleShape; // sample shape Geometry::IObject const *m_sampleShape; // sample shape
SampleComptonProperties *m_sampleProps; // description of sample properties SampleComptonProperties *m_sampleProps; // description of sample properties
double m_detHeight, m_detWidth, m_detThick; // (m) double m_detHeight, m_detWidth, m_detThick; // (m)
double m_tmin, m_tmax, m_delt; // min, max & dt TOF value double m_tmin, m_tmax, m_delt; // min, max & dt TOF value
double m_foilRes; // resolution in energy of foil double m_foilRes; // resolution in energy of foil
......
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