libMesh
Loading...
Searching...
No Matches
sum_shell_matrix.h
Go to the documentation of this file.
1// The libMesh Finite Element Library.
2// Copyright (C) 2002-2026 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
32namespace libMesh
33{
34
43template <typename T>
44class SumShellMatrix : public ShellMatrix<T>
45{
46public:
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
91template <typename T>
92inline
94 ShellMatrix<T>(comm_in),
95 matrices()
96{}
97
98
99
100template <typename T>
101inline
103 const Parallel::Communicator & comm_in):
104 ShellMatrix<T>(comm_in),
105 matrices(mat)
106{}
107
108
109
110template <typename T>
111inline
114
115
116} // namespace libMesh
117
118
119#endif // LIBMESH_SUM_SHELL_MATRIX_H
Provides a uniform interface to vector storage schemes for different linear algebra libraries.
Generic shell matrix, i.e.
This class combines any number of shell matrices to a single shell matrix by summing them together.
SumShellMatrix(const Parallel::Communicator &comm_in)
Constructor; initializes an empty sum.
virtual void vector_mult(NumericVector< T > &dest, const NumericVector< T > &arg) const override
Multiplies the matrix with arg and stores the result in dest.
std::vector< ShellMatrix< T > * > matrices
A vector of pointers to the summands.
virtual numeric_index_type n() const override
virtual void get_diagonal(NumericVector< T > &dest) const override
Copies the diagonal part of the matrix into dest.
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.
virtual ~SumShellMatrix()
Destructor.
virtual numeric_index_type m() const override
The libMesh namespace provides an interface to certain functionality in the library.
dof_id_type numeric_index_type
Definition id_types.h:99