libMesh
sum_shell_matrix.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2019 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 
20 #ifndef LIBMESH_SUM_SHELL_MATRIX_H
21 #define LIBMESH_SUM_SHELL_MATRIX_H
22 
23 // Local includes
24 #include "libmesh/libmesh_common.h"
25 #include "libmesh/reference_counted_object.h"
26 #include "libmesh/libmesh.h"
27 #include "libmesh/shell_matrix.h"
28 
29 // C++ includes
30 #include <vector>
31 
32 namespace libMesh
33 {
34 
43 template <typename T>
44 class SumShellMatrix : public ShellMatrix<T>
45 {
46 public:
55  SumShellMatrix (const Parallel::Communicator & comm_in);
56 
60  explicit
61  SumShellMatrix (const std::vector<ShellMatrix<T> *> & mat,
62  const Parallel::Communicator & comm_in);
63 
67  virtual ~SumShellMatrix ();
68 
69  virtual numeric_index_type m () const override;
70 
71  virtual numeric_index_type n () const override;
72 
73  virtual void vector_mult (NumericVector<T> & dest,
74  const NumericVector<T> & arg) const override;
75 
76  virtual void vector_mult_add (NumericVector<T> & dest,
77  const NumericVector<T> & arg) const override;
78 
79  virtual void get_diagonal (NumericVector<T> & dest) const override;
80 
84  std::vector<ShellMatrix<T> *> matrices;
85 };
86 
87 
88 
89 //-----------------------------------------------------------------------
90 // SumShellMatrix inline members
91 template <typename T>
92 inline
93 SumShellMatrix<T>::SumShellMatrix (const Parallel::Communicator & comm_in):
94  ShellMatrix<T>(comm_in),
95  matrices()
96 {}
97 
98 
99 
100 template <typename T>
101 inline
103  const Parallel::Communicator & comm_in):
104  ShellMatrix<T>(comm_in),
105  matrices(mat)
106 {}
107 
108 
109 
110 template <typename T>
111 inline
113 {}
114 
115 
116 } // namespace libMesh
117 
118 
119 #endif // LIBMESH_SUM_SHELL_MATRIX_H
libMesh::ShellMatrix
Generic shell matrix, i.e.
Definition: eigen_preconditioner.h:36
libMesh::SumShellMatrix::vector_mult
virtual void vector_mult(NumericVector< T > &dest, const NumericVector< T > &arg) const override
Multiplies the matrix with arg and stores the result in dest.
Definition: sum_shell_matrix.C:57
libMesh::SumShellMatrix::get_diagonal
virtual void get_diagonal(NumericVector< T > &dest) const override
Copies the diagonal part of the matrix into dest.
Definition: sum_shell_matrix.C:77
libMesh
The libMesh namespace provides an interface to certain functionality in the library.
Definition: factoryfunction.C:55
libMesh::SumShellMatrix::matrices
std::vector< ShellMatrix< T > * > matrices
A vector of pointers to the summands.
Definition: sum_shell_matrix.h:84
libMesh::NumericVector
Provides a uniform interface to vector storage schemes for different linear algebra libraries.
Definition: vector_fe_ex5.C:43
libMesh::SumShellMatrix::SumShellMatrix
SumShellMatrix(const Parallel::Communicator &comm_in)
Constructor; initializes an empty sum.
Definition: sum_shell_matrix.h:93
libMesh::numeric_index_type
dof_id_type numeric_index_type
Definition: id_types.h:99
libMesh::SumShellMatrix::~SumShellMatrix
virtual ~SumShellMatrix()
Destructor.
Definition: sum_shell_matrix.h:112
libMesh::SumShellMatrix::m
virtual numeric_index_type m() const override
Definition: sum_shell_matrix.C:29
libMesh::SumShellMatrix
This class combines any number of shell matrices to a single shell matrix by summing them together.
Definition: sum_shell_matrix.h:44
libMesh::SumShellMatrix::vector_mult_add
virtual void vector_mult_add(NumericVector< T > &dest, const NumericVector< T > &arg) const override
Multiplies the matrix with arg and adds the result to dest.
Definition: sum_shell_matrix.C:67
libMesh::SumShellMatrix::n
virtual numeric_index_type n() const override
Definition: sum_shell_matrix.C:43