deal.II version GIT relicensing-6842-g793a97d2aa 2026-10-02 14:00:01+00:00
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
psblas_sparse_matrix.h
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 2019 - 2023 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_psblas_matrix_h
16#define dealii_psblas_matrix_h
17
18#include <deal.II/base/config.h>
19
21
24#include <deal.II/lac/vector.h>
25
26
27#ifdef DEAL_II_WITH_PSBLAS
30#endif
31
33
34#ifdef DEAL_II_WITH_PSBLAS
35namespace PSCToolkitWrappers
36{
37
67 {
68 public:
73
77 using value_type = double;
78
83
88
92 SparseMatrix(const SparsityPattern &psblas_sparsity_pattern,
93 const MPI_Comm communicator = MPI_COMM_WORLD);
94
98 SparseMatrix(const SparseMatrix &) = delete;
99
104 operator=(const SparseMatrix &) = delete;
105
110 operator=(const value_type d) = delete;
111
117 void
118 copy_from(const SparseMatrix &other);
119
120
125 void
126 reinit(const IndexSet &parallel_partitioning,
127 const MPI_Comm communicator = MPI_COMM_WORLD);
128
133 void
134 reinit(const SparsityPattern &psblas_sparsity_pattern,
135 const MPI_Comm communicator = MPI_COMM_WORLD);
136
141 void
142 reinit(const IndexSet &local_rows,
143 const DynamicSparsityPattern &sparsity_pattern,
144 const MPI_Comm communicator = MPI_COMM_WORLD);
145
150 m() const;
151
156 n() const;
157
166 local_size() const;
167
176 std::pair<size_type, size_type>
177 local_range() const;
178
183 bool
184 in_local_range(const size_type index) const;
185
190 n_nonzero_elements() const;
191
196 el(const size_type i, const size_type j) const;
197
202 diag_element(const size_type i) const;
203
209 operator()(const size_type i, const size_type j) const;
210
215 void
216 set(const size_type i, const size_type j, const value_type value);
217
227 void
228 set(const std::vector<size_type> &indices,
229 const FullMatrix<double> &matrix);
230
235 void
236 add(const size_type i, const size_type j, const value_type value);
237
242 void
243 add(const size_type row,
244 const std::vector<size_type> &col_indices,
245 const std::vector<value_type> &values,
246 const bool = false);
247
252 void
253 add(const size_type row,
254 const size_type ncols,
255 const std::vector<size_type> &col_indices,
256 const value_type *values,
257 const bool = false,
258 const bool = false);
259
265 void
266 add(const size_type row,
267 const size_type ncols,
268 const std::vector<size_type> &col_indices,
269 const std::vector<value_type> &values,
270 const bool = false,
271 const bool = false);
272
278 void
279 add(const size_type row,
280 const size_type n_cols,
281 const size_type *col_indices,
282 const value_type *values,
283 const bool elide_zero_values = true,
284 const bool col_indices_are_sorted = false);
285
289 void
290 compress();
291
298 void
299 vmult(Vector &dst, const Vector &src) const;
300
307 void
308 vmult_add(Vector &dst, const Vector &src) const;
309
310
318 void
319 Tvmult(Vector &dst, const Vector &src) const;
320
327 void
328 Tvmult_add(Vector &dst, const Vector &src) const;
329
336 l1_norm() const;
337
344 linfty_norm() const;
345
352 frobenius_norm() const;
353
358 trace() const;
359
364 psb_c_dspmat *
365 get_psblas_matrix() const;
366
371 psb_c_descriptor *
372 get_psblas_descriptor() const;
373
379 get_mpi_communicator() const;
380
381
382 private:
386 MPI_Comm communicator;
387
391 psb_c_dspmat *psblas_sparse_matrix;
392
396 std::shared_ptr<psb_c_descriptor> psblas_descriptor;
397
401 psb_c_ctxt *psblas_context;
402
407 internal::State state;
408
409 friend class PreconditionAMG;
410 };
411
412
413} // namespace PSCToolkitWrappers
414#endif // DEAL_II_WITH_PSBLAS
416
417#endif
*  x_component_mask set(0, true)
*  *  Point< dim > operator()(const Point< dim > &p) const * 
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:38
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:39
std::pair< types::global_dof_index, types::global_dof_index > local_range
Definition mpi.cc:814
PETScWrappers::PreconditionBoomerAMG PreconditionAMG
std::string compress(const std::string &input)
Definition utilities.cc:381
void reinit(MatrixBlock< MatrixType > &v, const BlockSparsityPattern &p)
unsigned int global_dof_index
Definition types.h:92
constexpr Number trace(const SymmetricTensor< 2, dim2, Number > &)
Number linfty_norm(const Tensor< 2, dim, Number > &t)
Definition tensor.h:3033
Number l1_norm(const Tensor< 2, dim, Number > &t)
Definition tensor.h:3007