Skip to content

MagFieldServices: Rewrite BFieldCond in terms of Eigen3 vectors

The previous code was entirely scalar and quite messy. By rewriting the code in terms of Eigen3 vectors it becomes more expressive and clear. It also becomes a bit faster as we can now leverage SIMD implicitly through Eigen's internal optimisation engine.

We measure a speedup of 14.3% in the getField method. Not huge, but this should drip down into many parts of Athena as a subtle but worthwhile performance increase.

Note: This commit may introduce very slightly different numerical results. This is not a bug, rather it is a consequence of Eigen's internal optimisation heuristics and the way IEEE 754 floating-point mathematics works.

Merge request reports