| 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 | * Header info for the hypre_StructMatrix structures
|
|---|
| 17 | *
|
|---|
| 18 | *****************************************************************************/
|
|---|
| 19 |
|
|---|
| 20 | #ifndef hypre_STRUCT_MATRIX_HEADER
|
|---|
| 21 | #define hypre_STRUCT_MATRIX_HEADER
|
|---|
| 22 |
|
|---|
| 23 | #include <assert.h>
|
|---|
| 24 |
|
|---|
| 25 | /*--------------------------------------------------------------------------
|
|---|
| 26 | * hypre_StructMatrix:
|
|---|
| 27 | *--------------------------------------------------------------------------*/
|
|---|
| 28 |
|
|---|
| 29 | typedef struct hypre_StructMatrix_struct
|
|---|
| 30 | {
|
|---|
| 31 | MPI_Comm comm;
|
|---|
| 32 |
|
|---|
| 33 | hypre_StructGrid *grid;
|
|---|
| 34 | hypre_StructStencil *user_stencil;
|
|---|
| 35 | hypre_StructStencil *stencil;
|
|---|
| 36 | int num_values; /* Number of "stored" coefficients */
|
|---|
| 37 |
|
|---|
| 38 | hypre_BoxArray *data_space;
|
|---|
| 39 |
|
|---|
| 40 | double *data; /* Pointer to matrix data */
|
|---|
| 41 | int data_alloced; /* Boolean used for freeing data */
|
|---|
| 42 | int data_size; /* Size of matrix data */
|
|---|
| 43 | int **data_indices; /* num-boxes by stencil-size array
|
|---|
| 44 | of indices into the data array.
|
|---|
| 45 | data_indices[b][s] is the starting
|
|---|
| 46 | index of matrix data corresponding
|
|---|
| 47 | to box b and stencil coefficient s */
|
|---|
| 48 | int constant_coefficient; /* normally 0; set to 1 for
|
|---|
| 49 | constant coefficient matrices
|
|---|
| 50 | or 2 for constant coefficient
|
|---|
| 51 | with variable diagonal */
|
|---|
| 52 |
|
|---|
| 53 | int symmetric; /* Is the matrix symmetric */
|
|---|
| 54 | int *symm_elements;/* Which elements are "symmetric" */
|
|---|
| 55 | int num_ghost[6]; /* Num ghost layers in each direction */
|
|---|
| 56 |
|
|---|
| 57 | int global_size; /* Total number of nonzero coeffs */
|
|---|
| 58 |
|
|---|
| 59 | int OffProcAdd; /* offproc set values flag */
|
|---|
| 60 |
|
|---|
| 61 | int add_num_ghost[6]; /* ghostlayers to scan for offproc
|
|---|
| 62 | add values */
|
|---|
| 63 |
|
|---|
| 64 | hypre_CommPkg *comm_pkg; /* Info on how to update ghost data */
|
|---|
| 65 |
|
|---|
| 66 | int ref_count;
|
|---|
| 67 |
|
|---|
| 68 | } hypre_StructMatrix;
|
|---|
| 69 |
|
|---|
| 70 | /*--------------------------------------------------------------------------
|
|---|
| 71 | * Accessor macros: hypre_StructMatrix
|
|---|
| 72 | *--------------------------------------------------------------------------*/
|
|---|
| 73 |
|
|---|
| 74 | #define hypre_StructMatrixComm(matrix) ((matrix) -> comm)
|
|---|
| 75 | #define hypre_StructMatrixGrid(matrix) ((matrix) -> grid)
|
|---|
| 76 | #define hypre_StructMatrixUserStencil(matrix) ((matrix) -> user_stencil)
|
|---|
| 77 | #define hypre_StructMatrixStencil(matrix) ((matrix) -> stencil)
|
|---|
| 78 | #define hypre_StructMatrixNumValues(matrix) ((matrix) -> num_values)
|
|---|
| 79 | #define hypre_StructMatrixDataSpace(matrix) ((matrix) -> data_space)
|
|---|
| 80 | #define hypre_StructMatrixData(matrix) ((matrix) -> data)
|
|---|
| 81 | #define hypre_StructMatrixDataAlloced(matrix) ((matrix) -> data_alloced)
|
|---|
| 82 | #define hypre_StructMatrixDataSize(matrix) ((matrix) -> data_size)
|
|---|
| 83 | #define hypre_StructMatrixDataIndices(matrix) ((matrix) -> data_indices)
|
|---|
| 84 | #define hypre_StructMatrixConstantCoefficient(matrix) ((matrix) -> constant_coefficient)
|
|---|
| 85 | #define hypre_StructMatrixSymmetric(matrix) ((matrix) -> symmetric)
|
|---|
| 86 | #define hypre_StructMatrixSymmElements(matrix) ((matrix) -> symm_elements)
|
|---|
| 87 | #define hypre_StructMatrixNumGhost(matrix) ((matrix) -> num_ghost)
|
|---|
| 88 | #define hypre_StructMatrixGlobalSize(matrix) ((matrix) -> global_size)
|
|---|
| 89 | #define hypre_StructMatrixOffProcAdd(matrix) ((matrix) -> OffProcAdd)
|
|---|
| 90 | #define hypre_StructMatrixAddNumGhost(matrix) ((matrix) -> add_num_ghost)
|
|---|
| 91 | #define hypre_StructMatrixCommPkg(matrix) ((matrix) -> comm_pkg)
|
|---|
| 92 | #define hypre_StructMatrixRefCount(matrix) ((matrix) -> ref_count)
|
|---|
| 93 |
|
|---|
| 94 | #define hypre_StructMatrixBox(matrix, b) \
|
|---|
| 95 | hypre_BoxArrayBox(hypre_StructMatrixDataSpace(matrix), b)
|
|---|
| 96 |
|
|---|
| 97 | #define hypre_StructMatrixBoxData(matrix, b, s) \
|
|---|
| 98 | (hypre_StructMatrixData(matrix) + hypre_StructMatrixDataIndices(matrix)[b][s])
|
|---|
| 99 |
|
|---|
| 100 | #define hypre_StructMatrixBoxDataValue(matrix, b, s, index) \
|
|---|
| 101 | (hypre_StructMatrixBoxData(matrix, b, s) + \
|
|---|
| 102 | hypre_BoxIndexRank(hypre_StructMatrixBox(matrix, b), index))
|
|---|
| 103 |
|
|---|
| 104 | #define hypre_CCStructMatrixBoxDataValue(matrix, b, s, index) \
|
|---|
| 105 | (hypre_StructMatrixBoxData(matrix, b, s) + \
|
|---|
| 106 | hypre_CCBoxIndexRank(hypre_StructMatrixBox(matrix, b), index))
|
|---|
| 107 |
|
|---|
| 108 | #endif
|
|---|