Line data Source code
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 : #include "libmesh/libmesh_config.h"
19 :
20 : #ifdef LIBMESH_HAVE_PETSC
21 :
22 : // Local includes
23 : #include "libmesh/petsc_matrix_shell_matrix.h"
24 :
25 : namespace libMesh
26 : {
27 :
28 : template <typename T>
29 : void
30 350 : PetscMatrixShellMatrix<T>::init(const numeric_index_type m,
31 : const numeric_index_type n,
32 : const numeric_index_type m_l,
33 : const numeric_index_type n_l,
34 : const numeric_index_type,
35 : const numeric_index_type,
36 : const numeric_index_type blocksize)
37 : {
38 350 : init_shell_mat(*this, m, n, m_l, n_l, blocksize);
39 350 : this->set_context();
40 350 : }
41 :
42 : template <typename T>
43 : void
44 4130 : PetscMatrixShellMatrix<T>::init(ParallelType libmesh_dbg_var(type))
45 : {
46 : #ifndef NDEBUG
47 118 : libmesh_assert(this->_dof_map);
48 118 : const auto m = this->_dof_map->n_dofs();
49 118 : const auto m_l = this->_dof_map->n_local_dofs();
50 118 : if (m != m_l)
51 118 : libmesh_assert(type != SERIAL);
52 : #endif
53 4130 : init_shell_mat(*this);
54 4130 : this->set_context();
55 4130 : }
56 :
57 : template <typename T>
58 : void
59 0 : PetscMatrixShellMatrix<T>::zero()
60 : {
61 : // A shell matrix computes its action and stores no entries, so there is nothing to clear. This is
62 : // reachable through System::init_matrices(), which zeroes every matrix it initializes.
63 0 : }
64 :
65 : template <typename T>
66 : std::unique_ptr<SparseMatrix<T>>
67 0 : PetscMatrixShellMatrix<T>::zero_clone() const
68 : {
69 0 : libmesh_error();
70 : }
71 :
72 : template <typename T>
73 : std::unique_ptr<SparseMatrix<T>>
74 0 : PetscMatrixShellMatrix<T>::clone() const
75 : {
76 0 : libmesh_not_implemented();
77 : }
78 :
79 : template <typename T>
80 : void
81 0 : PetscMatrixShellMatrix<T>::set(const numeric_index_type, const numeric_index_type, const T)
82 : {
83 0 : libmesh_error();
84 : }
85 :
86 : template <typename T>
87 : void
88 0 : PetscMatrixShellMatrix<T>::add(const numeric_index_type, const numeric_index_type, const T)
89 : {
90 0 : libmesh_error();
91 : }
92 :
93 : template <typename T>
94 : void
95 0 : PetscMatrixShellMatrix<T>::add_matrix(const DenseMatrix<T> &,
96 : const std::vector<numeric_index_type> &,
97 : const std::vector<numeric_index_type> &)
98 : {
99 0 : libmesh_error();
100 : }
101 :
102 : template <typename T>
103 : void
104 0 : PetscMatrixShellMatrix<T>::add_matrix(const DenseMatrix<T> &,
105 : const std::vector<numeric_index_type> &)
106 : {
107 0 : libmesh_error();
108 : }
109 :
110 : template <typename T>
111 : void
112 0 : PetscMatrixShellMatrix<T>::add(const T, const SparseMatrix<T> &)
113 : {
114 0 : libmesh_error();
115 : }
116 :
117 : template <typename T>
118 : T
119 0 : PetscMatrixShellMatrix<T>::operator()(const numeric_index_type, const numeric_index_type) const
120 : {
121 0 : libmesh_error();
122 : }
123 :
124 : template <typename T>
125 : Real
126 0 : PetscMatrixShellMatrix<T>::l1_norm() const
127 : {
128 0 : libmesh_error();
129 : }
130 :
131 : template <typename T>
132 : Real
133 0 : PetscMatrixShellMatrix<T>::linfty_norm() const
134 : {
135 0 : libmesh_error();
136 : }
137 :
138 : template <typename T>
139 : void
140 0 : PetscMatrixShellMatrix<T>::print_personal(std::ostream &) const
141 : {
142 0 : libmesh_error();
143 : }
144 :
145 : template <typename T>
146 : void
147 0 : PetscMatrixShellMatrix<T>::get_diagonal(NumericVector<T> &) const
148 : {
149 0 : libmesh_error();
150 : }
151 :
152 : template <typename T>
153 : void
154 0 : PetscMatrixShellMatrix<T>::get_transpose(SparseMatrix<T> &) const
155 : {
156 0 : libmesh_error();
157 : }
158 :
159 : template <typename T>
160 : void
161 0 : PetscMatrixShellMatrix<T>::get_row(numeric_index_type,
162 : std::vector<numeric_index_type> &,
163 : std::vector<T> &) const
164 : {
165 0 : libmesh_error();
166 : }
167 :
168 : template class LIBMESH_EXPORT PetscMatrixShellMatrix<Number>;
169 :
170 : } // namespace libMesh
171 :
172 : #endif
|