source: CIVL/examples/mpi-omp/AMG2013/IJ_mv/IJ_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: 19.2 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/*BHEADER**********************************************************************
24 * Copyright (c) 2008, Lawrence Livermore National Security, LLC.
25 * Produced at the Lawrence Livermore National Laboratory.
26 * This file is part of HYPRE. See file COPYRIGHT for details.
27 *
28 * HYPRE is free software; you can redistribute it and/or modify it under the
29 * terms of the GNU Lesser General Public License (as published by the Free
30 * Software Foundation) version 2.1 dated February 1999.
31 *
32 * $Revision: 2.4 $
33 ***********************************************************************EHEADER*/
34/*BHEADER**********************************************************************
35 * Copyright (c) 2008, Lawrence Livermore National Security, LLC.
36 * Produced at the Lawrence Livermore National Laboratory.
37 * This file is part of HYPRE. See file COPYRIGHT for details.
38 *
39 * HYPRE is free software; you can redistribute it and/or modify it under the
40 * terms of the GNU Lesser General Public License (as published by the Free
41 * Software Foundation) version 2.1 dated February 1999.
42 *
43 * $Revision: 2.4 $
44 ***********************************************************************EHEADER*/
45
46/*#include <HYPRE_config.h>*/
47
48#ifndef hypre_IJ_HEADER
49#define hypre_IJ_HEADER
50
51#include "utilities.h"
52#include "seq_mv.h"
53#include "parcsr_mv.h"
54#include "HYPRE_IJ_mv.h"
55
56#ifdef __cplusplus
57extern "C" {
58#endif
59
60
61
62
63
64/******************************************************************************
65 *
66 * Header info for Auxiliary Parallel CSR Matrix data structures
67 *
68 * Note: this matrix currently uses 0-based indexing.
69 *
70 *****************************************************************************/
71
72#ifndef hypre_AUX_PARCSR_MATRIX_HEADER
73#define hypre_AUX_PARCSR_MATRIX_HEADER
74
75/*--------------------------------------------------------------------------
76 * Auxiliary Parallel CSR Matrix
77 *--------------------------------------------------------------------------*/
78
79typedef struct
80{
81 int local_num_rows; /* defines number of rows on this processors */
82 int local_num_cols; /* defines number of cols of diag */
83
84 int need_aux; /* if need_aux = 1, aux_j, aux_data are used to
85 generate the parcsr matrix (default),
86 for need_aux = 0, data is put directly into
87 parcsr structure (requires the knowledge of
88 offd_i and diag_i ) */
89
90 int *row_length; /* row_length_diag[i] contains number of stored
91 elements in i-th row */
92 int *row_space; /* row_space_diag[i] contains space allocated to
93 i-th row */
94 HYPRE_BigInt **aux_j; /* contains collected column indices */
95 double **aux_data; /* contains collected data */
96 int *indx_diag; /* indx_diag[i] points to first empty space of portion
97 in diag_j , diag_data assigned to row i */
98 int *indx_offd; /* indx_offd[i] points to first empty space of portion
99 in offd_j , offd_data assigned to row i */
100 int max_off_proc_elmts; /* length of off processor stash set for
101 SetValues and AddTOValues */
102 int current_num_elmts; /* current no. of elements stored in stash */
103 int off_proc_i_indx; /* pointer to first empty space in
104 set_off_proc_i_set */
105 HYPRE_BigInt *off_proc_i; /* length 2*num_off_procs_elmts, contains info pairs
106 (code, no. of elmts) where code contains global
107 row no. if SetValues, and (-global row no. -1)
108 if AddToValues*/
109 HYPRE_BigInt *off_proc_j; /* contains column indices */
110 double *off_proc_data; /* contains corresponding data */
111 HYPRE_BigInt *aux_offd_j;/* contains collected column indices for immediate
112 insertion into ParCSRMatrix data structure */
113} hypre_AuxParCSRMatrix;
114
115/*--------------------------------------------------------------------------
116 * Accessor functions for the Parallel CSR Matrix structure
117 *--------------------------------------------------------------------------*/
118
119#define hypre_AuxParCSRMatrixLocalNumRows(matrix) ((matrix) -> local_num_rows)
120#define hypre_AuxParCSRMatrixLocalNumCols(matrix) ((matrix) -> local_num_cols)
121
122#define hypre_AuxParCSRMatrixNeedAux(matrix) ((matrix) -> need_aux)
123#define hypre_AuxParCSRMatrixRowLength(matrix) ((matrix) -> row_length)
124#define hypre_AuxParCSRMatrixRowSpace(matrix) ((matrix) -> row_space)
125#define hypre_AuxParCSRMatrixAuxJ(matrix) ((matrix) -> aux_j)
126#define hypre_AuxParCSRMatrixAuxData(matrix) ((matrix) -> aux_data)
127
128#define hypre_AuxParCSRMatrixIndxDiag(matrix) ((matrix) -> indx_diag)
129#define hypre_AuxParCSRMatrixIndxOffd(matrix) ((matrix) -> indx_offd)
130
131#define hypre_AuxParCSRMatrixMaxOffProcElmts(matrix) ((matrix) -> max_off_proc_elmts)
132#define hypre_AuxParCSRMatrixCurrentNumElmts(matrix) ((matrix) -> current_num_elmts)
133#define hypre_AuxParCSRMatrixOffProcIIndx(matrix) ((matrix) -> off_proc_i_indx)
134#define hypre_AuxParCSRMatrixOffProcI(matrix) ((matrix) -> off_proc_i)
135#define hypre_AuxParCSRMatrixOffProcJ(matrix) ((matrix) -> off_proc_j)
136#define hypre_AuxParCSRMatrixOffProcData(matrix) ((matrix) -> off_proc_data)
137#define hypre_AuxParCSRMatrixAuxOffdJ(matrix) ((matrix) -> aux_offd_j)
138
139#endif
140
141
142
143
144/******************************************************************************
145 *
146 * Header info for Auxiliary Parallel Vector data structures
147 *
148 * Note: this vector currently uses 0-based indexing.
149 *
150 *****************************************************************************/
151
152#ifndef hypre_AUX_PAR_VECTOR_HEADER
153#define hypre_AUX_PAR_VECTOR_HEADER
154
155/*--------------------------------------------------------------------------
156 * Auxiliary Parallel Vector
157 *--------------------------------------------------------------------------*/
158
159typedef struct
160{
161 int max_off_proc_elmts; /* length of off processor stash for
162 SetValues and AddToValues*/
163 int current_num_elmts; /* current no. of elements stored in stash */
164 HYPRE_BigInt *off_proc_i; /* contains column indices */
165 double *off_proc_data; /* contains corresponding data */
166} hypre_AuxParVector;
167
168/*--------------------------------------------------------------------------
169 * Accessor functions for the Parallel Vector structure
170 *--------------------------------------------------------------------------*/
171
172#define hypre_AuxParVectorMaxOffProcElmts(matrix) ((matrix) -> max_off_proc_elmts)
173#define hypre_AuxParVectorCurrentNumElmts(matrix) ((matrix) -> current_num_elmts)
174#define hypre_AuxParVectorOffProcI(matrix) ((matrix) -> off_proc_i)
175#define hypre_AuxParVectorOffProcData(matrix) ((matrix) -> off_proc_data)
176
177#endif
178
179
180
181/******************************************************************************
182 *
183 * Header info for the hypre_IJMatrix structures
184 *
185 *****************************************************************************/
186
187#ifndef hypre_IJ_MATRIX_HEADER
188#define hypre_IJ_MATRIX_HEADER
189
190/*--------------------------------------------------------------------------
191 * hypre_IJMatrix:
192 *--------------------------------------------------------------------------*/
193
194typedef struct hypre_IJMatrix_struct
195{
196 MPI_Comm comm;
197
198 HYPRE_BigInt *row_partitioning; /* distribution of rows across processors */
199 HYPRE_BigInt *col_partitioning; /* distribution of columns */
200
201 int object_type; /* Indicates the type of "object" */
202 void *object; /* Structure for storing local portion */
203 void *translator; /* optional storage_type specfic structure
204 for holding additional local info */
205 int assemble_flag; /* indicates whether matrix has been
206 assembled */
207
208 HYPRE_BigInt global_first_row; /* these data items are necessary */
209 HYPRE_BigInt global_first_col; /* to be able to avoid using the */
210 HYPRE_BigInt global_num_rows; /* global partition */
211 HYPRE_BigInt global_num_cols;
212
213
214
215} hypre_IJMatrix;
216
217/*--------------------------------------------------------------------------
218 * Accessor macros: hypre_IJMatrix
219 *--------------------------------------------------------------------------*/
220
221#define hypre_IJMatrixComm(matrix) ((matrix) -> comm)
222
223#define hypre_IJMatrixRowPartitioning(matrix) ((matrix) -> row_partitioning)
224#define hypre_IJMatrixColPartitioning(matrix) ((matrix) -> col_partitioning)
225
226#define hypre_IJMatrixObjectType(matrix) ((matrix) -> object_type)
227#define hypre_IJMatrixObject(matrix) ((matrix) -> object)
228#define hypre_IJMatrixTranslator(matrix) ((matrix) -> translator)
229
230#define hypre_IJMatrixAssembleFlag(matrix) ((matrix) -> assemble_flag)
231
232
233#define hypre_IJMatrixGlobalFirstRow(matrix) ((matrix) -> global_first_row)
234#define hypre_IJMatrixGlobalFirstCol(matrix) ((matrix) -> global_first_col)
235#define hypre_IJMatrixGlobalNumRows(matrix) ((matrix) -> global_num_rows)
236#define hypre_IJMatrixGlobalNumCols(matrix) ((matrix) -> global_num_cols)
237
238/*--------------------------------------------------------------------------
239 * prototypes for operations on local objects
240 *--------------------------------------------------------------------------*/
241
242#ifdef PETSC_AVAILABLE
243/* IJMatrix_petsc.c */
244int
245hypre_GetIJMatrixParCSRMatrix( HYPRE_IJMatrix IJmatrix, Mat *reference )
246#endif
247
248#ifdef ISIS_AVAILABLE
249/* IJMatrix_isis.c */
250int
251hypre_GetIJMatrixISISMatrix( HYPRE_IJMatrix IJmatrix, RowMatrix *reference )
252#endif
253
254#endif
255
256
257
258/******************************************************************************
259 *
260 * Header info for the hypre_IJMatrix structures
261 *
262 *****************************************************************************/
263
264#ifndef hypre_IJ_VECTOR_HEADER
265#define hypre_IJ_VECTOR_HEADER
266
267/*--------------------------------------------------------------------------
268 * hypre_IJVector:
269 *--------------------------------------------------------------------------*/
270
271typedef struct hypre_IJVector_struct
272{
273 MPI_Comm comm;
274
275 HYPRE_BigInt *partitioning; /* Indicates partitioning over tasks */
276
277 int object_type; /* Indicates the type of "local storage" */
278
279 void *object; /* Structure for storing local portion */
280
281 void *translator; /* Structure for storing off processor
282 information */
283
284 HYPRE_BigInt global_first_row; /* these data items are necessary */
285 HYPRE_BigInt global_num_rows; /* to be able to avoid using the */
286 /* global partition */
287
288
289
290
291} hypre_IJVector;
292
293/*--------------------------------------------------------------------------
294 * Accessor macros: hypre_IJVector
295 *--------------------------------------------------------------------------*/
296
297#define hypre_IJVectorComm(vector) ((vector) -> comm)
298
299#define hypre_IJVectorPartitioning(vector) ((vector) -> partitioning)
300
301#define hypre_IJVectorObjectType(vector) ((vector) -> object_type)
302
303#define hypre_IJVectorObject(vector) ((vector) -> object)
304
305#define hypre_IJVectorTranslator(vector) ((vector) -> translator)
306
307#define hypre_IJVectorGlobalFirstRow(vector) ((vector) -> global_first_row)
308
309#define hypre_IJVectorGlobalNumRows(vector) ((vector) -> global_num_rows)
310
311/*--------------------------------------------------------------------------
312 * prototypes for operations on local objects
313 *--------------------------------------------------------------------------*/
314/* #include "./internal_protos.h" */
315
316#endif
317
318/* aux_parcsr_matrix.c */
319int hypre_AuxParCSRMatrixCreate ( hypre_AuxParCSRMatrix **aux_matrix , int local_num_rows , int local_num_cols , int *sizes );
320int hypre_AuxParCSRMatrixDestroy ( hypre_AuxParCSRMatrix *matrix );
321int hypre_AuxParCSRMatrixInitialize ( hypre_AuxParCSRMatrix *matrix );
322int hypre_AuxParCSRMatrixSetMaxOffPRocElmts ( hypre_AuxParCSRMatrix *matrix , int max_off_proc_elmts );
323
324/* aux_par_vector.c */
325int hypre_AuxParVectorCreate ( hypre_AuxParVector **aux_vector );
326int hypre_AuxParVectorDestroy ( hypre_AuxParVector *vector );
327int hypre_AuxParVectorInitialize ( hypre_AuxParVector *vector );
328int hypre_AuxParVectorSetMaxOffPRocElmts ( hypre_AuxParVector *vector , int max_off_proc_elmts );
329
330/* IJMatrix.c */
331int hypre_IJMatrixGetRowPartitioning ( HYPRE_IJMatrix matrix , HYPRE_BigInt **row_partitioning );
332int hypre_IJMatrixGetColPartitioning ( HYPRE_IJMatrix matrix , HYPRE_BigInt **col_partitioning );
333int hypre_IJMatrixSetObject ( HYPRE_IJMatrix matrix , void *object );
334
335/* IJMatrix_parcsr.c */
336int hypre_IJMatrixCreateParCSR ( hypre_IJMatrix *matrix );
337int hypre_IJMatrixSetRowSizesParCSR ( hypre_IJMatrix *matrix , const int *sizes );
338int hypre_IJMatrixSetDiagOffdSizesParCSR ( hypre_IJMatrix *matrix , const int *diag_sizes , const int *offdiag_sizes );
339int hypre_IJMatrixSetMaxOffProcElmtsParCSR ( hypre_IJMatrix *matrix , int max_off_proc_elmts );
340int hypre_IJMatrixInitializeParCSR ( hypre_IJMatrix *matrix );
341int hypre_IJMatrixGetRowCountsParCSR ( hypre_IJMatrix *matrix , int nrows , HYPRE_BigInt *rows , int *ncols );
342int hypre_IJMatrixGetValuesParCSR ( hypre_IJMatrix *matrix , int nrows , int *ncols , HYPRE_BigInt *rows , HYPRE_BigInt *cols , double *values );
343int hypre_IJMatrixSetValuesParCSR ( hypre_IJMatrix *matrix , int nrows , int *ncols , const HYPRE_BigInt *rows , const HYPRE_BigInt *cols , const double *values );
344int hypre_IJMatrixAddToValuesParCSR ( hypre_IJMatrix *matrix , int nrows , int *ncols , const HYPRE_BigInt *rows , const HYPRE_BigInt *cols , const double *values );
345int hypre_IJMatrixAssembleParCSR ( hypre_IJMatrix *matrix );
346int hypre_IJMatrixDestroyParCSR ( hypre_IJMatrix *matrix );
347int hypre_IJMatrixAssembleOffProcValsParCSR ( hypre_IJMatrix *matrix , int off_proc_i_indx , int max_off_proc_elmts , int current_num_elmts , HYPRE_BigInt *off_proc_i , HYPRE_BigInt *off_proc_j , double *off_proc_data );
348int hypre_FillResponseIJOffProcVals ( void *p_recv_contact_buf , int contact_size , int contact_proc , void *ro , MPI_Comm comm , void **p_send_response_buf , int *response_message_size );
349int hypre_FillResponseIJOffProcValsDouble ( void *p_recv_contact_buf , int contact_size , int contact_proc , void *ro , MPI_Comm comm , void **p_send_response_buf , int *response_message_size );
350int hypre_FindProc ( HYPRE_BigInt *list , HYPRE_BigInt value , int list_length );
351
352/* IJVector.c */
353int hypre_IJVectorDistribute ( HYPRE_IJVector vector , const HYPRE_BigInt *vec_starts );
354int hypre_IJVectorZeroValues ( HYPRE_IJVector vector );
355int hypre_IJVectorDistributePar(hypre_IJVector *vector, const int *vec_starts);
356
357/* IJVector_parcsr.c */
358int hypre_IJVectorCreatePar ( hypre_IJVector *vector , HYPRE_BigInt *IJpartitioning );
359int hypre_IJVectorDestroyPar ( hypre_IJVector *vector );
360int hypre_IJVectorInitializePar ( hypre_IJVector *vector );
361int hypre_IJVectorSetMaxOffProcElmtsPar ( hypre_IJVector *vector , int max_off_proc_elmts );
362int hypre_IJVectorZeroValuesPar ( hypre_IJVector *vector );
363int hypre_IJVectorSetValuesPar ( hypre_IJVector *vector , int num_values , const HYPRE_BigInt *indices , const double *values );
364int hypre_IJVectorAddToValuesPar ( hypre_IJVector *vector , int num_values , const HYPRE_BigInt *indices , const double *values );
365int hypre_IJVectorAssemblePar ( hypre_IJVector *vector );
366int hypre_IJVectorGetValuesPar ( hypre_IJVector *vector , int num_values , const HYPRE_BigInt *indices , double *values );
367int hypre_IJVectorAssembleOffProcValsPar ( hypre_IJVector *vector , int max_off_proc_elmts , int current_num_elmts , HYPRE_BigInt *off_proc_i , double *off_proc_data );
368
369/* HYPRE_IJMatrix.c */
370int HYPRE_IJMatrixCreate ( MPI_Comm comm , HYPRE_BigInt ilower , HYPRE_BigInt iupper , HYPRE_BigInt jlower , HYPRE_BigInt jupper , HYPRE_IJMatrix *matrix );
371int HYPRE_IJMatrixDestroy ( HYPRE_IJMatrix matrix );
372int HYPRE_IJMatrixInitialize ( HYPRE_IJMatrix matrix );
373int HYPRE_IJMatrixSetValues ( HYPRE_IJMatrix matrix , int nrows , int *ncols , const HYPRE_BigInt *rows , const HYPRE_BigInt *cols , const double *values );
374int HYPRE_IJMatrixAddToValues ( HYPRE_IJMatrix matrix , int nrows , int *ncols , const HYPRE_BigInt *rows , const HYPRE_BigInt *cols , const double *values );
375int HYPRE_IJMatrixAssemble ( HYPRE_IJMatrix matrix );
376int HYPRE_IJMatrixGetRowCounts ( HYPRE_IJMatrix matrix , int nrows , HYPRE_BigInt *rows , int *ncols );
377int HYPRE_IJMatrixGetValues ( HYPRE_IJMatrix matrix , int nrows , int *ncols , HYPRE_BigInt *rows , HYPRE_BigInt *cols , double *values );
378int HYPRE_IJMatrixSetObjectType ( HYPRE_IJMatrix matrix , int type );
379int HYPRE_IJMatrixGetObjectType ( HYPRE_IJMatrix matrix , int *type );
380int HYPRE_IJMatrixGetLocalRange ( HYPRE_IJMatrix matrix , HYPRE_BigInt *ilower , HYPRE_BigInt *iupper , HYPRE_BigInt *jlower , HYPRE_BigInt *jupper );
381int HYPRE_IJMatrixGetObject ( HYPRE_IJMatrix matrix , void **object );
382int HYPRE_IJMatrixSetRowSizes ( HYPRE_IJMatrix matrix , const int *sizes );
383int HYPRE_IJMatrixSetDiagOffdSizes ( HYPRE_IJMatrix matrix , const int *diag_sizes , const int *offdiag_sizes );
384int HYPRE_IJMatrixSetMaxOffProcElmts ( HYPRE_IJMatrix matrix , int max_off_proc_elmts );
385int HYPRE_IJMatrixRead ( const char *filename , MPI_Comm comm , int type , HYPRE_IJMatrix *matrix_ptr );
386int HYPRE_IJMatrixPrint ( HYPRE_IJMatrix matrix , const char *filename );
387
388/* HYPRE_IJVector.c */
389int HYPRE_IJVectorCreate ( MPI_Comm comm , HYPRE_BigInt jlower , HYPRE_BigInt jupper , HYPRE_IJVector *vector );
390int HYPRE_IJVectorDestroy ( HYPRE_IJVector vector );
391int HYPRE_IJVectorInitialize ( HYPRE_IJVector vector );
392int HYPRE_IJVectorSetValues ( HYPRE_IJVector vector , int nvalues , const HYPRE_BigInt *indices , const double *values );
393int HYPRE_IJVectorAddToValues ( HYPRE_IJVector vector , int nvalues , const HYPRE_BigInt *indices , const double *values );
394int HYPRE_IJVectorAssemble ( HYPRE_IJVector vector );
395int HYPRE_IJVectorGetValues ( HYPRE_IJVector vector , int nvalues , const HYPRE_BigInt *indices , double *values );
396int HYPRE_IJVectorSetMaxOffProcElmts ( HYPRE_IJVector vector , int max_off_proc_elmts );
397int HYPRE_IJVectorSetObjectType ( HYPRE_IJVector vector , int type );
398int HYPRE_IJVectorGetObjectType ( HYPRE_IJVector vector , int *type );
399int HYPRE_IJVectorGetLocalRange ( HYPRE_IJVector vector , HYPRE_BigInt *jlower , HYPRE_BigInt *jupper );
400int HYPRE_IJVectorGetObject ( HYPRE_IJVector vector , void **object );
401int HYPRE_IJVectorRead ( const char *filename , MPI_Comm comm , int type , HYPRE_IJVector *vector_ptr );
402int HYPRE_IJVectorPrint ( HYPRE_IJVector vector , const char *filename );
403
404#ifdef __cplusplus
405}
406#endif
407
408#endif
409
Note: See TracBrowser for help on using the repository browser.