blob: 8428d2af36c8fcca090ccdcdb6350e4628118490 [file] [log] [blame]
/*BHEADER**********************************************************************
* Copyright (c) 2006 The Regents of the University of California.
* Produced at the Lawrence Livermore National Laboratory.
* Written by the HYPRE team. UCRL-CODE-222953.
* All rights reserved.
*
* This file is part of HYPRE (see http://www.llnl.gov/CASC/hypre/).
* Please see the COPYRIGHT_and_LICENSE file for the copyright notice,
* disclaimer, contact information and the GNU Lesser General Public License.
*
* HYPRE is free software; you can redistribute it and/or modify it under the
* terms of the GNU General Public License (as published by the Free Software
* Foundation) version 2.1 dated February 1999.
*
* HYPRE is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the IMPLIED WARRANTY OF MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the terms and conditions of the GNU General
* Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* $Revision: 2.4 $
***********************************************************************EHEADER*/
/******************************************************************************
*
* Header info for CSR Matrix data structures
*
* Note: this matrix currently uses 0-based indexing.
*
*****************************************************************************/
#ifndef hypre_CSR_MATRIX_HEADER
#define hypre_CSR_MATRIX_HEADER
/*--------------------------------------------------------------------------
* CSR Matrix
*--------------------------------------------------------------------------*/
typedef struct
{
double *data;
int *i;
int *j;
int num_rows;
int num_cols;
int num_nonzeros;
/* for compressing rows in matrix multiplication */
int *rownnz;
int num_rownnz;
/* Does the CSRMatrix create/destroy `data', `i', `j'? */
int owns_data;
} hypre_CSRMatrix;
/*--------------------------------------------------------------------------
* Accessor functions for the CSR Matrix structure
*--------------------------------------------------------------------------*/
#define hypre_CSRMatrixData(matrix) ((matrix) -> data)
#define hypre_CSRMatrixI(matrix) ((matrix) -> i)
#define hypre_CSRMatrixJ(matrix) ((matrix) -> j)
#define hypre_CSRMatrixNumRows(matrix) ((matrix) -> num_rows)
#define hypre_CSRMatrixNumCols(matrix) ((matrix) -> num_cols)
#define hypre_CSRMatrixNumNonzeros(matrix) ((matrix) -> num_nonzeros)
#define hypre_CSRMatrixRownnz(matrix) ((matrix) -> rownnz)
#define hypre_CSRMatrixNumRownnz(matrix) ((matrix) -> num_rownnz)
#define hypre_CSRMatrixOwnsData(matrix) ((matrix) -> owns_data)
/*--------------------------------------------------------------------------
* CSR Boolean Matrix
*--------------------------------------------------------------------------*/
typedef struct
{
int *i;
int *j;
int num_rows;
int num_cols;
int num_nonzeros;
int owns_data;
} hypre_CSRBooleanMatrix;
/*--------------------------------------------------------------------------
* Accessor functions for the CSR Boolean Matrix structure
*--------------------------------------------------------------------------*/
#define hypre_CSRBooleanMatrix_Get_I(matrix) ((matrix)->i)
#define hypre_CSRBooleanMatrix_Get_J(matrix) ((matrix)->j)
#define hypre_CSRBooleanMatrix_Get_NRows(matrix) ((matrix)->num_rows)
#define hypre_CSRBooleanMatrix_Get_NCols(matrix) ((matrix)->num_cols)
#define hypre_CSRBooleanMatrix_Get_NNZ(matrix) ((matrix)->num_nonzeros)
#define hypre_CSRBooleanMatrix_Get_OwnsData(matrix) ((matrix)->owns_data)
#endif