| 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 Vector data structure
|
|---|
| 19 | *
|
|---|
| 20 | *****************************************************************************/
|
|---|
| 21 |
|
|---|
| 22 | #ifndef hypre_VECTOR_HEADER
|
|---|
| 23 | #define hypre_VECTOR_HEADER
|
|---|
| 24 |
|
|---|
| 25 | /*--------------------------------------------------------------------------
|
|---|
| 26 | * hypre_Vector
|
|---|
| 27 | *--------------------------------------------------------------------------*/
|
|---|
| 28 |
|
|---|
| 29 | typedef struct
|
|---|
| 30 | {
|
|---|
| 31 | double *data;
|
|---|
| 32 | int size;
|
|---|
| 33 |
|
|---|
| 34 | /* Does the Vector create/destroy `data'? */
|
|---|
| 35 | int owns_data;
|
|---|
| 36 |
|
|---|
| 37 | /* For multivectors...*/
|
|---|
| 38 | int num_vectors; /* the above "size" is size of one vector */
|
|---|
| 39 | int multivec_storage_method;
|
|---|
| 40 | /* ...if 0, store colwise v0[0], v0[1], ..., v1[0], v1[1], ... v2[0]... */
|
|---|
| 41 | /* ...if 1, store rowwise v0[0], v1[0], ..., v0[1], v1[1], ... */
|
|---|
| 42 | /* With colwise storage, vj[i] = data[ j*size + i]
|
|---|
| 43 | With rowwise storage, vj[i] = data[ j + num_vectors*i] */
|
|---|
| 44 | int vecstride, idxstride;
|
|---|
| 45 | /* ... so vj[i] = data[ j*vecstride + i*idxstride ] regardless of row_storage.*/
|
|---|
| 46 |
|
|---|
| 47 | } hypre_Vector;
|
|---|
| 48 |
|
|---|
| 49 | /*--------------------------------------------------------------------------
|
|---|
| 50 | * Accessor functions for the Vector structure
|
|---|
| 51 | *--------------------------------------------------------------------------*/
|
|---|
| 52 |
|
|---|
| 53 | #define hypre_VectorData(vector) ((vector) -> data)
|
|---|
| 54 | #define hypre_VectorSize(vector) ((vector) -> size)
|
|---|
| 55 | #define hypre_VectorOwnsData(vector) ((vector) -> owns_data)
|
|---|
| 56 | #define hypre_VectorNumVectors(vector) ((vector) -> num_vectors)
|
|---|
| 57 | #define hypre_VectorMultiVecStorageMethod(vector) ((vector) -> multivec_storage_method)
|
|---|
| 58 | #define hypre_VectorVectorStride(vector) ((vector) -> vecstride )
|
|---|
| 59 | #define hypre_VectorIndexStride(vector) ((vector) -> idxstride )
|
|---|
| 60 |
|
|---|
| 61 | #endif
|
|---|