From 258bf3f8fb03d4e96aa63286ec0a5e4771a99513 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Thu, 12 Nov 2020 09:30:20 +0100 Subject: [PATCH] rename beam <- getBeam --- Core/Export/SimulationToPython.cpp | 6 ++-- Core/Scan/SpecularSimulationElement.cpp | 4 +-- Core/Simulation/DepthProbeSimulation.cpp | 10 +++--- Core/Simulation/GISASSimulation.cpp | 2 +- Core/Simulation/OffSpecSimulation.cpp | 6 ++-- Core/Simulation/SpecularSimulation.cpp | 6 ++-- Core/Simulation/UnitConverterUtils.cpp | 4 +-- Device/Instrument/Instrument.cpp | 2 +- Device/Instrument/Instrument.h | 4 +-- GUI/coregui/Models/DomainObjectBuilder.cpp | 2 +- GUI/coregui/Models/InstrumentItems.cpp | 4 +-- GUI/coregui/Models/TransformFromDomain.cpp | 6 ++-- .../Python/PyPersistence/example_template.py | 2 +- .../Core/Detector/RectangularDetectorTest.cpp | 16 ++++----- .../Core/Fresnel/DepthProbeSimulationTest.cpp | 4 +-- .../Core/Fresnel/SpecularSimulationTest.cpp | 8 ++--- Tests/UnitTests/Core/Other/InstrumentTest.cpp | 6 ++-- auto/Wrap/doxygenDevice.i | 4 +-- auto/Wrap/libBornAgainDevice.py | 10 +++--- auto/Wrap/libBornAgainDevice_wrap.cpp | 34 +++++++++---------- 20 files changed, 70 insertions(+), 70 deletions(-) diff --git a/Core/Export/SimulationToPython.cpp b/Core/Export/SimulationToPython.cpp index 86845e34737..5cfb76f5576 100644 --- a/Core/Export/SimulationToPython.cpp +++ b/Core/Export/SimulationToPython.cpp @@ -269,7 +269,7 @@ SimulationToPython::defineDetectorPolarizationAnalysis(const ISimulation* simula std::string SimulationToPython::defineGISASBeam(const GISASSimulation& simulation) const { std::ostringstream result; - const Beam& beam = simulation.instrument().getBeam(); + const Beam& beam = simulation.instrument().beam(); result << pyfmt::indent() << "simulation.setBeamParameters(" << pyfmt::printNm(beam.getWavelength()) << ", " << pyfmt::printDegrees(beam.getAlpha()) @@ -284,7 +284,7 @@ std::string SimulationToPython::defineGISASBeam(const GISASSimulation& simulatio std::string SimulationToPython::defineOffSpecBeam(const OffSpecSimulation& simulation) const { std::ostringstream result; - const Beam& beam = simulation.instrument().getBeam(); + const Beam& beam = simulation.instrument().beam(); const std::string axis_def = pyfmt::indent() + "alpha_i_axis = "; result << axis_def << simulation.beamAxis()->pyString("rad", axis_def.size()) << "\n"; @@ -308,7 +308,7 @@ std::string SimulationToPython::defineSpecularScan(const SpecularSimulation& sim result << *scan << "\n"; result << pyfmt::indent() << "simulation.setScan(scan)\n"; - result << defineBeamIntensity(simulation.instrument().getBeam()); + result << defineBeamIntensity(simulation.instrument().beam()); result << "\n"; return result.str(); } diff --git a/Core/Scan/SpecularSimulationElement.cpp b/Core/Scan/SpecularSimulationElement.cpp index b5038b61d86..1dab5d474e7 100644 --- a/Core/Scan/SpecularSimulationElement.cpp +++ b/Core/Scan/SpecularSimulationElement.cpp @@ -19,7 +19,7 @@ SpecularSimulationElement::SpecularSimulationElement(double kz, const Instrument& instrument, bool computable) - : m_polarization(instrument.getBeam().getPolarization(), + : m_polarization(instrument.beam().getPolarization(), instrument.detector().detectionProperties().analyzerOperator()), m_intensity(0.0), m_computable(computable), m_kz_computation([kz](const std::vector<Slice>& slices) { @@ -30,7 +30,7 @@ SpecularSimulationElement::SpecularSimulationElement(double kz, const Instrument SpecularSimulationElement::SpecularSimulationElement(double wavelength, double alpha, const Instrument& instrument, bool computable) - : m_polarization(instrument.getBeam().getPolarization(), + : m_polarization(instrument.beam().getPolarization(), instrument.detector().detectionProperties().analyzerOperator()), m_intensity(0.0), m_computable(computable), m_kz_computation( diff --git a/Core/Simulation/DepthProbeSimulation.cpp b/Core/Simulation/DepthProbeSimulation.cpp index d2c3f457b21..070814ccf0d 100644 --- a/Core/Simulation/DepthProbeSimulation.cpp +++ b/Core/Simulation/DepthProbeSimulation.cpp @@ -99,7 +99,7 @@ size_t DepthProbeSimulation::intensityMapSize() const std::unique_ptr<IUnitConverter> DepthProbeSimulation::createUnitConverter() const { - return std::make_unique<DepthProbeConverter>(instrument().getBeam(), *m_alpha_axis, *m_z_axis); + return std::make_unique<DepthProbeConverter>(instrument().beam(), *m_alpha_axis, *m_z_axis); } DepthProbeSimulation::DepthProbeSimulation(const DepthProbeSimulation& other) @@ -142,12 +142,12 @@ void DepthProbeSimulation::setBeamParameters(double lambda, const IAxis& alpha_a instrument().setBeamParameters(lambda, zero_alpha_i, zero_phi_i); if (beam_shape) - instrument().getBeam().setFootprintFactor(*beam_shape); + instrument().beam().setFootprintFactor(*beam_shape); } void DepthProbeSimulation::initSimulationElementVector() { - m_sim_elements = generateSimulationElements(instrument().getBeam()); + m_sim_elements = generateSimulationElements(instrument().beam()); if (!m_cache.empty()) return; @@ -223,7 +223,7 @@ void DepthProbeSimulation::initialize() // allow for negative inclinations in the beam of specular simulation // it is required for proper averaging in the case of divergent beam - auto inclination = instrument().getBeam().parameter("InclinationAngle"); + auto inclination = instrument().beam().parameter("InclinationAngle"); inclination->setLimits(RealLimits::limited(-M_PI_2, M_PI_2)); } @@ -233,7 +233,7 @@ void DepthProbeSimulation::normalize(size_t start_ind, size_t n_elements) for (size_t i = start_ind, stop_point = start_ind + n_elements; i < stop_point; ++i) { auto& element = m_sim_elements[i]; const double alpha_i = -element.getAlphaI(); - const auto footprint = instrument().getBeam().footprintFactor(); + const auto footprint = instrument().beam().footprintFactor(); double intensity_factor = beam_intensity; if (footprint != nullptr) intensity_factor = intensity_factor * footprint->calculate(alpha_i); diff --git a/Core/Simulation/GISASSimulation.cpp b/Core/Simulation/GISASSimulation.cpp index 4f7331dd59e..aab7bb3f39d 100644 --- a/Core/Simulation/GISASSimulation.cpp +++ b/Core/Simulation/GISASSimulation.cpp @@ -65,7 +65,7 @@ GISASSimulation::GISASSimulation(const GISASSimulation& other) : ISimulation2D(o void GISASSimulation::initSimulationElementVector() { - m_sim_elements = generateSimulationElements(instrument().getBeam()); + m_sim_elements = generateSimulationElements(instrument().beam()); if (m_cache.empty()) m_cache.resize(m_sim_elements.size(), 0.0); } diff --git a/Core/Simulation/OffSpecSimulation.cpp b/Core/Simulation/OffSpecSimulation.cpp index 9944673417d..e8f96e75c76 100644 --- a/Core/Simulation/OffSpecSimulation.cpp +++ b/Core/Simulation/OffSpecSimulation.cpp @@ -42,7 +42,7 @@ size_t OffSpecSimulation::numberOfSimulationElements() const SimulationResult OffSpecSimulation::result() const { auto data = std::unique_ptr<OutputData<double>>(m_intensity_map.clone()); - OffSpecularConverter converter(instrument().detector2D(), instrument().getBeam(), + OffSpecularConverter converter(instrument().detector2D(), instrument().beam(), *m_alpha_i_axis); return SimulationResult(*data, converter); } @@ -69,7 +69,7 @@ std::unique_ptr<IUnitConverter> OffSpecSimulation::createUnitConverter() const if (!axis) throw std::runtime_error("Error in OffSpecSimulation::createUnitConverter:" " missing inclination angle axis"); - return std::make_unique<OffSpecularConverter>(instrument().detector2D(), instrument().getBeam(), + return std::make_unique<OffSpecularConverter>(instrument().detector2D(), instrument().beam(), *axis); } @@ -90,7 +90,7 @@ OffSpecSimulation::OffSpecSimulation(const OffSpecSimulation& other) : ISimulati void OffSpecSimulation::initSimulationElementVector() { m_sim_elements.clear(); - Beam beam = instrument().getBeam(); + Beam beam = instrument().beam(); const double wavelength = beam.getWavelength(); const double phi_i = beam.getPhi(); diff --git a/Core/Simulation/SpecularSimulation.cpp b/Core/Simulation/SpecularSimulation.cpp index 9258a602958..165eec53ced 100644 --- a/Core/Simulation/SpecularSimulation.cpp +++ b/Core/Simulation/SpecularSimulation.cpp @@ -49,7 +49,7 @@ std::vector<SpecularSimulationElement> generateSimulationElements(const Instrume { // TODO: remove if statement when pointwise resolution is implemented if (const auto* aScan = dynamic_cast<const AngularSpecScan*>(&scan)) - return mangledScan(*aScan, instrument.getBeam())->generateSimulationElements(instrument); + return mangledScan(*aScan, instrument.beam())->generateSimulationElements(instrument); return scan.generateSimulationElements(instrument); } @@ -191,7 +191,7 @@ void SpecularSimulation::initialize() // allow for negative inclinations in the beam of specular simulation // it is required for proper averaging in the case of divergent beam instrument() - .getBeam() + .beam() .parameter("InclinationAngle") ->setLimits(RealLimits::limited(-M_PI_2, M_PI_2)); } @@ -203,7 +203,7 @@ void SpecularSimulation::normalize(size_t start_ind, size_t n_elements) std::vector<double> footprints; // TODO: use just m_scan when pointwise resolution is implemented if (const auto* aScan = dynamic_cast<const AngularSpecScan*>(m_scan.get())) - footprints = mangledScan(*aScan, instrument().getBeam())->footprint(start_ind, n_elements); + footprints = mangledScan(*aScan, instrument().beam())->footprint(start_ind, n_elements); else footprints = m_scan->footprint(start_ind, n_elements); diff --git a/Core/Simulation/UnitConverterUtils.cpp b/Core/Simulation/UnitConverterUtils.cpp index 6500f71542b..af7b31ae893 100644 --- a/Core/Simulation/UnitConverterUtils.cpp +++ b/Core/Simulation/UnitConverterUtils.cpp @@ -38,9 +38,9 @@ UnitConverterUtils::createConverterForGISAS(const Instrument& instrument) const IDetector* const detector = instrument.getDetector(); if (const auto* const det = dynamic_cast<const SphericalDetector*>(detector)) - return std::make_unique<SphericalConverter>(*det, instrument.getBeam()); + return std::make_unique<SphericalConverter>(*det, instrument.beam()); else if (const auto* const det = dynamic_cast<const RectangularDetector*>(detector)) - return std::make_unique<RectangularConverter>(*det, instrument.getBeam()); + return std::make_unique<RectangularConverter>(*det, instrument.beam()); throw std::runtime_error("Error in createConverterForGISAS: wrong or absent detector type"); } diff --git a/Device/Instrument/Instrument.cpp b/Device/Instrument/Instrument.cpp index 4b957c112df..8f4eedccaa5 100644 --- a/Device/Instrument/Instrument.cpp +++ b/Device/Instrument/Instrument.cpp @@ -57,7 +57,7 @@ void Instrument::initDetector() if (!m_detector) throw Exceptions::RuntimeErrorException( "Instrument::initDetector() -> Error. Detector is not initialized."); - m_detector->init(getBeam()); + m_detector->init(beam()); } std::vector<const INode*> Instrument::getChildren() const diff --git a/Device/Instrument/Instrument.h b/Device/Instrument/Instrument.h index fea83b48116..a7dc9612e97 100644 --- a/Device/Instrument/Instrument.h +++ b/Device/Instrument/Instrument.h @@ -41,8 +41,8 @@ public: void accept(INodeVisitor* visitor) const final { visitor->visit(this); } - Beam& getBeam() { return m_beam; } - const Beam& getBeam() const { return m_beam; } + Beam& beam() { return m_beam; } + const Beam& beam() const { return m_beam; } void setBeam(const Beam& beam); //! Sets the beam wavelength and incoming angles diff --git a/GUI/coregui/Models/DomainObjectBuilder.cpp b/GUI/coregui/Models/DomainObjectBuilder.cpp index f543ba42e13..f6c283fb7bf 100644 --- a/GUI/coregui/Models/DomainObjectBuilder.cpp +++ b/GUI/coregui/Models/DomainObjectBuilder.cpp @@ -148,7 +148,7 @@ DomainObjectBuilder::createUnitConverter(const InstrumentItem* instrumentItem) auto axis_item = dynamic_cast<BasicAxisItem*>( instrumentItem->getItem(OffSpecInstrumentItem::P_ALPHA_AXIS)); const auto detector2d = dynamic_cast<const IDetector2D*>(instrument->getDetector()); - return std::make_unique<OffSpecularConverter>(*detector2d, instrument->getBeam(), + return std::make_unique<OffSpecularConverter>(*detector2d, instrument->beam(), *axis_item->createAxis(Units::degree)); } diff --git a/GUI/coregui/Models/InstrumentItems.cpp b/GUI/coregui/Models/InstrumentItems.cpp index 7977a6b39c4..eec3af28415 100644 --- a/GUI/coregui/Models/InstrumentItems.cpp +++ b/GUI/coregui/Models/InstrumentItems.cpp @@ -169,11 +169,11 @@ std::unique_ptr<IUnitConverter> SpecularInstrumentItem::createUnitConverter() co if (!pointwise_axis->containsNonXMLData()) // workaround for loading project return nullptr; Axes::Units native_units = JobItemUtils::axesUnitsFromName(pointwise_axis->getUnitsLabel()); - return std::make_unique<UnitConverterConvSpec>(instrument->getBeam(), + return std::make_unique<UnitConverterConvSpec>(instrument->beam(), *pointwise_axis->getAxis(), native_units); } else return std::make_unique<UnitConverterConvSpec>( - instrument->getBeam(), *axis_item->createAxis(1.0), Axes::Units::DEGREES); + instrument->beam(), *axis_item->createAxis(1.0), Axes::Units::DEGREES); } const QString Instrument2DItem::P_DETECTOR = "Detector"; diff --git a/GUI/coregui/Models/TransformFromDomain.cpp b/GUI/coregui/Models/TransformFromDomain.cpp index 9054767f6ad..ec0c12a018b 100644 --- a/GUI/coregui/Models/TransformFromDomain.cpp +++ b/GUI/coregui/Models/TransformFromDomain.cpp @@ -240,7 +240,7 @@ bool TransformFromDomain::isValidRoughness(const LayerRoughness* roughness) void TransformFromDomain::setGISASBeamItem(BeamItem* beam_item, const GISASSimulation& simulation) { ASSERT(beam_item); - Beam beam = simulation.instrument().getBeam(); + Beam beam = simulation.instrument().beam(); beam_item->setIntensity(beam.getIntensity()); beam_item->setWavelength(beam.getWavelength()); @@ -266,7 +266,7 @@ void TransformFromDomain::setGISASBeamItem(BeamItem* beam_item, const GISASSimul void TransformFromDomain::setOffSpecBeamItem(BeamItem* beam_item, const OffSpecSimulation& simulation) { - Beam beam = simulation.instrument().getBeam(); + Beam beam = simulation.instrument().beam(); beam_item->setIntensity(beam.getIntensity()); beam_item->setWavelength(beam.getWavelength()); @@ -278,7 +278,7 @@ void TransformFromDomain::setOffSpecBeamItem(BeamItem* beam_item, void TransformFromDomain::setSpecularBeamItem(SpecularBeamItem* beam_item, const SpecularSimulation& simulation) { - const Beam& beam = simulation.instrument().getBeam(); + const Beam& beam = simulation.instrument().beam(); beam_item->setIntensity(beam.getIntensity()); beam_item->setWavelength(beam.getWavelength()); diff --git a/Tests/Functional/Python/PyPersistence/example_template.py b/Tests/Functional/Python/PyPersistence/example_template.py index e3f9676bb77..1aade7b6345 100644 --- a/Tests/Functional/Python/PyPersistence/example_template.py +++ b/Tests/Functional/Python/PyPersistence/example_template.py @@ -34,7 +34,7 @@ def get_simulation_DepthProbe(): Returns custom simulation in the case of depth probe. """ simulation = example.get_simulation() - beam = simulation.instrument().getBeam() + beam = simulation.instrument().beam() wavelength = beam.getWavelength() incl_axis = simulation.getAlphaAxis() z_axis = simulation.getZAxis() diff --git a/Tests/UnitTests/Core/Detector/RectangularDetectorTest.cpp b/Tests/UnitTests/Core/Detector/RectangularDetectorTest.cpp index 6159e4de9a8..9f474af04d8 100644 --- a/Tests/UnitTests/Core/Detector/RectangularDetectorTest.cpp +++ b/Tests/UnitTests/Core/Detector/RectangularDetectorTest.cpp @@ -81,13 +81,13 @@ TEST_F(RectangularDetectorTest, PerpToSample) // initializing with the simulation GISASSimulation simulation; simulation.setBeamParameters(1.0, 10.0 * Units::degree, 0.0); - det.init(simulation.instrument().getBeam()); + det.init(simulation.instrument().beam()); EXPECT_TRUE(kvector_t(distance, 0, 0) == det.getNormalVector()); EXPECT_TRUE(kvector_t(0.0, -1.0, 0.0) == det.getDirectionVector()); // FIXME cleanup, replace with DetectorContext tests // std::vector<DetectorElement> elements - // = det.createDetectorElements(simulation.instrument().getBeam()); + // = det.createDetectorElements(simulation.instrument().beam()); // EXPECT_EQ(elements.size(), nbinsx * nbinsy); // double wavelength = 1.0; @@ -135,13 +135,13 @@ TEST_F(RectangularDetectorTest, PerpToDirectBeam) // initializing with the simulation GISASSimulation simulation; simulation.setBeamParameters(1.0, alpha_i, 0.0); - det.init(simulation.instrument().getBeam()); + det.init(simulation.instrument().beam()); kvector_t normal(distance * cos(alpha_i), 0.0, -1.0 * distance * sin(alpha_i)); EXPECT_TRUE(isEqual(normal, det.getNormalVector())); EXPECT_TRUE(kvector_t(0.0, -1.0, 0.0) == det.getDirectionVector()); // std::vector<DetectorElement> elements - // = det.createDetectorElements(simulation.instrument().getBeam()); + // = det.createDetectorElements(simulation.instrument().beam()); // EXPECT_EQ(elements.size(), nbinsx * nbinsy); // // lower left bin @@ -178,14 +178,14 @@ TEST_F(RectangularDetectorTest, PerpToReflectedBeam) // initializing with the simulation GISASSimulation simulation; simulation.setBeamParameters(1.0, alpha_i, 0.0); - det.init(simulation.instrument().getBeam()); + det.init(simulation.instrument().beam()); kvector_t normal(distance * cos(alpha_i), 0.0, 1.0 * distance * sin(alpha_i)); EXPECT_TRUE(isEqual(normal, det.getNormalVector())); EXPECT_TRUE(kvector_t(0.0, -1.0, 0.0) == det.getDirectionVector()); // // checking detector elements // std::vector<DetectorElement> elements - // = det.createDetectorElements(simulation.instrument().getBeam()); + // = det.createDetectorElements(simulation.instrument().beam()); // EXPECT_EQ(elements.size(), nbinsx * nbinsy); // double ds = v0 - dy / 2.; @@ -233,7 +233,7 @@ TEST_F(RectangularDetectorTest, PerpToReflectedBeamDpos) // initializing with the simulation GISASSimulation simulation; simulation.setBeamParameters(1.0, alpha_i, 0.0); - det.init(simulation.instrument().getBeam()); + det.init(simulation.instrument().beam()); kvector_t normal(distance * cos(alpha_i), 0.0, 1.0 * distance * sin(alpha_i)); EXPECT_TRUE(isEqual(normal, det.getNormalVector())); @@ -243,7 +243,7 @@ TEST_F(RectangularDetectorTest, PerpToReflectedBeamDpos) // // checking detector elements // std::vector<DetectorElement> elements - // = det.createDetectorElements(simulation.instrument().getBeam()); + // = det.createDetectorElements(simulation.instrument().beam()); // EXPECT_EQ(elements.size(), nbinsx * nbinsy); // double ds = v0 - dy / 2.; diff --git a/Tests/UnitTests/Core/Fresnel/DepthProbeSimulationTest.cpp b/Tests/UnitTests/Core/Fresnel/DepthProbeSimulationTest.cpp index 41524cc1b52..6103eb2af08 100644 --- a/Tests/UnitTests/Core/Fresnel/DepthProbeSimulationTest.cpp +++ b/Tests/UnitTests/Core/Fresnel/DepthProbeSimulationTest.cpp @@ -49,7 +49,7 @@ std::unique_ptr<DepthProbeSimulation> DepthProbeSimulationTest::defaultSimulatio void DepthProbeSimulationTest::checkBeamState(const DepthProbeSimulation& sim) { - const auto* inclination = sim.instrument().getBeam().parameter("InclinationAngle"); + const auto* inclination = sim.instrument().beam().parameter("InclinationAngle"); const auto test_limits = RealLimits::limited(-M_PI_2, M_PI_2); EXPECT_EQ(test_limits, inclination->limits()); EXPECT_EQ(0.0, inclination->value()); @@ -99,7 +99,7 @@ TEST_F(DepthProbeSimulationTest, CheckAxesOfDefaultSimulation) TEST_F(DepthProbeSimulationTest, SetBeamParameters) { DepthProbeSimulation sim; - const auto& beam = sim.instrument().getBeam(); + const auto& beam = sim.instrument().beam(); sim.setBeamParameters(1.0, 10, 1.0 * Units::degree, 10.0 * Units::degree); EXPECT_EQ(10u, sim.getAlphaAxis()->size()); diff --git a/Tests/UnitTests/Core/Fresnel/SpecularSimulationTest.cpp b/Tests/UnitTests/Core/Fresnel/SpecularSimulationTest.cpp index 8683b9cfd13..c2034698cdb 100644 --- a/Tests/UnitTests/Core/Fresnel/SpecularSimulationTest.cpp +++ b/Tests/UnitTests/Core/Fresnel/SpecularSimulationTest.cpp @@ -61,7 +61,7 @@ std::unique_ptr<SpecularSimulation> SpecularSimulationTest::defaultSimulation() void SpecularSimulationTest::checkBeamState(const SpecularSimulation& sim) { - const auto* inclination = sim.instrument().getBeam().parameter("InclinationAngle"); + const auto* inclination = sim.instrument().beam().parameter("InclinationAngle"); const auto test_limits = RealLimits::limited(-M_PI_2, M_PI_2); EXPECT_EQ(test_limits, inclination->limits()); EXPECT_EQ(0.0, inclination->value()); @@ -86,7 +86,7 @@ TEST_F(SpecularSimulationTest, SetAngularScan) SpecularSimulation sim; AngularSpecScan scan(1.0, std::vector<double>{1.0 * Units::deg, 3.0 * Units::deg}); sim.setScan(scan); - const auto& beam = sim.instrument().getBeam(); + const auto& beam = sim.instrument().beam(); EXPECT_EQ(2u, sim.coordinateAxis()->size()); EXPECT_EQ(1.0 * Units::deg, sim.coordinateAxis()->getMin()); @@ -135,7 +135,7 @@ TEST_F(SpecularSimulationTest, SetQScan) QSpecScan scan(std::vector<double>{1.0, 3.0}); sim.setScan(scan); - const auto& beam = sim.instrument().getBeam(); + const auto& beam = sim.instrument().beam(); EXPECT_EQ(2u, sim.coordinateAxis()->size()); EXPECT_EQ(1.0, sim.coordinateAxis()->getMin()); @@ -245,7 +245,7 @@ TEST_F(SpecularSimulationTest, AddingBeamDistributions) TEST_F(SpecularSimulationTest, OutOfRangeAngles) { auto sim = defaultSimulation(); - auto& beam = sim->instrument().getBeam(); + auto& beam = sim->instrument().beam(); beam.parameter("InclinationAngle")->setValue(-0.2 * Units::deg); sim->runSimulation(); diff --git a/Tests/UnitTests/Core/Other/InstrumentTest.cpp b/Tests/UnitTests/Core/Other/InstrumentTest.cpp index 9058f118244..a182cfd6ec5 100644 --- a/Tests/UnitTests/Core/Other/InstrumentTest.cpp +++ b/Tests/UnitTests/Core/Other/InstrumentTest.cpp @@ -31,9 +31,9 @@ TEST_F(InstrumentTest, BeamManipulation) double y = -k * std::cos(alpha) * std::sin(phi); double z = k * std::sin(alpha); m_instrument.setBeamParameters(lambda, -1.0 * alpha, phi); - EXPECT_DOUBLE_EQ(x, m_instrument.getBeam().getCentralK().x()); - EXPECT_DOUBLE_EQ(y, m_instrument.getBeam().getCentralK().y()); - EXPECT_DOUBLE_EQ(z, m_instrument.getBeam().getCentralK().z()); + EXPECT_DOUBLE_EQ(x, m_instrument.beam().getCentralK().x()); + EXPECT_DOUBLE_EQ(y, m_instrument.beam().getCentralK().y()); + EXPECT_DOUBLE_EQ(z, m_instrument.beam().getCentralK().z()); m_instrument.setBeamIntensity(10); EXPECT_EQ(double(10), m_instrument.getBeamIntensity()); diff --git a/auto/Wrap/doxygenDevice.i b/auto/Wrap/doxygenDevice.i index 19dee54c59a..be3bb405c55 100644 --- a/auto/Wrap/doxygenDevice.i +++ b/auto/Wrap/doxygenDevice.i @@ -1474,10 +1474,10 @@ C++ includes: Instrument.h %feature("docstring") Instrument::accept "void Instrument::accept(INodeVisitor *visitor) const final "; -%feature("docstring") Instrument::getBeam "Beam& Instrument::getBeam() +%feature("docstring") Instrument::beam "Beam& Instrument::beam() "; -%feature("docstring") Instrument::getBeam "const Beam& Instrument::getBeam() const +%feature("docstring") Instrument::beam "const Beam& Instrument::beam() const "; %feature("docstring") Instrument::setBeam "void Instrument::setBeam(const Beam &beam) diff --git a/auto/Wrap/libBornAgainDevice.py b/auto/Wrap/libBornAgainDevice.py index d099567a664..b7eef1a36f2 100644 --- a/auto/Wrap/libBornAgainDevice.py +++ b/auto/Wrap/libBornAgainDevice.py @@ -3897,14 +3897,14 @@ class Instrument(libBornAgainParam.INode): """ return _libBornAgainDevice.Instrument_accept(self, visitor) - def getBeam(self, *args): + def beam(self, *args): r""" - getBeam(Instrument self) -> Beam - getBeam(Instrument self) -> Beam - const Beam& Instrument::getBeam() const + beam(Instrument self) -> Beam + beam(Instrument self) -> Beam + const Beam& Instrument::beam() const """ - return _libBornAgainDevice.Instrument_getBeam(self, *args) + return _libBornAgainDevice.Instrument_beam(self, *args) def setBeam(self, beam): r""" diff --git a/auto/Wrap/libBornAgainDevice_wrap.cpp b/auto/Wrap/libBornAgainDevice_wrap.cpp index 0d4fbd72591..7006e9b3503 100644 --- a/auto/Wrap/libBornAgainDevice_wrap.cpp +++ b/auto/Wrap/libBornAgainDevice_wrap.cpp @@ -35242,7 +35242,7 @@ fail: } -SWIGINTERN PyObject *_wrap_Instrument_getBeam__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { +SWIGINTERN PyObject *_wrap_Instrument_beam__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { PyObject *resultobj = 0; Instrument *arg1 = (Instrument *) 0 ; void *argp1 = 0 ; @@ -35252,10 +35252,10 @@ SWIGINTERN PyObject *_wrap_Instrument_getBeam__SWIG_0(PyObject *SWIGUNUSEDPARM(s if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Instrument, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Instrument_getBeam" "', argument " "1"" of type '" "Instrument *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Instrument_beam" "', argument " "1"" of type '" "Instrument *""'"); } arg1 = reinterpret_cast< Instrument * >(argp1); - result = (Beam *) &(arg1)->getBeam(); + result = (Beam *) &(arg1)->beam(); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Beam, 0 | 0 ); return resultobj; fail: @@ -35263,7 +35263,7 @@ fail: } -SWIGINTERN PyObject *_wrap_Instrument_getBeam__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { +SWIGINTERN PyObject *_wrap_Instrument_beam__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { PyObject *resultobj = 0; Instrument *arg1 = (Instrument *) 0 ; void *argp1 = 0 ; @@ -35273,10 +35273,10 @@ SWIGINTERN PyObject *_wrap_Instrument_getBeam__SWIG_1(PyObject *SWIGUNUSEDPARM(s if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Instrument, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Instrument_getBeam" "', argument " "1"" of type '" "Instrument const *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Instrument_beam" "', argument " "1"" of type '" "Instrument const *""'"); } arg1 = reinterpret_cast< Instrument * >(argp1); - result = (Beam *) &((Instrument const *)arg1)->getBeam(); + result = (Beam *) &((Instrument const *)arg1)->beam(); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Beam, 0 | 0 ); return resultobj; fail: @@ -35284,13 +35284,13 @@ fail: } -SWIGINTERN PyObject *_wrap_Instrument_getBeam(PyObject *self, PyObject *args) { +SWIGINTERN PyObject *_wrap_Instrument_beam(PyObject *self, PyObject *args) { Py_ssize_t argc; PyObject *argv[2] = { 0 }; - if (!(argc = SWIG_Python_UnpackTuple(args, "Instrument_getBeam", 0, 1, argv))) SWIG_fail; + if (!(argc = SWIG_Python_UnpackTuple(args, "Instrument_beam", 0, 1, argv))) SWIG_fail; --argc; if (argc == 1) { int _v; @@ -35298,7 +35298,7 @@ SWIGINTERN PyObject *_wrap_Instrument_getBeam(PyObject *self, PyObject *args) { int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Instrument, 0); _v = SWIG_CheckState(res); if (_v) { - return _wrap_Instrument_getBeam__SWIG_0(self, argc, argv); + return _wrap_Instrument_beam__SWIG_0(self, argc, argv); } } if (argc == 1) { @@ -35307,15 +35307,15 @@ SWIGINTERN PyObject *_wrap_Instrument_getBeam(PyObject *self, PyObject *args) { int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Instrument, 0); _v = SWIG_CheckState(res); if (_v) { - return _wrap_Instrument_getBeam__SWIG_1(self, argc, argv); + return _wrap_Instrument_beam__SWIG_1(self, argc, argv); } } fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'Instrument_getBeam'.\n" + SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'Instrument_beam'.\n" " Possible C/C++ prototypes are:\n" - " Instrument::getBeam()\n" - " Instrument::getBeam() const\n"); + " Instrument::beam()\n" + " Instrument::beam() const\n"); return 0; } @@ -47385,10 +47385,10 @@ static PyMethodDef SwigMethods[] = { "void Instrument::accept(INodeVisitor *visitor) const final\n" "\n" ""}, - { "Instrument_getBeam", _wrap_Instrument_getBeam, METH_VARARGS, "\n" - "Instrument_getBeam(Instrument self) -> Beam\n" - "Instrument_getBeam(Instrument self) -> Beam\n" - "const Beam& Instrument::getBeam() const\n" + { "Instrument_beam", _wrap_Instrument_beam, METH_VARARGS, "\n" + "Instrument_beam(Instrument self) -> Beam\n" + "Instrument_beam(Instrument self) -> Beam\n" + "const Beam& Instrument::beam() const\n" "\n" ""}, { "Instrument_setBeam", _wrap_Instrument_setBeam, METH_VARARGS, "\n" -- GitLab