Find and replace values in dolfin::Function

Get the vector as an std::vector using https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Vec/VecGetValues.html
Then, you can use something like https://stackoverflow.com/questions/25846235/finding-the-indexes-of-all-occurrences-of-an-element-in-a-vector .

In your previous post you say that you don’t think this strategy is reasonable. Please elaborate on why you think so.