Skip to content
Snippets Groups Projects
Commit bc5fd1ff authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

Fluxes: class, not 'using'

parent 5a38c232
No related branches found
No related tags found
1 merge request!1017consequential use of OwningVector
Pipeline #74698 canceled
...@@ -61,12 +61,12 @@ void DiffuseElement::setFluxes(const Fluxes* fluxes_in, const Fluxes* fluxes_out ...@@ -61,12 +61,12 @@ void DiffuseElement::setFluxes(const Fluxes* fluxes_in, const Fluxes* fluxes_out
const IFlux* DiffuseElement::fluxIn(size_t i_layer) const const IFlux* DiffuseElement::fluxIn(size_t i_layer) const
{ {
return (*m_fluxes_in)[i_layer].get(); return (*m_fluxes_in)[i_layer];
} }
const IFlux* DiffuseElement::fluxOut(size_t i_layer) const const IFlux* DiffuseElement::fluxOut(size_t i_layer) const
{ {
return (*m_fluxes_out)[i_layer].get(); return (*m_fluxes_out)[i_layer];
} }
DiffuseElement DiffuseElement::pointElement(double x, double y) const DiffuseElement DiffuseElement::pointElement(double x, double y) const
......
...@@ -25,12 +25,11 @@ ...@@ -25,12 +25,11 @@
#include <memory> #include <memory>
#include <vector> #include <vector>
class Fluxes;
class IFlux; class IFlux;
class IPixel; class IPixel;
class WavevectorInfo; class WavevectorInfo;
using Fluxes = std::vector<std::unique_ptr<const IFlux>>;
//! Data stucture containing both input and output of a single detector cell. //! Data stucture containing both input and output of a single detector cell.
//! @ingroup simulation //! @ingroup simulation
......
...@@ -21,8 +21,7 @@ ...@@ -21,8 +21,7 @@
#define BORNAGAIN_RESAMPLE_FLUX_IFLUX_H #define BORNAGAIN_RESAMPLE_FLUX_IFLUX_H
#include "Base/Spin/Spinor.h" #include "Base/Spin/Spinor.h"
#include <memory> #include "Base/Types/OwningVector.h"
#include <vector>
//! Interface to access reflection/transmission coefficients. //! Interface to access reflection/transmission coefficients.
//! Realized by ScalarFlux and MatrixFlux. //! Realized by ScalarFlux and MatrixFlux.
...@@ -45,5 +44,7 @@ public: ...@@ -45,5 +44,7 @@ public:
virtual Spinor getKz() const = 0; virtual Spinor getKz() const = 0;
}; };
class Fluxes : public OwningVector<IFlux> {};
#endif // BORNAGAIN_RESAMPLE_FLUX_IFLUX_H #endif // BORNAGAIN_RESAMPLE_FLUX_IFLUX_H
#endif // USER_API #endif // USER_API
...@@ -25,14 +25,12 @@ ...@@ -25,14 +25,12 @@
#include <memory> #include <memory>
#include <vector> #include <vector>
class IFlux; class Fluxes;
class Material; class Material;
class MultiLayer; class MultiLayer;
class reLayout; class reLayout;
class SimulationOptions; class SimulationOptions;
using Fluxes = std::vector<std::unique_ptr<const IFlux>>;
//! Data structure that contains all the necessary data for scattering calculations. //! Data structure that contains all the necessary data for scattering calculations.
//! //!
//! If the usage of average materials is requested, layers and particles are sliced into multiple //! If the usage of average materials is requested, layers and particles are sliced into multiple
......
...@@ -183,7 +183,7 @@ Fluxes Compute::SpecularMagnetic::fluxes(const SliceStack& slices, const R3& k, ...@@ -183,7 +183,7 @@ Fluxes Compute::SpecularMagnetic::fluxes(const SliceStack& slices, const R3& k,
Fluxes result; Fluxes result;
for (auto& coeff : computeFlux(slices, kz, slices.roughnessModel(), forward)) for (auto& coeff : computeFlux(slices, kz, slices.roughnessModel(), forward))
result.emplace_back(std::make_unique<const MatrixFlux>(coeff)); result.emplace_back(new MatrixFlux(coeff));
return result; return result;
} }
......
...@@ -21,15 +21,12 @@ ...@@ -21,15 +21,12 @@
#define BORNAGAIN_RESAMPLE_SPECULAR_COMPUTEFLUXMAGNETIC_H #define BORNAGAIN_RESAMPLE_SPECULAR_COMPUTEFLUXMAGNETIC_H
#include "Base/Spin/SpinMatrix.h" #include "Base/Spin/SpinMatrix.h"
#include "Sample/Multilayer/RoughnessModels.h"
#include <heinz/Complex.h> #include <heinz/Complex.h>
#include <heinz/Vectors3D.h> #include <heinz/Vectors3D.h>
#include <memory>
#include <vector> #include <vector>
class IFlux; class Fluxes;
class SliceStack; class SliceStack;
using Fluxes = std::vector<std::unique_ptr<const IFlux>>;
//! Methods to compute polarized propagation directions and fluxes as function of slice. //! Methods to compute polarized propagation directions and fluxes as function of slice.
//! //!
......
...@@ -129,7 +129,7 @@ Fluxes Compute::SpecularScalar::fluxes(const SliceStack& slices, const R3& k) ...@@ -129,7 +129,7 @@ Fluxes Compute::SpecularScalar::fluxes(const SliceStack& slices, const R3& k)
Fluxes result; Fluxes result;
for (size_t i = 0; i < kz.size(); ++i) for (size_t i = 0; i < kz.size(); ++i)
result.emplace_back(std::make_unique<const ScalarFlux>(kz[i], TR[i])); result.emplace_back(new ScalarFlux(kz[i], TR[i]));
return result; return result;
} }
......
...@@ -23,12 +23,10 @@ ...@@ -23,12 +23,10 @@
#include "Sample/Multilayer/RoughnessModels.h" #include "Sample/Multilayer/RoughnessModels.h"
#include <heinz/Complex.h> #include <heinz/Complex.h>
#include <heinz/Vectors3D.h> #include <heinz/Vectors3D.h>
#include <memory>
#include <vector> #include <vector>
class IFlux; class Fluxes;
class SliceStack; class SliceStack;
using Fluxes = std::vector<std::unique_ptr<const IFlux>>;
//! Methods to compute scalar propagation directions and fluxes as function of slice. //! Methods to compute scalar propagation directions and fluxes as function of slice.
......
...@@ -55,7 +55,7 @@ void DepthProbeComputation::runProtected() ...@@ -55,7 +55,7 @@ void DepthProbeComputation::runProtected()
z_layer_top = i_layer ? m_re_sample.sliceTopZ(i_layer) : 0; z_layer_top = i_layer ? m_re_sample.sliceTopZ(i_layer) : 0;
// get R & T coefficients for current layer // get R & T coefficients for current layer
const auto* flux = dynamic_cast<const ScalarFlux*>(fluxes[i_layer].get()); const auto* flux = dynamic_cast<const ScalarFlux*>(fluxes[i_layer]);
ASSERT(flux); ASSERT(flux);
const complex_t R = flux->getScalarR(); const complex_t R = flux->getScalarR();
const complex_t T = flux->getScalarT(); const complex_t T = flux->getScalarT();
......
...@@ -33,7 +33,7 @@ protected: ...@@ -33,7 +33,7 @@ protected:
{ {
std::vector<ScalarFlux> result; std::vector<ScalarFlux> result;
for (auto& flux : fluxes) for (auto& flux : fluxes)
result.push_back(*dynamic_cast<const ScalarFlux*>(flux.get())); result.push_back(*dynamic_cast<const ScalarFlux*>(flux));
return result; return result;
} }
const Material air = RefractiveMaterial("Air", 1e-8, 1e-8); const Material air = RefractiveMaterial("Air", 1e-8, 1e-8);
......
...@@ -130,6 +130,10 @@ Tells if simulation element corresponds to a specular peak. ...@@ -130,6 +130,10 @@ Tells if simulation element corresponds to a specular peak.
"; ";
// File: classFluxes.xml
%feature("docstring") Fluxes "";
// File: classIFlux.xml // File: classIFlux.xml
%feature("docstring") IFlux " %feature("docstring") IFlux "
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment