Fixed SStruct-with-ParCSR so that VectorGetValues works correctly.
This commit is contained in:
parent
e130b5afdf
commit
e8bf09c8d6
16
HYPRE.h
16
HYPRE.h
@ -24,16 +24,16 @@
|
||||
* Constants
|
||||
*--------------------------------------------------------------------------*/
|
||||
|
||||
#define HYPRE_PETSC_MAT_PARILUT_SOLVER 22
|
||||
#define HYPRE_UNITIALIZED -999
|
||||
|
||||
#define HYPRE_PARILUT 872
|
||||
#define HYPRE_PETSC_MAT_PARILUT_SOLVER 222
|
||||
#define HYPRE_PARILUT 333
|
||||
|
||||
#define HYPRE_UNITIALIZED -47
|
||||
#define HYPRE_STRUCT 1111
|
||||
#define HYPRE_SSTRUCT 3333
|
||||
#define HYPRE_PARCSR 5555
|
||||
|
||||
#define HYPRE_ISIS 197983
|
||||
|
||||
#define HYPRE_PETSC 497967
|
||||
|
||||
#define HYPRE_PARCSR 797997
|
||||
#define HYPRE_ISIS 9911
|
||||
#define HYPRE_PETSC 9933
|
||||
|
||||
#endif
|
||||
|
||||
@ -36,6 +36,7 @@ HYPRE_SStructVectorCreate( MPI_Comm comm,
|
||||
hypre_SStructVectorComm(vector) = comm;
|
||||
hypre_SStructVectorNDim(vector) = hypre_SStructGridNDim(grid);
|
||||
hypre_SStructGridRef(grid, &hypre_SStructVectorGrid(vector));
|
||||
hypre_SStructVectorObjectType(vector) = HYPRE_SSTRUCT;
|
||||
nparts = hypre_SStructGridNParts(grid);
|
||||
hypre_SStructVectorNParts(vector) = nparts;
|
||||
pvectors = hypre_TAlloc(hypre_SStructPVector *, nparts);
|
||||
@ -258,6 +259,11 @@ HYPRE_SStructVectorGather( HYPRE_SStructVector vector )
|
||||
int nparts = hypre_SStructVectorNParts(vector);
|
||||
int part;
|
||||
|
||||
if (hypre_SStructVectorObjectType(vector) == HYPRE_PARCSR)
|
||||
{
|
||||
hypre_SStructVectorRestore(vector, hypre_SStructVectorParVector(vector));
|
||||
}
|
||||
|
||||
for (part = 0; part < nparts; part++)
|
||||
{
|
||||
hypre_SStructPVectorGather(hypre_SStructVectorPVector(vector, part));
|
||||
@ -337,6 +343,7 @@ HYPRE_SStructVectorSetObjectType( HYPRE_SStructVector vector,
|
||||
int ierr = 0;
|
||||
|
||||
/* this implements only HYPRE_PARCSR, which is always available */
|
||||
hypre_SStructVectorObjectType(vector) = type;
|
||||
|
||||
return ierr;
|
||||
}
|
||||
|
||||
@ -559,6 +559,7 @@ typedef struct hypre_SStructVector_struct
|
||||
MPI_Comm comm;
|
||||
int ndim;
|
||||
hypre_SStructGrid *grid;
|
||||
int object_type;
|
||||
|
||||
/* s-vector info */
|
||||
int nparts;
|
||||
@ -581,6 +582,7 @@ typedef struct hypre_SStructVector_struct
|
||||
#define hypre_SStructVectorComm(vec) ((vec) -> comm)
|
||||
#define hypre_SStructVectorNDim(vec) ((vec) -> ndim)
|
||||
#define hypre_SStructVectorGrid(vec) ((vec) -> grid)
|
||||
#define hypre_SStructVectorObjectType(vec) ((vec) -> object_type)
|
||||
#define hypre_SStructVectorNParts(vec) ((vec) -> nparts)
|
||||
#define hypre_SStructVectorPVectors(vec) ((vec) -> pvectors)
|
||||
#define hypre_SStructVectorPVector(vec, part) ((vec) -> pvectors[part])
|
||||
|
||||
@ -35,6 +35,7 @@ typedef struct hypre_SStructVector_struct
|
||||
MPI_Comm comm;
|
||||
int ndim;
|
||||
hypre_SStructGrid *grid;
|
||||
int object_type;
|
||||
|
||||
/* s-vector info */
|
||||
int nparts;
|
||||
@ -57,6 +58,7 @@ typedef struct hypre_SStructVector_struct
|
||||
#define hypre_SStructVectorComm(vec) ((vec) -> comm)
|
||||
#define hypre_SStructVectorNDim(vec) ((vec) -> ndim)
|
||||
#define hypre_SStructVectorGrid(vec) ((vec) -> grid)
|
||||
#define hypre_SStructVectorObjectType(vec) ((vec) -> object_type)
|
||||
#define hypre_SStructVectorNParts(vec) ((vec) -> nparts)
|
||||
#define hypre_SStructVectorPVectors(vec) ((vec) -> pvectors)
|
||||
#define hypre_SStructVectorPVector(vec, part) ((vec) -> pvectors[part])
|
||||
|
||||
@ -36,6 +36,7 @@ HYPRE_SStructVectorCreate( MPI_Comm comm,
|
||||
hypre_SStructVectorComm(vector) = comm;
|
||||
hypre_SStructVectorNDim(vector) = hypre_SStructGridNDim(grid);
|
||||
hypre_SStructGridRef(grid, &hypre_SStructVectorGrid(vector));
|
||||
hypre_SStructVectorObjectType(vector) = HYPRE_SSTRUCT;
|
||||
nparts = hypre_SStructGridNParts(grid);
|
||||
hypre_SStructVectorNParts(vector) = nparts;
|
||||
pvectors = hypre_TAlloc(hypre_SStructPVector *, nparts);
|
||||
@ -258,6 +259,11 @@ HYPRE_SStructVectorGather( HYPRE_SStructVector vector )
|
||||
int nparts = hypre_SStructVectorNParts(vector);
|
||||
int part;
|
||||
|
||||
if (hypre_SStructVectorObjectType(vector) == HYPRE_PARCSR)
|
||||
{
|
||||
hypre_SStructVectorRestore(vector, hypre_SStructVectorParVector(vector));
|
||||
}
|
||||
|
||||
for (part = 0; part < nparts; part++)
|
||||
{
|
||||
hypre_SStructPVectorGather(hypre_SStructVectorPVector(vector, part));
|
||||
@ -337,6 +343,7 @@ HYPRE_SStructVectorSetObjectType( HYPRE_SStructVector vector,
|
||||
int ierr = 0;
|
||||
|
||||
/* this implements only HYPRE_PARCSR, which is always available */
|
||||
hypre_SStructVectorObjectType(vector) = type;
|
||||
|
||||
return ierr;
|
||||
}
|
||||
|
||||
@ -559,6 +559,7 @@ typedef struct hypre_SStructVector_struct
|
||||
MPI_Comm comm;
|
||||
int ndim;
|
||||
hypre_SStructGrid *grid;
|
||||
int object_type;
|
||||
|
||||
/* s-vector info */
|
||||
int nparts;
|
||||
@ -581,6 +582,7 @@ typedef struct hypre_SStructVector_struct
|
||||
#define hypre_SStructVectorComm(vec) ((vec) -> comm)
|
||||
#define hypre_SStructVectorNDim(vec) ((vec) -> ndim)
|
||||
#define hypre_SStructVectorGrid(vec) ((vec) -> grid)
|
||||
#define hypre_SStructVectorObjectType(vec) ((vec) -> object_type)
|
||||
#define hypre_SStructVectorNParts(vec) ((vec) -> nparts)
|
||||
#define hypre_SStructVectorPVectors(vec) ((vec) -> pvectors)
|
||||
#define hypre_SStructVectorPVector(vec, part) ((vec) -> pvectors[part])
|
||||
|
||||
@ -35,6 +35,7 @@ typedef struct hypre_SStructVector_struct
|
||||
MPI_Comm comm;
|
||||
int ndim;
|
||||
hypre_SStructGrid *grid;
|
||||
int object_type;
|
||||
|
||||
/* s-vector info */
|
||||
int nparts;
|
||||
@ -57,6 +58,7 @@ typedef struct hypre_SStructVector_struct
|
||||
#define hypre_SStructVectorComm(vec) ((vec) -> comm)
|
||||
#define hypre_SStructVectorNDim(vec) ((vec) -> ndim)
|
||||
#define hypre_SStructVectorGrid(vec) ((vec) -> grid)
|
||||
#define hypre_SStructVectorObjectType(vec) ((vec) -> object_type)
|
||||
#define hypre_SStructVectorNParts(vec) ((vec) -> nparts)
|
||||
#define hypre_SStructVectorPVectors(vec) ((vec) -> pvectors)
|
||||
#define hypre_SStructVectorPVector(vec, part) ((vec) -> pvectors[part])
|
||||
|
||||
@ -1044,6 +1044,12 @@ main( int argc,
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Gather the solution vector
|
||||
*-----------------------------------------------------------*/
|
||||
|
||||
HYPRE_SStructVectorGather(x);
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Print the solution and other info
|
||||
*-----------------------------------------------------------*/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user