Reference documentation for deal.II version 9.1.1
\(\newcommand{\dealcoloneq}{\mathrel{\vcenter{:}}=}\)
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | List of all members
DataOutReader< dim, spacedim > Class Template Reference

#include <deal.II/base/data_out_base.h>

Inheritance diagram for DataOutReader< dim, spacedim >:
[legend]

Public Member Functions

void read (std::istream &in)
 
void merge (const DataOutReader< dim, spacedim > &other)
 
- Public Member Functions inherited from DataOutInterface< dim, spacedim >
 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)
 
template<typename FlagType >
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
 

Static Public Member Functions

static ::ExceptionBaseExcIncompatibleDatasetNames ()
 
static ::ExceptionBaseExcIncompatiblePatchLists ()
 
static ::ExceptionBaseExcIncompatibleDimensions (int arg1, int arg2, int arg3, int arg4)
 
- Static Public Member Functions inherited from DataOutInterface< dim, spacedim >
static void declare_parameters (ParameterHandler &prm)
 

Protected Member Functions

virtual const std::vector<::DataOutBase::Patch< dim, spacedim > > & get_patches () const override
 
virtual std::vector< std::string > get_dataset_names () const override
 
virtual std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation > > get_nonscalar_data_ranges () const override
 
- Protected Member Functions inherited from DataOutInterface< dim, spacedim >
virtual std::vector< std::tuple< unsigned int, unsigned int, std::string > > get_vector_data_ranges () const
 
void validate_dataset_names () const
 

Private Attributes

std::vector<::DataOutBase::Patch< dim, spacedim > > patches
 
std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation > > nonscalar_data_ranges
 

Additional Inherited Members

- Protected Attributes inherited from DataOutInterface< dim, spacedim >
unsigned int default_subdivisions
 

Detailed Description

template<int dim, int spacedim = dim>
class DataOutReader< dim, spacedim >

A class that is used to read data written in deal.II intermediate format back in, so that it can be written out in any of the other supported graphics formats. This class has two main purposes:

The first use of this class is so that application programs can defer the decision of which graphics format to use until after the program has been run. The data is written in intermediate format into a file, and later on it can then be converted into any graphics format you wish. This may be useful, for example, if you want to convert it to gnuplot format to get a quick glimpse and later on want to convert it to OpenDX format as well to get a high quality version of the data. The present class allows to read this intermediate format back into the program, and allows it to be written in any other supported format using the relevant functions of the base class.

The second use is mostly useful in parallel programs: rather than having one central process generate the graphical output for the entire program, one can let each process generate the graphical data for the cells it owns, and write it into a separate file in intermediate format. Later on, all these intermediate files can then be read back in and merged together, a process that is fast compared to generating the data in the first place. The use of the intermediate format is mostly because it allows separate files to be merged, while this is almost impossible once the data has been written out in any of the supported established graphics formats.

This second use scenario is explained in some detail in the step-18 example program.

Both these applications are implemented in the step-19 example program. There, a slight complication is also explained: in order to read data back into this object, you have to know the template parameters for the space dimension which were used when writing the data. If this knowledge is available at compile time, then this is no problem. However, if it is not (such as in a simple format converter), then it needs to be figured out at run time, even though the compiler already needs it at compile time. A way around using the DataOutBase::determine_intermediate_format_dimensions() function is explained in step-19.

Note that the intermediate format is what its name suggests: a direct representation of internal data. It isn't standardized and will change whenever we change our internal representation. You can only expect to process files written in this format using the same version of deal.II that was used for writing.

Author
Wolfgang Bangerth, 2005

Definition at line 3413 of file data_out_base.h.

Member Function Documentation

◆ read()

template<int dim, int spacedim>
void DataOutReader< dim, spacedim >::read ( std::istream &  in)

Read a sequence of patches as written previously by DataOutBase::write_deal_II_intermediate and store them in the present object. This overwrites any previous content.

Definition at line 8603 of file data_out_base.cc.

◆ merge()

template<int dim, int spacedim>
void DataOutReader< dim, spacedim >::merge ( const DataOutReader< dim, spacedim > &  other)

This function can be used to merge the patches read by the other object into the patches that this present object stores. This is sometimes handy if one has, for example, a domain decomposition algorithm where each block is represented by a DoFHandler of its own, but one wants to output the solution on all the blocks at the same time. Alternatively, it may also be used for parallel programs, where each process only generates output for its share of the cells, even if all processes can see all cells.

For this to work, the input files for the present object and the given argument need to have the same number of output vectors, and they need to use the same number of subdivisions per patch. The output will probably look rather funny if patches in both objects overlap in space.

If you call read() for this object after merging in patches, the previous state is overwritten, and the merged-in patches are lost.

This function will fail if either this or the other object did not yet set up any patches.

The use of this function is demonstrated in step-19.

Definition at line 8714 of file data_out_base.cc.

◆ get_patches()

template<int dim, int spacedim>
const std::vector< typename::DataOutBase::Patch< dim, spacedim > > & DataOutReader< dim, spacedim >::get_patches ( ) const
overrideprotectedvirtual

This is the function through which this class propagates preprocessed data in the form of Patch structures (declared in the base class DataOutBase) to the actual output function.

It returns the patches as read the last time a stream was given to the read() function.

Implements DataOutInterface< dim, spacedim >.

Definition at line 8776 of file data_out_base.cc.

◆ get_dataset_names()

template<int dim, int spacedim>
std::vector< std::string > DataOutReader< dim, spacedim >::get_dataset_names ( ) const
overrideprotectedvirtual

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

Return the names of the variables as read the last time we read a file.

Implements DataOutInterface< dim, spacedim >.

Definition at line 8785 of file data_out_base.cc.

◆ get_nonscalar_data_ranges()

template<int dim, int spacedim>
std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation > > DataOutReader< dim, spacedim >::get_nonscalar_data_ranges ( ) const
overrideprotectedvirtual

This functions returns information about how the individual components of output files that consist of more than one data set are to be interpreted.

It returns a list of index pairs and corresponding name indicating which components of the output are to be considered vector-valued rather than just a collection of scalar data. The index pairs are inclusive; for example, if we have a Stokes problem in 2d with components (u,v,p), then the corresponding vector data range should be (0,1), and the returned list would consist of only a single element with a tuple such as (0,1,"velocity").

Since some of the derived classes do not know about vector data, this function has a default implementation that simply returns an empty string, meaning that all data is to be considered a collection of scalar fields.

Reimplemented from DataOutInterface< dim, spacedim >.

Definition at line 8798 of file data_out_base.cc.

Member Data Documentation

◆ patches

template<int dim, int spacedim = dim>
std::vector<::DataOutBase::Patch<dim, spacedim> > DataOutReader< dim, spacedim >::patches
private

Arrays holding the set of patches as well as the names of output variables, all of which we read from an input stream.

Definition at line 3526 of file data_out_base.h.

◆ nonscalar_data_ranges

template<int dim, int spacedim = dim>
std::vector< std::tuple<unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation> > DataOutReader< dim, spacedim >::nonscalar_data_ranges
private

Information about whether certain components of the output field are to be considered vectors.

Definition at line 3538 of file data_out_base.h.


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