16 #ifndef dealii_matrix_out_h
17 # define dealii_matrix_out_h
19 # include <deal.II/base/config.h>
21 # include <deal.II/base/data_out_base.h>
23 # include <deal.II/lac/block_sparse_matrix.h>
24 # include <deal.II/lac/sparse_matrix.h>
26 # ifdef DEAL_II_WITH_TRILINOS
27 # include <deal.II/lac/trilinos_block_sparse_matrix.h>
28 # include <deal.II/lac/trilinos_sparse_matrix.h>
32 DEAL_II_NAMESPACE_OPEN
139 template <
class Matrix>
142 const std::string &
name,
168 virtual const std::vector<Patch> &
175 virtual std::vector<std::string>
185 template <
class Matrix>
199 namespace MatrixOutImplementation
204 template <
typename number>
206 get_element(const ::SparseMatrix<number> &matrix,
210 return matrix.el(i, j);
218 template <
typename number>
220 get_element(const ::BlockSparseMatrix<number> &matrix,
228 # ifdef DEAL_II_WITH_TRILINOS
256 # ifdef DEAL_II_WITH_PETSC
268 template <
class Matrix>
270 get_element(
const Matrix & matrix,
281 template <
class Matrix>
295 internal::MatrixOutImplementation::get_element(matrix, i, j));
297 return internal::MatrixOutImplementation::get_element(matrix, i, j);
313 average += std::fabs(
314 internal::MatrixOutImplementation::get_element(matrix, row, col));
317 internal::MatrixOutImplementation::get_element(matrix, row, col);
318 average /= n_elements;
324 template <
class Matrix>
327 const std::string &name,
331 (matrix.n() % options.
block_size != 0 ? 1 : 0)),
332 gridpoints_y = (matrix.m() / options.
block_size +
333 (matrix.m() % options.
block_size != 0 ? 1 : 0));
346 patches.resize((gridpoints_x) * (gridpoints_y));
350 for (
size_type i = 0; i < gridpoints_y; ++i)
351 for (
size_type j = 0; j < gridpoints_x; ++j, ++index)
360 patches[index].vertices[0](0) = j;
361 patches[index].vertices[0](1) = -static_cast<signed int>(i);
362 patches[index].vertices[1](0) = j;
363 patches[index].vertices[1](1) = -static_cast<signed int>(i + 1);
364 patches[index].vertices[2](0) = j + 1;
365 patches[index].vertices[2](1) = -static_cast<signed int>(i);
366 patches[index].vertices[3](0) = j + 1;
367 patches[index].vertices[3](1) = -static_cast<signed int>(i + 1);
372 for (
auto &vertex :
patches[index].vertices)
375 patches[index].n_subdivisions = 1;
377 patches[index].data.reinit(1, 4);
410 DEAL_II_NAMESPACE_CLOSE