| 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 Parallel CSR Matrix data structures
|
|---|
| 19 | *
|
|---|
| 20 | * Note: this matrix currently uses 0-based indexing.
|
|---|
| 21 | *
|
|---|
| 22 | *****************************************************************************/
|
|---|
| 23 |
|
|---|
| 24 | #ifndef hypre_PAR_CSR_MATRIX_HEADER
|
|---|
| 25 | #define hypre_PAR_CSR_MATRIX_HEADER
|
|---|
| 26 |
|
|---|
| 27 | /*--------------------------------------------------------------------------
|
|---|
| 28 | * Parallel CSR Matrix
|
|---|
| 29 | *--------------------------------------------------------------------------*/
|
|---|
| 30 |
|
|---|
| 31 | typedef struct
|
|---|
| 32 | {
|
|---|
| 33 | MPI_Comm comm;
|
|---|
| 34 |
|
|---|
| 35 | HYPRE_BigInt global_num_rows;
|
|---|
| 36 | HYPRE_BigInt global_num_cols;
|
|---|
| 37 | HYPRE_BigInt first_row_index;
|
|---|
| 38 | HYPRE_BigInt first_col_diag;
|
|---|
| 39 | /* need to know entire local range in case row_starts and col_starts
|
|---|
| 40 | are null (i.e., bgl) AHB 6/05*/
|
|---|
| 41 | HYPRE_BigInt last_row_index;
|
|---|
| 42 | HYPRE_BigInt last_col_diag;
|
|---|
| 43 |
|
|---|
| 44 | hypre_CSRMatrix *diag;
|
|---|
| 45 | hypre_CSRMatrix *offd;
|
|---|
| 46 | HYPRE_BigInt *col_map_offd;
|
|---|
| 47 | /* maps columns of offd to global columns */
|
|---|
| 48 | HYPRE_BigInt *row_starts;
|
|---|
| 49 | /* array of length num_procs+1, row_starts[i] contains the
|
|---|
| 50 | global number of the first row on proc i,
|
|---|
| 51 | first_row_index = row_starts[my_id],
|
|---|
| 52 | row_starts[num_procs] = global_num_rows */
|
|---|
| 53 | HYPRE_BigInt *col_starts;
|
|---|
| 54 | /* array of length num_procs+1, col_starts[i] contains the
|
|---|
| 55 | global number of the first column of diag on proc i,
|
|---|
| 56 | first_col_diag = col_starts[my_id],
|
|---|
| 57 | col_starts[num_procs] = global_num_cols */
|
|---|
| 58 |
|
|---|
| 59 | hypre_ParCSRCommPkg *comm_pkg;
|
|---|
| 60 | hypre_ParCSRCommPkg *comm_pkgT;
|
|---|
| 61 |
|
|---|
| 62 | /* Does the ParCSRMatrix create/destroy `diag', `offd', `col_map_offd'? */
|
|---|
| 63 | int owns_data;
|
|---|
| 64 | /* Does the ParCSRMatrix create/destroy `row_starts', `col_starts'? */
|
|---|
| 65 | int owns_row_starts;
|
|---|
| 66 | int owns_col_starts;
|
|---|
| 67 |
|
|---|
| 68 | HYPRE_BigInt num_nonzeros;
|
|---|
| 69 | double d_num_nonzeros;
|
|---|
| 70 |
|
|---|
| 71 | /* Buffers used by GetRow to hold row currently being accessed. AJC, 4/99 */
|
|---|
| 72 | HYPRE_BigInt *rowindices;
|
|---|
| 73 | double *rowvalues;
|
|---|
| 74 | int getrowactive;
|
|---|
| 75 |
|
|---|
| 76 | hypre_IJAssumedPart *assumed_partition; /* only populated if no_global_partition option
|
|---|
| 77 | is used (compile-time option)*/
|
|---|
| 78 |
|
|---|
| 79 |
|
|---|
| 80 | } hypre_ParCSRMatrix;
|
|---|
| 81 |
|
|---|
| 82 | /*--------------------------------------------------------------------------
|
|---|
| 83 | * Accessor functions for the Parallel CSR Matrix structure
|
|---|
| 84 | *--------------------------------------------------------------------------*/
|
|---|
| 85 |
|
|---|
| 86 | #define hypre_ParCSRMatrixComm(matrix) ((matrix) -> comm)
|
|---|
| 87 | #define hypre_ParCSRMatrixGlobalNumRows(matrix) ((matrix) -> global_num_rows)
|
|---|
| 88 | #define hypre_ParCSRMatrixGlobalNumCols(matrix) ((matrix) -> global_num_cols)
|
|---|
| 89 | #define hypre_ParCSRMatrixFirstRowIndex(matrix) ((matrix) -> first_row_index)
|
|---|
| 90 | #define hypre_ParCSRMatrixFirstColDiag(matrix) ((matrix) -> first_col_diag)
|
|---|
| 91 | #define hypre_ParCSRMatrixLastRowIndex(matrix) ((matrix) -> last_row_index)
|
|---|
| 92 | #define hypre_ParCSRMatrixLastColDiag(matrix) ((matrix) -> last_col_diag)
|
|---|
| 93 | #define hypre_ParCSRMatrixDiag(matrix) ((matrix) -> diag)
|
|---|
| 94 | #define hypre_ParCSRMatrixOffd(matrix) ((matrix) -> offd)
|
|---|
| 95 | #define hypre_ParCSRMatrixColMapOffd(matrix) ((matrix) -> col_map_offd)
|
|---|
| 96 | #define hypre_ParCSRMatrixRowStarts(matrix) ((matrix) -> row_starts)
|
|---|
| 97 | #define hypre_ParCSRMatrixColStarts(matrix) ((matrix) -> col_starts)
|
|---|
| 98 | #define hypre_ParCSRMatrixCommPkg(matrix) ((matrix) -> comm_pkg)
|
|---|
| 99 | #define hypre_ParCSRMatrixCommPkgT(matrix) ((matrix) -> comm_pkgT)
|
|---|
| 100 | #define hypre_ParCSRMatrixOwnsData(matrix) ((matrix) -> owns_data)
|
|---|
| 101 | #define hypre_ParCSRMatrixOwnsRowStarts(matrix) ((matrix) -> owns_row_starts)
|
|---|
| 102 | #define hypre_ParCSRMatrixOwnsColStarts(matrix) ((matrix) -> owns_col_starts)
|
|---|
| 103 | #define hypre_ParCSRMatrixNumRows(matrix) \
|
|---|
| 104 | hypre_CSRMatrixNumRows(hypre_ParCSRMatrixDiag(matrix))
|
|---|
| 105 | #define hypre_ParCSRMatrixNumCols(matrix) \
|
|---|
| 106 | hypre_CSRMatrixNumCols(hypre_ParCSRMatrixDiag(matrix))
|
|---|
| 107 | #define hypre_ParCSRMatrixNumNonzeros(matrix) ((matrix) -> num_nonzeros)
|
|---|
| 108 | #define hypre_ParCSRMatrixDNumNonzeros(matrix) ((matrix) -> d_num_nonzeros)
|
|---|
| 109 | #define hypre_ParCSRMatrixRowindices(matrix) ((matrix) -> rowindices)
|
|---|
| 110 | #define hypre_ParCSRMatrixRowvalues(matrix) ((matrix) -> rowvalues)
|
|---|
| 111 | #define hypre_ParCSRMatrixGetrowactive(matrix) ((matrix) -> getrowactive)
|
|---|
| 112 | #define hypre_ParCSRMatrixAssumedPartition(matrix) ((matrix) -> assumed_partition)
|
|---|
| 113 |
|
|---|
| 114 | #endif
|
|---|