xref: /petsc/src/mat/impls/hypre/mhypre.h (revision 978814f1ffe028842bf651401e1d413e711a3534)
1 
2 #if !defined(_MHYPRE_H)
3 #define _MHYPRE_H
4 
5 #include <HYPRE.h>
6 #include <_hypre_IJ_mv.h>
7 #include <HYPRE_IJ_mv.h>
8 
9 typedef struct {
10   HYPRE_IJMatrix ij;
11   HYPRE_IJVector x;
12   HYPRE_IJVector b;
13   MPI_Comm       comm;
14   PetscBool      inner_free;
15 } Mat_HYPRE;
16 
17 PETSC_EXTERN PetscErrorCode VecHYPRE_IJVectorCreate(Vec,HYPRE_IJVector*);
18 PETSC_EXTERN PetscErrorCode VecHYPRE_IJVectorCopy(Vec,HYPRE_IJVector);
19 
20 /*
21     Replaces the address where the HYPRE vector points to its data with the address of
22     PETSc's data. Saves the old address so it can be reset when we are finished with it.
23     Allows users to get the data into a HYPRE vector without the cost of memcopies
24 */
25 #define HYPREReplacePointer(b,newvalue,savedvalue) { \
26     hypre_ParVector *par_vector   = (hypre_ParVector*)hypre_IJVectorObject(((hypre_IJVector*)b)); \
27     hypre_Vector    *local_vector = hypre_ParVectorLocalVector(par_vector); \
28     savedvalue         = local_vector->data; \
29     local_vector->data = newvalue;          \
30 }
31 
32 
33 #endif
34