Skip to content
Snippets Groups Projects
Commit 66e3dc70 authored by Mikhail Svechnikov's avatar Mikhail Svechnikov
Browse files

rm top and bottom layers from interface class

parent 3f6510be
No related branches found
No related tags found
1 merge request!2729Move roughness from LayerInterface to Layer (#20)
......@@ -16,14 +16,9 @@
#include "Base/Util/Assert.h"
#include "Sample/Interface/LayerRoughness.h"
LayerInterface::LayerInterface(const Layer* top_layer, const Layer* bottom_layer,
const LayerRoughness* layerRoughness)
: m_top_layer(top_layer)
, m_bottom_layer(bottom_layer)
, m_roughness(layerRoughness)
LayerInterface::LayerInterface(const LayerRoughness* layerRoughness)
: m_roughness(layerRoughness)
{
ASSERT(top_layer);
ASSERT(bottom_layer);
ASSERT(layerRoughness);
}
......
......@@ -28,8 +28,7 @@ class LayerRoughness;
class LayerInterface : public ISampleNode {
public:
LayerInterface(const Layer* top_layer, const Layer* bottom_layer,
const LayerRoughness* layerRoughness);
LayerInterface(const LayerRoughness* layerRoughness);
~LayerInterface() override;
LayerInterface* clone() const override;
......@@ -38,17 +37,11 @@ public:
//! Returns roughness of the interface.
const LayerRoughness* roughness() const;
const Layer* topLayer() const;
const Layer* bottomLayer() const;
std::vector<const INode*> nodeChildren() const override;
std::string validate() const override;
private:
const Layer* m_top_layer; //!< pointer to the layer above interface
const Layer* m_bottom_layer; //!< pointer to the layer below interface
std::unique_ptr<const LayerRoughness> m_roughness; //!< roughness of the interface
};
......@@ -57,14 +50,4 @@ inline const LayerRoughness* LayerInterface::roughness() const
return m_roughness.get();
}
inline const Layer* LayerInterface::topLayer() const
{
return m_top_layer;
}
inline const Layer* LayerInterface::bottomLayer() const
{
return m_bottom_layer;
}
#endif // BORNAGAIN_SAMPLE_INTERFACE_LAYERINTERFACE_H
......@@ -70,7 +70,6 @@ void MultiLayer::addLayerExec(const Layer& layer, const LayerRoughness* roughnes
const Layer* new_layer = layer.clone();
if (numberOfLayers()) { // not the top layer
const Layer* last_layer = m_layers.back();
const LayerRoughness* new_roughness;
if (roughness)
new_roughness = roughness->clone();
......@@ -79,7 +78,7 @@ void MultiLayer::addLayerExec(const Layer& layer, const LayerRoughness* roughnes
ErfInterlayer interlayer;
new_roughness = new LayerRoughness(&autocorrelation, &interlayer);
}
m_interfaces.push_back(new LayerInterface(last_layer, new_layer, new_roughness));
m_interfaces.push_back(new LayerInterface(new_roughness));
} else { // the top layer
if (new_layer->thickness() != 0.0)
......
......@@ -254,5 +254,5 @@ TEST_F(MultiLayerTest, MultiLayerComposite)
for (size_t i = 0; i < layer_buffer.size(); ++i)
EXPECT_EQ(double(i * 10), layer_buffer[i]->thickness());
for (size_t i = 0; i < interface_buffer.size(); ++i)
EXPECT_EQ(double((i + 1) * 10), interface_buffer[i]->bottomLayer()->thickness());
EXPECT_EQ(double((i + 1) * 10), layer_buffer[i + 1]->thickness());
}
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