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

fixed Meso bug, at the expense of additional complication in Material handling

parent a61f73ca
No related branches found
No related tags found
1 merge request!560Resolve Decorator Pattern in IFormFactor hierarchy
......@@ -21,19 +21,19 @@
#include "Sample/Scattering/Rotations.h"
#include <iostream>
DecoratedFF::DecoratedFF(IBornFF* ff, const Material& material,
const Material& ambient_material, const R3* position,
DecoratedFF::DecoratedFF(IBornFF* ff, const Material* material,
const Material* ambient_material, const R3* position,
const RotMatrix* rotMatrix)
: m_ff(std::move(ff))
, m_material(std::make_unique<const Material>(material))
, m_ambient_material(std::make_unique<Material>(ambient_material))
, m_material(std::move(material))
, m_ambient_material(std::move(ambient_material))
, m_position(std::move(position))
, m_rotMatrix(std::move(rotMatrix))
{
}
DecoratedFF::DecoratedFF(const IBornFF& ff)
: DecoratedFF(ff.clone(), HomogeneousMaterial(), HomogeneousMaterial(), nullptr, nullptr)
: DecoratedFF(ff.clone(), nullptr, nullptr, nullptr, nullptr)
{
}
......@@ -41,8 +41,8 @@ DecoratedFF::~DecoratedFF() = default;
DecoratedFF* DecoratedFF::clone() const
{
return new DecoratedFF(m_ff->clone(), *m_material,
*m_ambient_material,
return new DecoratedFF(m_ff->clone(), m_material ? new Material (*m_material) : nullptr,
m_ambient_material ? new Material(*m_ambient_material) : nullptr,
m_position ? new R3(*m_position) : nullptr,
m_rotMatrix ? new RotMatrix(*m_rotMatrix) : nullptr);
}
......
......@@ -70,8 +70,8 @@ protected:
std::unique_ptr<const IBornFF> m_ff;
//private:
DecoratedFF(IBornFF* ff, const Material& material,
const Material& ambient_material, const R3* position, const RotMatrix* rotMatrix);
DecoratedFF(IBornFF* ff, const Material* material,
const Material* ambient_material, const R3* position, const RotMatrix* rotMatrix);
std::unique_ptr<const Material> m_material;
std::unique_ptr<const Material> m_ambient_material;
......
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