libMesh/libmesh

Operator `()` of a petsc vector is not safe if used together with `set()` in a threaded loop.

grmnptr opened this issue · 0 comments

If this is used in a threaded loop:

const auto normalized_value = (*grad_container[dim_index])(dof_id_elem) / volume;
grad_container[dim_index]->set(dof_id_elem, normalized_value);

We get the following error:

libMesh terminating:
Assertion `local_index < _local_size' failed.
local_index = 24
_local_size = 0

which comes from the fact that the set function can set _local_size to 0.