Commit 9044d896 authored by Kendrick, Coleman's avatar Kendrick, Coleman Committed by Peterson, Peter
Browse files

Initial tests for hollow cylinder integration

parent c407b875
......@@ -896,6 +896,58 @@ public:
TS_ASSERT_EQUALS(back_midpoint.totalDistInsideObject(), 1.5 * RADIUS);
}
void testTracksForHollowCylinder() {
// hollow cylinder at the origin with the symmetry axis along y
// using PAC06 dimensions: 2.95mm inner radius, 3.15mm outer radius
// x 5.68mm height
constexpr double INNER_RADIUS{0.00295};
constexpr double OUTER_RADIUS{0.00315};
constexpr double WALL_THICKNESS{OUTER_RADIUS - INNER_RADIUS};
constexpr double HEIGHT{0.00568};
constexpr double TOLERANCE{1e-12};
V3D BOTTOM_CENTRE{0., -.5 * HEIGHT, 0.};
V3D AXIS_SYMM{0., 1., 0.};
auto cylinder = ComponentCreationHelper::createHollowCylinder(
INNER_RADIUS, OUTER_RADIUS, HEIGHT, BOTTOM_CENTRE, AXIS_SYMM, "cyl");
const V3D BEAM_DIRECTION{0., 0., 1.}; // along z-axis
// centre of sample
Track origin(V3D{0., 0., 0.}, BEAM_DIRECTION);
cylinder->interceptSurface(origin);
// this test should equal wall thickness since this track should
// only be summing distances on the inside of an object
TS_ASSERT_DELTA(origin.totalDistInsideObject(), WALL_THICKNESS, TOLERANCE);
constexpr double WALL_CENTER{0.5 * (OUTER_RADIUS + INNER_RADIUS)};
// Right midpoint in wall between origin and radius (front wrt beam dir)
Track front_midpt(V3D{0., 0., WALL_CENTER}, BEAM_DIRECTION);
cylinder->interceptSurface(front_midpt);
TS_ASSERT_DELTA(front_midpt.totalDistInsideObject(), 0.5 * WALL_THICKNESS,
TOLERANCE);
// Left midpoint in wall between origin and radius (back wrt beam dir)
Track back_midpt(V3D{0., 0., -WALL_CENTER}, BEAM_DIRECTION);
cylinder->interceptSurface(back_midpt);
TS_ASSERT_DELTA(back_midpt.totalDistInsideObject(), 1.5 * WALL_THICKNESS,
TOLERANCE);
// Add a quarter offset to the midpoint
constexpr double WALL_CENTER_OFFSET{0.25 * INNER_RADIUS +
0.75 * OUTER_RADIUS};
front_midpt = Track(V3D{0., 0., WALL_CENTER_OFFSET}, BEAM_DIRECTION);
cylinder->interceptSurface(front_midpt);
TS_ASSERT_DELTA(front_midpt.totalDistInsideObject(), 0.25 * WALL_THICKNESS,
TOLERANCE);
// Left midpoint in wall between origin and radius (back wrt beam dir)
back_midpt = Track(V3D{0., 0., -WALL_CENTER_OFFSET}, BEAM_DIRECTION);
cylinder->interceptSurface(back_midpt);
TS_ASSERT_DELTA(back_midpt.totalDistInsideObject(), 1.75 * WALL_THICKNESS,
TOLERANCE);
}
void testGeneratePointInsideSphere() {
using namespace ::testing;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment