Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add IJVectorSetConstantValues for setting all values to a constant #689

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fredrikekre
Copy link
Contributor

@fredrikekre fredrikekre commented Jul 25, 2022

This adds a new function:

HYPRE_IJVectorSetConstantValues( HYPRE_IJVector vector, HYPRE_Complex value )

for setting all values in an IJVector to a constant value, analoguous to HYPRE_IJMatrixSetConstantValues. Internally this simply generalizes the existing hypre_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

HYPRE_IJVectorInitialize(x)
HYPRE_IJVectorAssemble(x)

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!

This adds a new function:

```
HYPRE_IJVectorSetConstantValues(HYPRE_IJVector vector, HYPRE_Complex value)
```

for setting all values in an `IJVector` to a constant value, analoguous
to `HYPRE_IJMatrixSetConstantValues`. Internally this simply generalizes
the existing `hypre_IJVectorZeroValuesPar` function to work with any
value, not just zero.
@fredrikekre
Copy link
Contributor Author

Bump. Is this something that is interesting/useful to have in hypre?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant