Reference documentation for deal.II version 9.1.1
\(\newcommand{\dealcoloneq}{\mathrel{\vcenter{:}}=}\)
Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
MatrixOut Class Reference

#include <deal.II/lac/matrix_out.h>

Inheritance diagram for MatrixOut:
[legend]

Classes

struct  Options
 

Public Types

using size_type = types::global_dof_index
 

Public Member Functions

virtual ~MatrixOut () override=default
 
template<class Matrix >
void build_patches (const Matrix &matrix, const std::string &name, const Options options=Options(false, 1, false))
 
- Public Member Functions inherited from DataOutInterface< 2, 2 >
 DataOutInterface ()
 
virtual ~DataOutInterface ()=default
 
void write_dx (std::ostream &out) const
 
void write_eps (std::ostream &out) const
 
void write_gmv (std::ostream &out) const
 
void write_gnuplot (std::ostream &out) const
 
void write_povray (std::ostream &out) const
 
void write_tecplot (std::ostream &out) const
 
void write_tecplot_binary (std::ostream &out) const
 
void write_ucd (std::ostream &out) const
 
void write_vtk (std::ostream &out) const
 
void write_vtu (std::ostream &out) const
 
void write_vtu_in_parallel (const std::string &filename, MPI_Comm comm) const
 
void write_pvtu_record (std::ostream &out, const std::vector< std::string > &piece_names) const
 
void write_svg (std::ostream &out) const
 
void write_deal_II_intermediate (std::ostream &out) const
 
XDMFEntry create_xdmf_entry (const DataOutBase::DataOutFilter &data_filter, const std::string &h5_filename, const double cur_time, MPI_Comm comm) const
 
XDMFEntry create_xdmf_entry (const DataOutBase::DataOutFilter &data_filter, const std::string &h5_mesh_filename, const std::string &h5_solution_filename, const double cur_time, MPI_Comm comm) const
 
void write_xdmf_file (const std::vector< XDMFEntry > &entries, const std::string &filename, MPI_Comm comm) const
 
void write_hdf5_parallel (const DataOutBase::DataOutFilter &data_filter, const std::string &filename, MPI_Comm comm) const
 
void write_hdf5_parallel (const DataOutBase::DataOutFilter &data_filter, const bool write_mesh_file, const std::string &mesh_filename, const std::string &solution_filename, MPI_Comm comm) const
 
void write_filtered_data (DataOutBase::DataOutFilter &filtered_data) const
 
void write (std::ostream &out, const DataOutBase::OutputFormat output_format=DataOutBase::default_format) const
 
void set_default_format (const DataOutBase::OutputFormat default_format)
 
void set_flags (const FlagType &flags)
 
std::string default_suffix (const DataOutBase::OutputFormat output_format=DataOutBase::default_format) const
 
void parse_parameters (ParameterHandler &prm)
 
std::size_t memory_consumption () const
 

Private Types

using Patch = DataOutBase::Patch< 2, 2 >
 

Private Member Functions

virtual const std::vector< Patch > & get_patches () const override
 
virtual std::vector< std::string > get_dataset_names () const override
 

Static Private Member Functions

template<class Matrix >
static double get_gridpoint_value (const Matrix &matrix, const size_type i, const size_type j, const Options &options)
 

Private Attributes

std::vector< Patchpatches
 
std::string name
 

Additional Inherited Members

- Static Public Member Functions inherited from DataOutInterface< 2, 2 >
static void declare_parameters (ParameterHandler &prm)
 
- Protected Member Functions inherited from DataOutInterface< 2, 2 >
virtual std::vector< std::tuple< unsigned int, unsigned int, std::string > > get_vector_data_ranges () const
 
virtual std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation > > get_nonscalar_data_ranges () const
 
void validate_dataset_names () const
 
- Protected Attributes inherited from DataOutInterface< 2, 2 >
unsigned int default_subdivisions
 

Detailed Description

Output a matrix in graphical form using the generic format independent output routines of the base class. The matrix is converted into a list of patches on a 2d domain where the height is given by the elements of the matrix. The functions of the base class can then write this "mountain representation" of the matrix in a variety of graphical output formats. The coordinates of the matrix output are that the columns run with increasing x-axis, as usual, starting from zero, while the rows run into the negative y-axis, also starting from zero. Note that due to some internal restrictions, this class can only output one matrix at a time, i.e. it can not take advantage of the multiple dataset capabilities of the base class.

A typical usage of this class would be as follows:

// fill matrix M with some values
...
// now write out M:
MatrixOut matrix_out;
std::ofstream out ("M.gnuplot");
matrix_out.build_patches (M, "M");
matrix_out.write_gnuplot (out);

Of course, you can as well choose a different graphical output format. Also, this class supports any matrix, not only of type FullMatrix, as long as it satisfies a number of requirements, stated with the member functions of this class.

The generation of patches through the build_patches() function can be modified by giving it an object holding certain flags. See the documentation of the members of the Options class for a description of these flags.

Author
Wolfgang Bangerth, 2001

Definition at line 72 of file matrix_out.h.

Member Typedef Documentation

◆ size_type

Declare type for container size.

Definition at line 78 of file matrix_out.h.

◆ Patch

using MatrixOut::Patch = DataOutBase::Patch<2, 2>
private

Abbreviate the somewhat lengthy name for the DataOutBase::Patch class.

Definition at line 150 of file matrix_out.h.

Constructor & Destructor Documentation

◆ ~MatrixOut()

virtual MatrixOut::~MatrixOut ( )
overridevirtualdefault

Destructor. Declared in order to make it virtual.

Member Function Documentation

◆ build_patches()

template<class Matrix >
void MatrixOut::build_patches ( const Matrix &  matrix,
const std::string &  name,
const Options  options = Options(false, 1, false) 
)

Generate a list of patches from the given matrix and use the given string as the name of the data set upon writing to a file. Once patches have been built, you can use the functions of the base class to write the data into a files, using one of the supported output formats.

You may give a structure holding various options. See the description of the fields of this structure for more information.

Note that this function requires that we can extract elements of the matrix, which is done using the get_element() function declared in an internal namespace. By adding specializations, you can extend this class to other matrix classes which are not presently supported. Furthermore, we need to be able to extract the size of the matrix, for which we assume that the matrix type offers member functions m() and n(), which return the number of rows and columns, respectively.

Definition at line 326 of file matrix_out.h.

◆ get_patches()

const std::vector< MatrixOut::Patch > & MatrixOut::get_patches ( ) const
overrideprivatevirtual

Function by which the base class's functions get to know what patches they shall write to a file.

Implements DataOutInterface< 2, 2 >.

Definition at line 32 of file matrix_out.cc.

◆ get_dataset_names()

std::vector< std::string > MatrixOut::get_dataset_names ( ) const
overrideprivatevirtual

Virtual function through which the names of data sets are obtained by the output functions of the base class.

Implements DataOutInterface< 2, 2 >.

Definition at line 40 of file matrix_out.cc.

◆ get_gridpoint_value()

template<class Matrix >
double MatrixOut::get_gridpoint_value ( const Matrix &  matrix,
const size_type  i,
const size_type  j,
const Options options 
)
inlinestaticprivate

Get the value of the matrix at gridpoint (i,j). Depending on the given flags, this can mean different things, for example if only absolute values shall be shown then the absolute value of the matrix entry is taken. If the block size is larger than one, then an average of several matrix entries is taken.

Definition at line 283 of file matrix_out.h.

Member Data Documentation

◆ patches

std::vector<Patch> MatrixOut::patches
private

This is a list of patches that is created each time build_patches() is called. These patches are used in the output routines of the base classes.

Definition at line 157 of file matrix_out.h.

◆ name

std::string MatrixOut::name
private

Name of the matrix to be written.

Definition at line 162 of file matrix_out.h.


The documentation for this class was generated from the following files: