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

process mesocrystal basis directly, w/o passing through slicing

parent 30974515
No related branches found
No related tags found
1 merge request!1174IFormFactor and children: replace BottomZ, TopZ by spanZ
......@@ -256,7 +256,23 @@ IReParticle* processBasis(const IParticle* basis, const Material& ambientMat)
throw std::runtime_error("Mesocrystal with CoreAndShell basis not yet supported");
}
// Remaining case: the basis is a single particle.
return Compute::Slicing::particlesInSlice(basis, {}, ambientMat).release_back();
const auto* p = dynamic_cast<const Particle*>(basis);
ASSERT(p);
const IRotation* rot = p->rotation();
auto particleSlice = std::make_unique<ReParticle>(
*p->pFormfactor(), new const R3(p->particlePosition()),
rot && !rot->isIdentity() ? std::move(new const RotMatrix(rot->rotMatrix())) : nullptr);
if (!particleSlice)
return {};
double volume = particleSlice->volume();
Material transformed_material(p->rotation()
? p->material()->rotatedMaterial(p->rotation()->rotMatrix())
: *p->material());
particleSlice->setMaterial(transformed_material);
particleSlice->setAdmixedFraction(volume);
particleSlice->setAdmixedMaterial(transformed_material);
particleSlice->setAmbientMaterial(ambientMat);
return particleSlice.release();
}
} // namespace
......
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