hypre/seq_mv/vector.h
2008-07-18 01:34:48 +00:00

63 lines
2.3 KiB
C

/*BHEADER**********************************************************************
* Copyright (c) 2008, Lawrence Livermore National Security, LLC.
* Produced at the Lawrence Livermore National Laboratory.
* This file is part of HYPRE. See file COPYRIGHT for details.
*
* HYPRE is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License (as published by the Free
* Software Foundation) version 2.1 dated February 1999.
*
* $Revision$
***********************************************************************EHEADER*/
/******************************************************************************
*
* Header info for Vector data structure
*
*****************************************************************************/
#ifndef hypre_VECTOR_HEADER
#define hypre_VECTOR_HEADER
/*--------------------------------------------------------------------------
* hypre_Vector
*--------------------------------------------------------------------------*/
typedef struct
{
double *data;
int size;
/* Does the Vector create/destroy `data'? */
int owns_data;
/* For multivectors...*/
int num_vectors; /* the above "size" is size of one vector */
int multivec_storage_method;
/* ...if 0, store colwise v0[0], v0[1], ..., v1[0], v1[1], ... v2[0]... */
/* ...if 1, store rowwise v0[0], v1[0], ..., v0[1], v1[1], ... */
/* With colwise storage, vj[i] = data[ j*size + i]
With rowwise storage, vj[i] = data[ j + num_vectors*i] */
int vecstride, idxstride;
/* ... so vj[i] = data[ j*vecstride + i*idxstride ] regardless of row_storage.*/
} hypre_Vector;
/*--------------------------------------------------------------------------
* Accessor functions for the Vector structure
*--------------------------------------------------------------------------*/
#define hypre_VectorData(vector) ((vector) -> data)
#define hypre_VectorSize(vector) ((vector) -> size)
#define hypre_VectorOwnsData(vector) ((vector) -> owns_data)
#define hypre_VectorNumVectors(vector) ((vector) -> num_vectors)
#define hypre_VectorMultiVecStorageMethod(vector) ((vector) -> multivec_storage_method)
#define hypre_VectorVectorStride(vector) ((vector) -> vecstride )
#define hypre_VectorIndexStride(vector) ((vector) -> idxstride )
#endif