NanoComp / libctl

Guile-based library implementing flexible control files for scientific simulations
GNU General Public License v2.0
19 stars 22 forks source link

more prism tests #52

Open stevengj opened 4 years ago

stevengj commented 4 years ago

Would be nice to add some more prism tests. There are some tests that are easier to implement if you use a fixed object (or a set of fixed objects), as a supplement to the random "fuzz testing" in the test-prism.c code.

To start with, we could use some canonical non-convex test object (including some non right-angles), e.g. a C-like shape. Then you could precompute some things like the volume, the intersection of a box with the object, the normal vector at a few points, the result of point-in-prism at a few points (near boundaries and corners), and test against these.

smartalecH commented 4 years ago

I've added a tarball with ~200 tests to https://github.com/NanoComp/meep/issues/864

The tests come from a paper/research group that focuses on point-in-polygon methods. We can selectively choose from those.

stevengj commented 4 years ago

(Don't make the C shape too rounded, since rounded shapes are very special in that subsequent edges are nearly parallel.)

It should be sufficient for now to implement tests for a handful of hard-coded points. We can always add additional test cases later as issues arise.

stevengj commented 4 years ago

It would also be reasonable to use the 200 tabulated tests you mentioned for the 2d point-in-polygon subroutine, but we still need separate tests for polyhedra.