Reference documentation for deal.II version Git 1e5934d 2014-09-16 11:53:50 -0400
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
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

typedef types::global_dof_index size_type
 

Public Member Functions

virtual ~MatrixOut ()
 
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 ()
 
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 char *filename, MPI_Comm comm) const
 
void write_pvtu_record (std::ostream &out, const std::vector< std::string > &piece_names) const
 
void write_pvd_record (std::ostream &out, const std::vector< std::pair< double, std::string > > &times_and_names) const
 
void write_visit_record (std::ostream &out, const std::vector< std::string > &piece_names) const
 
void write_visit_record (std::ostream &out, const std::vector< 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 std::string &h5_filename, const double cur_time, MPI_Comm comm) const DEAL_II_DEPRECATED
 
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 std::string &filename, MPI_Comm comm) const DEAL_II_DEPRECATED
 
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 DataOutBase::DXFlags &dx_flags)
 
void set_flags (const DataOutBase::UcdFlags &ucd_flags)
 
void set_flags (const DataOutBase::GnuplotFlags &gnuplot_flags)
 
void set_flags (const DataOutBase::PovrayFlags &povray_flags)
 
void set_flags (const DataOutBase::EpsFlags &eps_flags)
 
void set_flags (const DataOutBase::GmvFlags &gmv_flags)
 
void set_flags (const DataOutBase::TecplotFlags &tecplot_flags)
 
void set_flags (const DataOutBase::VtkFlags &vtk_flags)
 
void set_flags (const DataOutBase::SvgFlags &svg_flags)
 
void set_flags (const DataOutBase::Deal_II_IntermediateFlags &deal_II_intermediate_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

typedef ::DataOutBase::Patch< 2, 2 > Patch
 

Private Member Functions

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

Static Private Member Functions

template<typename number >
static double get_element (const SparseMatrix< number > &matrix, const size_type i, const size_type j)
 
template<typename number >
static double get_element (const BlockSparseMatrix< number > &matrix, const size_type i, const size_type j)
 
template<class Matrix >
static double get_element (const Matrix &matrix, const size_type i, const size_type j)
 
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_cxx11::tuple< unsigned
int, unsigned int, std::string > > 
get_vector_data_ranges () 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.

Internals

To avoid a compiler error in Sun's Forte compiler, we derive privately from DataOutBase. Since the base class DataOutInterface does so as well, this does no harm, but calms the compiler which is suspecting an access control conflict otherwise. Testcase here:

template <typename T> class V {};
struct B1 {
template <int dim> struct X {
int i[dim];
};
};
struct B2 : private B1 {};
struct D : public B2, private B1 {
~D () {};
typedef B1::X<2> X;
V<X> x;
};
D d;
Author
Wolfgang Bangerth, 2001

Definition at line 93 of file matrix_out.h.

Member Typedef Documentation

Declare type for container size.

Definition at line 99 of file matrix_out.h.

typedef ::DataOutBase::Patch<2,2> MatrixOut::Patch
private

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

Note that we have to indicate the global scope in front of DataOutBase, since otherwise the C++ rules specify that this here indicates the DataOutBase base class of this class. Since that is a private base class, we cannot access its members, and so access to the local Patch type would be forbidden.

Definition at line 222 of file matrix_out.h.

Constructor & Destructor Documentation

virtual MatrixOut::~MatrixOut ( )
virtual

Destructor. Declared in order to make it virtual.

Member Function Documentation

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 below. 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 392 of file matrix_out.h.

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

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

Implements DataOutInterface< 2, 2 >.

virtual std::vector<std::string> MatrixOut::get_dataset_names ( ) const
privatevirtual

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

Implements DataOutInterface< 2, 2 >.

template<typename number >
double MatrixOut::get_element ( const SparseMatrix< number > &  matrix,
const size_type  i,
const size_type  j 
)
inlinestaticprivate

Return the element with given indices of a sparse matrix.

Definition at line 316 of file matrix_out.h.

template<typename number >
double MatrixOut::get_element ( const BlockSparseMatrix< number > &  matrix,
const size_type  i,
const size_type  j 
)
inlinestaticprivate

Return the element with given indices of a block sparse matrix.

Definition at line 329 of file matrix_out.h.

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

Return the element with given indices from any matrix type for which no specialization of this function was declared above. This will call operator() on the matrix.

Definition at line 342 of file matrix_out.h.

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 354 of file matrix_out.h.

Member Data Documentation

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 232 of file matrix_out.h.

std::string MatrixOut::name
private

Name of the matrix to be written.

Definition at line 238 of file matrix_out.h.


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