27 MultiLayer::MultiLayer() : m_crossCorrLength(0)
29 setName(
"MultiLayer");
30 registerParameter(
"CrossCorrelationLength", &m_crossCorrLength).setUnit(
"nm").setNonnegative();
31 registerVector(
"ExternalField", &m_ext_field,
"");
34 MultiLayer::~MultiLayer() =
default;
41 ret->setRoughnessModel(roughnessModel());
42 for (
size_t i = 0; i < numberOfLayers(); ++i) {
43 const auto*
interface = i > 0 ? m_interfaces[i - 1] : nullptr;
45 if (i > 0 && interface->getRoughness())
64 if (numberOfLayers()) {
66 const Layer* last_layer = m_layers.back();
72 addAndRegisterInterface(interface);
75 if (new_layer->thickness() != 0.0)
76 throw std::runtime_error(
77 "Invalid call to MultiLayer::addLayer(): the semi-infinite top layer "
78 "must have a pro forma thickness of 0");
81 throw std::runtime_error(
82 "Invalid call to MultiLayer::addLayer(): the semi-infinite top layer "
83 "cannot have roughness.");
85 addAndRegisterLayer(new_layer);
90 return m_layers[check_layer_index(i_layer)];
95 return m_interfaces[check_interface_index(i_interface)];
107 m_ext_field = ext_field;
110 void MultiLayer::setRoughnessModel(RoughnessModel roughnessModel)
112 m_roughness_model = roughnessModel;
117 std::vector<const INode*> ret;
118 const size_t N = m_layers.size();
119 ret.reserve(N + m_interfaces.size());
121 for (
size_t i = 0; i < N; ++i) {
122 ret.push_back(m_layers[i]);
123 const LayerInterface*
interface = MultiLayerUtils::LayerBottomInterface(*
this, i);
125 ret.push_back(interface);
130 void MultiLayer::addAndRegisterLayer(
Layer* child)
132 m_layers.push_back(child);
133 handleLayerThicknessRegistration();
134 registerChild(child);
139 m_interfaces.push_back(child);
140 registerChild(child);
143 void MultiLayer::handleLayerThicknessRegistration()
145 size_t n_layers = numberOfLayers();
146 for (
size_t i = 0; i < numberOfLayers(); ++i)
147 m_layers[i]->registerThickness(i > 0 && i < n_layers - 1);
150 size_t MultiLayer::check_layer_index(
size_t i_layer)
const
152 if (i_layer >= m_layers.size())
157 size_t MultiLayer::check_interface_index(
size_t i_interface)
const
159 if (i_interface >= m_interfaces.size())
Defines many exception classes in namespace Exceptionss.
Defines and implements interface class ILayout.
Defines class LayerFillLimits.
Defines class LayerInterface.
Defines class LayerRoughness.
Declares functions in namespace MaterialUtils.
Defines helper functions for MultiLayer objects.
Defines class MultiLayer.
Defines class ParameterPool.
Defines class RealParameter.
Interface between two layers, possibly with roughness.
static LayerInterface * createRoughInterface(const Layer *top_layer, const Layer *bottom_layer, const LayerRoughness &roughness)
Creates rough interface between two layers.
static LayerInterface * createSmoothInterface(const Layer *top_layer, const Layer *bottom_layer)
Creates smooth interface between two layers.
A roughness of interface between two layers.
double getSigma() const
Returns rms of roughness.
A layer, with thickness (in nanometer) and material.
Layer * clone() const override final
Returns a clone of this ISample object.
Our sample model: a stack of layers one below the other.
const LayerInterface * layerInterface(size_t i_interface) const
Returns interface with given index.
const Layer * layer(size_t i_layer) const
Returns layer with given index.
MultiLayer * clone() const final override
Returns a clone of multilayer with clones of all layers and interfaces between layers.
kvector_t externalField() const
Returns the external field applied to the multilayer (units: A/m)
std::vector< const INode * > getChildren() const final override
Returns a vector of children (const).
void setExternalField(kvector_t ext_field)
Sets the external field applied to the multilayer (units: A/m)
void setCrossCorrLength(double crossCorrLength)
Sets cross correlation length of roughnesses between interfaces.
void addLayer(const Layer &layer)
Adds object to multilayer.
void addLayerWithTopRoughness(const Layer &layer, const LayerRoughness &roughness)
Adds layer with top roughness.
double crossCorrLength() const
Returns cross correlation length of roughnesses between interfaces.