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

New vector APIs for hypre_IJVector #1179

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

New vector APIs for hypre_IJVector #1179

wants to merge 3 commits into from

Conversation

victorapm
Copy link
Contributor

@victorapm victorapm commented Nov 5, 2024

This PR introduces new public APIs and internal functions in hypre to allow users to directly assign external data pointers to IJ vectors, which is useful for applications that wish to avoid additional memory allocations or copies by reusing pre-existing data arrays.

The new key APIs are HYPRE_IJVectorInitializeShell for setting up HYPRE_IJVector metadata without doing any memory allocations and HYPRE_IJVectorInitializeData for assigning an external data array to the vector structure.

Example usage:

      // Data array is allocated and set

      HYPRE_IJVector ij_vec;
      HYPRE_IJVectorCreate(comm, ilower, iupper, &ij_vec);
      HYPRE_IJVectorSetObjectType(ij_vec, HYPRE_PARCSR);
      HYPRE_IJVectorInitializeShell(ij_vec);
      HYPRE_IJVectorInitializeData(ij_vec, data);
      HYPRE_IJVectorAssemble(ij_vec);

@victorapm victorapm changed the title [WIP]: Draft implementation of new vector APIs for hypre_IJVector New vector APIs for hypre_IJVector Nov 7, 2024
@victorapm victorapm marked this pull request as ready for review November 7, 2024 14:42
Copy link
Contributor

@rfalgout rfalgout left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thanks!

victorapm

This comment was marked as resolved.

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.

2 participants