Debian Codegraph @

include/deal.II/lac/generic_linear_algebra.h

raw
1 // ------------------------------------------------------------------------
2 //
3 // SPDX-License-Identifier: LGPL-2.1-or-later
4 // Copyright (C) 2012 - 2025 by the deal.II authors
5 //
6 // This file is part of the deal.II library.
7 //
8 // Part of the source code is dual licensed under Apache-2.0 WITH
9 // LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10 // governing the source code and code contributions can be found in
11 // LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12 //
13 // ------------------------------------------------------------------------
14
15 #ifndef dealii_generic_linear_algebra_h
16 #define dealii_generic_linear_algebra_h
17
18 #include <deal.II/base/config.h>
19
20 #include <deal.II/lac/block_sparse_matrix.h>
21 #include <deal.II/lac/block_sparsity_pattern.h>
22 #include <deal.II/lac/block_vector.h>
23 #include <deal.II/lac/precondition.h>
24 #include <deal.II/lac/sparse_matrix.h>
25 #include <deal.II/lac/vector.h>
26
27 #ifdef DEAL_II_WITH_PETSC
28 # include <deal.II/lac/petsc_block_sparse_matrix.h>
29 # include <deal.II/lac/petsc_precondition.h>
30 # include <deal.II/lac/petsc_solver.h>
31 # include <deal.II/lac/petsc_sparse_matrix.h>
32 #endif
33
34 #ifdef DEAL_II_WITH_TRILINOS
35 # include <deal.II/lac/trilinos_block_sparse_matrix.h>
36 # include <deal.II/lac/trilinos_precondition.h>
37 # include <deal.II/lac/trilinos_solver.h>
38 # include <deal.II/lac/trilinos_sparse_matrix.h>
39 #endif
40
41
42 DEAL_II_NAMESPACE_OPEN
43
44 /**
45 * A namespace in which the deal.II linear algebra classes are aliased to
46 * generic names. There are similar namespaces LinearAlgebraPETSc and
47 * LinearAlgebraTrilinos for alias to classes that interface with the PETSc
48 * and Trilinos libraries.
49 */
50 namespace LinearAlgebraDealII
51 {
52 /**
53 * Typedef for the vector type used
54 */
55 using Vector = Vector<double>;
56
57 /**
58 * Typedef for the block-vector type used
59 */
60 using BlockVector = BlockVector<double>;
61
62 /**
63 * Typedef for sparse matrix type used
64 */
65 using SparseMatrix = SparseMatrix<double>;
66
67 /**
68 * Typedef describing sparse matrices that consist of multiple blocks.
69 */
70 using BlockSparseMatrix = BlockSparseMatrix<double>;
71
72 /**
73 * Typedef for the SSOR preconditioner used
74 */
75 using PreconditionSSOR = PreconditionSSOR<SparseMatrix>;
76 } // namespace LinearAlgebraDealII
77
78
79 #ifdef DEAL_II_WITH_PETSC
80
81 /**
82 * A namespace in which the wrappers to the PETSc linear algebra classes are
83 * aliased to generic names. There are similar namespaces
84 * LinearAlgebraDealII and LinearAlgebraTrilinos for alias to deal.II's own
85 * classes and classes that interface with Trilinos.
86 */
87 namespace LinearAlgebraPETSc
88 {
89 /**
90 * Typedef for the CG solver type used.
91 */
92 using SolverCG = PETScWrappers::SolverCG;
93
94 /**
95 * Typedef for the GMRES solver type used.
96 */
97 using SolverGMRES = PETScWrappers::SolverGMRES;
98
99 /**
100 * A namespace with alias to generic names for parallel PETSc linear
101 * algebra objects.
102 */
103 namespace MPI
104 {
105 /**
106 * Typedef for the vector type used.
107 */
108 using Vector = PETScWrappers::MPI::Vector;
109
110 /**
111 * Typedef for the type used to describe vectors that consist of multiple
112 * blocks.
113 */
114 using BlockVector = PETScWrappers::MPI::BlockVector;
115
116 /**
117 * Typedef for the sparse matrix type used.
118 */
119 using SparseMatrix = PETScWrappers::MPI::SparseMatrix;
120
121 /**
122 * Typedef for the type used to describe sparse matrices that consist of
123 * multiple blocks.
124 */
125 using BlockSparseMatrix = PETScWrappers::MPI::BlockSparseMatrix;
126
127 /**
128 * Typedef for the compressed block sparsity pattern used.
129 */
130 using BlockCompressedSparsityPattern = dealii::BlockDynamicSparsityPattern;
131
132 /**
133 * Typedef for the AMG preconditioner type.
134 */
135 using PreconditionAMG = PETScWrappers::PreconditionBoomerAMG;
136
137 /**
138 * Typedef for the Incomplete Cholesky preconditioner.
139 */
140 using PreconditionIC = PETScWrappers::PreconditionICC;
141
142 /**
143 * Typedef for the Incomplete LU decomposition preconditioner.
144 */
145 using PreconditionILU = PETScWrappers::PreconditionILU;
146
147 /**
148 * Typedef for the Incomplete Jacobi decomposition preconditioner.
149 */
150 using PreconditionJacobi = PETScWrappers::PreconditionJacobi;
151
152 /**
153 * Typedef for the SSOR preconditioner.
154 */
155 using PreconditionSSOR = PETScWrappers::PreconditionSSOR;
156
157 } // namespace MPI
158
159 } // namespace LinearAlgebraPETSc
160 #endif // DEAL_II_WITH_PETSC
161
162 #ifdef DEAL_II_WITH_TRILINOS
163
164 /**
165 * A namespace in which the wrappers to the Trilinos linear algebra classes
166 * are aliased to generic names. There are similar namespaces
167 * LinearAlgebraDealII and LinearAlgebraPETSc for alias to deal.II's own
168 * classes and classes that interface with PETSc.
169 */
170 namespace LinearAlgebraTrilinos
171 {
172 /**
173 * Typedef for the CG solver type used.
174 */
175 using SolverCG = TrilinosWrappers::SolverCG;
176
177 /**
178 * Typedef for the GMRES solver type used.
179 */
180 using SolverGMRES = TrilinosWrappers::SolverGMRES;
181
182 /**
183 * A namespace with alias to generic names for parallel Trilinos linear
184 * algebra objects.
185 */
186 namespace MPI
187 {
188 /**
189 * Typedef for the vector type used.
190 */
191 using Vector = TrilinosWrappers::MPI::Vector;
192
193 /**
194 * Typedef for the type used to describe vectors that consist of multiple
195 * blocks.
196 */
197 using BlockVector = TrilinosWrappers::MPI::BlockVector;
198
199 /**
200 * Typedef for the sparse matrix type used.
201 */
202 using SparseMatrix = TrilinosWrappers::SparseMatrix;
203
204 /**
205 * Typedef for the type used to describe sparse matrices that consist of
206 * multiple blocks.
207 */
208 using BlockSparseMatrix = TrilinosWrappers::BlockSparseMatrix;
209
210 /**
211 * Typedef for the type used for compressed block sparsity pattern.
212 */
213 using BlockCompressedSparsityPattern =
214 TrilinosWrappers::BlockSparsityPattern;
215
216 /**
217 * Typedef for the AMG preconditioner type.
218 */
219 using PreconditionAMG = TrilinosWrappers::PreconditionAMG;
220
221 /**
222 * Typedef for the Incomplete Cholesky preconditioner.
223 */
224 using PreconditionIC = TrilinosWrappers::PreconditionIC;
225
226 /**
227 * Typedef for the Incomplete LU decomposition preconditioner.
228 */
229 using PreconditionILU = TrilinosWrappers::PreconditionILU;
230
231 /**
232 * Typedef for the Incomplete Jacobi decomposition preconditioner.
233 */
234 using PreconditionJacobi = TrilinosWrappers::PreconditionJacobi;
235
236 /**
237 * Typedef for the SSOR preconditioner
238 */
239 using PreconditionSSOR = TrilinosWrappers::PreconditionSSOR;
240
241
242 } // namespace MPI
243
244 } // namespace LinearAlgebraTrilinos
245
246
247 #endif // DEAL_II_WITH_TRILINOS
248
249 DEAL_II_NAMESPACE_CLOSE
250
251 #endif