diff --git a/GUI/Model/Device/InstrumentItems.cpp b/GUI/Model/Device/InstrumentItems.cpp index 3ebb13dfe41fb1a3955910c83bb46b11e1b77576..20c5806f34a15534f5d9c25dfc23a2c78e62592b 100644 --- a/GUI/Model/Device/InstrumentItems.cpp +++ b/GUI/Model/Device/InstrumentItems.cpp @@ -370,24 +370,24 @@ std::unique_ptr<Instrument> Instrument2DItem::createInstrument() const ScatteringSimulation* Instrument2DItem::createScatteringSimulation(const MultiLayer& sample) const { auto beam = beamItem()->createBeam(); + beam->setPolarization(m_polarization); auto detector = detectorItem()->createDetector(); + detector->setAnalyzer(m_analyzerDirection, m_analyzerEfficiency, m_analyzerTotalTransmission); detector->setDetectorNormal(beam->direction().zReflected()); auto* result = new ScatteringSimulation(*beam, sample, *detector); - result->setPolarization(m_polarization); - result->setAnalyzer(m_analyzerDirection, m_analyzerEfficiency, m_analyzerTotalTransmission); return result; } OffspecSimulation* Instrument2DItem::createOffspecSimulation(const MultiLayer& sample) const { auto beam = beamItem()->createBeam(); + beam->setPolarization(m_polarization); auto detector = detectorItem()->createDetector(); + detector->setAnalyzer(m_analyzerDirection, m_analyzerEfficiency, m_analyzerTotalTransmission); detector->setDetectorNormal(beam->direction().zReflected()); auto* result = new OffspecSimulation(*beam, sample, *detector); - result->setPolarization(m_polarization); - result->setAnalyzer(m_analyzerDirection, m_analyzerEfficiency, m_analyzerTotalTransmission); return result; } diff --git a/GUI/Model/FromCore/ItemizeSimulation.cpp b/GUI/Model/FromCore/ItemizeSimulation.cpp index 8da32fdc95eaae447a34c8b6464a9cd52c4556f4..8a1be6ab078045f6e0fa7c89d793866c73cf38e6 100644 --- a/GUI/Model/FromCore/ItemizeSimulation.cpp +++ b/GUI/Model/FromCore/ItemizeSimulation.cpp @@ -137,9 +137,9 @@ void setMaskContainer(MaskItems* destMaskItems, const IDetector& detector, doubl } } -void setDetectorMasks(DetectorItem* detector_item, const ISimulation& simulation) +void setDetectorMasks(DetectorItem* detector_item, const ISimulation2D& simulation) { - const IDetector& detector = simulation.detector(); + const IDetector& detector = simulation.detector2D(); if ((detector.detectorMask() && detector.detectorMask()->hasMasks()) || detector.hasExplicitRegionOfInterest()) { const double scale = 1.0 / detector_item->axesToCoreUnitsFactor(); @@ -460,10 +460,9 @@ SpecularInstrumentItem* createSpecularInstrumentItem(const SpecularSimulation& s auto* result = new SpecularInstrumentItem(); SpecularBeamItem* beam_item = result->beamItem(); - const Beam& beam = simulation.beam(); const ISpecularScan* scan = simulation.scan(); - beam_item->setIntensity(beam.intensity()); + beam_item->setIntensity(1.0); beam_item->setWavelength(scan->wavelength()); beam_item->setInclinationAngle(0.0); // inclination angle is hardcoded beam_item->setAzimuthalAngle(0.0); // azimuthal angle is hardcoded diff --git a/GUI/Model/ToCore/SimulationToCore.cpp b/GUI/Model/ToCore/SimulationToCore.cpp index 252b124be9b288374df25a9e3aa4c7db8f472fbf..1ec1f0dbbfed63beb37e1eb8edffad2c53d703b4 100644 --- a/GUI/Model/ToCore/SimulationToCore.cpp +++ b/GUI/Model/ToCore/SimulationToCore.cpp @@ -141,7 +141,7 @@ SpecularSimulation* createSpecularSimulation(std::unique_ptr<MultiLayer> sample, scan.setAngleResolution(*resolution); auto* result = new SpecularSimulation(scan, *sample); - result->beam().setIntensity(beam_item->intensity()); + // result->beam().setIntensity(beam_item->intensity()); addBackgroundToSimulation(*item, *result); diff --git a/Param/Distrib/DistributionHandler.cpp b/Param/Distrib/DistributionHandler.cpp index 1cf534a6c138b1cac4128c4a9bb90bf663efa6f3..a4c8def2ce879f7c72b40eae385d10df863ff9bd 100644 --- a/Param/Distrib/DistributionHandler.cpp +++ b/Param/Distrib/DistributionHandler.cpp @@ -61,15 +61,6 @@ double DistributionHandler::setParameterValues(size_t index) return weight; } -void DistributionHandler::setParameterToMeans() const -{ - for (const auto& distribution : m_distributions) { - // set the value in the ISimulation instance (via callback) - ASSERT(m_setValueFunctions.count(&distribution) == 1); - m_setValueFunctions.at (&distribution)(distribution.getDistribution()->mean()); - } -} - const std::vector<ParameterDistribution>& DistributionHandler::getDistributions() const { return m_distributions; diff --git a/Param/Distrib/DistributionHandler.h b/Param/Distrib/DistributionHandler.h index db1b813b452678db02545bf50150d70be6df0d41..bf384f011515367a6464be8ff7d05e372cd4c582 100644 --- a/Param/Distrib/DistributionHandler.h +++ b/Param/Distrib/DistributionHandler.h @@ -50,10 +50,6 @@ public: //! initParameterLinks() has to be called before this! double setParameterValues(size_t index); - //! Sets mean distribution values in all contained distributions. initParameterLinks() has to be - //! called before this! - void setParameterToMeans() const; - const std::vector<ParameterDistribution>& getDistributions() const; void defineCallbackForDistribution(const ParameterDistribution* distribution, diff --git a/Sim/Export/SimulationToPython.cpp b/Sim/Export/SimulationToPython.cpp index 451bd43dca132f60c1c7c1f58c400648e5211a79..abfda0831c9f92f2305939c5393406b247486dfb 100644 --- a/Sim/Export/SimulationToPython.cpp +++ b/Sim/Export/SimulationToPython.cpp @@ -129,6 +129,26 @@ std::string defineQzScan(const QzScan& scan) return result.str(); } +std::string definePolarizationAnalyzer(const PolFilter& analyzer, const std::string parent) +{ + std::ostringstream result; + R3 analyzer_direction = analyzer.analyzerDirection(); + double analyzer_efficiency = analyzer.analyzerEfficiency(); + double analyzer_total_transmission = analyzer.totalTransmission(); + + if (analyzer_direction.mag() > 0.0) { + std::string direction_name = "analyzer_direction"; + result << indent() << direction_name << " = R3(" + << Py::Fmt::printDouble(analyzer_direction.x()) << ", " + << Py::Fmt::printDouble(analyzer_direction.y()) << ", " + << Py::Fmt::printDouble(analyzer_direction.z()) << ")\n"; + result << indent() << parent << ".setAnalyzer(" << direction_name << ", " + << Py::Fmt::printDouble(analyzer_efficiency) << ", " + << Py::Fmt::printDouble(analyzer_total_transmission) << ")\n"; + } + return result.str(); +} + std::string defineScan(const ISpecularScan* scan) { if (const auto* s = dynamic_cast<const AlphaScan*>(scan); s) @@ -138,7 +158,7 @@ std::string defineScan(const ISpecularScan* scan) ASSERT(0); } -std::string defineDetector(const ISimulation* simulation) +std::string defineDetector(const ISimulation2D* simulation) { const IDetector& detector = simulation->detector(); if (detector.rank() != 2) @@ -210,13 +230,13 @@ std::string defineDetector(const ISimulation* simulation) << printFunc(detector)(xBounds.second) << ", " << printFunc(detector)(yBounds.second) << ")\n"; } + result << definePolarizationAnalyzer(detector.analyzer(), "detector"); return result.str(); } -std::string defineDetectorResolutionFunction(const ISimulation* simulation) +std::string defineDetectorResolutionFunction(const IDetector2D& detector) { std::ostringstream result; - const IDetector& detector = simulation->detector(); if (const IDetectorResolution* resfunc = detector.detectorResolution()) { if (const auto* convfunc = dynamic_cast<const ConvolutionDetectorResolution*>(resfunc)) { @@ -236,27 +256,6 @@ std::string defineDetectorResolutionFunction(const ISimulation* simulation) return result.str(); } -std::string defineDetectorPolarizationAnalysis(const ISimulation* simulation) -{ - std::ostringstream result; - const IDetector& detector = simulation->detector(); - R3 analyzer_direction = detector.analyzer().analyzerDirection(); - double analyzer_efficiency = detector.analyzer().analyzerEfficiency(); - double analyzer_total_transmission = detector.analyzer().totalTransmission(); - - if (analyzer_direction.mag() > 0.0) { - std::string direction_name = "analyzer_direction"; - result << indent() << direction_name << " = R3(" - << Py::Fmt::printDouble(analyzer_direction.x()) << ", " - << Py::Fmt::printDouble(analyzer_direction.y()) << ", " - << Py::Fmt::printDouble(analyzer_direction.z()) << ")\n"; - result << indent() << "simulation.setAnalyzer(" << direction_name << ", " - << Py::Fmt::printDouble(analyzer_efficiency) << ", " - << Py::Fmt::printDouble(analyzer_total_transmission) << ")\n"; - } - return result.str(); -} - std::string defineBeamPolarization(const Beam& beam) { std::ostringstream result; @@ -321,6 +320,9 @@ std::string defineSpecularScan(const SpecularSimulation& simulation) throw std::runtime_error("Error defineSpecularScan: passed simulation " "does not contain any scan"); result << defineScan(scan) << "\n"; + const PolFilter* analyzer = scan->analyzer(); + if (analyzer) + result << definePolarizationAnalyzer(*analyzer, "scan"); return result.str(); } @@ -348,12 +350,11 @@ std::string defineParameterDistributions(const ISimulation* simulation) return result.str(); } -std::string defineMasks(const ISimulation* simulation) +std::string defineMasks(const IDetector2D& detector) { std::ostringstream result; result << std::setprecision(12); - const IDetector& detector = simulation->detector(); const DetectorMask* detectorMask = detector.detectorMask(); if (detectorMask && detectorMask->hasMasks()) { result << "\n"; @@ -411,10 +412,9 @@ std::string defineScatteringSimulation(const ScatteringSimulation* simulation) result << defineGISASBeam(*simulation); result << defineDetector(simulation); result << indent() << "simulation = ba.ScatteringSimulation(beam, sample, detector)\n"; - result << defineDetectorResolutionFunction(simulation); - result << defineDetectorPolarizationAnalysis(simulation); + result << defineDetectorResolutionFunction(simulation->detector2D()); result << defineParameterDistributions(simulation); - result << defineMasks(simulation); + result << defineMasks(simulation->detector2D()); result << defineSimulationOptions(simulation); result << defineBackground(simulation); return result.str(); @@ -425,11 +425,10 @@ std::string defineOffspecSimulation(const OffspecSimulation* simulation) std::ostringstream result; result << indent() << "simulation = ba.OffspecSimulation()\n"; result << defineDetector(simulation); - result << defineDetectorResolutionFunction(simulation); - result << defineDetectorPolarizationAnalysis(simulation); + result << defineDetectorResolutionFunction(simulation->detector2D()); result << defineOffspecBeam(*simulation); result << defineParameterDistributions(simulation); - result << defineMasks(simulation); + result << defineMasks(simulation->detector2D()); result << defineSimulationOptions(simulation); result << defineBackground(simulation); return result.str(); @@ -440,11 +439,11 @@ std::string defineSpecularSimulation(const SpecularSimulation* simulation) std::ostringstream result; result << defineSpecularScan(*simulation); result << indent() << "simulation = ba.SpecularSimulation(scan, sample)\n"; - result << defineDetectorPolarizationAnalysis(simulation); result << defineParameterDistributions(simulation); result << defineSimulationOptions(simulation); result << defineBackground(simulation); - result << defineBeamIntensity(simulation->beam()) << "\n"; + // result << defineBeamIntensity(simulation->beam()); + result << "\n"; return result.str(); } diff --git a/Sim/Scan/ISpecularScan.h b/Sim/Scan/ISpecularScan.h index 9bf6e37835c092ce3a6ea09283e8dad250bdf87c..7519064bf80ebe6443a59bde63b944a4ea11800a 100644 --- a/Sim/Scan/ISpecularScan.h +++ b/Sim/Scan/ISpecularScan.h @@ -42,6 +42,8 @@ public: //! Sets the polarization analyzer characteristics of the detector void setAnalyzer(R3 direction, double efficiency, double total_transmission); + const PolFilter* analyzer() const { return m_polAnalyzer.get(); } + virtual double wavelength() const = 0; #ifndef SWIG diff --git a/Sim/Simulation/DepthProbeSimulation.cpp b/Sim/Simulation/DepthProbeSimulation.cpp index f32ec1c563a5630eb6f8c2463b9866488b236659..6e351b750534eebc494d920b970005df8e18a9f9 100644 --- a/Sim/Simulation/DepthProbeSimulation.cpp +++ b/Sim/Simulation/DepthProbeSimulation.cpp @@ -34,7 +34,7 @@ const double zero_alpha_i = 0.0; DepthProbeSimulation::DepthProbeSimulation(const MultiLayer& sample) - : ISimulation(sample) + : ISimulation2D(sample) { // allow for negative inclinations in the beam of specular simulation // it is required for proper averaging in the case of divergent beam diff --git a/Sim/Simulation/DepthProbeSimulation.h b/Sim/Simulation/DepthProbeSimulation.h index 6265667780f460d5123edef5f9d34cd4f9e40ff8..efcb6875b8c462b61e19029b30b1645d737ceb39 100644 --- a/Sim/Simulation/DepthProbeSimulation.h +++ b/Sim/Simulation/DepthProbeSimulation.h @@ -17,7 +17,7 @@ #include "Base/Element/DepthProbeElement.h" #include "Device/Data/Powerfield.h" -#include "Sim/Simulation/ISimulation.h" +#include "Sim/Simulation/ISimulation2D.h" #include <vector> @@ -34,7 +34,7 @@ class ICoordSystem; //! Only refraction, reflection and attenuation of the incoming beam are accounted for. //! @ingroup simulation -class DepthProbeSimulation : public ISimulation { +class DepthProbeSimulation : public ISimulation2D { public: DepthProbeSimulation(const MultiLayer& sample); ~DepthProbeSimulation() override; diff --git a/Sim/Simulation/ISimulation.cpp b/Sim/Simulation/ISimulation.cpp index 63a1d69d85012a281c691f00b1bcec2f5c9b55d4..4577d9386b3296b112c3fde888f13a40516b4973 100644 --- a/Sim/Simulation/ISimulation.cpp +++ b/Sim/Simulation/ISimulation.cpp @@ -16,9 +16,6 @@ #include "Base/Progress/ProgressHandler.h" #include "Base/Util/Assert.h" #include "Base/Util/StringUtils.h" -#include "Device/Beam/Beam.h" -#include "Device/Detector/IDetector.h" -#include "Device/Detector/SphericalDetector.h" #include "Device/Histo/SimulationResult.h" #include "Resample/Options/SimulationOptions.h" #include "Resample/Processed/ReSample.h" @@ -108,20 +105,8 @@ void runComputations(const std::vector<std::unique_ptr<IComputation>>& computati // class implementation // ************************************************************************************************ -ISimulation::ISimulation(const Beam& beam, const MultiLayer& sample, const IDetector& detector) - : m_beam(beam.clone()) - , m_detector(detector.clone()) - , m_sample(sample.clone()) - , m_options(std::make_unique<SimulationOptions>()) - , m_progress(std::make_unique<ProgressHandler>()) -{ - m_detector->setDetectorNormal(m_beam->direction().zReflected()); -} - ISimulation::ISimulation(const MultiLayer& sample) - : m_beam(Beam::horizontalBeam().clone()) - , m_detector(new SphericalDetector()) - , m_sample(sample.clone()) + : m_sample(sample.clone()) , m_options(std::make_unique<SimulationOptions>()) , m_progress(std::make_unique<ProgressHandler>()) { @@ -165,16 +150,6 @@ void ISimulation::setTerminalProgressMonitor() }); } -void ISimulation::setPolarization(R3 bloch_vector) -{ - beam().setPolarization(bloch_vector); -} - -void ISimulation::setAnalyzer(const R3 direction, double efficiency, double total_transmission) -{ - detector().setAnalyzer(direction, efficiency, total_transmission); -} - //! Runs simulation with possible averaging over parameter distributions; returns result. SimulationResult ISimulation::simulate() { @@ -203,32 +178,11 @@ SimulationResult ISimulation::simulate() if (param_combinations == 1) runSingleSimulation(re_sample, batch_start, batch_size, 1.); else { - // init callbacks for setting the parameter values - for (const auto& distribution : m_distribution_handler.getDistributions()) { - const auto* dc = const_cast<ParameterDistribution*>(&distribution); - - switch (dc->whichParameter()) { - case ParameterDistribution::BeamAzimuthalAngle: - m_distribution_handler.defineCallbackForDistribution( - dc, [&](double d) { beam().setAzimuthalAngleGuarded(d); }); - break; - case ParameterDistribution::BeamInclinationAngle: - m_distribution_handler.defineCallbackForDistribution( - dc, [&](double d) { beam().setInclinationAngleGuarded(d); }); - break; - case ParameterDistribution::BeamWavelength: - m_distribution_handler.defineCallbackForDistribution( - dc, [&](double d) { beam().setWavelengthGuarded(d); }); - break; - default: - throw std::runtime_error("ISimulation::simulate() missing implementation"); - } - } + initDistributionHandler(); for (size_t index = 0; index < param_combinations; ++index) { double weight = m_distribution_handler.setParameterValues(index); runSingleSimulation(re_sample, batch_start, batch_size, weight); } - m_distribution_handler.setParameterToMeans(); } moveDataFromCache(); return pack_result(); @@ -247,11 +201,6 @@ void ISimulation::setBackground(const IBackground& bg) std::vector<const INode*> ISimulation::nodeChildren() const { std::vector<const INode*> result; - result.push_back(m_beam.get()); - if (m_detector) - result.push_back(m_detector.get()); - if (m_background) - result << m_background.get(); if (m_sample) result << m_sample.get(); return result; diff --git a/Sim/Simulation/ISimulation.h b/Sim/Simulation/ISimulation.h index d2505c4f44a3a23b6dd3503cc57de0f30dc4b5e2..0aee457f56c7f00552bcdf961c5bdf754b01bb2c 100644 --- a/Sim/Simulation/ISimulation.h +++ b/Sim/Simulation/ISimulation.h @@ -22,8 +22,6 @@ template <class T> class Powerfield; -class Beam; -class IDetector; class IBackground; class IComputation; class ICoordSystem; @@ -45,7 +43,6 @@ class SimulationResult; class ISimulation : public INode { public: - ISimulation(const Beam& beam, const MultiLayer& sample, const IDetector& detector); ISimulation(const MultiLayer& sample); ~ISimulation() override; @@ -68,15 +65,6 @@ public: void setTerminalProgressMonitor(); - Beam& beam() { return *m_beam; } - IDetector& detector() { return *m_detector; } - - //! Sets the polarization density matrix according to the given Bloch vector - void setPolarization(R3 bloch_vector); - - //! Sets the polarization analyzer characteristics of the detector - void setAnalyzer(R3 direction, double efficiency, double total_transmission); - //! Force polarized computation even in absence of sample magnetization or external fields virtual bool force_polarized() const = 0; @@ -87,10 +75,6 @@ public: const MultiLayer* sample() const; - const Beam& beam() const { return *m_beam; } - const IDetector& detector() const { return *m_detector; } - const IDetector* getDetector() const { return m_detector.get(); } - const IBackground* background() const { return m_background.get(); } const std::vector<ParameterDistribution>& getDistributions() const; @@ -119,8 +103,9 @@ protected: ProgressHandler& progress(); - std::unique_ptr<Beam> m_beam; - std::unique_ptr<IDetector> m_detector; + DistributionHandler m_distribution_handler; + + virtual void initDistributionHandler() {} private: void runSingleSimulation(const reSample& re_sample, size_t batch_start, size_t batch_size, @@ -151,7 +136,6 @@ private: std::shared_ptr<SimulationOptions> m_options; std::shared_ptr<ProgressHandler> m_progress; - DistributionHandler m_distribution_handler; std::shared_ptr<IBackground> m_background; #endif // SWIG }; diff --git a/Sim/Simulation/ISimulation2D.cpp b/Sim/Simulation/ISimulation2D.cpp index 344b3d256088f1a48cb38834717abd8d00e47e13..f98ee1b2e753d807d1e453a7bb85e94f215a0af1 100644 --- a/Sim/Simulation/ISimulation2D.cpp +++ b/Sim/Simulation/ISimulation2D.cpp @@ -16,18 +16,24 @@ #include "Base/Util/Assert.h" #include "Device/Beam/Beam.h" #include "Device/Detector/DetectorContext.h" +#include "Device/Detector/SphericalDetector.h" #include "Device/Detector/IDetector2D.h" #include "Resample/Element/DiffuseElement.h" #include "Sim/Background/IBackground.h" #include "Sim/Computation/DWBAComputation.h" ISimulation2D::ISimulation2D(const Beam& beam, const MultiLayer& sample, const IDetector& detector) - : ISimulation(beam, sample, detector) + : ISimulation(sample) + , m_beam(beam.clone()) + , m_detector(detector.clone()) { + m_detector->setDetectorNormal(m_beam->direction().zReflected()); } ISimulation2D::ISimulation2D(const MultiLayer& sample) : ISimulation(sample) + , m_beam(Beam::horizontalBeam().clone()) + , m_detector(new SphericalDetector()) { } @@ -47,6 +53,15 @@ const IDetector2D& ISimulation2D::detector2D() const return *p; } +std::vector<const INode*> ISimulation2D::nodeChildren() const +{ + std::vector<const INode*> result = ISimulation::nodeChildren(); + result.push_back(m_beam.get()); + if (m_detector) + result.push_back(m_detector.get()); + return result; +} + void ISimulation2D::prepareSimulation() { m_detector_context = detector2D().createContext(); @@ -160,3 +175,28 @@ bool ISimulation2D::force_polarized() const { return detector().analyzer().analyzerDirection() != R3{}; } + +//! init callbacks for setting the parameter values +void ISimulation2D::initDistributionHandler() +{ + for (const auto& distribution : m_distribution_handler.getDistributions()) { + const auto* dc = const_cast<ParameterDistribution*>(&distribution); + + switch (dc->whichParameter()) { + case ParameterDistribution::BeamAzimuthalAngle: + m_distribution_handler.defineCallbackForDistribution( + dc, [&](double d) { beam().setAzimuthalAngleGuarded(d); }); + break; + case ParameterDistribution::BeamInclinationAngle: + m_distribution_handler.defineCallbackForDistribution( + dc, [&](double d) { beam().setInclinationAngleGuarded(d); }); + break; + case ParameterDistribution::BeamWavelength: + m_distribution_handler.defineCallbackForDistribution( + dc, [&](double d) { beam().setWavelengthGuarded(d); }); + break; + default: + ASSERT(0); + } + } +} diff --git a/Sim/Simulation/ISimulation2D.h b/Sim/Simulation/ISimulation2D.h index fd486d5b3132b3d3da051a8fdcd973561417fba4..3768c9ec3268487a02e142035cf362cecd97e05a 100644 --- a/Sim/Simulation/ISimulation2D.h +++ b/Sim/Simulation/ISimulation2D.h @@ -18,6 +18,8 @@ #include "Sim/Simulation/ISimulation.h" #include <memory> +class Beam; +class IDetector; class DetectorContext; class DiffuseElement; class IDetector2D; @@ -35,6 +37,8 @@ public: ISimulation2D(const MultiLayer& sample); ~ISimulation2D() override; + std::vector<const INode*> nodeChildren() const override; + //! Sets spherical detector parameters using angle ranges //! @param n_x number of phi-axis bins //! @param x_min low edge of first phi-bin @@ -60,17 +64,26 @@ public: bool force_polarized() const override; + Beam& beam() { return *m_beam; } + IDetector& detector() { return *m_detector; } + #ifndef SWIG + const Beam& beam() const { return *m_beam; } + const IDetector& detector() const { return *m_detector; } + const IDetector* getDetector() const { return m_detector.get(); } + const IDetector2D& detector2D() const; + protected: IDetector2D& detector2D(); - const IDetector2D& detector2D() const; //! Put into a clean state for running a simulation void prepareSimulation() override; virtual void initCoordSystem() {} + void initDistributionHandler() override; + //! Gets the number of elements this simulation needs to calculate size_t numberOfElements() const override; @@ -95,6 +108,8 @@ protected: void moveDataFromCache() override; + std::unique_ptr<Beam> m_beam; + std::unique_ptr<IDetector> m_detector; std::vector<std::unique_ptr<DiffuseElement>> m_eles; std::vector<double> m_cache; diff --git a/Sim/Simulation/SpecularSimulation.cpp b/Sim/Simulation/SpecularSimulation.cpp index 7cbbf271b0da89967b018049751e9d71c5de6315..4ef50e6f4ffe10ccee8ebce44af6f67c23b085bc 100644 --- a/Sim/Simulation/SpecularSimulation.cpp +++ b/Sim/Simulation/SpecularSimulation.cpp @@ -39,19 +39,12 @@ SpecularSimulation::SpecularSimulation(const ISpecularScan& scan, const MultiLay // TODO: move inside AlphaScan when pointwise resolution is implemented if (scan.coordinateAxis()->min() < 0.0) throw std::runtime_error("Invalid scan: minimum value on coordinate axis is negative"); - - detector().addDetAxis(*scan.coordinateAxis()); } SpecularSimulation::~SpecularSimulation() = default; SpecularSimulation::SpecularSimulation(SpecularSimulation&&) = default; -void SpecularSimulation::prepareSimulation() -{ - ASSERT(detector().rank() == 1); -} - size_t SpecularSimulation::numberOfElements() const { return m_scan->numberOfElements(); diff --git a/Sim/Simulation/SpecularSimulation.h b/Sim/Simulation/SpecularSimulation.h index b1492c09d6732a53856b1edcc0d5028a8552611f..d2302bddbb8dcc2cea1e02fe62914ad8a3408f83 100644 --- a/Sim/Simulation/SpecularSimulation.h +++ b/Sim/Simulation/SpecularSimulation.h @@ -20,7 +20,6 @@ class IAxis; class IFootprintFactor; class ISpecularScan; -class MultiLayer; class PolMatrices; class SpecularElement; @@ -52,7 +51,7 @@ public: #ifndef SWIG //! Put into a clean state for running a simulation. - void prepareSimulation() override; + void prepareSimulation() override {} ICoordSystem* createCoordSystem() const override; //! Returns internal data handler diff --git a/Tests/Functional/Suite/MakeSimulations.cpp b/Tests/Functional/Suite/MakeSimulations.cpp index f6794618f585e72924492d9b3d7f9535b4077e0e..622408d252afcb0f3e6581432ca876db76af1252 100644 --- a/Tests/Functional/Suite/MakeSimulations.cpp +++ b/Tests/Functional/Suite/MakeSimulations.cpp @@ -71,8 +71,8 @@ using Units::deg; std::unique_ptr<ScatteringSimulation> test::makeSimulation::MiniGISAS(const MultiLayer& sample) { Beam beam(1.0, 1 * angstrom, Direction(0.2 * deg, 0)); - SphericalDetector det(25, -2 * deg, 2 * deg, 25, 0, 2 * deg); - return std::make_unique<ScatteringSimulation>(beam, sample, det); + SphericalDetector detector(25, -2 * deg, 2 * deg, 25, 0, 2 * deg); + return std::make_unique<ScatteringSimulation>(beam, sample, detector); } @@ -81,8 +81,8 @@ std::unique_ptr<ScatteringSimulation> test::makeSimulation::MiniGISAS(const Mult std::unique_ptr<ScatteringSimulation> test::makeSimulation::MiniGISAS_v2(const MultiLayer& sample) { Beam beam(1.0, 1 * angstrom, Direction(0.2 * deg, 0)); - SphericalDetector det(25, -1 * deg, 1 * deg, 25, 0, 1 * deg); - return std::make_unique<ScatteringSimulation>(beam, sample, det); + SphericalDetector detector(25, -1 * deg, 1 * deg, 25, 0, 1 * deg); + return std::make_unique<ScatteringSimulation>(beam, sample, detector); } std::unique_ptr<ScatteringSimulation> @@ -90,10 +90,10 @@ test::makeSimulation::MiniZPolarizedGISAS(const MultiLayer& sample, const std::s { const auto zCase = ZPolarizationCases.at(polCase); Beam beam(1.0, 1 * angstrom, Direction(0.2 * deg, 0)); - SphericalDetector det(25, -2 * deg, 2 * deg, 25, 0, 2 * deg); - auto sim = std::make_unique<ScatteringSimulation>(beam, sample, det); - sim->setPolarization(zCase.first); - sim->setAnalyzer(zCase.second, 1., .5); + beam.setPolarization(zCase.first); + SphericalDetector detector(25, -2 * deg, 2 * deg, 25, 0, 2 * deg); + detector.setAnalyzer(zCase.second, 1., .5); + auto sim = std::make_unique<ScatteringSimulation>(beam, sample, detector); return sim; } @@ -103,8 +103,8 @@ test::makeSimulation::MiniZPolarizedGISAS(const MultiLayer& sample, const std::s std::unique_ptr<ScatteringSimulation> test::makeSimulation::BasicGISAS(const MultiLayer& sample) { Beam beam(1.0, 1 * angstrom, Direction(0.2 * deg, 0)); - SphericalDetector det(100, 0, 2 * deg, 100, 0, 2 * deg); - return std::make_unique<ScatteringSimulation>(beam, sample, det); + SphericalDetector detector(100, 0, 2 * deg, 100, 0, 2 * deg); + return std::make_unique<ScatteringSimulation>(beam, sample, detector); } //! Basic GISAS simulation for spin flip channel. @@ -112,8 +112,8 @@ std::unique_ptr<ScatteringSimulation> test::makeSimulation::BasicGISAS(const Mul std::unique_ptr<ScatteringSimulation> test::makeSimulation::SpinflipGISAS(const MultiLayer& sample) { std::unique_ptr<ScatteringSimulation> result = BasicGISAS(sample); - result->setPolarization(zplus); - result->setAnalyzer(zplus, -1.0, 0.5); + result->beam().setPolarization(zplus); + result->detector().setAnalyzer(zplus, -1.0, 0.5); return result; } @@ -140,9 +140,9 @@ test::makeSimulation::MiniGISASBeamDivergence(const MultiLayer& sample) std::unique_ptr<ScatteringSimulation> test::makeSimulation::GISASWithMasks(const MultiLayer& sample) { Beam beam(1e7, 1 * angstrom, Direction(0.2 * deg, 0)); - SphericalDetector det(50, -1 * deg, 1 * deg, 50, 0, 2 * deg); + SphericalDetector detector(50, -1 * deg, 1 * deg, 50, 0, 2 * deg); std::unique_ptr<ScatteringSimulation> result = - std::make_unique<ScatteringSimulation>(beam, sample, det); + std::make_unique<ScatteringSimulation>(beam, sample, detector); result->maskAll(); // pacman @@ -184,9 +184,9 @@ std::unique_ptr<ScatteringSimulation> test::makeSimulation::MiniGISASSpecularPeak(const MultiLayer& sample) { Beam beam(1.0, 1 * angstrom, Direction(0.2 * deg, 0)); - SphericalDetector det(25, -2 * deg, 2 * deg, 25, 0, 2 * deg); + SphericalDetector detector(25, -2 * deg, 2 * deg, 25, 0, 2 * deg); std::unique_ptr<ScatteringSimulation> result = - std::make_unique<ScatteringSimulation>(beam, sample, det); + std::make_unique<ScatteringSimulation>(beam, sample, detector); result->options().setIncludeSpecular(true); return result; } @@ -196,8 +196,8 @@ test::makeSimulation::MiniGISASSpecularPeak(const MultiLayer& sample) std::unique_ptr<ScatteringSimulation> test::makeSimulation::MaxiGISAS(const MultiLayer& sample) { Beam beam(1.0, 1 * angstrom, Direction(0.2 * deg, 0)); - SphericalDetector det(256, -2 * deg, 2 * deg, 256, 0, 2 * deg); - return std::make_unique<ScatteringSimulation>(beam, sample, det); + SphericalDetector detector(256, -2 * deg, 2 * deg, 256, 0, 2 * deg); + return std::make_unique<ScatteringSimulation>(beam, sample, detector); } //! Basic GISAS for polarization studies. @@ -205,8 +205,8 @@ std::unique_ptr<ScatteringSimulation> test::makeSimulation::MaxiGISAS(const Mult std::unique_ptr<ScatteringSimulation> test::makeSimulation::MaxiGISAS00(const MultiLayer& sample) { std::unique_ptr<ScatteringSimulation> result = MaxiGISAS(sample); - result->setPolarization(zplus); - result->setAnalyzer(zplus, 1.0, 0.5); + result->beam().setPolarization(zplus); + result->detector().setAnalyzer(zplus, 1.0, 0.5); return result; } @@ -216,9 +216,10 @@ std::unique_ptr<ScatteringSimulation> test::makeSimulation::RectDetectorGeneric(const MultiLayer& sample) { Beam beam(1.0, 1 * angstrom, Direction(0.2 * deg, 0)); - RectangularDetector det(rdet_nbinsx, rdet_width, rdet_nbinsy, rdet_height); - det.setDetectorPosition(R3(rdet_distance, 10.0, 5.0), rdet_width / 2., 1.0, R3(0.1, -1.0, 0.2)); - return std::make_unique<ScatteringSimulation>(beam, sample, det); + RectangularDetector detector(rdet_nbinsx, rdet_width, rdet_nbinsy, rdet_height); + detector.setDetectorPosition( + R3(rdet_distance, 10.0, 5.0), rdet_width / 2., 1.0, R3(0.1, -1.0, 0.2)); + return std::make_unique<ScatteringSimulation>(beam, sample, detector); } //! GISAS simulation with the rectangular detector perpendicular to the sample. @@ -227,9 +228,9 @@ std::unique_ptr<ScatteringSimulation> test::makeSimulation::RectDetectorPerpToSample(const MultiLayer& sample) { Beam beam(1.0, 1 * angstrom, Direction(0.2 * deg, 0)); - RectangularDetector det(rdet_nbinsx, rdet_width, rdet_nbinsy, rdet_height); - det.setPerpendicularToSampleX(rdet_distance, rdet_width / 2., 1.0); - return std::make_unique<ScatteringSimulation>(beam, sample, det); + RectangularDetector detector(rdet_nbinsx, rdet_width, rdet_nbinsy, rdet_height); + detector.setPerpendicularToSampleX(rdet_distance, rdet_width / 2., 1.0); + return std::make_unique<ScatteringSimulation>(beam, sample, detector); } //! GISAS simulation with the rectangular detector perpendicular to the direct beam. @@ -238,9 +239,9 @@ std::unique_ptr<ScatteringSimulation> test::makeSimulation::RectDetectorPerpToDirectBeam(const MultiLayer& sample) { Beam beam(1.0, 1 * angstrom, Direction(0.2 * deg, 0)); - RectangularDetector det(rdet_nbinsx, rdet_width, rdet_nbinsy, rdet_height); - det.setPerpendicularToDirectBeam(rdet_distance, rdet_width / 2., 1.0); - return std::make_unique<ScatteringSimulation>(beam, sample, det); + RectangularDetector detector(rdet_nbinsx, rdet_width, rdet_nbinsy, rdet_height); + detector.setPerpendicularToDirectBeam(rdet_distance, rdet_width / 2., 1.0); + return std::make_unique<ScatteringSimulation>(beam, sample, detector); } //! GISAS simulation with the rectangular detector perpendicular to the reflected beam. @@ -249,9 +250,9 @@ std::unique_ptr<ScatteringSimulation> test::makeSimulation::RectDetectorPerpToReflectedBeam(const MultiLayer& sample) { Beam beam(1.0, 1 * angstrom, Direction(0.2 * deg, 0)); - RectangularDetector det(rdet_nbinsx, rdet_width, rdet_nbinsy, rdet_height); - det.setPerpendicularToReflectedBeam(rdet_distance, rdet_width / 2., 1.0); - return std::make_unique<ScatteringSimulation>(beam, sample, det); + RectangularDetector detector(rdet_nbinsx, rdet_width, rdet_nbinsy, rdet_height); + detector.setPerpendicularToReflectedBeam(rdet_distance, rdet_width / 2., 1.0); + return std::make_unique<ScatteringSimulation>(beam, sample, detector); } //! GISAS simulation with the rectangular detector perpendicular to the reflected beam when @@ -261,10 +262,10 @@ std::unique_ptr<ScatteringSimulation> test::makeSimulation::RectDetectorPerpToReflectedBeamDpos(const MultiLayer& sample) { Beam beam(1.0, 1 * angstrom, Direction(0.2 * deg, 0)); - RectangularDetector det(rdet_nbinsx, rdet_width, rdet_nbinsy, rdet_height); - det.setPerpendicularToReflectedBeam(rdet_distance); - det.setDirectBeamPosition(rdet_width / 2., 1.0); - return std::make_unique<ScatteringSimulation>(beam, sample, det); + RectangularDetector detector(rdet_nbinsx, rdet_width, rdet_nbinsy, rdet_height); + detector.setPerpendicularToReflectedBeam(rdet_distance); + detector.setDirectBeamPosition(rdet_width / 2., 1.0); + return std::make_unique<ScatteringSimulation>(beam, sample, detector); } //! GISAS simulation with Monte-Carlo integration switched ON. @@ -283,9 +284,9 @@ std::unique_ptr<ScatteringSimulation> test::makeSimulation::SphericalDetWithRoi(const MultiLayer& sample) { Beam beam(1.0, 1 * angstrom, Direction(0.2 * deg, 0)); - SphericalDetector det(40, -2 * deg, 2 * deg, 30, 0, 3 * deg); + SphericalDetector detector(40, -2 * deg, 2 * deg, 30, 0, 3 * deg); std::unique_ptr<ScatteringSimulation> result = - std::make_unique<ScatteringSimulation>(beam, sample, det); + std::make_unique<ScatteringSimulation>(beam, sample, detector); result->addMask(Rectangle(-0.5 * deg, 0.3 * deg, -0.2 * deg, 0.6 * deg)); result->setRegionOfInterest(-1.5 * deg, 0.25 * deg, 1.5 * deg, 1.75 * deg); return result; @@ -307,8 +308,8 @@ std::unique_ptr<ScatteringSimulation> test::makeSimulation::ExtraLongWavelengthGISAS(const MultiLayer& sample) { Beam beam(1e8, 13.52 * Units::nm, Direction(0.2 * deg, 0)); - SphericalDetector det(100, -1 * deg, 1 * deg, 100, 0.0, 2 * deg); - auto simulation = std::make_unique<ScatteringSimulation>(beam, sample, det); + SphericalDetector detector(100, -1 * deg, 1 * deg, 100, 0.0, 2 * deg); + auto simulation = std::make_unique<ScatteringSimulation>(beam, sample, detector); simulation->options().setIncludeSpecular(true); return simulation; } diff --git a/Tests/Unit/Sim/SpecularSimulationTest.cpp b/Tests/Unit/Sim/SpecularSimulationTest.cpp index b648c91f1da5df4b31c0b7c53c2b67b41f06d810..fc302c7b9317a50e004a74e65385a832d7ec8637 100644 --- a/Tests/Unit/Sim/SpecularSimulationTest.cpp +++ b/Tests/Unit/Sim/SpecularSimulationTest.cpp @@ -47,60 +47,6 @@ std::unique_ptr<SpecularSimulation> SpecularSimulationTest::defaultSimulation() return std::make_unique<SpecularSimulation>(scan, sample); } -TEST_F(SpecularSimulationTest, SetAngularScan) -{ - AlphaScan scan(1.0, std::vector<double>{1.0 * Units::deg, 3.0 * Units::deg}); - SpecularSimulation sim(scan, sample); - - const auto& beam = sim.beam(); - - EXPECT_EQ(2u, sim.coordinateAxis()->size()); - EXPECT_EQ(1.0 * Units::deg, sim.coordinateAxis()->min()); - EXPECT_EQ(3.0 * Units::deg, sim.coordinateAxis()->max()); - EXPECT_EQ(1.0, beam.intensity()); - EXPECT_EQ(1.0, beam.wavelength()); - EXPECT_EQ(0.0, beam.direction().alpha()); - EXPECT_EQ(0.0, beam.direction().phi()); - - AlphaScan scan2(1.0, 10, 1.0 * Units::deg, 10.0 * Units::deg); - SpecularSimulation sim2(scan2, sample); - EXPECT_EQ(10u, sim2.coordinateAxis()->size()); - EXPECT_EQ(1.0 * Units::deg, sim2.coordinateAxis()->min()); - EXPECT_EQ(10.0 * Units::deg, sim2.coordinateAxis()->max()); - EXPECT_EQ(1.0, beam.wavelength()); - EXPECT_EQ(0.0, beam.direction().alpha()); - EXPECT_EQ(0.0, beam.direction().phi()); -} - -TEST_F(SpecularSimulationTest, SetQScan) -{ - QzScan scan(std::vector<double>{1.0, 3.0}); - SpecularSimulation sim(scan, sample); - - const auto& beam = sim.beam(); - - EXPECT_EQ(2u, sim.coordinateAxis()->size()); - EXPECT_EQ(1.0, sim.coordinateAxis()->min()); - EXPECT_EQ(3.0, sim.coordinateAxis()->max()); - EXPECT_EQ(1.0, beam.intensity()); - EXPECT_EQ(1.0, beam.wavelength()); - EXPECT_EQ(0.0, beam.direction().alpha()); - EXPECT_EQ(0.0, beam.direction().phi()); - - sim.beam().setIntensity(2.0); - EXPECT_EQ(2.0, beam.intensity()); - - QzScan scan2(10, 1.0, 10.0); - SpecularSimulation sim2(scan2, sample); - EXPECT_EQ(10u, sim2.coordinateAxis()->size()); - EXPECT_EQ(1.0, sim2.coordinateAxis()->min()); - EXPECT_EQ(10.0, sim2.coordinateAxis()->max()); - EXPECT_EQ(2.0, beam.intensity()); - EXPECT_EQ(1.0, beam.wavelength()); - EXPECT_EQ(0.0, beam.direction().alpha()); - EXPECT_EQ(0.0, beam.direction().phi()); -} - TEST_F(SpecularSimulationTest, ConstructSimulation) { auto sim = defaultSimulation(); diff --git a/auto/Wrap/doxygenParam.i b/auto/Wrap/doxygenParam.i index 7a53a0675a099e33bd41b260e8488621fe678647..cb3c9a1cb91f2de890ee91955514cf4971b6a19c 100644 --- a/auto/Wrap/doxygenParam.i +++ b/auto/Wrap/doxygenParam.i @@ -213,11 +213,6 @@ get the total number of parameter value combinations (product of the individual set the parameter values of the simulation object to a specific combination of values, determined by the index (which must be smaller than the total number of combinations) and returns the weight associated with this combination of parameter values. initParameterLinks() has to be called before this! "; -%feature("docstring") DistributionHandler::setParameterToMeans "void DistributionHandler::setParameterToMeans() const - -Sets mean distribution values in all contained distributions. initParameterLinks() has to be called before this! -"; - %feature("docstring") DistributionHandler::getDistributions "const std::vector< ParameterDistribution > & DistributionHandler::getDistributions() const "; diff --git a/auto/Wrap/doxygenSim.i b/auto/Wrap/doxygenSim.i index 0b3377aa144ed9afad153790a52f8ff2183f0bed..c1a6544bf1552f9f33248cdc52dd6f8f906094ec 100644 --- a/auto/Wrap/doxygenSim.i +++ b/auto/Wrap/doxygenSim.i @@ -862,9 +862,6 @@ Simulations are run, and results returned, by the function ISimulation::simulat C++ includes: ISimulation.h "; -%feature("docstring") ISimulation::ISimulation "ISimulation::ISimulation(const Beam &beam, const MultiLayer &sample, const IDetector &detector) -"; - %feature("docstring") ISimulation::ISimulation "ISimulation::ISimulation(const MultiLayer &sample) "; @@ -904,22 +901,6 @@ Runs simulation with possible averaging over parameter distributions; returns re Initializes a progress monitor that prints to stdout. "; -%feature("docstring") ISimulation::beam "Beam& ISimulation::beam() -"; - -%feature("docstring") ISimulation::detector "IDetector& ISimulation::detector() -"; - -%feature("docstring") ISimulation::setPolarization "void ISimulation::setPolarization(R3 bloch_vector) - -Sets the polarization density matrix according to the given Bloch vector. -"; - -%feature("docstring") ISimulation::setAnalyzer "void ISimulation::setAnalyzer(R3 direction, double efficiency, double total_transmission) - -Sets the polarization analyzer characteristics of the detector. -"; - %feature("docstring") ISimulation::force_polarized "virtual bool ISimulation::force_polarized() const =0 Force polarized computation even in absence of sample magnetization or external fields. @@ -934,15 +915,6 @@ Force polarized computation even in absence of sample magnetization or external %feature("docstring") ISimulation::sample "const MultiLayer * ISimulation::sample() const "; -%feature("docstring") ISimulation::beam "const Beam& ISimulation::beam() const -"; - -%feature("docstring") ISimulation::detector "const IDetector& ISimulation::detector() const -"; - -%feature("docstring") ISimulation::getDetector "const IDetector* ISimulation::getDetector() const -"; - %feature("docstring") ISimulation::background "const IBackground* ISimulation::background() const "; @@ -982,6 +954,9 @@ C++ includes: ISimulation2D.h %feature("docstring") ISimulation2D::~ISimulation2D "ISimulation2D::~ISimulation2D() override "; +%feature("docstring") ISimulation2D::nodeChildren "std::vector< const INode * > ISimulation2D::nodeChildren() const override +"; + %feature("docstring") ISimulation2D::setDetectorParameters "void ISimulation2D::setDetectorParameters(size_t n_x, double x_min, double x_max, size_t n_y, double y_min, double y_max) Sets spherical detector parameters using angle ranges @@ -1037,6 +1012,24 @@ Sets rectangular region of interest with lower left and upper right corners defi Force polarized computation even in absence of sample magnetization or external fields. "; +%feature("docstring") ISimulation2D::beam "Beam& ISimulation2D::beam() +"; + +%feature("docstring") ISimulation2D::detector "IDetector& ISimulation2D::detector() +"; + +%feature("docstring") ISimulation2D::beam "const Beam& ISimulation2D::beam() const +"; + +%feature("docstring") ISimulation2D::detector "const IDetector& ISimulation2D::detector() const +"; + +%feature("docstring") ISimulation2D::getDetector "const IDetector* ISimulation2D::getDetector() const +"; + +%feature("docstring") ISimulation2D::detector2D "const IDetector2D & ISimulation2D::detector2D() const +"; + // File: classISpecularScan.xml %feature("docstring") ISpecularScan " @@ -1062,6 +1055,9 @@ Sets the polarization density matrix according to the given Bloch vector. Sets the polarization analyzer characteristics of the detector. "; +%feature("docstring") ISpecularScan::analyzer "const PolFilter* ISpecularScan::analyzer() const +"; + %feature("docstring") ISpecularScan::wavelength "virtual double ISpecularScan::wavelength() const =0 "; diff --git a/auto/Wrap/libBornAgainSim.py b/auto/Wrap/libBornAgainSim.py index 591783f39e44e671be74e08fd47116ea5a6df039..88fcbda622df5e3a8291baeebc378e730e476fc5 100644 --- a/auto/Wrap/libBornAgainSim.py +++ b/auto/Wrap/libBornAgainSim.py @@ -3116,6 +3116,14 @@ class ISpecularScan(libBornAgainBase.ICloneable): """ return _libBornAgainSim.ISpecularScan_setAnalyzer(self, direction, efficiency, total_transmission) + def analyzer(self): + r""" + analyzer(ISpecularScan self) -> PolFilter const * + const PolFilter* ISpecularScan::analyzer() const + + """ + return _libBornAgainSim.ISpecularScan_analyzer(self) + def wavelength(self): r""" wavelength(ISpecularScan self) -> double @@ -3468,42 +3476,6 @@ class ISimulation(libBornAgainParam.INode): """ return _libBornAgainSim.ISimulation_setTerminalProgressMonitor(self) - def beam(self): - r""" - beam(ISimulation self) -> Beam & - const Beam& ISimulation::beam() const - - """ - return _libBornAgainSim.ISimulation_beam(self) - - def detector(self): - r""" - detector(ISimulation self) -> IDetector & - const IDetector& ISimulation::detector() const - - """ - return _libBornAgainSim.ISimulation_detector(self) - - def setPolarization(self, bloch_vector): - r""" - setPolarization(ISimulation self, R3 bloch_vector) - void ISimulation::setPolarization(R3 bloch_vector) - - Sets the polarization density matrix according to the given Bloch vector. - - """ - return _libBornAgainSim.ISimulation_setPolarization(self, bloch_vector) - - def setAnalyzer(self, direction, efficiency, total_transmission): - r""" - setAnalyzer(ISimulation self, R3 direction, double efficiency, double total_transmission) - void ISimulation::setAnalyzer(R3 direction, double efficiency, double total_transmission) - - Sets the polarization analyzer characteristics of the detector. - - """ - return _libBornAgainSim.ISimulation_setAnalyzer(self, direction, efficiency, total_transmission) - def force_polarized(self): r""" force_polarized(ISimulation self) -> bool @@ -3538,6 +3510,14 @@ class ISimulation2D(ISimulation): __repr__ = _swig_repr __swig_destroy__ = _libBornAgainSim.delete_ISimulation2D + def nodeChildren(self): + r""" + nodeChildren(ISimulation2D self) -> swig_dummy_type_const_inode_vector + std::vector< const INode * > ISimulation2D::nodeChildren() const override + + """ + return _libBornAgainSim.ISimulation2D_nodeChildren(self) + def setDetectorParameters(self, n_x, x_min, x_max, n_y, y_min, y_max): r""" setDetectorParameters(ISimulation2D self, size_t n_x, double x_min, double x_max, size_t n_y, double y_min, double y_max) @@ -3618,6 +3598,22 @@ class ISimulation2D(ISimulation): """ return _libBornAgainSim.ISimulation2D_force_polarized(self) + def beam(self): + r""" + beam(ISimulation2D self) -> Beam & + const Beam& ISimulation2D::beam() const + + """ + return _libBornAgainSim.ISimulation2D_beam(self) + + def detector(self): + r""" + detector(ISimulation2D self) -> IDetector & + const IDetector& ISimulation2D::detector() const + + """ + return _libBornAgainSim.ISimulation2D_detector(self) + # Register ISimulation2D in _libBornAgainSim: _libBornAgainSim.ISimulation2D_swigregister(ISimulation2D) @@ -3666,7 +3662,7 @@ class ScatteringSimulation(ISimulation2D): # Register ScatteringSimulation in _libBornAgainSim: _libBornAgainSim.ScatteringSimulation_swigregister(ScatteringSimulation) -class DepthProbeSimulation(ISimulation): +class DepthProbeSimulation(ISimulation2D): r""" diff --git a/auto/Wrap/libBornAgainSim_wrap.cpp b/auto/Wrap/libBornAgainSim_wrap.cpp index 711dabf258859b08482809833f29fe45c78e7fc7..3d0d4b65f11bb3b14d18d2a1ff34054a3f14293a 100644 --- a/auto/Wrap/libBornAgainSim_wrap.cpp +++ b/auto/Wrap/libBornAgainSim_wrap.cpp @@ -3128,74 +3128,75 @@ namespace Swig { #define SWIGTYPE_p_OffspecSimulation swig_types[28] #define SWIGTYPE_p_ParameterDistribution swig_types[29] #define SWIGTYPE_p_PoissonBackground swig_types[30] -#define SWIGTYPE_p_PyBuilderCallback swig_types[31] -#define SWIGTYPE_p_PyObserverCallback swig_types[32] -#define SWIGTYPE_p_QzScan swig_types[33] -#define SWIGTYPE_p_RealLimits swig_types[34] -#define SWIGTYPE_p_ScanResolution swig_types[35] -#define SWIGTYPE_p_ScatteringSimulation swig_types[36] -#define SWIGTYPE_p_SimulationOptions swig_types[37] -#define SWIGTYPE_p_SimulationResult swig_types[38] -#define SWIGTYPE_p_SpecularSimulation swig_types[39] -#define SWIGTYPE_p_VarianceConstantFunction swig_types[40] -#define SWIGTYPE_p_VarianceSimFunction swig_types[41] -#define SWIGTYPE_p_Vec3T_double_t swig_types[42] -#define SWIGTYPE_p_Vec3T_int_t swig_types[43] -#define SWIGTYPE_p_Vec3T_std__complexT_double_t_t swig_types[44] -#define SWIGTYPE_p_allocator_type swig_types[45] -#define SWIGTYPE_p_char swig_types[46] -#define SWIGTYPE_p_difference_type swig_types[47] -#define SWIGTYPE_p_first_type swig_types[48] -#define SWIGTYPE_p_int swig_types[49] -#define SWIGTYPE_p_key_type swig_types[50] -#define SWIGTYPE_p_long_long swig_types[51] -#define SWIGTYPE_p_mapped_type swig_types[52] -#define SWIGTYPE_p_mumufit__MinimizerResult swig_types[53] -#define SWIGTYPE_p_mumufit__Parameters swig_types[54] -#define SWIGTYPE_p_p_PyObject swig_types[55] -#define SWIGTYPE_p_second_type swig_types[56] -#define SWIGTYPE_p_short swig_types[57] -#define SWIGTYPE_p_signed_char swig_types[58] -#define SWIGTYPE_p_size_type swig_types[59] -#define SWIGTYPE_p_std__allocatorT_AxisInfo_t swig_types[60] -#define SWIGTYPE_p_std__allocatorT_INode_const_p_t swig_types[61] -#define SWIGTYPE_p_std__allocatorT_INode_p_t swig_types[62] -#define SWIGTYPE_p_std__allocatorT_Vec3T_double_t_t swig_types[63] -#define SWIGTYPE_p_std__allocatorT_double_t swig_types[64] -#define SWIGTYPE_p_std__allocatorT_int_t swig_types[65] -#define SWIGTYPE_p_std__allocatorT_std__complexT_double_t_t swig_types[66] -#define SWIGTYPE_p_std__allocatorT_std__pairT_double_double_t_t swig_types[67] -#define SWIGTYPE_p_std__allocatorT_std__pairT_std__string_const_double_t_t swig_types[68] -#define SWIGTYPE_p_std__allocatorT_std__string_t swig_types[69] -#define SWIGTYPE_p_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t swig_types[70] -#define SWIGTYPE_p_std__allocatorT_std__vectorT_int_std__allocatorT_int_t_t_t swig_types[71] -#define SWIGTYPE_p_std__allocatorT_unsigned_long_t swig_types[72] -#define SWIGTYPE_p_std__complexT_double_t swig_types[73] -#define SWIGTYPE_p_std__invalid_argument swig_types[74] -#define SWIGTYPE_p_std__lessT_std__string_t swig_types[75] -#define SWIGTYPE_p_std__mapT_std__string_double_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_double_t_t_t swig_types[76] -#define SWIGTYPE_p_std__pairT_double_double_t swig_types[77] -#define SWIGTYPE_p_std__vectorT_AxisInfo_std__allocatorT_AxisInfo_t_t swig_types[78] -#define SWIGTYPE_p_std__vectorT_INode_const_p_std__allocatorT_INode_const_p_t_t swig_types[79] -#define SWIGTYPE_p_std__vectorT_INode_p_std__allocatorT_INode_p_t_t swig_types[80] -#define SWIGTYPE_p_std__vectorT_ParaMeta_std__allocatorT_ParaMeta_t_t swig_types[81] -#define SWIGTYPE_p_std__vectorT_Vec3T_double_t_std__allocatorT_Vec3T_double_t_t_t swig_types[82] -#define SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t swig_types[83] -#define SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t swig_types[84] -#define SWIGTYPE_p_std__vectorT_std__complexT_double_t_std__allocatorT_std__complexT_double_t_t_t swig_types[85] -#define SWIGTYPE_p_std__vectorT_std__pairT_double_double_t_std__allocatorT_std__pairT_double_double_t_t_t swig_types[86] -#define SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t swig_types[87] -#define SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t swig_types[88] -#define SWIGTYPE_p_std__vectorT_std__vectorT_int_std__allocatorT_int_t_t_std__allocatorT_std__vectorT_int_std__allocatorT_int_t_t_t_t swig_types[89] -#define SWIGTYPE_p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t swig_types[90] -#define SWIGTYPE_p_swig__SwigPyIterator swig_types[91] -#define SWIGTYPE_p_unsigned_char swig_types[92] -#define SWIGTYPE_p_unsigned_int swig_types[93] -#define SWIGTYPE_p_unsigned_long_long swig_types[94] -#define SWIGTYPE_p_unsigned_short swig_types[95] -#define SWIGTYPE_p_value_type swig_types[96] -static swig_type_info *swig_types[98]; -static swig_module_info swig_module = {swig_types, 97, 0, 0, 0, 0}; +#define SWIGTYPE_p_PolFilter swig_types[31] +#define SWIGTYPE_p_PyBuilderCallback swig_types[32] +#define SWIGTYPE_p_PyObserverCallback swig_types[33] +#define SWIGTYPE_p_QzScan swig_types[34] +#define SWIGTYPE_p_RealLimits swig_types[35] +#define SWIGTYPE_p_ScanResolution swig_types[36] +#define SWIGTYPE_p_ScatteringSimulation swig_types[37] +#define SWIGTYPE_p_SimulationOptions swig_types[38] +#define SWIGTYPE_p_SimulationResult swig_types[39] +#define SWIGTYPE_p_SpecularSimulation swig_types[40] +#define SWIGTYPE_p_VarianceConstantFunction swig_types[41] +#define SWIGTYPE_p_VarianceSimFunction swig_types[42] +#define SWIGTYPE_p_Vec3T_double_t swig_types[43] +#define SWIGTYPE_p_Vec3T_int_t swig_types[44] +#define SWIGTYPE_p_Vec3T_std__complexT_double_t_t swig_types[45] +#define SWIGTYPE_p_allocator_type swig_types[46] +#define SWIGTYPE_p_char swig_types[47] +#define SWIGTYPE_p_difference_type swig_types[48] +#define SWIGTYPE_p_first_type swig_types[49] +#define SWIGTYPE_p_int swig_types[50] +#define SWIGTYPE_p_key_type swig_types[51] +#define SWIGTYPE_p_long_long swig_types[52] +#define SWIGTYPE_p_mapped_type swig_types[53] +#define SWIGTYPE_p_mumufit__MinimizerResult swig_types[54] +#define SWIGTYPE_p_mumufit__Parameters swig_types[55] +#define SWIGTYPE_p_p_PyObject swig_types[56] +#define SWIGTYPE_p_second_type swig_types[57] +#define SWIGTYPE_p_short swig_types[58] +#define SWIGTYPE_p_signed_char swig_types[59] +#define SWIGTYPE_p_size_type swig_types[60] +#define SWIGTYPE_p_std__allocatorT_AxisInfo_t swig_types[61] +#define SWIGTYPE_p_std__allocatorT_INode_const_p_t swig_types[62] +#define SWIGTYPE_p_std__allocatorT_INode_p_t swig_types[63] +#define SWIGTYPE_p_std__allocatorT_Vec3T_double_t_t swig_types[64] +#define SWIGTYPE_p_std__allocatorT_double_t swig_types[65] +#define SWIGTYPE_p_std__allocatorT_int_t swig_types[66] +#define SWIGTYPE_p_std__allocatorT_std__complexT_double_t_t swig_types[67] +#define SWIGTYPE_p_std__allocatorT_std__pairT_double_double_t_t swig_types[68] +#define SWIGTYPE_p_std__allocatorT_std__pairT_std__string_const_double_t_t swig_types[69] +#define SWIGTYPE_p_std__allocatorT_std__string_t swig_types[70] +#define SWIGTYPE_p_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t swig_types[71] +#define SWIGTYPE_p_std__allocatorT_std__vectorT_int_std__allocatorT_int_t_t_t swig_types[72] +#define SWIGTYPE_p_std__allocatorT_unsigned_long_t swig_types[73] +#define SWIGTYPE_p_std__complexT_double_t swig_types[74] +#define SWIGTYPE_p_std__invalid_argument swig_types[75] +#define SWIGTYPE_p_std__lessT_std__string_t swig_types[76] +#define SWIGTYPE_p_std__mapT_std__string_double_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_double_t_t_t swig_types[77] +#define SWIGTYPE_p_std__pairT_double_double_t swig_types[78] +#define SWIGTYPE_p_std__vectorT_AxisInfo_std__allocatorT_AxisInfo_t_t swig_types[79] +#define SWIGTYPE_p_std__vectorT_INode_const_p_std__allocatorT_INode_const_p_t_t swig_types[80] +#define SWIGTYPE_p_std__vectorT_INode_p_std__allocatorT_INode_p_t_t swig_types[81] +#define SWIGTYPE_p_std__vectorT_ParaMeta_std__allocatorT_ParaMeta_t_t swig_types[82] +#define SWIGTYPE_p_std__vectorT_Vec3T_double_t_std__allocatorT_Vec3T_double_t_t_t swig_types[83] +#define SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t swig_types[84] +#define SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t swig_types[85] +#define SWIGTYPE_p_std__vectorT_std__complexT_double_t_std__allocatorT_std__complexT_double_t_t_t swig_types[86] +#define SWIGTYPE_p_std__vectorT_std__pairT_double_double_t_std__allocatorT_std__pairT_double_double_t_t_t swig_types[87] +#define SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t swig_types[88] +#define SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t swig_types[89] +#define SWIGTYPE_p_std__vectorT_std__vectorT_int_std__allocatorT_int_t_t_std__allocatorT_std__vectorT_int_std__allocatorT_int_t_t_t_t swig_types[90] +#define SWIGTYPE_p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t swig_types[91] +#define SWIGTYPE_p_swig__SwigPyIterator swig_types[92] +#define SWIGTYPE_p_unsigned_char swig_types[93] +#define SWIGTYPE_p_unsigned_int swig_types[94] +#define SWIGTYPE_p_unsigned_long_long swig_types[95] +#define SWIGTYPE_p_unsigned_short swig_types[96] +#define SWIGTYPE_p_value_type swig_types[97] +static swig_type_info *swig_types[99]; +static swig_module_info swig_module = {swig_types, 98, 0, 0, 0, 0}; #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) @@ -35535,6 +35536,29 @@ fail: } +SWIGINTERN PyObject *_wrap_ISpecularScan_analyzer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ISpecularScan *arg1 = (ISpecularScan *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + PolFilter *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ISpecularScan, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ISpecularScan_analyzer" "', argument " "1"" of type '" "ISpecularScan const *""'"); + } + arg1 = reinterpret_cast< ISpecularScan * >(argp1); + result = (PolFilter *)((ISpecularScan const *)arg1)->analyzer(); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PolFilter, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + SWIGINTERN PyObject *_wrap_ISpecularScan_wavelength(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; ISpecularScan *arg1 = (ISpecularScan *) 0 ; @@ -37840,142 +37864,6 @@ fail: } -SWIGINTERN PyObject *_wrap_ISimulation_beam(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - ISimulation *arg1 = (ISimulation *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - Beam *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ISimulation, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ISimulation_beam" "', argument " "1"" of type '" "ISimulation *""'"); - } - arg1 = reinterpret_cast< ISimulation * >(argp1); - result = (Beam *) &(arg1)->beam(); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Beam, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ISimulation_detector(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - ISimulation *arg1 = (ISimulation *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - IDetector *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ISimulation, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ISimulation_detector" "', argument " "1"" of type '" "ISimulation *""'"); - } - arg1 = reinterpret_cast< ISimulation * >(argp1); - result = (IDetector *) &(arg1)->detector(); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_IDetector, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ISimulation_setPolarization(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - ISimulation *arg1 = (ISimulation *) 0 ; - R3 arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "ISimulation_setPolarization", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ISimulation, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ISimulation_setPolarization" "', argument " "1"" of type '" "ISimulation *""'"); - } - arg1 = reinterpret_cast< ISimulation * >(argp1); - { - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_Vec3T_double_t, 0 | 0); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ISimulation_setPolarization" "', argument " "2"" of type '" "R3""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ISimulation_setPolarization" "', argument " "2"" of type '" "R3""'"); - } else { - R3 * temp = reinterpret_cast< R3 * >(argp2); - arg2 = *temp; - if (SWIG_IsNewObj(res2)) delete temp; - } - } - (arg1)->setPolarization(arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ISimulation_setAnalyzer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - ISimulation *arg1 = (ISimulation *) 0 ; - R3 arg2 ; - double arg3 ; - double arg4 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 ; - int res2 = 0 ; - double val3 ; - int ecode3 = 0 ; - double val4 ; - int ecode4 = 0 ; - PyObject *swig_obj[4] ; - - if (!SWIG_Python_UnpackTuple(args, "ISimulation_setAnalyzer", 4, 4, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ISimulation, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ISimulation_setAnalyzer" "', argument " "1"" of type '" "ISimulation *""'"); - } - arg1 = reinterpret_cast< ISimulation * >(argp1); - { - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_Vec3T_double_t, 0 | 0); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ISimulation_setAnalyzer" "', argument " "2"" of type '" "R3""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ISimulation_setAnalyzer" "', argument " "2"" of type '" "R3""'"); - } else { - R3 * temp = reinterpret_cast< R3 * >(argp2); - arg2 = *temp; - if (SWIG_IsNewObj(res2)) delete temp; - } - } - ecode3 = SWIG_AsVal_double(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "ISimulation_setAnalyzer" "', argument " "3"" of type '" "double""'"); - } - arg3 = static_cast< double >(val3); - ecode4 = SWIG_AsVal_double(swig_obj[3], &val4); - if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "ISimulation_setAnalyzer" "', argument " "4"" of type '" "double""'"); - } - arg4 = static_cast< double >(val4); - (arg1)->setAnalyzer(arg2,arg3,arg4); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - SWIGINTERN PyObject *_wrap_ISimulation_force_polarized(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; ISimulation *arg1 = (ISimulation *) 0 ; @@ -38028,6 +37916,29 @@ fail: } +SWIGINTERN PyObject *_wrap_ISimulation2D_nodeChildren(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ISimulation2D *arg1 = (ISimulation2D *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + std::vector< INode const *,std::allocator< INode const * > > result; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ISimulation2D, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ISimulation2D_nodeChildren" "', argument " "1"" of type '" "ISimulation2D const *""'"); + } + arg1 = reinterpret_cast< ISimulation2D * >(argp1); + result = ((ISimulation2D const *)arg1)->nodeChildren(); + resultobj = swig::from(static_cast< std::vector< INode const*,std::allocator< INode const * > > >(result)); + return resultobj; +fail: + return NULL; +} + + SWIGINTERN PyObject *_wrap_ISimulation2D_setDetectorParameters(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; ISimulation2D *arg1 = (ISimulation2D *) 0 ; @@ -38315,6 +38226,52 @@ fail: } +SWIGINTERN PyObject *_wrap_ISimulation2D_beam(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ISimulation2D *arg1 = (ISimulation2D *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + Beam *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ISimulation2D, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ISimulation2D_beam" "', argument " "1"" of type '" "ISimulation2D *""'"); + } + arg1 = reinterpret_cast< ISimulation2D * >(argp1); + result = (Beam *) &(arg1)->beam(); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Beam, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ISimulation2D_detector(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ISimulation2D *arg1 = (ISimulation2D *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject *swig_obj[1] ; + IDetector *result = 0 ; + + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ISimulation2D, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ISimulation2D_detector" "', argument " "1"" of type '" "ISimulation2D *""'"); + } + arg1 = reinterpret_cast< ISimulation2D * >(argp1); + result = (IDetector *) &(arg1)->detector(); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_IDetector, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + SWIGINTERN PyObject *ISimulation2D_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL; @@ -42061,6 +42018,11 @@ static PyMethodDef SwigMethods[] = { "Sets the polarization analyzer characteristics of the detector. \n" "\n" ""}, + { "ISpecularScan_analyzer", _wrap_ISpecularScan_analyzer, METH_O, "\n" + "ISpecularScan_analyzer(ISpecularScan self) -> PolFilter const *\n" + "const PolFilter* ISpecularScan::analyzer() const\n" + "\n" + ""}, { "ISpecularScan_wavelength", _wrap_ISpecularScan_wavelength, METH_O, "\n" "ISpecularScan_wavelength(ISpecularScan self) -> double\n" "virtual double ISpecularScan::wavelength() const =0\n" @@ -42262,30 +42224,6 @@ static PyMethodDef SwigMethods[] = { "Initializes a progress monitor that prints to stdout. \n" "\n" ""}, - { "ISimulation_beam", _wrap_ISimulation_beam, METH_O, "\n" - "ISimulation_beam(ISimulation self) -> Beam &\n" - "const Beam& ISimulation::beam() const\n" - "\n" - ""}, - { "ISimulation_detector", _wrap_ISimulation_detector, METH_O, "\n" - "ISimulation_detector(ISimulation self) -> IDetector &\n" - "const IDetector& ISimulation::detector() const\n" - "\n" - ""}, - { "ISimulation_setPolarization", _wrap_ISimulation_setPolarization, METH_VARARGS, "\n" - "ISimulation_setPolarization(ISimulation self, R3 bloch_vector)\n" - "void ISimulation::setPolarization(R3 bloch_vector)\n" - "\n" - "Sets the polarization density matrix according to the given Bloch vector. \n" - "\n" - ""}, - { "ISimulation_setAnalyzer", _wrap_ISimulation_setAnalyzer, METH_VARARGS, "\n" - "ISimulation_setAnalyzer(ISimulation self, R3 direction, double efficiency, double total_transmission)\n" - "void ISimulation::setAnalyzer(R3 direction, double efficiency, double total_transmission)\n" - "\n" - "Sets the polarization analyzer characteristics of the detector. \n" - "\n" - ""}, { "ISimulation_force_polarized", _wrap_ISimulation_force_polarized, METH_O, "\n" "ISimulation_force_polarized(ISimulation self) -> bool\n" "virtual bool ISimulation::force_polarized() const =0\n" @@ -42299,6 +42237,11 @@ static PyMethodDef SwigMethods[] = { "ISimulation2D::~ISimulation2D() override\n" "\n" ""}, + { "ISimulation2D_nodeChildren", _wrap_ISimulation2D_nodeChildren, METH_O, "\n" + "ISimulation2D_nodeChildren(ISimulation2D self) -> swig_dummy_type_const_inode_vector\n" + "std::vector< const INode * > ISimulation2D::nodeChildren() const override\n" + "\n" + ""}, { "ISimulation2D_setDetectorParameters", _wrap_ISimulation2D_setDetectorParameters, METH_VARARGS, "\n" "ISimulation2D_setDetectorParameters(ISimulation2D self, size_t n_x, double x_min, double x_max, size_t n_y, double y_min, double y_max)\n" "void ISimulation2D::setDetectorParameters(size_t n_x, double x_min, double x_max, size_t n_y, double y_min, double y_max)\n" @@ -42364,6 +42307,16 @@ static PyMethodDef SwigMethods[] = { "Force polarized computation even in absence of sample magnetization or external fields. \n" "\n" ""}, + { "ISimulation2D_beam", _wrap_ISimulation2D_beam, METH_O, "\n" + "ISimulation2D_beam(ISimulation2D self) -> Beam &\n" + "const Beam& ISimulation2D::beam() const\n" + "\n" + ""}, + { "ISimulation2D_detector", _wrap_ISimulation2D_detector, METH_O, "\n" + "ISimulation2D_detector(ISimulation2D self) -> IDetector &\n" + "const IDetector& ISimulation2D::detector() const\n" + "\n" + ""}, { "ISimulation2D_swigregister", ISimulation2D_swigregister, METH_O, NULL}, { "new_ScatteringSimulation", _wrap_new_ScatteringSimulation, METH_VARARGS, "\n" "new_ScatteringSimulation(Beam const & beam, MultiLayer const & sample, IDetector2D const & detector) -> ScatteringSimulation\n" @@ -42834,7 +42787,7 @@ static void *_p_ScatteringSimulationTo_p_ISimulation(void *x, int *SWIGUNUSEDPAR return (void *)((ISimulation *) (ISimulation2D *) ((ScatteringSimulation *) x)); } static void *_p_DepthProbeSimulationTo_p_ISimulation(void *x, int *SWIGUNUSEDPARM(newmemory)) { - return (void *)((ISimulation *) ((DepthProbeSimulation *) x)); + return (void *)((ISimulation *) (ISimulation2D *) ((DepthProbeSimulation *) x)); } static void *_p_SpecularSimulationTo_p_ISimulation(void *x, int *SWIGUNUSEDPARM(newmemory)) { return (void *)((ISimulation *) ((SpecularSimulation *) x)); @@ -42870,7 +42823,7 @@ static void *_p_ScatteringSimulationTo_p_INode(void *x, int *SWIGUNUSEDPARM(newm return (void *)((INode *) (ISimulation *)(ISimulation2D *) ((ScatteringSimulation *) x)); } static void *_p_DepthProbeSimulationTo_p_INode(void *x, int *SWIGUNUSEDPARM(newmemory)) { - return (void *)((INode *) (ISimulation *) ((DepthProbeSimulation *) x)); + return (void *)((INode *) (ISimulation *)(ISimulation2D *) ((DepthProbeSimulation *) x)); } static void *_p_SpecularSimulationTo_p_INode(void *x, int *SWIGUNUSEDPARM(newmemory)) { return (void *)((INode *) (ISimulation *) ((SpecularSimulation *) x)); @@ -42893,6 +42846,9 @@ static void *_p_ISampleNodeTo_p_INode(void *x, int *SWIGUNUSEDPARM(newmemory)) { static void *_p_ScatteringSimulationTo_p_ISimulation2D(void *x, int *SWIGUNUSEDPARM(newmemory)) { return (void *)((ISimulation2D *) ((ScatteringSimulation *) x)); } +static void *_p_DepthProbeSimulationTo_p_ISimulation2D(void *x, int *SWIGUNUSEDPARM(newmemory)) { + return (void *)((ISimulation2D *) ((DepthProbeSimulation *) x)); +} static void *_p_OffspecSimulationTo_p_ISimulation2D(void *x, int *SWIGUNUSEDPARM(newmemory)) { return (void *)((ISimulation2D *) ((OffspecSimulation *) x)); } @@ -42957,6 +42913,7 @@ static swig_type_info _swigt__p_MultiLayer = {"_p_MultiLayer", "MultiLayer *", 0 static swig_type_info _swigt__p_OffspecSimulation = {"_p_OffspecSimulation", "OffspecSimulation *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_ParameterDistribution = {"_p_ParameterDistribution", "ParameterDistribution *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_PoissonBackground = {"_p_PoissonBackground", "PoissonBackground *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_PolFilter = {"_p_PolFilter", "PolFilter *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_PyBuilderCallback = {"_p_PyBuilderCallback", "PyBuilderCallback *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_PyObserverCallback = {"_p_PyObserverCallback", "PyObserverCallback *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_QzScan = {"_p_QzScan", "QzScan *", 0, 0, (void*)0, 0}; @@ -43056,6 +43013,7 @@ static swig_type_info *swig_type_initial[] = { &_swigt__p_OffspecSimulation, &_swigt__p_ParameterDistribution, &_swigt__p_PoissonBackground, + &_swigt__p_PolFilter, &_swigt__p_PyBuilderCallback, &_swigt__p_PyObserverCallback, &_swigt__p_QzScan, @@ -43141,11 +43099,11 @@ static swig_cast_info _swigc__p_IDetector2D[] = { {&_swigt__p_IDetector2D, 0, 0 static swig_cast_info _swigc__p_IDistribution1D[] = { {&_swigt__p_IDistribution1D, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_IFootprintFactor[] = { {&_swigt__p_IFootprintFactor, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_IIntensityFunction[] = { {&_swigt__p_IntensityFunctionSqrt, _p_IntensityFunctionSqrtTo_p_IIntensityFunction, 0, 0}, {&_swigt__p_IIntensityFunction, 0, 0, 0}, {&_swigt__p_IntensityFunctionLog, _p_IntensityFunctionLogTo_p_IIntensityFunction, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_INode[] = { {&_swigt__p_INode, 0, 0, 0}, {&_swigt__p_ISimulation2D, _p_ISimulation2DTo_p_INode, 0, 0}, {&_swigt__p_ScatteringSimulation, _p_ScatteringSimulationTo_p_INode, 0, 0}, {&_swigt__p_OffspecSimulation, _p_OffspecSimulationTo_p_INode, 0, 0}, {&_swigt__p_ISimulation, _p_ISimulationTo_p_INode, 0, 0}, {&_swigt__p_DepthProbeSimulation, _p_DepthProbeSimulationTo_p_INode, 0, 0}, {&_swigt__p_SpecularSimulation, _p_SpecularSimulationTo_p_INode, 0, 0}, {&_swigt__p_IBackground, _p_IBackgroundTo_p_INode, 0, 0}, {&_swigt__p_ConstantBackground, _p_ConstantBackgroundTo_p_INode, 0, 0}, {&_swigt__p_PoissonBackground, _p_PoissonBackgroundTo_p_INode, 0, 0}, {&_swigt__p_ISampleNode, _p_ISampleNodeTo_p_INode, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_INode[] = { {&_swigt__p_INode, 0, 0, 0}, {&_swigt__p_ISimulation2D, _p_ISimulation2DTo_p_INode, 0, 0}, {&_swigt__p_ScatteringSimulation, _p_ScatteringSimulationTo_p_INode, 0, 0}, {&_swigt__p_DepthProbeSimulation, _p_DepthProbeSimulationTo_p_INode, 0, 0}, {&_swigt__p_OffspecSimulation, _p_OffspecSimulationTo_p_INode, 0, 0}, {&_swigt__p_ISimulation, _p_ISimulationTo_p_INode, 0, 0}, {&_swigt__p_SpecularSimulation, _p_SpecularSimulationTo_p_INode, 0, 0}, {&_swigt__p_IBackground, _p_IBackgroundTo_p_INode, 0, 0}, {&_swigt__p_ConstantBackground, _p_ConstantBackgroundTo_p_INode, 0, 0}, {&_swigt__p_PoissonBackground, _p_PoissonBackgroundTo_p_INode, 0, 0}, {&_swigt__p_ISampleNode, _p_ISampleNodeTo_p_INode, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_IRangedDistribution[] = { {&_swigt__p_IRangedDistribution, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_IShape2D[] = { {&_swigt__p_IShape2D, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_ISimulation[] = { {&_swigt__p_ISimulation2D, _p_ISimulation2DTo_p_ISimulation, 0, 0}, {&_swigt__p_ISimulation, 0, 0, 0}, {&_swigt__p_ScatteringSimulation, _p_ScatteringSimulationTo_p_ISimulation, 0, 0}, {&_swigt__p_OffspecSimulation, _p_OffspecSimulationTo_p_ISimulation, 0, 0}, {&_swigt__p_DepthProbeSimulation, _p_DepthProbeSimulationTo_p_ISimulation, 0, 0}, {&_swigt__p_SpecularSimulation, _p_SpecularSimulationTo_p_ISimulation, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_ISimulation2D[] = { {&_swigt__p_ISimulation2D, 0, 0, 0}, {&_swigt__p_ScatteringSimulation, _p_ScatteringSimulationTo_p_ISimulation2D, 0, 0}, {&_swigt__p_OffspecSimulation, _p_OffspecSimulationTo_p_ISimulation2D, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_ISimulation[] = { {&_swigt__p_ISimulation2D, _p_ISimulation2DTo_p_ISimulation, 0, 0}, {&_swigt__p_ISimulation, 0, 0, 0}, {&_swigt__p_ScatteringSimulation, _p_ScatteringSimulationTo_p_ISimulation, 0, 0}, {&_swigt__p_DepthProbeSimulation, _p_DepthProbeSimulationTo_p_ISimulation, 0, 0}, {&_swigt__p_OffspecSimulation, _p_OffspecSimulationTo_p_ISimulation, 0, 0}, {&_swigt__p_SpecularSimulation, _p_SpecularSimulationTo_p_ISimulation, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_ISimulation2D[] = { {&_swigt__p_ISimulation2D, 0, 0, 0}, {&_swigt__p_ScatteringSimulation, _p_ScatteringSimulationTo_p_ISimulation2D, 0, 0}, {&_swigt__p_DepthProbeSimulation, _p_DepthProbeSimulationTo_p_ISimulation2D, 0, 0}, {&_swigt__p_OffspecSimulation, _p_OffspecSimulationTo_p_ISimulation2D, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_ISpecularScan[] = { {&_swigt__p_QzScan, _p_QzScanTo_p_ISpecularScan, 0, 0}, {&_swigt__p_AlphaScan, _p_AlphaScanTo_p_ISpecularScan, 0, 0}, {&_swigt__p_ISpecularScan, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_IVarianceFunction[] = { {&_swigt__p_IVarianceFunction, 0, 0, 0}, {&_swigt__p_VarianceConstantFunction, _p_VarianceConstantFunctionTo_p_IVarianceFunction, 0, 0}, {&_swigt__p_VarianceSimFunction, _p_VarianceSimFunctionTo_p_IVarianceFunction, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_IntensityFunctionLog[] = { {&_swigt__p_IntensityFunctionLog, 0, 0, 0},{0, 0, 0, 0}}; @@ -43155,6 +43113,7 @@ static swig_cast_info _swigc__p_MultiLayer[] = { {&_swigt__p_MultiLayer, 0, 0, static swig_cast_info _swigc__p_OffspecSimulation[] = { {&_swigt__p_OffspecSimulation, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_ParameterDistribution[] = { {&_swigt__p_ParameterDistribution, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_PoissonBackground[] = { {&_swigt__p_PoissonBackground, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_PolFilter[] = { {&_swigt__p_PolFilter, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_PyBuilderCallback[] = { {&_swigt__p_PyBuilderCallback, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_PyObserverCallback[] = { {&_swigt__p_PyObserverCallback, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_QzScan[] = { {&_swigt__p_QzScan, 0, 0, 0},{0, 0, 0, 0}}; @@ -43254,6 +43213,7 @@ static swig_cast_info *swig_cast_initial[] = { _swigc__p_OffspecSimulation, _swigc__p_ParameterDistribution, _swigc__p_PoissonBackground, + _swigc__p_PolFilter, _swigc__p_PyBuilderCallback, _swigc__p_PyObserverCallback, _swigc__p_QzScan,