20#include <shapes/SimplePore.hpp>
38std::pair<double, double> SimplePore::dist_half_pore(
double r,
double z)
const {
61 if ((z <= c_z) && (r <= (c_z + c_r - z))) {
63 return {m_rad - r, 0};
65 if (((z >= c_z) && (r >= c_r)) || ((z <= c_z) && (r > (c_z + c_r - z)))) {
67 return {0, m_half_length - z};
71 auto const dr = c_r - r;
72 auto const dz = c_z - z;
75 auto const d = std::sqrt(dr * dr + dz * dz);
76 auto const fac = (d - m_smoothing_rad) / d;
78 return {fac * dr, fac * dz};
85 auto const c_dist = pos - m_center;
86 auto const z = e_z * c_dist;
87 auto const r_vec = c_dist - z * e_z;
88 auto const r = r_vec.
norm();
92 auto const e_r = (r == 0) ? e_r_axis : r_vec / r;
97 auto [dr, dz] = dist_half_pore(r, std::abs(z));
100 if (((dz == 0) && (r <= m_rad)) ||
101 ((dr == 0) && (std::abs(z) > m_half_length))) {
105 if (std::abs(z) >= c_z) {
117 dist = std::sqrt(dr * dr + dz * dz) * side;
118 vec = -dr * e_r - dz * e_z;
Vector implementation and trait types for boost qvm interoperability.
void calculate_dist(const Utils::Vector3d &pos, double &dist, Utils::Vector3d &vec) const override
DEVICE_QUALIFIER constexpr T sqr(T x)
Calculates the SQuaRe of x.