AMDiS  0.1
The Adaptive Multi-Dimensional Simulation Toolbox
MatrixNnzStructure.hpp
1 #pragma once
2 
3 #include <algorithm>
4 #include <vector>
5 
6 #include <amdis/common/Index.hpp>
7 #include <amdis/linearalgebra/SymmetryStructure.hpp>
8 
9 #if HAVE_MPI
10 #include <amdis/common/parallel/Communicator.hpp>
11 #endif
12 
13 namespace AMDiS
14 {
17  {
18  public:
19  template <class RowBasis, class ColBasis>
20  MatrixNnzStructure(RowBasis const& rowBasis, ColBasis const& colBasis,
21  SymmetryStructure symmetry = SymmetryStructure::unknown)
22  : symmetry_(symmetry)
23  {
24  init(rowBasis, colBasis);
25  }
26 
27  // Return Number of nonzeros in the diagonal part (owner part)
28  std::vector<PetscInt> const& d_nnz() const
29  {
30  return dnnz_;
31  }
32 
34  std::vector<PetscInt> const& o_nnz() const
35  {
36  return onnz_;
37  }
38 
40  SymmetryStructure symmetry() const
41  {
42  return symmetry_;
43  }
44 
45  protected:
46  // Create pattern from basis
47  template <class RowBasis, class ColBasis>
48  void init(RowBasis const& rowBasis, ColBasis const& colBasis);
49 
50  private:
51  std::vector<PetscInt> dnnz_; //< number of nonzeros in the diagonal part (owner part)
52  std::vector<PetscInt> onnz_; //< number of nonzeros in the off-diagonal part (overlap part)
53  SymmetryStructure symmetry_;
54 
55 #if HAVE_MPI
56  const Mpi::Tag tag_{916821}; //< Communication tag used internally
57 #endif
58  };
59 
60 } // end namespace AMDiS
61 
62 #include <amdis/linearalgebra/petsc/MatrixNnzStructure.inc.hpp>
std::vector< PetscInt > const & o_nnz() const
Return Number of nonzeros in the off-diagonal part (overlap part)
Definition: MatrixNnzStructure.hpp:34
SymmetryStructure symmetry() const
Symmetry of the matrix entries.
Definition: MatrixNnzStructure.hpp:40
Contains all classes needed for solving linear and non linear equation systems.
Definition: AdaptBase.hpp:6
Sparsity pattern used to create PETSc matrices.
Definition: MatrixNnzStructure.hpp:16