Added MatrixGet(Box)Values routines to Struct and SStruct.

This commit is contained in:
falgout 2008-01-24 18:50:05 +00:00
parent d814b6853b
commit 343643eb9c
5 changed files with 104 additions and 0 deletions

View File

@ -46,6 +46,8 @@
could only be used as a preconditioner). Added HYPRE_Jacobi as an option to
SetStructSolver.
- Added Get(Box)Values routines for Struct/SStruct Matrix.
- Added capability to change Euclid runtime parameters using individual
functions.

View File

@ -530,6 +530,56 @@ int HYPRE_SStructMatrixAddToBoxValues(HYPRE_SStructMatrix matrix,
**/
int HYPRE_SStructMatrixAssemble(HYPRE_SStructMatrix matrix);
/**
* Get matrix coefficients index by index. The {\tt values} array is of length
* {\tt nentries}.
*
* NOTE: For better efficiency, use \Ref{HYPRE_SStructMatrixGetBoxValues} to get
* coefficients a box at a time.
*
* NOTE: Users may get values on any process that owns the associated variables.
*
* NOTE: The entries in this routine must all be of the same type: either
* stencil or non-stencil, but not both. Also, if they are stencil entries,
* they must all represent couplings to the same variable type (there are no
* such restrictions for non-stencil entries).
*
* If the matrix is complex, then {\tt values} consists of pairs of doubles
* representing the real and imaginary parts of each complex value.
*
* @see HYPRE_SStructMatrixSetComplex
**/
int HYPRE_SStructMatrixGetValues(HYPRE_SStructMatrix matrix,
int part,
int *index,
int var,
int nentries,
int *entries,
double *values);
/**
* Get matrix coefficients a box at a time. The data in {\tt values} is
* ordered as in \Ref{HYPRE_SStructMatrixSetBoxValues}.
*
* NOTE: Users may get values on any process that owns the associated variables.
*
* NOTE: The entries in this routine must all be of stencil type. Also, they
* must all represent couplings to the same variable type.
*
* If the matrix is complex, then {\tt values} consists of pairs of doubles
* representing the real and imaginary parts of each complex value.
*
* @see HYPRE_SStructMatrixSetComplex
**/
int HYPRE_SStructMatrixGetBoxValues(HYPRE_SStructMatrix matrix,
int part,
int *ilower,
int *iupper,
int var,
int nentries,
int *entries,
double *values);
/**
* Define symmetry properties for the stencil entries in the matrix. The
* boolean argument {\tt symmetric} is applied to stencil entries on part {\tt

View File

@ -96,6 +96,33 @@ HYPRE_StructMatrixSetValues( HYPRE_StructMatrix matrix,
return hypre_error_flag;
}
/*--------------------------------------------------------------------------
* HYPRE_StructMatrixGetValues
*--------------------------------------------------------------------------*/
int
HYPRE_StructMatrixGetValues( HYPRE_StructMatrix matrix,
int *grid_index,
int num_stencil_indices,
int *stencil_indices,
double *values )
{
hypre_Index new_grid_index;
int d;
hypre_ClearIndex(new_grid_index);
for (d = 0; d < hypre_StructGridDim(hypre_StructMatrixGrid(matrix)); d++)
{
hypre_IndexD(new_grid_index, d) = grid_index[d];
}
hypre_StructMatrixSetValues(matrix, new_grid_index,
num_stencil_indices, stencil_indices,
values, -1, -1, 0);
return hypre_error_flag;
}
/*--------------------------------------------------------------------------
* HYPRE_StructMatrixSetBoxValues
*--------------------------------------------------------------------------*/

View File

@ -275,6 +275,30 @@ int HYPRE_StructMatrixAddToBoxValues(HYPRE_StructMatrix matrix,
**/
int HYPRE_StructMatrixAssemble(HYPRE_StructMatrix matrix);
/**
* Get matrix coefficients index by index. The {\tt values} array is of length
* {\tt nentries}.
*
* NOTE: For better efficiency, use \Ref{HYPRE_StructMatrixGetBoxValues} to get
* coefficients a box at a time.
**/
int HYPRE_StructMatrixGetValues(HYPRE_StructMatrix matrix,
int *index,
int nentries,
int *entries,
double *values);
/**
* Get matrix coefficients a box at a time. The data in {\tt values} is
* ordered as in \Ref{HYPRE_StructMatrixSetBoxValues}.
**/
int HYPRE_StructMatrixGetBoxValues(HYPRE_StructMatrix matrix,
int *ilower,
int *iupper,
int nentries,
int *entries,
double *values);
/**
* Define symmetry properties of the matrix. By default, matrices are assumed
* to be nonsymmetric. Significant storage savings can be made if the matrix is

View File

@ -2249,6 +2249,7 @@ int HYPRE_StructMatrixCreate ( MPI_Comm comm , HYPRE_StructGrid grid , HYPRE_Str
int HYPRE_StructMatrixDestroy ( HYPRE_StructMatrix matrix );
int HYPRE_StructMatrixInitialize ( HYPRE_StructMatrix matrix );
int HYPRE_StructMatrixSetValues ( HYPRE_StructMatrix matrix , int *grid_index , int num_stencil_indices , int *stencil_indices , double *values );
int HYPRE_StructMatrixGetValues ( HYPRE_StructMatrix matrix , int *grid_index , int num_stencil_indices , int *stencil_indices , double *values );
int HYPRE_StructMatrixSetBoxValues ( HYPRE_StructMatrix matrix , int *ilower , int *iupper , int num_stencil_indices , int *stencil_indices , double *values );
int HYPRE_StructMatrixGetBoxValues ( HYPRE_StructMatrix matrix , int *ilower , int *iupper , int num_stencil_indices , int *stencil_indices , double *values );
int HYPRE_StructMatrixSetConstantValues ( HYPRE_StructMatrix matrix , int num_stencil_indices , int *stencil_indices , double *values );