30 const std::vector<Slice>& slices,
34 bool CheckRegions(
const std::vector<HomogeneousRegion>& regions);
37 const std::map<
size_t, std::vector<HomogeneousRegion>>& region_map);
41 : m_slices{}, m_top_z{0.0}, m_polarized{false}, m_crossCorrLength{sample.crossCorrLength()},
42 m_ext_field{sample.externalField()}
91 throw std::runtime_error(
"ProcessedSample::bottomRoughness: "
92 "index out of bounds.");
93 return m_slices[i + 1].topRoughness();
111 for (
size_t j = 1; j <= i; ++j)
124 if (slice.topRoughness())
138 if (!rough_j || !rough_k)
140 double sigma_j = rough_j->
getSigma();
141 double sigma_k = rough_k->
getSigma();
142 if (sigma_j <= 0 || sigma_k <= 0)
159 auto p_layer = sample.
layer(i);
160 auto n_slices = p_layer->numberOfSlices();
161 const ZLimits& slice_limits = layer_limits[i];
162 double tl = p_layer->thickness();
163 const Material* p_material = p_layer->material();
165 if (p_roughness && p_roughness->getSigma() <= 0)
166 p_roughness =
nullptr;
171 addSlice(tl, *p_material, p_roughness);
179 throw std::runtime_error(
"ProcessedSample::ProcessedSample: "
180 "top limit for top layer must be > 0.");
191 addSlice(-top, *p_material, p_roughness);
215 auto p_layer = sample.
layer(i);
216 for (
auto p_layout : p_layer->layouts()) {
227 m_slices.emplace_back(thickness, material, *p_roughness);
229 m_slices.emplace_back(thickness, material);
236 if (thickness <= 0.0)
239 throw std::runtime_error(
"ProcessedSample::addNSlices: number of slices should be "
240 "bigger than zero.");
241 double slice_thickness = thickness / n;
242 addSlice(slice_thickness, material, p_roughness);
243 for (
size_t i = 1; i < n; ++i) {
244 addSlice(slice_thickness, material);
252 double m_z0 =
m_slices[0].material().magnetization().z();
254 for (
size_t i = 0; i <
m_slices.size(); ++i) {
260 const std::map<
size_t, std::vector<HomogeneousRegion>>& region_map)
262 for (
auto& entry : region_map) {
263 size_t i = entry.first;
264 auto& regions = entry.second;
281 const std::vector<Slice>& slices,
284 std::unique_ptr<IFresnelMap> P_result;
291 P_result->disableCaching();
298 if (mat->isMagneticMaterial())
305 for (
size_t i = 0; i < slices.size(); ++i) {
306 if (slices[i].material().isMagneticMaterial())
314 double total_fraction = 0.0;
315 for (
auto& region : regions)
316 total_fraction += region.m_volume;
317 return (total_fraction >= 0 && total_fraction <= 1);
322 const std::map<
size_t, std::vector<HomogeneousRegion>>& region_map)
324 std::vector<Slice> result = slices;
325 auto last_slice_index = slices.size() - 1;
326 for (
auto& entry : region_map) {
327 auto i_slice = entry.first;
328 if (i_slice == 0 || i_slice == last_slice_index)
330 auto slice_mat = slices[i_slice].material();
332 throw std::runtime_error(
"CreateAverageMaterialSlices: "
333 "total volumetric fraction of particles exceeds 1!");
335 result[i_slice].setMaterial(new_material);
Defines struct HomogeneousRegion, and declares fct createAveragedMaterial.
Defines class LayerRoughness.
Defines class MatrixFresnelMap.
Defines helper functions for MultiLayer objects.
Defines class ProcessedLayout.
Defines class ProcessedSample.
Defines class ScalarFresnelMap.
Defines class SimulationOptions.
Defines class SpecularStrategyBuilder.
T z() const
Returns z-component in cartesian coordinate system.
Holds the necessary information to calculate the radiation wavefunction in every layer for different ...
std::vector< const Material * > containedMaterials() const
Returns set of unique materials contained in this ISample.
A roughness of interface between two layers.
double getSigma() const
Returns rms of roughness.
double getSpectralFun(const kvector_t kvec) const
Returns power spectral density of the surface roughness.
A wrapper for underlying material implementation.
Our sample model: a stack of layers one below the other.
const Layer * layer(size_t i_layer) const
Returns layer with given index.
size_t numberOfLayers() const
void initLayouts(const MultiLayer &sample)
const std::vector< Slice > & slices() const
std::vector< Slice > m_slices
std::map< size_t, std::vector< HomogeneousRegion > > m_region_map
ProcessedSample(const MultiLayer &sample, const SimulationOptions &options)
void initSlices(const MultiLayer &sample, const SimulationOptions &options)
bool hasRoughness() const
double sliceTopZ(size_t i) const
kvector_t externalField() const
void addSlice(double thickness, const Material &material, const LayerRoughness *p_roughness=nullptr)
void addNSlices(size_t n, double thickness, const Material &material, const LayerRoughness *p_roughness=nullptr)
void mergeRegionMap(const std::map< size_t, std::vector< HomogeneousRegion >> ®ion_map)
double sliceBottomZ(size_t i) const
void initFresnelMap(const SimulationOptions &sim_options)
bool containsMagneticMaterial() const
std::unique_ptr< IFresnelMap > mP_fresnel_map
const IFresnelMap * fresnelMap() const
size_t numberOfSlices() const
double crossCorrSpectralFun(const kvector_t kvec, size_t j, size_t k) const
Fourier transform of the correlation function of roughnesses between the interfaces.
const std::vector< Slice > & averageSlices() const
const std::vector< ProcessedLayout > & layouts() const
double crossCorrelationLength() const
const LayerRoughness * bottomRoughness(size_t i) const
std::vector< ProcessedLayout > m_layouts
Collect the different options for simulation.
bool useAvgMaterials() const
static constexpr double Magnetic_Permeability
static std::unique_ptr< ISpecularStrategy > build(const MultiLayer &sample, const bool magnetic)
Class that contains upper and lower limits of the z-coordinate for the slicing of form factors.
OneSidedLimit lowerLimit() const
OneSidedLimit upperLimit() const
Material createAveragedMaterial(const Material &layer_mat, const std::vector< HomogeneousRegion > ®ions)
Creates averaged material.
const LayerRoughness * LayerTopRoughness(const MultiLayer &multilayer, size_t i)
Returns top roughness of layer.
std::vector< ZLimits > ParticleRegions(const MultiLayer &multilayer, bool use_slicing)
Calculate z-regions occupied by particles.
double LayerThickness(const MultiLayer &multilayer, size_t i)
Returns thickness of layer.
std::unique_ptr< IFresnelMap > CreateFresnelMap(const MultiLayer &sample, const std::vector< Slice > &slices, const SimulationOptions &options)
bool ContainsMagneticMaterial(const MultiLayer &sample)
std::vector< Slice > CreateAverageMaterialSlices(const std::vector< Slice > &slices, const std::map< size_t, std::vector< HomogeneousRegion >> ®ion_map)
bool ContainsMagneticSlice(const std::vector< Slice > &slices)
bool CheckRegions(const std::vector< HomogeneousRegion > ®ions)