Draft constness write functions#348
Conversation
|
@Dominanz Thank you for your contribution! Could you please also adjust the C bindings in |
|
@fsimonis I have done and commited this. |
|
I just looked over this PR again. |
|
You're totally right, I oversaw that. Thanks, I'm doing this tonight! |
|
@fsimonis Done. I realized that the same thing can be done for set/get mesh vertex functions, so I updated them too |
BenjaminRodenberg
left a comment
There was a problem hiding this comment.
As soon as #348 (comment) is resolved, we can merge.
b31217b to
ec5425c
Compare
Refactor data write functions to take const pointer arguments. Change the write functions in SolverInterface (and the functions called by them) to take a const double* (resp. const double&) instead of a double* (resp. double) for the value argument. The purpose of these functions is to copy the contents of the buffer provided as value argument to the other solver. Hence, the access to the write buffer is read-only, consequently it can be const. Add const to the C bindings Add const in the set/get mesh vertex functions and for the valueIndices in Block functions
ec5425c to
269fd94
Compare
|
Well... I am embarrassed that I didn't notice this earlier, but I just realized that only the implementation (/src/precice/impl/SolverInterfaceImpl.), the request manager (/src/precice/impl/RequestManager.) and the c bindings were changed in the merge. The /src/precice/SolverInterface itself remained unchanged, rendering the changes useless. I am pretty confused because I had thought of these files and was convinced that I had modified them too, but I might well have simply forgotten that. Whatever... should I open a new pull request for that? Or is it, somehow, possible to reuse this one? |
No reason to be embarrassed. We also didn't notice it in the review of your PR ;)
I am not sure whether this change was already missing in your original PR or whether @fsimonis and I removed the changes in
As far as I know, we cannot reuse this PR. Just open a new one. You can link to this PR by referring to #348 and possibly your comment #348 (comment) in the body of the new PR. |
|
See #357 |
As discussed in this issue, the value arguments of the write functions in were changed into
constpointers in this branch, since access to them is read-only inside this functions. This allows for safer code and better optimizations in programs that use preCICE, because they are now guaranteed that values are accessed read-only in the write functions.