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

make iffHardDisk thread safe

parent e2d3797b
No related branches found
No related tags found
1 merge request!193Make all of Sample thread safe
Pipeline #41267 passed
......@@ -82,16 +82,19 @@ double InterferenceFunctionHardDisk::density() const
double InterferenceFunctionHardDisk::iff_without_dw(const kvector_t q) const
{
double qx = q.x();
double qy = q.y();
m_q = 2.0 * std::sqrt(qx * qx + qy * qy) * m_radius;
m_packing = packingRatio();
m_c_zero = Czero(m_packing);
m_s2 = S2(m_packing);
double c_q =
const double qx = q.x();
const double qy = q.y();
const double q2r = 2.0 * std::sqrt(qx * qx + qy * qy) * m_radius;
const double packing = packingRatio();
const double c_zero = Czero(packing);
const double s2 = S2(packing);
const double c_q =
2.0 * M_PI
* RealIntegrator().integrate([&](double x) -> double { return integrand(x); }, 0.0, 1.0);
double rho = 4.0 * m_packing / M_PI;
* RealIntegrator().integrate([=](double x) -> double {
double cx = c_zero * (1.0 + 4.0 * packing * (W2(x / 2.0) - 1.0) + s2 * x);
return x * cx * Math::Bessel::J0(q2r * x);
}, 0.0, 1.0);
const double rho = 4.0 * packing / M_PI;
return 1.0 / (1.0 - rho * c_q);
}
......@@ -99,9 +102,3 @@ double InterferenceFunctionHardDisk::packingRatio() const
{
return M_PI * m_radius * m_radius * m_density;
}
double InterferenceFunctionHardDisk::integrand(double x) const
{
double cx = m_c_zero * (1.0 + 4.0 * m_packing * (W2(x / 2.0) - 1.0) + m_s2 * x);
return x * cx * Math::Bessel::J0(m_q * x);
}
......@@ -41,12 +41,9 @@ public:
private:
double iff_without_dw(const kvector_t q) const override;
double packingRatio() const;
double integrand(double x) const;
double m_radius;
double m_density;
mutable double m_q, m_c_zero, m_s2, m_packing;
};
#endif // BORNAGAIN_SAMPLE_AGGREGATE_INTERFERENCEFUNCTIONHARDDISK_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment