Reference documentation for deal.II version 8.5.1
Main Page
Tutorial
Code gallery
Modules
Namespaces
Classes
Related Pages
Files
dealii.org
File List
source
lac
petsc_full_matrix.cc
1
// ---------------------------------------------------------------------
2
//
3
// Copyright (C) 2004 - 2016 by the deal.II authors
4
//
5
// This file is part of the deal.II library.
6
//
7
// The deal.II library is free software; you can use it, redistribute
8
// it, and/or modify it under the terms of the GNU Lesser General
9
// Public License as published by the Free Software Foundation; either
10
// version 2.1 of the License, or (at your option) any later version.
11
// The full text of the license can be found in the file LICENSE at
12
// the top level of the deal.II distribution.
13
//
14
// ---------------------------------------------------------------------
15
16
#include <deal.II/lac/petsc_full_matrix.h>
17
18
#ifdef DEAL_II_WITH_PETSC
19
20
#include <deal.II/lac/petsc_compatibility.h>
21
#include <deal.II/lac/exceptions.h>
22
23
DEAL_II_NAMESPACE_OPEN
24
25
namespace
PETScWrappers
26
{
27
28
FullMatrix::FullMatrix
()
29
{
30
// empty constructor generate an empty matrix
31
do_reinit
(0, 0);
32
}
33
34
FullMatrix::FullMatrix
(
const
size_type
m
,
35
const
size_type
n
)
36
{
37
do_reinit
(m, n);
38
}
39
40
void
41
FullMatrix::reinit
(
const
size_type
m
,
42
const
size_type
n
)
43
{
44
// get rid of old matrix and generate a
45
// new one
46
const
PetscErrorCode ierr =
destroy_matrix
(
matrix
);
47
AssertThrow
(ierr == 0,
ExcPETScError
(ierr));
48
49
do_reinit
(m, n);
50
}
51
52
void
53
FullMatrix::do_reinit
(
const
size_type
m
,
54
const
size_type
n
)
55
{
56
// use the call sequence indicating only a maximal number of
57
// elements per row for all rows globally
58
const
PetscErrorCode ierr = MatCreateSeqDense (PETSC_COMM_SELF, m, n,
59
PETSC_NULL, &
matrix
);
60
AssertThrow
(ierr == 0,
ExcPETScError
(ierr));
61
}
62
63
64
const
MPI_Comm &
65
FullMatrix::get_mpi_communicator
()
const
66
{
67
static
const
MPI_Comm communicator = MPI_COMM_SELF;
68
return
communicator;
69
}
70
}
71
72
73
DEAL_II_NAMESPACE_CLOSE
74
75
#endif // DEAL_II_WITH_PETSC
PETScWrappers::destroy_matrix
PetscErrorCode destroy_matrix(Mat &matrix)
Definition:
petsc_compatibility.h:73
PETScWrappers
Definition:
la_parallel_block_vector.h:35
PETScWrappers::FullMatrix::size_type
types::global_dof_index size_type
Definition:
petsc_full_matrix.h:56
PETScWrappers::FullMatrix::FullMatrix
FullMatrix()
Definition:
petsc_full_matrix.cc:28
PETScWrappers::FullMatrix::get_mpi_communicator
virtual const MPI_Comm & get_mpi_communicator() const
Definition:
petsc_full_matrix.cc:65
AssertThrow
#define AssertThrow(cond, exc)
Definition:
exceptions.h:369
PETScWrappers::MatrixBase::m
size_type m() const
Definition:
petsc_matrix_base.cc:246
PETScWrappers::FullMatrix::do_reinit
void do_reinit(const size_type m, const size_type n)
Definition:
petsc_full_matrix.cc:53
PETScWrappers::FullMatrix::reinit
void reinit(const size_type m, const size_type n)
Definition:
petsc_full_matrix.cc:41
PETScWrappers::MatrixBase::n
size_type n() const
Definition:
petsc_matrix_base.cc:259
PETScWrappers::MatrixBase::matrix
Mat matrix
Definition:
petsc_matrix_base.h:901
LACExceptions::ExcPETScError
Definition:
exceptions.h:54
Generated by
1.8.11