[petsc-users] The Matrix and Vector Format Convert between PETSc and HYPRE

Barry Smith bsmith at petsc.dev
Mon Feb 7 10:01:15 CST 2022


  Sijie,

    Generally to use hypre from PETSc you just use PETSc matrices and vectors in your code and set the desired hypre solver with PC; you don't need to deal with hypre matrices and vectors directly at all.

  Barry


> On Feb 6, 2022, at 12:34 AM, Sijie Tang <sijietang1995 at gmail.com> wrote:
> 
> I make a mistake there is no hypre_ParCSRVector, that should be hypre_ParVector.
> 
> Sijie
> 
>> On Feb 5, 2022, at 21:53, Sijie Tang <sijietang1995 at gmail.com <mailto:sijietang1995 at gmail.com>> wrote:
>> 
>> Hi developer,
>> 
>> I have many questions about he Matrix and Vector Format Convert between PETSc and HYPRE, could you give me some answers or hints?
>> 
>> Can I convert MATHYPRE (in PETSc) to hypre_ParCSRMatrix ( HYPRE ) use function MatHYPREGetParCSR() (in PETSc) ? 
>> for 2, or I should use MatHYPRE_IJMatrixCreate  and MatHYPRE_IJMatrixCopy to get hypre_IJMatrix, then hypre_IJMatrix convert to hypre_ParCSRMatrix ?
>> for the vector, I don't find any function can convert vector in PETSc to hypre_ParCSRVector, Is there any function can do this work ?
>> But I find I can use VecHYPRE_IJVectorCreate and VecHYPRE_IJVectorCopy to get hypre_IJVector, then hypre_IJVector convert to hypre_ParCSRVector?
>> Is there any function can convert the format back? like hypre_ParCSRMatrix convert to MATHYPRE, and hypre_ParCSRVector convert to PETSc's vector?
>> 
>> Thanks,
>> Sijie
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20220207/392df947/attachment.html>


More information about the petsc-users mailing list