source: CIVL/examples/mpi-omp/AMG2013/struct_mv/HYPRE_struct_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: 14.3 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
13
14
15#ifndef HYPRE_STRUCT_MV_HEADER
16#define HYPRE_STRUCT_MV_HEADER
17
18#include "HYPRE_utilities.h"
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24/*--------------------------------------------------------------------------
25 *--------------------------------------------------------------------------*/
26
27/**
28 * @name Struct System Interface
29 *
30 * This interface represents a structured-grid conceptual view of a linear
31 * system.
32 *
33 * @memo A structured-grid conceptual interface
34 **/
35/*@{*/
36
37/*--------------------------------------------------------------------------
38 *--------------------------------------------------------------------------*/
39
40/**
41 * @name Struct Grids
42 **/
43/*@{*/
44
45struct hypre_StructGrid_struct;
46/**
47 * A grid object is constructed out of several ``boxes'', defined on a global
48 * abstract index space.
49 **/
50typedef struct hypre_StructGrid_struct *HYPRE_StructGrid;
51
52/**
53 * Create an {\tt ndim}-dimensional grid object.
54 **/
55int HYPRE_StructGridCreate(MPI_Comm comm,
56 int ndim,
57 HYPRE_StructGrid *grid);
58
59/**
60 * Destroy a grid object. An object should be explicitly destroyed using this
61 * destructor when the user's code no longer needs direct access to it. Once
62 * destroyed, the object must not be referenced again. Note that the object may
63 * not be deallocated at the completion of this call, since there may be
64 * internal package references to the object. The object will then be destroyed
65 * when all internal reference counts go to zero.
66 **/
67int HYPRE_StructGridDestroy(HYPRE_StructGrid grid);
68
69/**
70 * Set the extents for a box on the grid.
71 **/
72int HYPRE_StructGridSetExtents(HYPRE_StructGrid grid,
73 int *ilower,
74 int *iupper);
75
76/**
77 * Finalize the construction of the grid before using.
78 **/
79int HYPRE_StructGridAssemble(HYPRE_StructGrid grid);
80
81/**
82 * Set periodic.
83 **/
84int HYPRE_StructGridSetPeriodic(HYPRE_StructGrid grid,
85 int *periodic);
86
87/**
88 * Set the ghost layer in the grid object
89 **/
90int HYPRE_StructGridSetNumGhost(HYPRE_StructGrid grid,
91 int *num_ghost);
92
93/*@}*/
94
95/*--------------------------------------------------------------------------
96 *--------------------------------------------------------------------------*/
97
98/**
99 * @name Struct Stencils
100 **/
101/*@{*/
102
103struct hypre_StructStencil_struct;
104/**
105 * The stencil object.
106 **/
107typedef struct hypre_StructStencil_struct *HYPRE_StructStencil;
108
109/**
110 * Create a stencil object for the specified number of spatial dimensions and
111 * stencil entries.
112 **/
113int HYPRE_StructStencilCreate(int ndim,
114 int size,
115 HYPRE_StructStencil *stencil);
116
117/**
118 * Destroy a stencil object.
119 **/
120int HYPRE_StructStencilDestroy(HYPRE_StructStencil stencil);
121
122/**
123 * Set a stencil entry.
124 *
125 * NOTE: The name of this routine will eventually be changed to {\tt
126 * HYPRE\_StructStencilSetEntry}.
127 **/
128int HYPRE_StructStencilSetElement(HYPRE_StructStencil stencil,
129 int entry,
130 int *offset);
131
132/*@}*/
133
134/*--------------------------------------------------------------------------
135 *--------------------------------------------------------------------------*/
136
137/**
138 * @name Struct Matrices
139 **/
140/*@{*/
141
142struct hypre_StructMatrix_struct;
143/**
144 * The matrix object.
145 **/
146typedef struct hypre_StructMatrix_struct *HYPRE_StructMatrix;
147
148/**
149 * Create a matrix object.
150 **/
151int HYPRE_StructMatrixCreate(MPI_Comm comm,
152 HYPRE_StructGrid grid,
153 HYPRE_StructStencil stencil,
154 HYPRE_StructMatrix *matrix);
155
156/**
157 * Destroy a matrix object.
158 **/
159int HYPRE_StructMatrixDestroy(HYPRE_StructMatrix matrix);
160
161/**
162 * Prepare a matrix object for setting coefficient values.
163 **/
164int HYPRE_StructMatrixInitialize(HYPRE_StructMatrix matrix);
165
166/**
167 * Set matrix coefficients index by index. The {\tt values} array is of length
168 * {\tt nentries}.
169 *
170 * NOTE: For better efficiency, use \Ref{HYPRE_StructMatrixSetBoxValues} to set
171 * coefficients a box at a time.
172 **/
173int HYPRE_StructMatrixSetValues(HYPRE_StructMatrix matrix,
174 int *index,
175 int nentries,
176 int *entries,
177 double *values);
178
179/**
180 * Add to matrix coefficients index by index. The {\tt values} array is of
181 * length {\tt nentries}.
182 *
183 * NOTE: For better efficiency, use \Ref{HYPRE_StructMatrixAddToBoxValues} to
184 * set coefficients a box at a time.
185 **/
186int HYPRE_StructMatrixAddToValues(HYPRE_StructMatrix matrix,
187 int *index,
188 int nentries,
189 int *entries,
190 double *values);
191
192/**
193 * Set matrix coefficients which are constant over the grid. The {\tt values}
194 * array is of length {\tt nentries}.
195 **/
196int HYPRE_StructMatrixSetConstantValues(HYPRE_StructMatrix matrix,
197 int nentries,
198 int *entries,
199 double *values);
200/**
201 * Add to matrix coefficients which are constant over the grid. The {\tt
202 * values} array is of length {\tt nentries}.
203 **/
204int HYPRE_StructMatrixAddToConstantValues(HYPRE_StructMatrix matrix,
205 int nentries,
206 int *entries,
207 double *values);
208
209/**
210 * Set matrix coefficients a box at a time. The data in {\tt values} is ordered
211 * as follows:
212 *
213 \begin{verbatim}
214 m = 0;
215 for (k = ilower[2]; k <= iupper[2]; k++)
216 for (j = ilower[1]; j <= iupper[1]; j++)
217 for (i = ilower[0]; i <= iupper[0]; i++)
218 for (entry = 0; entry < nentries; entry++)
219 {
220 values[m] = ...;
221 m++;
222 }
223 \end{verbatim}
224 **/
225int HYPRE_StructMatrixSetBoxValues(HYPRE_StructMatrix matrix,
226 int *ilower,
227 int *iupper,
228 int nentries,
229 int *entries,
230 double *values);
231/**
232 * Add to matrix coefficients a box at a time. The data in {\tt values} is
233 * ordered as in \Ref{HYPRE_StructMatrixSetBoxValues}.
234 **/
235int HYPRE_StructMatrixAddToBoxValues(HYPRE_StructMatrix matrix,
236 int *ilower,
237 int *iupper,
238 int nentries,
239 int *entries,
240 double *values);
241
242/**
243 * Finalize the construction of the matrix before using.
244 **/
245int HYPRE_StructMatrixAssemble(HYPRE_StructMatrix matrix);
246
247/**
248 * Define symmetry properties of the matrix. By default, matrices are assumed
249 * to be nonsymmetric. Significant storage savings can be made if the matrix is
250 * symmetric.
251 **/
252int HYPRE_StructMatrixSetSymmetric(HYPRE_StructMatrix matrix,
253 int symmetric);
254
255/**
256 * Specify which stencil entries are constant over the grid. Declaring entries
257 * to be ``constant over the grid'' yields significant memory savings because
258 * the value for each declared entry will only be stored once. However, not all
259 * solvers are able to utilize this feature.
260 *
261 * Presently supported:
262 * \begin{itemize}
263 * \item no entries constant (this function need not be called)
264 * \item all entries constant
265 * \item all but the diagonal entry constant
266 * \end{itemize}
267 **/
268int HYPRE_StructMatrixSetConstantEntries( HYPRE_StructMatrix matrix,
269 int nentries,
270 int *entries );
271
272/**
273 * Set the ghost layer in the matrix
274 **/
275int HYPRE_StructMatrixSetNumGhost(HYPRE_StructMatrix matrix,
276 int *num_ghost);
277
278
279/**
280 * Print the matrix to file. This is mainly for debugging purposes.
281 **/
282int HYPRE_StructMatrixPrint(const char *filename,
283 HYPRE_StructMatrix matrix,
284 int all);
285
286/*@}*/
287
288/*--------------------------------------------------------------------------
289 *--------------------------------------------------------------------------*/
290
291/**
292 * @name Struct Vectors
293 **/
294/*@{*/
295
296struct hypre_StructVector_struct;
297/**
298 * The vector object.
299 **/
300typedef struct hypre_StructVector_struct *HYPRE_StructVector;
301
302/**
303 * Create a vector object.
304 **/
305int HYPRE_StructVectorCreate(MPI_Comm comm,
306 HYPRE_StructGrid grid,
307 HYPRE_StructVector *vector);
308
309/**
310 * Destroy a vector object.
311 **/
312int HYPRE_StructVectorDestroy(HYPRE_StructVector vector);
313
314/**
315 * Prepare a vector object for setting coefficient values.
316 **/
317int HYPRE_StructVectorInitialize(HYPRE_StructVector vector);
318
319/**
320 * Clears the ghostvalues of vector object. Beneficial to users that re-assemble
321 * a vector object (e.g., in time-stepping).
322 **/
323int HYPRE_StructVectorClearGhostValues(HYPRE_StructVector vector);
324
325
326/**
327 * Set vector coefficients index by index.
328 *
329 * NOTE: For better efficiency, use \Ref{HYPRE_StructVectorSetBoxValues} to set
330 * coefficients a box at a time.
331 **/
332int HYPRE_StructVectorSetValues(HYPRE_StructVector vector,
333 int *index,
334 double value);
335
336/**
337 * Add to vector coefficients index by index.
338 *
339 * NOTE: For better efficiency, use \Ref{HYPRE_StructVectorAddToBoxValues} to
340 * set coefficients a box at a time.
341 **/
342int HYPRE_StructVectorAddToValues(HYPRE_StructVector vector,
343 int *index,
344 double value);
345
346/**
347 * Set vector coefficients a box at a time. The data in {\tt values} is ordered
348 * as follows:
349 *
350 \begin{verbatim}
351 m = 0;
352 for (k = ilower[2]; k <= iupper[2]; k++)
353 for (j = ilower[1]; j <= iupper[1]; j++)
354 for (i = ilower[0]; i <= iupper[0]; i++)
355 {
356 values[m] = ...;
357 m++;
358 }
359 \end{verbatim}
360 **/
361int HYPRE_StructVectorSetBoxValues(HYPRE_StructVector vector,
362 int *ilower,
363 int *iupper,
364 double *values);
365/**
366 * Add to vector coefficients a box at a time. The data in {\tt values} is
367 * ordered as in \Ref{HYPRE_StructVectorSetBoxValues}.
368 **/
369int HYPRE_StructVectorAddToBoxValues(HYPRE_StructVector vector,
370 int *ilower,
371 int *iupper,
372 double *values);
373
374/**
375 * Finalize the construction of the vector before using.
376 **/
377int HYPRE_StructVectorAssemble(HYPRE_StructVector vector);
378
379/**
380 * Get vector coefficients index by index.
381 *
382 * NOTE: For better efficiency, use \Ref{HYPRE_StructVectorGetBoxValues} to get
383 * coefficients a box at a time.
384 **/
385int HYPRE_StructVectorGetValues(HYPRE_StructVector vector,
386 int *index,
387 double *value);
388
389/**
390 * Get vector coefficients a box at a time. The data in {\tt values} is ordered
391 * as in \Ref{HYPRE_StructVectorSetBoxValues}.
392 **/
393int HYPRE_StructVectorGetBoxValues(HYPRE_StructVector vector,
394 int *ilower,
395 int *iupper,
396 double *values);
397
398/**
399 * Print the vector to file. This is mainly for debugging purposes.
400 **/
401int HYPRE_StructVectorPrint(const char *filename,
402 HYPRE_StructVector vector,
403 int all);
404
405/*@}*/
406/*@}*/
407
408/*--------------------------------------------------------------------------
409 * Miscellaneous: These probably do not belong in the interface.
410 *--------------------------------------------------------------------------*/
411
412int HYPRE_StructMatrixGetGrid(HYPRE_StructMatrix matrix,
413 HYPRE_StructGrid *grid);
414
415struct hypre_CommPkg_struct;
416typedef struct hypre_CommPkg_struct *HYPRE_CommPkg;
417
418int HYPRE_StructVectorSetNumGhost(HYPRE_StructVector vector,
419 int *num_ghost);
420
421int HYPRE_StructVectorSetConstantValues(HYPRE_StructVector vector,
422 double values);
423
424int HYPRE_StructVectorGetMigrateCommPkg(HYPRE_StructVector from_vector,
425 HYPRE_StructVector to_vector,
426 HYPRE_CommPkg *comm_pkg);
427
428int HYPRE_StructVectorMigrate(HYPRE_CommPkg comm_pkg,
429 HYPRE_StructVector from_vector,
430 HYPRE_StructVector to_vector);
431
432int HYPRE_CommPkgDestroy(HYPRE_CommPkg comm_pkg);
433
434/*--------------------------------------------------------------------------
435 *--------------------------------------------------------------------------*/
436
437#ifdef __cplusplus
438}
439#endif
440
441#endif
442
Note: See TracBrowser for help on using the repository browser.