Skip to content

Make UGGrid LBMessageBuffer depend on the data type

Oliver Sander requested to merge make-uggrid-message-buffer-more-robust into master

Previously, the methods LBMessageBuffer::read and LBMessageBuffer::write depended on the DataType, but the LBMessageBuffer class itself did not. This lead to subtle bugs: I wanted to send a vector of doubles, stored in a std::map. By error, I set the DataType to std::map::value_type, which is a std::pair<IdType,double> rather than to the correct type std::map::mapped_type (aka double). Still, my DataHandle only wrote double values into the message buffer, which lead to strange memory corruption.

This patch makes sure the compiler finds such a bug.

Merge request reports