20 ParticleCoreShell::ParticleCoreShell(
const Particle& shell,
const Particle& core,
23 setName(
"ParticleCoreShell");
25 addAndRegisterCore(core, relative_core_position);
26 addAndRegisterShell(shell);
29 ParticleCoreShell::~ParticleCoreShell() =
default;
43 if (!mp_core || !mp_shell)
45 std::unique_ptr<IRotation> P_rotation(IRotation::createIdentity());
47 P_rotation.reset(mP_rotation->clone());
50 std::unique_ptr<Particle> P_core(mp_core->clone());
51 P_core->rotate(*P_rotation);
52 P_core->translate(m_position);
53 auto sliced_core = P_core->createSlicedParticle(limits);
56 std::unique_ptr<Particle> P_shell(mp_shell->clone());
57 P_shell->rotate(*P_rotation);
58 P_shell->translate(m_position);
59 auto sliced_shell = P_shell->createSlicedParticle(limits);
60 if (!sliced_shell.mP_slicedff)
65 if (!sliced_core.mP_slicedff) {
66 result.mP_slicedff.reset(sliced_shell.mP_slicedff.release());
67 result.m_regions.push_back(sliced_shell.m_regions.back());
72 if (sliced_shell.m_regions.size() != 1)
74 auto shell_material = sliced_shell.m_regions[0].m_material;
75 sliced_core.mP_slicedff->setAmbientMaterial(shell_material);
78 sliced_shell.m_regions.back().m_volume -= sliced_core.m_regions.back().m_volume;
80 sliced_shell.mP_slicedff.release()));
81 result.m_regions.push_back(sliced_core.m_regions.back());
82 result.m_regions.push_back(sliced_shell.m_regions.back());
92 void ParticleCoreShell::addAndRegisterCore(
const Particle& core,
kvector_t relative_core_position)
94 mp_core.reset(core.
clone());
95 mp_core->translate(relative_core_position);
96 registerChild(mp_core.get());
97 mp_core->registerAbundance(
false);
100 void ParticleCoreShell::addAndRegisterShell(
const Particle& shell)
102 mp_shell.reset(shell.
clone());
103 registerChild(mp_shell.get());
104 mp_shell->registerAbundance(
false);
105 mp_shell->registerPosition(
false);
108 ParticleCoreShell::ParticleCoreShell() : mp_shell{nullptr}, mp_core{nullptr}
110 setName(
"ParticleCoreShell");
Defines ParticleCoreShell.
Defines class SlicedParticle.
void setAbundance(double abundance)
Sets particle abundance.
std::vector< const INode * > getChildren() const override
Returns a vector of children (const).
void setPosition(kvector_t position)
Sets relative position of the particle's reference point in the coordinate system of parent.
void setRotation(const IRotation &rotation)
Sets transformation.
void registerParticleProperties()
Registers abundance and position.
A particle with a core/shell geometry.
std::vector< const INode * > getChildren() const override final
Returns a vector of children (const).
ParticleCoreShell * clone() const override final
Returns a clone of this ISample object.
SlicedParticle createSlicedParticle(ZLimits limits) const override final
Creates a sliced form factor for this particle.
A particle with a form factor and refractive index.
Particle * clone() const override final
Returns a clone of this ISample object.
Class that contains upper and lower limits of the z-coordinate for the slicing of form factors.
Struct that contains information on a sliced particle.