| 1 | /*BHEADER**********************************************************************
|
|---|
| 2 | * Copyright (c) 2008, Lawrence Livermore National Security, LLC.
|
|---|
| 3 | * Produced at the Lawrence Livermore National Laboratory.
|
|---|
| 4 | * This file is part of HYPRE. See file COPYRIGHT for details.
|
|---|
| 5 | *
|
|---|
| 6 | * HYPRE is free software; you can redistribute it and/or modify it under the
|
|---|
| 7 | * terms of the GNU Lesser General Public License (as published by the Free
|
|---|
| 8 | * Software Foundation) version 2.1 dated February 1999.
|
|---|
| 9 | *
|
|---|
| 10 | * $Revision: 2.4 $
|
|---|
| 11 | ***********************************************************************EHEADER*/
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 | /******************************************************************************
|
|---|
| 17 | *
|
|---|
| 18 | * Header info for CSR Matrix data structures
|
|---|
| 19 | *
|
|---|
| 20 | * Note: this matrix currently uses 0-based indexing.
|
|---|
| 21 | *
|
|---|
| 22 | *****************************************************************************/
|
|---|
| 23 |
|
|---|
| 24 | #ifndef hypre_CSR_MATRIX_HEADER
|
|---|
| 25 | #define hypre_CSR_MATRIX_HEADER
|
|---|
| 26 |
|
|---|
| 27 | /*--------------------------------------------------------------------------
|
|---|
| 28 | * CSR Matrix
|
|---|
| 29 | *--------------------------------------------------------------------------*/
|
|---|
| 30 |
|
|---|
| 31 | typedef struct
|
|---|
| 32 | {
|
|---|
| 33 | double *data;
|
|---|
| 34 | int *i;
|
|---|
| 35 | int *j;
|
|---|
| 36 | int num_rows;
|
|---|
| 37 | int num_cols;
|
|---|
| 38 | int num_nonzeros;
|
|---|
| 39 |
|
|---|
| 40 | /* for compressing rows in matrix multiplication */
|
|---|
| 41 | int *rownnz;
|
|---|
| 42 | int num_rownnz;
|
|---|
| 43 |
|
|---|
| 44 | /* Does the CSRMatrix create/destroy `data', `i', `j'? */
|
|---|
| 45 | int owns_data;
|
|---|
| 46 |
|
|---|
| 47 | } hypre_CSRMatrix;
|
|---|
| 48 |
|
|---|
| 49 | /*--------------------------------------------------------------------------
|
|---|
| 50 | * Accessor functions for the CSR Matrix structure
|
|---|
| 51 | *--------------------------------------------------------------------------*/
|
|---|
| 52 |
|
|---|
| 53 | #define hypre_CSRMatrixData(matrix) ((matrix) -> data)
|
|---|
| 54 | #define hypre_CSRMatrixI(matrix) ((matrix) -> i)
|
|---|
| 55 | #define hypre_CSRMatrixJ(matrix) ((matrix) -> j)
|
|---|
| 56 | #define hypre_CSRMatrixNumRows(matrix) ((matrix) -> num_rows)
|
|---|
| 57 | #define hypre_CSRMatrixNumCols(matrix) ((matrix) -> num_cols)
|
|---|
| 58 | #define hypre_CSRMatrixNumNonzeros(matrix) ((matrix) -> num_nonzeros)
|
|---|
| 59 | #define hypre_CSRMatrixRownnz(matrix) ((matrix) -> rownnz)
|
|---|
| 60 | #define hypre_CSRMatrixNumRownnz(matrix) ((matrix) -> num_rownnz)
|
|---|
| 61 | #define hypre_CSRMatrixOwnsData(matrix) ((matrix) -> owns_data)
|
|---|
| 62 |
|
|---|
| 63 |
|
|---|
| 64 | /*--------------------------------------------------------------------------
|
|---|
| 65 | * BigCSR Matrix
|
|---|
| 66 | *--------------------------------------------------------------------------*/
|
|---|
| 67 |
|
|---|
| 68 | typedef struct
|
|---|
| 69 | {
|
|---|
| 70 | int *i;
|
|---|
| 71 | HYPRE_BigInt *j;
|
|---|
| 72 | double *data;
|
|---|
| 73 | int num_rows;
|
|---|
| 74 | int num_cols;
|
|---|
| 75 | int num_nonzeros;
|
|---|
| 76 | int owns_data;
|
|---|
| 77 |
|
|---|
| 78 | } hypre_BigCSRMatrix;
|
|---|
| 79 |
|
|---|
| 80 | /*--------------------------------------------------------------------------
|
|---|
| 81 | * Accessor functions for the BigCSRMatrix structure
|
|---|
| 82 | *--------------------------------------------------------------------------*/
|
|---|
| 83 |
|
|---|
| 84 | #define hypre_BigCSRMatrixI(matrix) ((matrix)->i)
|
|---|
| 85 | #define hypre_BigCSRMatrixJ(matrix) ((matrix)->j)
|
|---|
| 86 | #define hypre_BigCSRMatrixData(matrix) ((matrix)->data)
|
|---|
| 87 | #define hypre_BigCSRMatrixNumRows(matrix) ((matrix)->num_rows)
|
|---|
| 88 | #define hypre_BigCSRMatrixNumCols(matrix) ((matrix)->num_cols)
|
|---|
| 89 | #define hypre_BigCSRMatrixNumNonzeros(matrix)((matrix)->num_nonzeros)
|
|---|
| 90 | #define hypre_BigCSRMatrixOwnsData(matrix) ((matrix)->owns_data)
|
|---|
| 91 |
|
|---|
| 92 | #endif
|
|---|
| 93 |
|
|---|
| 94 |
|
|---|