#737 Wrong results in concurrent access to reference elements
Metadata
| Property | Value | 
|---|---|
| Reported by | Martin Weiser (weiser@zib.de) | 
| Reported at | Feb 12, 2010 09:24 | 
| Type | Bug Report | 
| Version | Git (pre2.4) [autotools] | 
| Operating System | Unspecified / All | 
| Last edited by | Oliver Sander (oliver.sander@tu-dresden.de) | 
| Last edited at | Mar 28, 2010 11:42 | 
| Closed by | Oliver Sander (oliver.sander@tu-dresden.de) | 
| Closed at | Mar 28, 2010 11:42 | 
| Closed in version | Unknown | 
| Resolution | Fixed | 
| Comment | Removed the 'static' qualifier on the trunk in revision 6546. | 
Description
The mapping of subentity-coordinates to reference-coordinates in ReferenceElement<ctype,dim>::global() uses a static FieldMatrix (in mapGlobal(), referenceelements.hh:34).
In multithreaded applications, this leads to wrong results due to concurrent access to the same matrix, which is shared by all threads due to being static.
I propose to remove the static qualifier.
The impact on performance should be negligible because the construction of a FieldMatrix on the stack is fast. The only issue might be that the constructor initializes the matrix elements to zero. Using a static matrix saves this initialization. However, a good optimizer should detect the double write and remove the initialization.