17 #ifndef __deal2__matrix_out_h
18 #define __deal2__matrix_out_h
20 #include <deal.II/base/config.h>
21 #include <deal.II/base/data_out_base.h>
22 #include <deal.II/lac/sparse_matrix.h>
23 #include <deal.II/lac/block_sparse_matrix.h>
152 Options (
const bool show_absolute_values =
false,
153 const unsigned int block_size = 1,
154 const bool discontinuous =
false);
200 template <
class Matrix>
202 const std::string &
name,
222 typedef ::DataOutBase::Patch<2,2>
Patch;
246 virtual const std::vector<Patch> &
261 template <
typename number>
271 template <
typename number>
284 template <
class Matrix>
302 template <
class Matrix>
313 template <
typename number>
320 return matrix.
el(i,j);
326 template <
typename number>
333 return matrix.
el(i,j);
339 template <
class Matrix>
351 template <
class Matrix>
373 size_type n_elements = 0;
375 row < std::min(size_type(matrix.m()),
378 col < std::min(size_type(matrix.m()),
381 average += std::fabs(
get_element (matrix, row, col));
384 average /= n_elements;
390 template <
class Matrix>
393 const std::string &name,
397 gridpoints_x = (matrix.n() / options.
block_size
399 (matrix.n() % options.
block_size != 0 ? 1 : 0)),
400 gridpoints_y = (matrix.m() / options.
block_size
402 (matrix.m() % options.
block_size != 0 ? 1 : 0));
415 patches.resize ((gridpoints_x) * (gridpoints_y));
419 for (size_type i=0; i<gridpoints_y; ++i)
420 for (size_type j=0; j<gridpoints_x; ++j, ++index)
442 patches[index].vertices[0](0) = j;
443 patches[index].vertices[0](1) = static_cast<signed int>(-i);
444 patches[index].vertices[1](0) = j;
445 patches[index].vertices[1](1) = static_cast<signed int>(-i-1);
446 patches[index].vertices[2](0) = j+1;
447 patches[index].vertices[2](1) = static_cast<signed int>(-i);
448 patches[index].vertices[3](0) = j+1;
449 patches[index].vertices[3](1) = static_cast<signed int>(-i-1);
454 for (
unsigned int v=0; v<4; ++v)
457 patches[index].n_subdivisions = 1;
459 patches[index].data.reinit (1,4);
484 DEAL_II_NAMESPACE_CLOSE
virtual const std::vector< Patch > & get_patches() const
static double get_element(const SparseMatrix< number > &matrix, const size_type i, const size_type j)
static double get_gridpoint_value(const Matrix &matrix, const size_type i, const size_type j, const Options &options)
std::vector< Patch > patches
number el(const size_type i, const size_type j) const
unsigned int global_dof_index
::DataOutBase::Patch< 2, 2 > Patch
value_type 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
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)