xref: /petsc/src/mat/impls/hypre/mhypre.h (revision 49a781f5cee36db85e8d5b951eec29f10ac13593)
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 } Mat_HYPRE;
15 
16 PETSC_EXTERN PetscErrorCode VecHYPRE_IJVectorCreate(Vec,HYPRE_IJVector*);
17 PETSC_EXTERN PetscErrorCode VecHYPRE_IJVectorCopy(Vec,HYPRE_IJVector);
18 
19 /*
20     Replaces the address where the HYPRE vector points to its data with the address of
21     PETSc's data. Saves the old address so it can be reset when we are finished with it.
22     Allows users to get the data into a HYPRE vector without the cost of memcopies
23 */
24 #define HYPREReplacePointer(b,newvalue,savedvalue) { \
25     hypre_ParVector *par_vector   = (hypre_ParVector*)hypre_IJVectorObject(((hypre_IJVector*)b)); \
26     hypre_Vector    *local_vector = hypre_ParVectorLocalVector(par_vector); \
27     savedvalue         = local_vector->data; \
28     local_vector->data = newvalue;          \
29 }
30 
31 
32 #endif
33