libMesh
Loading...
Searching...
No Matches
petsc_mffd_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#ifndef LIBMESH_PETSC_MFFD_MATRIX_H
19#define LIBMESH_PETSC_MFFD_MATRIX_H
20
21#include "libmesh/libmesh_config.h"
22
23#ifdef LIBMESH_HAVE_PETSC
24
25#include "libmesh/petsc_matrix_base.h"
26
27namespace libMesh
28{
29
36template <typename T>
38{
39public:
47 explicit PetscMFFDMatrix(Mat m, const Parallel::Communicator & comm_in);
48
49 explicit PetscMFFDMatrix(const Parallel::Communicator & comm_in);
50
52
53 virtual void init(const numeric_index_type,
57 const numeric_index_type = 30,
58 const numeric_index_type = 10,
59 const numeric_index_type = 1) override;
60
65 virtual void init(ParallelType = PARALLEL) override;
66
67 virtual SparseMatrix<T> & operator=(const SparseMatrix<T> &) override;
68
69 virtual void zero() override;
70 virtual std::unique_ptr<SparseMatrix<T>> zero_clone() const override;
71 virtual std::unique_ptr<SparseMatrix<T>> clone() const override;
72 virtual void set(const numeric_index_type i, const numeric_index_type j, const T value) override;
73 virtual void add(const numeric_index_type i, const numeric_index_type j, const T value) override;
74 virtual void add_matrix(const DenseMatrix<T> & dm,
75 const std::vector<numeric_index_type> & rows,
76 const std::vector<numeric_index_type> & cols) override;
77 virtual void add_matrix(const DenseMatrix<T> & dm,
78 const std::vector<numeric_index_type> & dof_indices) override;
79 virtual void add(const T a, const SparseMatrix<T> & X) override;
80 virtual T operator()(const numeric_index_type i, const numeric_index_type j) const override;
81 virtual Real l1_norm() const override;
82 virtual Real linfty_norm() const override;
83 virtual void print_personal(std::ostream & os = libMesh::out) const override;
84 virtual void get_diagonal(NumericVector<T> & dest) const override;
85 virtual void get_transpose(SparseMatrix<T> & dest) const override;
87 std::vector<numeric_index_type> & indices,
88 std::vector<T> & values) const override;
89};
90
91template <typename T>
93 : PetscMatrixBase<T>(m, comm_in)
94{
95}
96
97template <typename T>
102
103template <typename T>
106{
107 this->_mat = m;
108 return *this;
109}
110
111template <typename T>
112void
114 const numeric_index_type,
115 const numeric_index_type,
116 const numeric_index_type,
117 const numeric_index_type,
118 const numeric_index_type,
119 const numeric_index_type)
120{
121 libmesh_error();
122}
123
124template <typename T>
125void
127{
128 libmesh_error();
129}
130
131template <typename T>
134{
135 libmesh_error();
136}
137
138template <typename T>
139void
141{
142 libmesh_error();
143}
144
145template <typename T>
146std::unique_ptr<SparseMatrix<T>>
148{
149 libmesh_error();
150}
151
152template <typename T>
153std::unique_ptr<SparseMatrix<T>>
155{
156 libmesh_not_implemented();
157}
158
159template <typename T>
160void
162{
163 libmesh_error();
164}
165
166template <typename T>
167void
169{
170 libmesh_error();
171}
172
173template <typename T>
174void
176 const std::vector<numeric_index_type> &,
177 const std::vector<numeric_index_type> &)
178{
179 libmesh_error();
180}
181
182template <typename T>
183void
184PetscMFFDMatrix<T>::add_matrix(const DenseMatrix<T> &, const std::vector<numeric_index_type> &)
185{
186 libmesh_error();
187}
188
189template <typename T>
190void
192{
193 libmesh_error();
194}
195
196template <typename T>
197T
199{
200 libmesh_error();
201}
202
203template <typename T>
204Real
206{
207 libmesh_error();
208}
209
210template <typename T>
211Real
213{
214 libmesh_error();
215}
216
217template <typename T>
218void
220{
221 libmesh_error();
222}
223
224template <typename T>
225void
227{
228 libmesh_error();
229}
230
231template <typename T>
232void
234{
235 libmesh_error();
236}
237
238template <typename T>
239void
241 std::vector<numeric_index_type> &,
242 std::vector<T> &) const
243{
244 libmesh_error();
245}
246
247} // namespace libMesh
248
249#endif // LIBMESH_HAVE_PETSC
250#endif // LIBMESH_SPARSE_SHELL_MATRIX_H
Defines a dense matrix for use in Finite Element-type computations.
Provides a uniform interface to vector storage schemes for different linear algebra libraries.
This class allows to use a PETSc shell matrix as a PetscMatrix.
virtual void zero() override
Set all entries to 0.
virtual Real linfty_norm() const override
virtual SparseMatrix< T > & operator=(const SparseMatrix< T > &) override
This looks like a copy assignment operator, but note that, unlike normal copy assignment operators,...
virtual Real l1_norm() const override
virtual void add_matrix(const DenseMatrix< T > &dm, const std::vector< numeric_index_type > &rows, const std::vector< numeric_index_type > &cols) override
Add the full matrix dm to the SparseMatrix.
virtual void add(const numeric_index_type i, const numeric_index_type j, const T value) override
Add value to the element (i,j).
virtual void get_diagonal(NumericVector< T > &dest) const override
Copies the diagonal part of the matrix into dest.
virtual std::unique_ptr< SparseMatrix< T > > zero_clone() const override
virtual void set(const numeric_index_type i, const numeric_index_type j, const T value) override
Set the element (i,j) to value.
virtual T operator()(const numeric_index_type i, const numeric_index_type j) const override
virtual void add(const T a, const SparseMatrix< T > &X) override
Compute for scalar a, matrix X.
virtual std::unique_ptr< SparseMatrix< T > > clone() const override
virtual void init(const numeric_index_type, const numeric_index_type, const numeric_index_type, const numeric_index_type, const numeric_index_type=30, const numeric_index_type=10, const numeric_index_type=1) override
Initialize SparseMatrix with the specified sizes.
virtual void get_transpose(SparseMatrix< T > &dest) const override
Copies the transpose of the matrix into dest, which may be *this.
virtual void print_personal(std::ostream &os=libMesh::out) const override
Print the contents of the matrix to the screen in a package-personalized style, if available.
PetscMFFDMatrix & operator=(Mat m)
virtual void init(ParallelType=PARALLEL) override
Initialize this matrix using the sparsity structure computed by dof_map.
virtual void add_matrix(const DenseMatrix< T > &dm, const std::vector< numeric_index_type > &dof_indices) override
Same as add_matrix, but assumes the row and column maps are the same.
PetscMFFDMatrix(const Parallel::Communicator &comm_in)
PetscMFFDMatrix(Mat m, const Parallel::Communicator &comm_in)
Constructor.
virtual void get_row(numeric_index_type i, std::vector< numeric_index_type > &indices, std::vector< T > &values) const override
Get a row from the matrix.
This class provides a nice interface to the PETSc C-based data structures for parallel,...
virtual numeric_index_type m() const override
Generic sparse matrix.
The libMesh namespace provides an interface to certain functionality in the library.
ParallelType
Defines an enum for parallel data structure types.
OStreamProxy out
dof_id_type numeric_index_type
Definition id_types.h:99
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static const bool value
Definition xdr_io.C:55