254 if (
const auto* p =
dynamic_cast<const Particle*
>(particle)) {
255 ASSERT(p->formfactor_at_bottom());
256 std::unique_ptr<ReParticle> particleSlice(createParticleSlice(
257 p->formfactor_at_bottom(), limits, p->rotation(), p->particlePosition()));
260 double volume = particleSlice->volume();
262 p->rotation() ? p->material()->rotatedMaterial(p->rotation()->rotMatrix())
264 particleSlice->setMaterial(transformed_material);
265 return {std::move(particleSlice), {{{volume, transformed_material}}}};
268 const Particle* core = p->coreParticle();
269 const Particle* shell = p->shellParticle();
273 std::unique_ptr<Particle> P_core(core->
clone());
275 P_core->rotate(*p->rotation());
276 P_core->translate(p->particlePosition());
280 std::unique_ptr<Particle> P_shell(shell->
clone());
282 P_shell->rotate(*p->rotation());
283 P_shell->translate(p->particlePosition());
299 auto shell_material = sliced_shell.
admixtures[0].material;
300 sliced_core.
particleSlice->setAmbientMaterial(shell_material);
312 throw std::runtime_error(
"ParticleComposition does not yet support slicing");
314 }
else if (
const auto* p =
dynamic_cast<const MesoCrystal*
>(particle)) {
315 const Crystal* crystal = &p->particleStructure();
316 const IFormFactor* meso_formfactor = p->outerShape();
317 ASSERT(crystal && meso_formfactor);
320 if (unit_cell_volume <= 0)
325 std::unique_ptr<ReParticle> new_shape(
326 createParticleSlice(meso_formfactor, limits, p->rotation(), p->particlePosition()));
328 const std::unique_ptr<Crystal> new_crystal(
329 crystal->
transformed(p->rotation(), p->particlePosition()));
331 const std::unique_ptr<IReParticle> new_basis(processBasis(new_crystal->basis()));
334 *new_shape, new_crystal->position_variance()));
342 for (
auto& region : regions)
343 region.fraction *= meso_formfactor->
volume() / unit_cell_volume;
#define ASSERT(condition)
The list of material admixtures to a slice.
A crystal structure, defined by a Bravais lattice, a basis, and a position variance.
Crystal * transformed(const IRotation *rotation, const R3 &translation) const
const IParticle * basis() const
const Lattice3D * lattice() const
virtual std::vector< std::unique_ptr< IParticle > > decompose() const
Decompose in constituent IParticle objects.
double unitCellVolume() const
Returns the volume of the unit cell.
A wrapper for underlying material implementation.
A particle with a crystalline inner structure, made of smaller particles, and an outer shape describe...
A composition of particles at fixed positions.
A particle with a core/shell geometry.
A particle with a form factor and refractive index.
Particle * clone() const override
Returns a clone of this ISampleNode object.
A reprocessed core shell particle.
A reprocessed MesoCrystal.
ParticleInSlice createParticleInSlice(const IParticle *particle, const ZLimits &)
Struct that contains information on a sliced particle. This information is needed for evaluating the ...
std::unique_ptr< IReParticle > particleSlice