22 FormFactorHemiEllipsoid::FormFactorHemiEllipsoid(
const std::vector<double> P)
24 "actually a spheroid, truncated at central xy plane",
25 {{
"RadiusX",
"nm",
"radius in x direction", 0, +INF, 0},
26 {
"RadiusY",
"nm",
"radius in y direction", 0, +INF, 0},
27 {
"Height",
"nm",
"height = radius in z direction", 0, +INF, 0}}},
29 m_radius_x(m_P[0]), m_radius_y(m_P[1]), m_height(m_P[2])
34 FormFactorHemiEllipsoid::FormFactorHemiEllipsoid(
double radius_x,
double radius_y,
double height)
41 return (m_radius_x + m_radius_y) / 2.0;
45 complex_t FormFactorHemiEllipsoid::Integrand(
double Z)
const
47 double R = m_radius_x;
48 double W = m_radius_y;
51 double Rz = R * std::sqrt(1.0 - Z * Z / (H * H));
52 double Wz = W * std::sqrt(1.0 - Z * Z / (H * H));
54 complex_t qxRz = m_q.
x() * Rz;
55 complex_t qyWz = m_q.
y() * Wz;
57 complex_t gamma = std::sqrt(qxRz * qxRz + qyWz * qyWz);
60 return Rz * Wz * J1_gamma_div_gamma *
exp_I(m_q.
z() * Z);
66 double R = m_radius_x;
67 double W = m_radius_y;
70 if (std::abs(m_q.
mag()) <= std::numeric_limits<double>::epsilon())
71 return M_TWOPI * R * W * H / 3.;
72 return M_TWOPI *
ComplexIntegrator().integrate([&](
double Z) {
return Integrand(Z); }, 0., H);
78 std::make_unique<TruncatedEllipsoid>(m_radius_x, m_radius_x, m_height, m_height, 0.0);
complex_t exp_I(complex_t z)
Returns exp(I*z), where I is the imaginary unit.
Defines classes RealIntegrator, ComplexIntegrator.
Defines M_PI and some more mathematical constants.
Defines namespace MathFunctions.
Defines class TruncatedEllipsoid.
double mag() const
Returns magnitude of the vector.
T z() const
Returns z-component in cartesian coordinate system.
T y() const
Returns y-component in cartesian coordinate system.
T x() const
Returns x-component in cartesian coordinate system.
To integrate a complex function of a real variable.
double Bessel_J1c(double x)
Bessel function Bessel_J1(x)/x.