Reference documentation for deal.II version 9.6.0
\(\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
petsc_full_matrix.cc
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 2004 - 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
16
17#ifdef DEAL_II_WITH_PETSC
18
21
23
24namespace PETScWrappers
25{
27 {
28 // empty constructor generate an empty matrix
29 do_reinit(0, 0);
30 }
31
33 {
34 do_reinit(m, n);
35 }
36
37 void
39 {
40 // get rid of old matrix and generate a
41 // new one
42 const PetscErrorCode ierr = MatDestroy(&matrix);
43 AssertThrow(ierr == 0, ExcPETScError(ierr));
44
45 do_reinit(m, n);
46 }
47
48 void
50 {
51 // use the call sequence indicating only a maximal number of
52 // elements per row for all rows globally
53 const PetscErrorCode ierr =
54 MatCreateSeqDense(PETSC_COMM_SELF, m, n, nullptr, &matrix);
55 AssertThrow(ierr == 0, ExcPETScError(ierr));
56 }
57
58} // namespace PETScWrappers
59
60
62
63#endif // DEAL_II_WITH_PETSC
void reinit(const size_type m, const size_type n)
void do_reinit(const size_type m, const size_type n)
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:503
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:504
#define AssertThrow(cond, exc)