Add IJVectorSetConstantValues
for setting all values to a constant
#689
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds a new function:
for setting all values in an
IJVector
to a constant value, analoguous toHYPRE_IJMatrixSetConstantValues
. Internally this simply generalizes the existinghypre_IJVectorZeroValuesPar
function to work with any value, not just zero.To provide some background information: I wanted a simple way to zero out a vector (for original allocation, and for reusing when solving the next time-step, for example). However, while working on this I noticed that
might be enough, but
examples/ex5.c
, where all values in the solution vector is explicitly set to 0, made the impression that this might not be the case. However, since there is a corresponding function for IJMatrix, perhaps this is patch is useful regardless. Opening as a draft PR (Edit: I miss clicked, and only maintainers can convert to a draft PR, apparently.) since I want feedback whether this patch make sense, and if it does I can add some tests. Cheers!