16 #ifndef dealii__matrix_out_h 17 #define dealii__matrix_out_h 19 #include <deal.II/base/config.h> 20 #include <deal.II/base/data_out_base.h> 21 #include <deal.II/lac/sparse_matrix.h> 22 #include <deal.II/lac/block_sparse_matrix.h> 24 #ifdef DEAL_II_WITH_TRILINOS 25 # include <deal.II/lac/trilinos_sparse_matrix.h> 26 # include <deal.II/lac/trilinos_block_sparse_matrix.h> 30 DEAL_II_NAMESPACE_OPEN
136 template <
class Matrix>
138 const std::string &
name,
165 virtual const std::vector<Patch> &
181 template <
class Matrix>
201 template <
typename number>
202 double get_element (const ::SparseMatrix<number> &matrix,
206 return matrix.el(i,j);
214 template <
typename number>
215 double get_element (const ::BlockSparseMatrix<number> &matrix,
219 return matrix.el(i,j);
223 #ifdef DEAL_II_WITH_TRILINOS 232 return matrix.el(i,j);
246 return matrix.el(i,j);
251 #ifdef DEAL_II_WITH_PETSC 263 template <
class Matrix>
264 double get_element (
const Matrix &matrix,
276 template <
class Matrix>
290 return std::fabs(internal::MatrixOut::get_element (matrix, i, j));
292 return internal::MatrixOut::get_element (matrix, i, j);
306 average += std::fabs(internal::MatrixOut::get_element (matrix, row, col));
308 average += internal::MatrixOut::get_element (matrix, row, col);
309 average /= n_elements;
315 template <
class Matrix>
318 const std::string &name,
322 gridpoints_x = (matrix.n() / options.
block_size 324 (matrix.n() % options.
block_size != 0 ? 1 : 0)),
325 gridpoints_y = (matrix.m() / options.
block_size 327 (matrix.m() % options.
block_size != 0 ? 1 : 0));
340 patches.resize ((gridpoints_x) * (gridpoints_y));
345 for (
size_type j=0; j<gridpoints_x; ++j, ++index)
367 patches[index].vertices[0](0) = j;
368 patches[index].vertices[0](1) = static_cast<signed int>(-i);
369 patches[index].vertices[1](0) = j;
370 patches[index].vertices[1](1) = static_cast<signed int>(-i-1);
371 patches[index].vertices[2](0) = j+1;
372 patches[index].vertices[2](1) = static_cast<signed int>(-i);
373 patches[index].vertices[3](0) = j+1;
374 patches[index].vertices[3](1) = static_cast<signed int>(-i-1);
379 for (
unsigned int v=0; v<4; ++v)
382 patches[index].n_subdivisions = 1;
384 patches[index].data.reinit (1,4);
409 DEAL_II_NAMESPACE_CLOSE
static double get_gridpoint_value(const Matrix &matrix, const size_type i, const size_type j, const Options &options)
std::vector< Patch > patches
DataOutBase::Patch< 2, 2 > Patch
unsigned int global_dof_index
virtual const std::vector< Patch > & get_patches() const
void build_patches(const Matrix &matrix, const std::string &name, const Options options=Options(false, 1, false))
bool show_absolute_values
types::global_dof_index size_type
virtual std::vector< std::string > get_dataset_names() const
Options(const bool show_absolute_values=false, const unsigned int block_size=1, const bool discontinuous=false)