Reference documentation for deal.II version 8.5.1
petsc_block_sparse_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_block_sparse_matrix.h>
17 
18 #ifdef DEAL_II_WITH_PETSC
19 
20 DEAL_II_NAMESPACE_OPEN
21 
22 namespace PETScWrappers
23 {
25  {}
26 
27 
28 
30  {}
31 
32 
33 
36  {
38 
39  return *this;
40  }
41 
42 
43  void
45  reinit (const size_type n_block_rows,
46  const size_type n_block_columns)
47  {
48  // first delete previous content of
49  // the subobjects array
50  clear ();
51 
52  // then resize. set sizes of blocks to
53  // zero. user will later have to call
54  // collect_sizes for this
55  this->sub_objects.reinit (n_block_rows,
56  n_block_columns);
57  this->row_block_indices.reinit (n_block_rows, 0);
58  this->column_block_indices.reinit (n_block_columns, 0);
59 
60  // and reinitialize the blocks
61  for (size_type r=0; r<this->n_block_rows(); ++r)
62  for (size_type c=0; c<this->n_block_cols(); ++c)
63  {
64  BlockType *p = new BlockType();
65  this->sub_objects[r][c] = p;
66  }
67  }
68 
69  std::vector<BlockSparseMatrix::size_type >
72  {
73  std::vector< size_type > index_sets;
74 
75  for ( unsigned int i=0; i<this->n_block_cols(); ++i)
76  index_sets.push_back(this->block(0,i).n());
77 
78  return index_sets;
79  }
80 
81  std::vector<BlockSparseMatrix::size_type >
84  {
85  std::vector< size_type > index_sets;
86 
87  for ( unsigned int i=0; i<this->n_block_rows(); ++i)
88  index_sets.push_back(this->block(i,0).m());
89 
90  return index_sets;
91  }
92 
93  void
95  {
97  }
98 
99 }
100 
101 
102 DEAL_II_NAMESPACE_CLOSE
103 
104 #endif
BlockSparseMatrix & operator=(const BlockSparseMatrix &)
std::vector< size_type > locally_owned_domain_sizes() const
Subscriptor & operator=(const Subscriptor &)
Definition: subscriptor.cc:154
void reinit(const size_type n_block_rows, const size_type n_block_columns)
void reinit(const TableIndices< N > &new_size, const bool omit_default_initialization=false)
void reinit(const unsigned int n_blocks, const size_type n_elements_per_block)
Table< 2, SmartPointer< BlockType, BlockMatrixBase< PETScWrappers::SparseMatrix > > > sub_objects
std::vector< size_type > locally_owned_range_sizes() const