svalinn / r2s-act

Rigorous 2 Step Activation Workflow
4 stars 7 forks source link

Uniform sampling - use binary search of mesh boundaries #25

Closed erelson closed 11 years ago

erelson commented 11 years ago

Currently, uniform sampling does a linear search in each dimension (xyz) to locate which mesh boundaries a sampled point is within. This can be sped up using a binary search implemented in source.F90.

Just to note an observation, the linear search method, assuming the number of indices in each dimension is roughly equal, is O(3·n^(1/3)), where n is the number of voxels. The binary search method will be O(3·log(n^(1/3))). (The 3· is typically ignored of course...) This improvement will be much smaller than the O(n) to O(1) result of implementing alias sampling.

erelson commented 11 years ago

This has been implemented. I used the binary search code that is used elsewhere in MCNP. All tests get the same/expected results. I have not however done any timing testing.