2000-07-01 04:02:16 +08:00
|
|
|
/*BHEADER**********************************************************************
|
2008-07-18 09:34:48 +08:00
|
|
|
* Copyright (c) 2008, Lawrence Livermore National Security, LLC.
|
2006-07-28 07:26:57 +08:00
|
|
|
* Produced at the Lawrence Livermore National Laboratory.
|
2008-07-18 09:34:48 +08:00
|
|
|
* This file is part of HYPRE. See file COPYRIGHT for details.
|
2000-07-01 04:02:16 +08:00
|
|
|
*
|
2008-07-18 09:34:48 +08:00
|
|
|
* HYPRE is free software; you can redistribute it and/or modify it under the
|
|
|
|
|
* terms of the GNU Lesser General Public License (as published by the Free
|
|
|
|
|
* Software Foundation) version 2.1 dated February 1999.
|
2000-07-01 04:02:16 +08:00
|
|
|
*
|
|
|
|
|
* $Revision$
|
2006-07-28 07:26:57 +08:00
|
|
|
***********************************************************************EHEADER*/
|
|
|
|
|
|
2006-09-23 06:06:21 +08:00
|
|
|
|
|
|
|
|
|
2007-11-14 03:56:09 +08:00
|
|
|
|
2000-07-01 04:02:16 +08:00
|
|
|
/******************************************************************************
|
|
|
|
|
*
|
|
|
|
|
* Header info for the hypre_SStructMatrix structures
|
|
|
|
|
*
|
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifndef hypre_SSTRUCT_MATRIX_HEADER
|
|
|
|
|
#define hypre_SSTRUCT_MATRIX_HEADER
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------------
|
|
|
|
|
* hypre_SStructMatrix:
|
|
|
|
|
*--------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
MPI_Comm comm;
|
|
|
|
|
hypre_SStructPGrid *pgrid;
|
|
|
|
|
hypre_SStructStencil **stencils; /* nvar array of stencils */
|
|
|
|
|
|
2010-12-23 09:25:40 +08:00
|
|
|
HYPRE_Int nvars;
|
|
|
|
|
HYPRE_Int **smaps;
|
2000-07-01 04:02:16 +08:00
|
|
|
hypre_StructStencil ***sstencils; /* nvar x nvar array of sstencils */
|
|
|
|
|
hypre_StructMatrix ***smatrices; /* nvar x nvar array of smatrices */
|
2010-12-23 09:25:40 +08:00
|
|
|
HYPRE_Int **symmetric; /* Stencil entries symmetric?
|
2002-07-14 21:50:02 +08:00
|
|
|
* (nvar x nvar array) */
|
2000-07-01 04:02:16 +08:00
|
|
|
|
|
|
|
|
/* temporary storage for SetValues routines */
|
2010-12-23 09:25:40 +08:00
|
|
|
HYPRE_Int sentries_size;
|
|
|
|
|
HYPRE_Int *sentries;
|
2000-07-01 04:02:16 +08:00
|
|
|
|
2010-12-23 09:25:40 +08:00
|
|
|
HYPRE_Int accumulated; /* AddTo values accumulated? */
|
|
|
|
|
HYPRE_Int complex; /* Matrix complex? */
|
2000-10-23 23:07:22 +08:00
|
|
|
|
2010-12-23 09:25:40 +08:00
|
|
|
HYPRE_Int ref_count;
|
2001-02-24 05:24:25 +08:00
|
|
|
|
2000-07-01 04:02:16 +08:00
|
|
|
} hypre_SStructPMatrix;
|
|
|
|
|
|
|
|
|
|
typedef struct hypre_SStructMatrix_struct
|
|
|
|
|
{
|
|
|
|
|
MPI_Comm comm;
|
2010-12-23 09:25:40 +08:00
|
|
|
HYPRE_Int ndim;
|
2000-07-01 04:02:16 +08:00
|
|
|
hypre_SStructGraph *graph;
|
2010-12-23 09:25:40 +08:00
|
|
|
HYPRE_Int ***splits; /* S/U-matrix split for each stencil */
|
2000-07-01 04:02:16 +08:00
|
|
|
|
|
|
|
|
/* S-matrix info */
|
2010-12-23 09:25:40 +08:00
|
|
|
HYPRE_Int nparts;
|
2000-07-01 04:02:16 +08:00
|
|
|
hypre_SStructPMatrix **pmatrices;
|
2010-12-23 09:25:40 +08:00
|
|
|
HYPRE_Int ***symmetric; /* Stencil entries symmetric?
|
2002-07-14 21:50:02 +08:00
|
|
|
* (nparts x nvar x nvar array) */
|
2000-07-01 04:02:16 +08:00
|
|
|
|
|
|
|
|
/* U-matrix info */
|
|
|
|
|
HYPRE_IJMatrix ijmatrix;
|
|
|
|
|
hypre_ParCSRMatrix *parcsrmatrix;
|
|
|
|
|
|
|
|
|
|
/* temporary storage for SetValues routines */
|
2010-12-23 09:25:40 +08:00
|
|
|
HYPRE_Int entries_size;
|
|
|
|
|
HYPRE_Int *Sentries;
|
|
|
|
|
HYPRE_Int *Uentries;
|
|
|
|
|
HYPRE_Int *tmp_col_coords;
|
2000-11-07 03:25:06 +08:00
|
|
|
double *tmp_coeffs;
|
2000-07-01 04:02:16 +08:00
|
|
|
|
2010-12-23 09:25:40 +08:00
|
|
|
HYPRE_Int ns_symmetric; /* Non-stencil entries symmetric? */
|
|
|
|
|
HYPRE_Int complex; /* Matrix complex? */
|
|
|
|
|
HYPRE_Int global_size; /* Total number of nonzero coeffs */
|
2000-07-01 04:02:16 +08:00
|
|
|
|
2010-12-23 09:25:40 +08:00
|
|
|
HYPRE_Int ref_count;
|
2000-07-01 04:02:16 +08:00
|
|
|
|
Module: sstruct_mv
Data Structure/Function:sstruct_matrix
Changes: added a type that for now is HYPRE_PARCSR or HYPRE_SSTRUCT
Reason: This will determine the dimension and entry location in the IJMatrix side of the structure
File: sstruct_mv.h sstruct_matrix.h
Module: sstruct_mv
Data Structure/Function: HYPRE_SStructMatrixCReate
Changes: the default of the type was set to HYPRE_SSTRUCT
The creation of the IJmatrix was moved to the initialization phase
Reason: The ijcreation is postponed until the user decided the type of matrix and vector she/he will
use to solve the problem
File: HYPRE_sstruct_matrix.c
Module: sstruct_mv
Data Structure/Function: HYPRE_SStruct_MAtrixSetObjectType
Changes: to inject the type into the sstruct_matrix
Reason: The user at the end decides whether to use parcsr or sstruct solver
File: HYPRE_sstruct_matrix.c
Module: sstruct_mv
Data Structure/Function: HYPRE_SStructMatrixInitialize
Changes: the ijmatrix is created here with a dimension that depends on the type.
Reason: It could have been done in the create part but it seems more natural after running the setobjectype.
File:HYPRE_sstruct_matrix.c
Module: sstruct_mv
Data Structure/Function:hypre_SStructUMatrixInitialize
Changes: When HYPRE_SSTRUCT type, you pass zero rowsizes to the IJSetRowSizes function.
Reason: To pass the rowsizes information, information about the nonzero rows is needed. HOwever, when
the matrix is HYPRE_SSTRUCT all the rows associated with a ghost index are zero. But, we
do not have this information stored in the sstruct_matrix, and it is too costly to have it.
It turns out that passing zero for all rows is less costly than passing a constant size.
File: sstruct_matrix.c
Module: sstruct_mv
Data Structure/Function: hypre_SStructUMatrixSetBoxValues, UMatrixSetValues
Changes: Replace the calculation of the Global Rank for one that depends on the matrix type..
hypre_SStructGetGlobalRank(mapentry,index,rank,type)
instead of hypre_SStructGetGlobalRank(mapentry, index, rank)
Reason: the dimension and entries of the umatrix depend on the type of matrix
File: sstruct_matrix.c
2002-12-13 13:17:10 +08:00
|
|
|
/* GEC0902 adding an object type to the matrix */
|
2010-12-23 09:25:40 +08:00
|
|
|
HYPRE_Int object_type;
|
Module: sstruct_mv
Data Structure/Function:sstruct_matrix
Changes: added a type that for now is HYPRE_PARCSR or HYPRE_SSTRUCT
Reason: This will determine the dimension and entry location in the IJMatrix side of the structure
File: sstruct_mv.h sstruct_matrix.h
Module: sstruct_mv
Data Structure/Function: HYPRE_SStructMatrixCReate
Changes: the default of the type was set to HYPRE_SSTRUCT
The creation of the IJmatrix was moved to the initialization phase
Reason: The ijcreation is postponed until the user decided the type of matrix and vector she/he will
use to solve the problem
File: HYPRE_sstruct_matrix.c
Module: sstruct_mv
Data Structure/Function: HYPRE_SStruct_MAtrixSetObjectType
Changes: to inject the type into the sstruct_matrix
Reason: The user at the end decides whether to use parcsr or sstruct solver
File: HYPRE_sstruct_matrix.c
Module: sstruct_mv
Data Structure/Function: HYPRE_SStructMatrixInitialize
Changes: the ijmatrix is created here with a dimension that depends on the type.
Reason: It could have been done in the create part but it seems more natural after running the setobjectype.
File:HYPRE_sstruct_matrix.c
Module: sstruct_mv
Data Structure/Function:hypre_SStructUMatrixInitialize
Changes: When HYPRE_SSTRUCT type, you pass zero rowsizes to the IJSetRowSizes function.
Reason: To pass the rowsizes information, information about the nonzero rows is needed. HOwever, when
the matrix is HYPRE_SSTRUCT all the rows associated with a ghost index are zero. But, we
do not have this information stored in the sstruct_matrix, and it is too costly to have it.
It turns out that passing zero for all rows is less costly than passing a constant size.
File: sstruct_matrix.c
Module: sstruct_mv
Data Structure/Function: hypre_SStructUMatrixSetBoxValues, UMatrixSetValues
Changes: Replace the calculation of the Global Rank for one that depends on the matrix type..
hypre_SStructGetGlobalRank(mapentry,index,rank,type)
instead of hypre_SStructGetGlobalRank(mapentry, index, rank)
Reason: the dimension and entries of the umatrix depend on the type of matrix
File: sstruct_matrix.c
2002-12-13 13:17:10 +08:00
|
|
|
|
2000-07-01 04:02:16 +08:00
|
|
|
} hypre_SStructMatrix;
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------------
|
|
|
|
|
* Accessor macros: hypre_SStructMatrix
|
|
|
|
|
*--------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
#define hypre_SStructMatrixComm(mat) ((mat) -> comm)
|
|
|
|
|
#define hypre_SStructMatrixNDim(mat) ((mat) -> ndim)
|
|
|
|
|
#define hypre_SStructMatrixGraph(mat) ((mat) -> graph)
|
2002-07-14 21:50:02 +08:00
|
|
|
#define hypre_SStructMatrixSplits(mat) ((mat) -> splits)
|
2000-07-01 04:02:16 +08:00
|
|
|
#define hypre_SStructMatrixSplit(mat, p, v) ((mat) -> splits[p][v])
|
|
|
|
|
#define hypre_SStructMatrixNParts(mat) ((mat) -> nparts)
|
|
|
|
|
#define hypre_SStructMatrixPMatrices(mat) ((mat) -> pmatrices)
|
|
|
|
|
#define hypre_SStructMatrixPMatrix(mat, part) ((mat) -> pmatrices[part])
|
2002-07-14 21:50:02 +08:00
|
|
|
#define hypre_SStructMatrixSymmetric(mat) ((mat) -> symmetric)
|
2000-07-01 04:02:16 +08:00
|
|
|
#define hypre_SStructMatrixIJMatrix(mat) ((mat) -> ijmatrix)
|
|
|
|
|
#define hypre_SStructMatrixParCSRMatrix(mat) ((mat) -> parcsrmatrix)
|
2001-08-21 05:33:24 +08:00
|
|
|
#define hypre_SStructMatrixEntriesSize(mat) ((mat) -> entries_size)
|
2000-07-01 04:02:16 +08:00
|
|
|
#define hypre_SStructMatrixSEntries(mat) ((mat) -> Sentries)
|
|
|
|
|
#define hypre_SStructMatrixUEntries(mat) ((mat) -> Uentries)
|
2000-11-07 03:25:06 +08:00
|
|
|
#define hypre_SStructMatrixTmpColCoords(mat) ((mat) -> tmp_col_coords)
|
|
|
|
|
#define hypre_SStructMatrixTmpCoeffs(mat) ((mat) -> tmp_coeffs)
|
2002-07-14 21:50:02 +08:00
|
|
|
#define hypre_SStructMatrixNSSymmetric(mat) ((mat) -> ns_symmetric)
|
2000-10-23 23:07:22 +08:00
|
|
|
#define hypre_SStructMatrixComplex(mat) ((mat) -> complex)
|
2000-07-01 04:02:16 +08:00
|
|
|
#define hypre_SStructMatrixGlobalSize(mat) ((mat) -> global_size)
|
|
|
|
|
#define hypre_SStructMatrixRefCount(mat) ((mat) -> ref_count)
|
Module: sstruct_mv
Data Structure/Function:sstruct_matrix
Changes: added a type that for now is HYPRE_PARCSR or HYPRE_SSTRUCT
Reason: This will determine the dimension and entry location in the IJMatrix side of the structure
File: sstruct_mv.h sstruct_matrix.h
Module: sstruct_mv
Data Structure/Function: HYPRE_SStructMatrixCReate
Changes: the default of the type was set to HYPRE_SSTRUCT
The creation of the IJmatrix was moved to the initialization phase
Reason: The ijcreation is postponed until the user decided the type of matrix and vector she/he will
use to solve the problem
File: HYPRE_sstruct_matrix.c
Module: sstruct_mv
Data Structure/Function: HYPRE_SStruct_MAtrixSetObjectType
Changes: to inject the type into the sstruct_matrix
Reason: The user at the end decides whether to use parcsr or sstruct solver
File: HYPRE_sstruct_matrix.c
Module: sstruct_mv
Data Structure/Function: HYPRE_SStructMatrixInitialize
Changes: the ijmatrix is created here with a dimension that depends on the type.
Reason: It could have been done in the create part but it seems more natural after running the setobjectype.
File:HYPRE_sstruct_matrix.c
Module: sstruct_mv
Data Structure/Function:hypre_SStructUMatrixInitialize
Changes: When HYPRE_SSTRUCT type, you pass zero rowsizes to the IJSetRowSizes function.
Reason: To pass the rowsizes information, information about the nonzero rows is needed. HOwever, when
the matrix is HYPRE_SSTRUCT all the rows associated with a ghost index are zero. But, we
do not have this information stored in the sstruct_matrix, and it is too costly to have it.
It turns out that passing zero for all rows is less costly than passing a constant size.
File: sstruct_matrix.c
Module: sstruct_mv
Data Structure/Function: hypre_SStructUMatrixSetBoxValues, UMatrixSetValues
Changes: Replace the calculation of the Global Rank for one that depends on the matrix type..
hypre_SStructGetGlobalRank(mapentry,index,rank,type)
instead of hypre_SStructGetGlobalRank(mapentry, index, rank)
Reason: the dimension and entries of the umatrix depend on the type of matrix
File: sstruct_matrix.c
2002-12-13 13:17:10 +08:00
|
|
|
#define hypre_SStructMatrixObjectType(mat) ((mat) -> object_type)
|
2000-07-01 04:02:16 +08:00
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------------
|
|
|
|
|
* Accessor macros: hypre_SStructPMatrix
|
|
|
|
|
*--------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
#define hypre_SStructPMatrixComm(pmat) ((pmat) -> comm)
|
|
|
|
|
#define hypre_SStructPMatrixPGrid(pmat) ((pmat) -> pgrid)
|
|
|
|
|
#define hypre_SStructPMatrixStencils(pmat) ((pmat) -> stencils)
|
|
|
|
|
#define hypre_SStructPMatrixNVars(pmat) ((pmat) -> nvars)
|
|
|
|
|
#define hypre_SStructPMatrixStencil(pmat, var) ((pmat) -> stencils[var])
|
|
|
|
|
#define hypre_SStructPMatrixSMaps(pmat) ((pmat) -> smaps)
|
|
|
|
|
#define hypre_SStructPMatrixSMap(pmat, var) ((pmat) -> smaps[var])
|
|
|
|
|
#define hypre_SStructPMatrixSStencils(pmat) ((pmat) -> sstencils)
|
|
|
|
|
#define hypre_SStructPMatrixSStencil(pmat, vi, vj) \
|
|
|
|
|
((pmat) -> sstencils[vi][vj])
|
|
|
|
|
#define hypre_SStructPMatrixSMatrices(pmat) ((pmat) -> smatrices)
|
|
|
|
|
#define hypre_SStructPMatrixSMatrix(pmat, vi, vj) \
|
|
|
|
|
((pmat) -> smatrices[vi][vj])
|
2002-07-14 21:50:02 +08:00
|
|
|
#define hypre_SStructPMatrixSymmetric(pmat) ((pmat) -> symmetric)
|
2001-08-21 05:33:24 +08:00
|
|
|
#define hypre_SStructPMatrixSEntriesSize(pmat) ((pmat) -> sentries_size)
|
2000-07-01 04:02:16 +08:00
|
|
|
#define hypre_SStructPMatrixSEntries(pmat) ((pmat) -> sentries)
|
2008-01-23 09:14:45 +08:00
|
|
|
#define hypre_SStructPMatrixAccumulated(pmat) ((pmat) -> accumulated)
|
2000-10-23 23:07:22 +08:00
|
|
|
#define hypre_SStructPMatrixComplex(pmat) ((pmat) -> complex)
|
2001-02-24 05:24:25 +08:00
|
|
|
#define hypre_SStructPMatrixRefCount(pmat) ((pmat) -> ref_count)
|
2000-07-01 04:02:16 +08:00
|
|
|
|
|
|
|
|
#endif
|