dbeurle / neon

A finite element code
Other
10 stars 8 forks source link

Thread local matrices / vectors #117

Closed dbeurle closed 5 years ago

dbeurle commented 5 years ago

The current mesh architecture requires the submeshes to provide their contributions to the stiffness and load vector. For multithreaded assembly, the element contributions are passed by value incurring an allocation and deallocation for each invocation. Move will not help us here as the moved to object will need to be deleted when it reaches the end of the scope.

With C++11 a thread_local specifier can be used and returned as a reference. Using this approach eliminates repeated heap allocations but in practice results in a bug likely to do with returning a pair of references. A small structural change would be required to pull these apart and simply request both of these separately.

dbeurle commented 5 years ago

Available now on master.