MFEM  v3.3.2
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_HPP
13 #define MFEM_HYPRE_PARCSR_HPP
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. The col_map_offd do not
95  need to be the same, but a more efficient algorithm is used if that's the
96  case. */
97 hypre_ParCSRMatrix *
98 hypre_ParCSRMatrixAdd(hypre_ParCSRMatrix *A,
99  hypre_ParCSRMatrix *B);
100 
101 /** Perform the operation A += beta*B, assuming that both matrices use the same
102  row and column partitions and the same col_map_offd arrays. We also assume
103  that the sparsity pattern of A contains that of B. */
104 HYPRE_Int
105 hypre_ParCSRMatrixSum(hypre_ParCSRMatrix *A,
106  HYPRE_Complex beta,
107  hypre_ParCSRMatrix *B);
108 
109 /** Initialize all entries of A with value. */
110 HYPRE_Int
111 hypre_CSRMatrixSetConstantValues(hypre_CSRMatrix *A,
112  HYPRE_Complex value);
113 
114 /** Initialize all entries of A with value. */
115 HYPRE_Int
116 hypre_ParCSRMatrixSetConstantValues(hypre_ParCSRMatrix *A,
117  HYPRE_Complex value);
118 
119 } // namespace mfem::internal
120 
121 } // namespace mfem
122 
123 #endif // MFEM_USE_MPI
124 
125 #endif
const double alpha
Definition: ex15.cpp:337