source: CIVL/examples/mpi-omp/AMG2013/seq_mv/seq_mv.h

main
Last change on this file was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago

Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5704 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 9.8 KB
Line 
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/*BHEADER**********************************************************************
13 * Copyright (c) 2008, Lawrence Livermore National Security, LLC.
14 * Produced at the Lawrence Livermore National Laboratory.
15 * This file is part of HYPRE. See file COPYRIGHT for details.
16 *
17 * HYPRE is free software; you can redistribute it and/or modify it under the
18 * terms of the GNU Lesser General Public License (as published by the Free
19 * Software Foundation) version 2.1 dated February 1999.
20 *
21 * $Revision: 2.4 $
22 ***********************************************************************EHEADER*/
23
24#include "HYPRE_seq_mv.h"
25
26#ifndef hypre_MV_HEADER
27#define hypre_MV_HEADER
28
29#include "utilities.h"
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
35
36
37
38
39/******************************************************************************
40 *
41 * Header info for CSR Matrix data structures
42 *
43 * Note: this matrix currently uses 0-based indexing.
44 *
45 *****************************************************************************/
46
47#ifndef hypre_CSR_MATRIX_HEADER
48#define hypre_CSR_MATRIX_HEADER
49
50/*--------------------------------------------------------------------------
51 * CSR Matrix
52 *--------------------------------------------------------------------------*/
53
54typedef struct
55{
56 double *data;
57 int *i;
58 int *j;
59 int num_rows;
60 int num_cols;
61 int num_nonzeros;
62
63 /* for compressing rows in matrix multiplication */
64 int *rownnz;
65 int num_rownnz;
66
67 /* Does the CSRMatrix create/destroy `data', `i', `j'? */
68 int owns_data;
69
70 /* only used for threaded MatVecT */
71 double *expand_data;
72
73} hypre_CSRMatrix;
74
75/*--------------------------------------------------------------------------
76 * Accessor functions for the CSR Matrix structure
77 *--------------------------------------------------------------------------*/
78
79#define hypre_CSRMatrixData(matrix) ((matrix) -> data)
80#define hypre_CSRMatrixI(matrix) ((matrix) -> i)
81#define hypre_CSRMatrixJ(matrix) ((matrix) -> j)
82#define hypre_CSRMatrixNumRows(matrix) ((matrix) -> num_rows)
83#define hypre_CSRMatrixNumCols(matrix) ((matrix) -> num_cols)
84#define hypre_CSRMatrixNumNonzeros(matrix) ((matrix) -> num_nonzeros)
85#define hypre_CSRMatrixRownnz(matrix) ((matrix) -> rownnz)
86#define hypre_CSRMatrixNumRownnz(matrix) ((matrix) -> num_rownnz)
87#define hypre_CSRMatrixOwnsData(matrix) ((matrix) -> owns_data)
88
89
90/*--------------------------------------------------------------------------
91 * BigCSR Matrix
92 *--------------------------------------------------------------------------*/
93
94typedef struct
95{
96 int *i;
97 HYPRE_BigInt *j;
98 double *data;
99 int num_rows;
100 int num_cols;
101 int num_nonzeros;
102 int owns_data;
103
104 /* only used for threaded MatVecT */
105 double *expand_data;
106
107} hypre_BigCSRMatrix;
108
109/*--------------------------------------------------------------------------
110 * Accessor functions for the BigCSRMatrix structure
111 *--------------------------------------------------------------------------*/
112
113#define hypre_BigCSRMatrixI(matrix) ((matrix)->i)
114#define hypre_BigCSRMatrixJ(matrix) ((matrix)->j)
115#define hypre_BigCSRMatrixData(matrix) ((matrix)->data)
116#define hypre_BigCSRMatrixNumRows(matrix) ((matrix)->num_rows)
117#define hypre_BigCSRMatrixNumCols(matrix) ((matrix)->num_cols)
118#define hypre_BigCSRMatrixNumNonzeros(matrix)((matrix)->num_nonzeros)
119#define hypre_BigCSRMatrixOwnsData(matrix) ((matrix)->owns_data)
120
121#endif
122
123
124
125
126
127/******************************************************************************
128 *
129 * Header info for Vector data structure
130 *
131 *****************************************************************************/
132
133#ifndef hypre_VECTOR_HEADER
134#define hypre_VECTOR_HEADER
135
136/*--------------------------------------------------------------------------
137 * hypre_Vector
138 *--------------------------------------------------------------------------*/
139
140typedef struct
141{
142 double *data;
143 int size;
144
145 /* Does the Vector create/destroy `data'? */
146 int owns_data;
147
148 /* For multivectors...*/
149 int num_vectors; /* the above "size" is size of one vector */
150 int multivec_storage_method;
151 /* ...if 0, store colwise v0[0], v0[1], ..., v1[0], v1[1], ... v2[0]... */
152 /* ...if 1, store rowwise v0[0], v1[0], ..., v0[1], v1[1], ... */
153 /* With colwise storage, vj[i] = data[ j*size + i]
154 With rowwise storage, vj[i] = data[ j + num_vectors*i] */
155 int vecstride, idxstride;
156 /* ... so vj[i] = data[ j*vecstride + i*idxstride ] regardless of row_storage.*/
157
158} hypre_Vector;
159
160/*--------------------------------------------------------------------------
161 * Accessor functions for the Vector structure
162 *--------------------------------------------------------------------------*/
163
164#define hypre_VectorData(vector) ((vector) -> data)
165#define hypre_VectorSize(vector) ((vector) -> size)
166#define hypre_VectorOwnsData(vector) ((vector) -> owns_data)
167#define hypre_VectorNumVectors(vector) ((vector) -> num_vectors)
168#define hypre_VectorMultiVecStorageMethod(vector) ((vector) -> multivec_storage_method)
169#define hypre_VectorVectorStride(vector) ((vector) -> vecstride )
170#define hypre_VectorIndexStride(vector) ((vector) -> idxstride )
171
172#endif
173
174/* big_csr_matrix.c */
175hypre_BigCSRMatrix *hypre_BigCSRMatrixCreate ( int num_rows , int num_cols , int num_nonzeros );
176int hypre_BigCSRMatrixDestroy ( hypre_BigCSRMatrix *matrix );
177int hypre_BigCSRMatrixInitialize ( hypre_BigCSRMatrix *matrix );
178int hypre_BigCSRMatrixSetDataOwner ( hypre_BigCSRMatrix *matrix , int owns_data );
179int hypre_BigCSRMatrixCopy ( hypre_BigCSRMatrix *A , hypre_BigCSRMatrix *B , int copy_data );
180
181/* csr_matop.c */
182hypre_CSRMatrix *hypre_CSRMatrixAdd ( hypre_CSRMatrix *A , hypre_CSRMatrix *B );
183hypre_CSRMatrix *hypre_CSRMatrixMultiply ( hypre_CSRMatrix *A , hypre_CSRMatrix *B );
184hypre_CSRMatrix *hypre_CSRMatrixDeleteZeros ( hypre_CSRMatrix *A , double tol );
185int hypre_CSRMatrixTranspose ( hypre_CSRMatrix *A , hypre_CSRMatrix **AT , int data );
186int hypre_CSRMatrixReorder ( hypre_CSRMatrix *A );
187double hypre_CSRMatrixSumElts ( hypre_CSRMatrix *A );
188
189/* csr_matrix.c */
190hypre_CSRMatrix *hypre_CSRMatrixCreate ( int num_rows , int num_cols , int num_nonzeros );
191int hypre_CSRMatrixDestroy ( hypre_CSRMatrix *matrix );
192int hypre_CSRMatrixInitialize ( hypre_CSRMatrix *matrix );
193int hypre_CSRMatrixSetDataOwner ( hypre_CSRMatrix *matrix , int owns_data );
194int hypre_CSRMatrixSetRownnz ( hypre_CSRMatrix *matrix );
195hypre_CSRMatrix *hypre_CSRMatrixRead ( char *file_name );
196int hypre_CSRMatrixPrint ( hypre_CSRMatrix *matrix , char *file_name );
197int hypre_CSRMatrixCopy ( hypre_CSRMatrix *A , hypre_CSRMatrix *B , int copy_data );
198hypre_CSRMatrix *hypre_CSRMatrixClone ( hypre_CSRMatrix *A );
199hypre_CSRMatrix *hypre_CSRMatrixUnion ( hypre_CSRMatrix *A , hypre_CSRMatrix *B , HYPRE_BigInt *col_map_offd_A , HYPRE_BigInt *col_map_offd_B , HYPRE_BigInt **col_map_offd_C );
200
201/* csr_matvec.c */
202int hypre_CSRMatrixMatvec ( double alpha , hypre_CSRMatrix *A , hypre_Vector *x , double beta , hypre_Vector *y );
203int hypre_CSRMatrixMatvecT ( double alpha , hypre_CSRMatrix *A , hypre_Vector *x , double beta , hypre_Vector *y );
204int hypre_CSRMatrixMatvec_FF ( double alpha , hypre_CSRMatrix *A , hypre_Vector *x , double beta , hypre_Vector *y , int *CF_marker_x , int *CF_marker_y , int fpt );
205
206/* genpart.c */
207int hypre_GeneratePartitioning ( HYPRE_BigInt length , int num_procs , HYPRE_BigInt **part_ptr );
208int hypre_GenerateLocalPartitioning ( HYPRE_BigInt length , int num_procs , int myid , HYPRE_BigInt **part_ptr );
209
210/* HYPRE_csr_matrix.c */
211HYPRE_CSRMatrix HYPRE_CSRMatrixCreate ( int num_rows , int num_cols , int *row_sizes );
212int HYPRE_CSRMatrixDestroy ( HYPRE_CSRMatrix matrix );
213int HYPRE_CSRMatrixInitialize ( HYPRE_CSRMatrix matrix );
214HYPRE_CSRMatrix HYPRE_CSRMatrixRead ( char *file_name );
215void HYPRE_CSRMatrixPrint ( HYPRE_CSRMatrix matrix , char *file_name );
216int HYPRE_CSRMatrixGetNumRows ( HYPRE_CSRMatrix matrix , int *num_rows );
217
218/* HYPRE_vector.c */
219HYPRE_Vector HYPRE_VectorCreate ( int size );
220int HYPRE_VectorDestroy ( HYPRE_Vector vector );
221int HYPRE_VectorInitialize ( HYPRE_Vector vector );
222int HYPRE_VectorPrint ( HYPRE_Vector vector , char *file_name );
223HYPRE_Vector HYPRE_VectorRead ( char *file_name );
224
225/* vector.c */
226hypre_Vector *hypre_SeqVectorCreate ( int size );
227hypre_Vector *hypre_SeqMultiVectorCreate ( int size , int num_vectors );
228int hypre_SeqVectorDestroy ( hypre_Vector *vector );
229int hypre_SeqVectorInitialize ( hypre_Vector *vector );
230int hypre_SeqVectorSetDataOwner ( hypre_Vector *vector , int owns_data );
231hypre_Vector *hypre_SeqVectorRead ( char *file_name );
232int hypre_SeqVectorPrint ( hypre_Vector *vector , char *file_name );
233int hypre_SeqVectorSetConstantValues ( hypre_Vector *v , double value );
234int hypre_SeqVectorSetRandomValues ( hypre_Vector *v , int seed );
235int hypre_SeqVectorCopy ( hypre_Vector *x , hypre_Vector *y );
236hypre_Vector *hypre_SeqVectorCloneDeep ( hypre_Vector *x );
237hypre_Vector *hypre_SeqVectorCloneShallow ( hypre_Vector *x );
238int hypre_SeqVectorScale ( double alpha , hypre_Vector *y );
239int hypre_SeqVectorAxpy ( double alpha , hypre_Vector *x , hypre_Vector *y );
240double hypre_SeqVectorInnerProd ( hypre_Vector *x , hypre_Vector *y );
241double hypre_VectorSumElts ( hypre_Vector *vector );
242
243#ifdef __cplusplus
244}
245#endif
246
247#endif
248
Note: See TracBrowser for help on using the repository browser.