Implement automatic caching of the BEM matrix