version GIT relicensing-7341-gcb9dbcaa45 2026-12-04 11:10: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: Apache-2.0 WITH LLVM-exception OR 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// Detailed license information governing the source code and contributions
9// can be found in LICENSE.md and CONTRIBUTING.md at the top level directory.
10//
11// -----------------------------------------------------------------------------
12
13#ifndef dealii_psblas_matrix_h
14#define dealii_psblas_matrix_h
15
16#include <deal.II/base/config.h>
17
19
22#include <deal.II/lac/vector.h>
23
24
25#ifdef DEAL_II_WITH_PSBLAS
28#endif
29
31
32#ifdef DEAL_II_WITH_PSBLAS
33namespace PSCToolkitWrappers
34{
35
66 {
67 public:
72
76 using value_type = double;
77
82
87
91 SparseMatrix(const SparsityPattern &psblas_sparsity_pattern,
92 const MPI_Comm communicator = MPI_COMM_WORLD);
93
97 SparseMatrix(const SparseMatrix &) = delete;
98
103 operator=(const SparseMatrix &) = delete;
104
109 operator=(const value_type d) = delete;
110
116 void
117 copy_from(const SparseMatrix &other);
118
119
124 void
125 reinit(const IndexSet &parallel_partitioning,
126 const MPI_Comm communicator = MPI_COMM_WORLD);
127
132 void
133 reinit(const SparsityPattern &psblas_sparsity_pattern,
134 const MPI_Comm communicator = MPI_COMM_WORLD);
135
140 void
141 reinit(const IndexSet &local_rows,
142 const DynamicSparsityPattern &sparsity_pattern,
143 const MPI_Comm communicator = MPI_COMM_WORLD);
144
149 m() const;
150
155 n() const;
156
165 local_size() const;
166
175 std::pair<size_type, size_type>
176 local_range() const;
177
182 bool
183 in_local_range(const size_type index) const;
184
189 n_nonzero_elements() const;
190
195 el(const size_type i, const size_type j) const;
196
201 diag_element(const size_type i) const;
202
208 operator()(const size_type i, const size_type j) const;
209
214 void
215 set(const size_type i, const size_type j, const value_type value);
216
226 void
227 set(const std::vector<size_type> &indices,
228 const FullMatrix<double> &matrix);
229
234 void
235 add(const size_type i, const size_type j, const value_type value);
236
241 void
242 add(const size_type row,
243 const std::vector<size_type> &col_indices,
244 const std::vector<value_type> &values,
245 const bool = false);
246
251 void
252 add(const size_type row,
253 const size_type ncols,
254 const std::vector<size_type> &col_indices,
255 const value_type *values,
256 const bool = false,
257 const bool = false);
258
264 void
265 add(const size_type row,
266 const size_type ncols,
267 const std::vector<size_type> &col_indices,
268 const std::vector<value_type> &values,
269 const bool = false,
270 const bool = false);
271
277 void
278 add(const size_type row,
279 const size_type n_cols,
280 const size_type *col_indices,
281 const value_type *values,
282 const bool elide_zero_values = true,
283 const bool col_indices_are_sorted = false);
284
288 void
289 compress();
290
297 void
298 vmult(Vector &dst, const Vector &src) const;
299
306 void
307 vmult_add(Vector &dst, const Vector &src) const;
308
309
317 void
318 Tvmult(Vector &dst, const Vector &src) const;
319
326 void
327 Tvmult_add(Vector &dst, const Vector &src) const;
328
335 l1_norm() const;
336
343 linfty_norm() const;
344
351 frobenius_norm() const;
352
357 trace() const;
358
363 psb_c_dspmat *
364 get_psblas_matrix() const;
365
370 psb_c_descriptor *
371 get_psblas_descriptor() const;
372
378 get_mpi_communicator() const;
379
380
381 private:
386
390 psb_c_dspmat *psblas_sparse_matrix;
391
395 std::shared_ptr<psb_c_descriptor> psblas_descriptor;
396
400 psb_c_ctxt *psblas_context;
401
407
408 friend class PreconditionAMG;
409 };
410
411
412} // namespace PSCToolkitWrappers
413#endif // DEAL_II_WITH_PSBLAS
415
416#endif
void copy_from(const SparseMatrix &other)
value_type operator()(const size_type i, const size_type j) const
void Tvmult_add(Vector &dst, const Vector &src) const
std::shared_ptr< psb_c_descriptor > psblas_descriptor
value_type diag_element(const size_type i) const
void add(const size_type row, const std::vector< size_type > &col_indices, const std::vector< value_type > &values, const bool=false)
void vmult(Vector &dst, const Vector &src) const
SparseMatrix & operator=(const value_type d)=delete
value_type el(const size_type i, const size_type j) const
void vmult_add(Vector &dst, const Vector &src) const
void reinit(const IndexSet &parallel_partitioning, const MPI_Comm communicator=MPI_COMM_WORLD)
void set(const size_type i, const size_type j, const value_type value)
std::pair< size_type, size_type > local_range() const
void Tvmult(Vector &dst, const Vector &src) const
void add(const size_type i, const size_type j, const value_type value)
psb_c_descriptor * get_psblas_descriptor() const
SparseMatrix(const SparseMatrix &)=delete
SparseMatrix & operator=(const SparseMatrix &)=delete
bool in_local_range(const size_type index) const
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:38
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:39
unsigned int global_dof_index
Definition types.h:92