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
types::global_dof_index size_type
static double get_gridpoint_value(const Matrix &matrix, const size_type i, const size_type j, const Options &options)
Contents is actually a matrix.
virtual std::vector< std::string > get_dataset_names() const override
std::vector< Patch > patches
virtual ~MatrixOut() override=default
void build_patches(const Matrix &matrix, const std::string &name, const Options options=Options(false, 1, false))
bool show_absolute_values
unsigned int global_dof_index
Options(const bool show_absolute_values=false, const unsigned int block_size=1, const bool discontinuous=false)
virtual const std::vector< Patch > & get_patches() const override