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
112 Options(
const bool show_absolute_values =
false,
113 const unsigned int block_size = 1,
114 const bool discontinuous =
false);
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,
224 return matrix.el(i, j);
228 # ifdef DEAL_II_WITH_TRILINOS 237 return matrix.
el(i, j);
251 return matrix.
el(i, j);
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)
373 patches[index].vertices[0](0) = j;
374 patches[index].vertices[0](1) = static_cast<signed int>(-i);
375 patches[index].vertices[1](0) = j;
376 patches[index].vertices[1](1) = static_cast<signed int>(-i - 1);
377 patches[index].vertices[2](0) = j + 1;
378 patches[index].vertices[2](1) = static_cast<signed int>(-i);
379 patches[index].vertices[3](0) = j + 1;
380 patches[index].vertices[3](1) = static_cast<signed int>(-i - 1);
385 for (
unsigned int v = 0; v < 4; ++v)
388 patches[index].n_subdivisions = 1;
390 patches[index].data.reinit(1, 4);
423 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)
virtual std::vector< std::string > get_dataset_names() const override
std::vector< Patch > patches
virtual ~MatrixOut() override=default
unsigned long long int global_dof_index
value_type el(const size_type i, const size_type j) const
TrilinosScalar el(const size_type i, const size_type j) const
void build_patches(const Matrix &matrix, const std::string &name, const Options options=Options(false, 1, false))
bool show_absolute_values
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