deal.II version GIT relicensing-6963-gc25d64af46 2026-10-23 04:50: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
65 {
66 public:
71
75 using value_type = double;
76
81
86
90 SparseMatrix(const SparsityPattern &psblas_sparsity_pattern,
91 const MPI_Comm communicator = MPI_COMM_WORLD);
92
96 SparseMatrix(const SparseMatrix &) = delete;
97
102 operator=(const SparseMatrix &) = delete;
103
108 operator=(const value_type d) = delete;
109
115 void
116 copy_from(const SparseMatrix &other);
117
118
123 void
124 reinit(const IndexSet &parallel_partitioning,
125 const MPI_Comm communicator = MPI_COMM_WORLD);
126
131 void
132 reinit(const SparsityPattern &psblas_sparsity_pattern,
133 const MPI_Comm communicator = MPI_COMM_WORLD);
134
139 void
140 reinit(const IndexSet &local_rows,
141 const DynamicSparsityPattern &sparsity_pattern,
142 const MPI_Comm communicator = MPI_COMM_WORLD);
143
148 m() const;
149
154 n() const;
155
164 local_size() const;
165
174 std::pair<size_type, size_type>
175 local_range() const;
176
181 bool
182 in_local_range(const size_type index) const;
183
188 n_nonzero_elements() const;
189
194 el(const size_type i, const size_type j) const;
195
200 diag_element(const size_type i) const;
201
207 operator()(const size_type i, const size_type j) const;
208
213 void
214 set(const size_type i, const size_type j, const value_type value);
215
225 void
226 set(const std::vector<size_type> &indices,
227 const FullMatrix<double> &matrix);
228
233 void
234 add(const size_type i, const size_type j, const value_type value);
235
240 void
241 add(const size_type row,
242 const std::vector<size_type> &col_indices,
243 const std::vector<value_type> &values,
244 const bool = false);
245
250 void
251 add(const size_type row,
252 const size_type ncols,
253 const std::vector<size_type> &col_indices,
254 const value_type *values,
255 const bool = false,
256 const bool = false);
257
263 void
264 add(const size_type row,
265 const size_type ncols,
266 const std::vector<size_type> &col_indices,
267 const std::vector<value_type> &values,
268 const bool = false,
269 const bool = false);
270
276 void
277 add(const size_type row,
278 const size_type n_cols,
279 const size_type *col_indices,
280 const value_type *values,
281 const bool elide_zero_values = true,
282 const bool col_indices_are_sorted = false);
283
287 void
288 compress();
289
296 void
297 vmult(Vector &dst, const Vector &src) const;
298
305 void
306 vmult_add(Vector &dst, const Vector &src) const;
307
308
316 void
317 Tvmult(Vector &dst, const Vector &src) const;
318
325 void
326 Tvmult_add(Vector &dst, const Vector &src) const;
327
334 l1_norm() const;
335
342 linfty_norm() const;
343
350 frobenius_norm() const;
351
356 trace() const;
357
362 psb_c_dspmat *
363 get_psblas_matrix() const;
364
369 psb_c_descriptor *
370 get_psblas_descriptor() const;
371
377 get_mpi_communicator() const;
378
379
380 private:
384 MPI_Comm communicator;
385
389 psb_c_dspmat *psblas_sparse_matrix;
390
394 std::shared_ptr<psb_c_descriptor> psblas_descriptor;
395
399 psb_c_ctxt *psblas_context;
400
405 internal::State state;
406
407 friend class PreconditionAMG;
408 };
409
410
411} // namespace PSCToolkitWrappers
412#endif // DEAL_II_WITH_PSBLAS
414
415#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