MFEM  v3.3
Finite element discretization library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
hypre_parcsr.hpp
Go to the documentation of this file.
1 // Copyright (c) 2010, Lawrence Livermore National Security, LLC. Produced at
2 // the Lawrence Livermore National Laboratory. LLNL-CODE-443211. All Rights
3 // reserved. See file COPYRIGHT for details.
4 //
5 // This file is part of the MFEM library. For more information and source code
6 // availability see http://mfem.org.
7 //
8 // MFEM is free software; you can redistribute it and/or modify it under the
9 // terms of the GNU Lesser General Public License (as published by the Free
10 // Software Foundation) version 2.1 dated February 1999.
11 
12 #ifndef MFEM_HYPRE_PARCSR
13 #define MFEM_HYPRE_PARCSR
14 
15 #include "../config/config.hpp"
16 
17 #ifdef MFEM_USE_MPI
18 
19 // Enable internal hypre timing routines
20 #define HYPRE_TIMING
21 
22 #include "_hypre_parcsr_mv.h"
23 
24 namespace mfem
25 {
26 
27 // This module contains functions that are logically part of HYPRE, and might
28 // become part of HYPRE at some point. In the meantime the module can be
29 // thought of as an extension of HYPRE.
30 
31 namespace internal
32 {
33 
34 /** Parallel essential BC elimination from the system A*X = B.
35  (Adapted from hypre_ParCSRMatrixEliminateRowsCols.) */
36 void hypre_ParCSRMatrixEliminateAXB(hypre_ParCSRMatrix *A,
37  HYPRE_Int num_rowscols_to_elim,
38  HYPRE_Int *rowscols_to_elim,
39  hypre_ParVector *X,
40  hypre_ParVector *B);
41 
42 /** Parallel essential BC elimination from matrix A only. The eliminated
43  elements are stored in a new matrix Ae, so that (A + Ae) equals the original
44  matrix A. */
45 void hypre_ParCSRMatrixEliminateAAe(hypre_ParCSRMatrix *A,
46  hypre_ParCSRMatrix **Ae,
47  HYPRE_Int num_rowscols_to_elim,
48  HYPRE_Int *rowscols_to_elim);
49 
50 /** Split matrix 'A' into nr x nc blocks, return nr x nc pointers to
51  new parallel matrices. The array 'blocks' needs to be preallocated to hold
52  nr x nc pointers. If 'interleaved' == 0 the matrix is split into contiguous
53  blocks (AAABBBCCC) otherwise the blocks are interleaved (ABCABCABC).
54  The local number of rows of A must be divisible by nr. The local number of
55  columns of A must be divisible by nc. */
56 void hypre_ParCSRMatrixSplit(hypre_ParCSRMatrix *A,
57  HYPRE_Int nr, HYPRE_Int nc,
58  hypre_ParCSRMatrix **blocks,
59  int interleaved_rows, int interleaved_cols);
60 
61 typedef int HYPRE_Bool;
62 #define HYPRE_MPI_BOOL MPI_INT
63 
64 /** The "Boolean" analog of y = alpha * A * x + beta * y, where elements in the
65  sparsity pattern of the CSR matrix A are treated as "true". */
66 void hypre_CSRMatrixBooleanMatvec(hypre_CSRMatrix *A,
67  HYPRE_Bool alpha,
68  HYPRE_Bool *x,
69  HYPRE_Bool beta,
70  HYPRE_Bool *y);
71 
72 hypre_ParCSRCommHandle *
73 hypre_ParCSRCommHandleCreate_bool(HYPRE_Int job,
74  hypre_ParCSRCommPkg *comm_pkg,
75  HYPRE_Bool *send_data,
76  HYPRE_Bool *recv_data);
77 
78 /** The "Boolean" analog of y = alpha * A * x + beta * y, where elements in the
79  sparsity pattern of the ParCSR matrix A are treated as "true". */
80 void hypre_ParCSRMatrixBooleanMatvec(hypre_ParCSRMatrix *A,
81  HYPRE_Bool alpha,
82  HYPRE_Bool *x,
83  HYPRE_Bool beta,
84  HYPRE_Bool *y);
85 
86 /** Perform the operation A += beta*B, assuming that the sparsity pattern of A
87  contains that of B. */
88 HYPRE_Int
89 hypre_CSRMatrixSum(hypre_CSRMatrix *A,
90  HYPRE_Complex beta,
91  hypre_CSRMatrix *B);
92 
93 /** Return a new matrix containing the sum of A and B, assuming that both
94  matrices use the same row and column partitions and the same col_map_offd
95  arrays. */
96 hypre_ParCSRMatrix *
97 hypre_ParCSRMatrixAdd(hypre_ParCSRMatrix *A,
98  hypre_ParCSRMatrix *B);
99 
100 /** Perform the operation A += beta*B, assuming that both matrices use the same
101  row and column partitions and the same col_map_offd arrays. We also assume
102  that the sparsity pattern of A contains that of B. */
103 HYPRE_Int
104 hypre_ParCSRMatrixSum(hypre_ParCSRMatrix *A,
105  HYPRE_Complex beta,
106  hypre_ParCSRMatrix *B);
107 
108 /** Initialize all entries of A with value. */
109 HYPRE_Int
110 hypre_CSRMatrixSetConstantValues(hypre_CSRMatrix *A,
111  HYPRE_Complex value);
112 
113 /** Initialize all entries of A with value. */
114 HYPRE_Int
115 hypre_ParCSRMatrixSetConstantValues(hypre_ParCSRMatrix *A,
116  HYPRE_Complex value);
117 
118 } // namespace mfem::internal
119 
120 } // namespace mfem
121 
122 #endif // MFEM_USE_MPI
123 
124 #endif
const double alpha
Definition: ex15.cpp:337