Grid geometry lazy load still not thread safe
The used double-checked locking is known to be a non-thread-safe pattern (see e.g. https://www.justsoftwaresolutions.co.uk/threading/multithreading-in-c++0x-part-6-double-checked-locking.html).
Making the if
check atomic might be bad for performance in case of element map. We could also always make the element map at the cost of memory overhead.
Edited by Timo Koch