Reference documentation for deal.II version 9.0.0
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
DataOutStack< dim, spacedim, DoFHandlerType > Class Template Reference

#include <deal.II/numerics/data_out_stack.h>

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

Classes

struct  DataVector
 

Public Types

enum  VectorType { cell_vector, dof_vector }
 

Public Member Functions

virtual ~DataOutStack ()=default
 
void new_parameter_value (const double parameter_value, const double parameter_step)
 
void attach_dof_handler (const DoFHandlerType &dof_handler)
 
void declare_data_vector (const std::string &name, const VectorType vector_type)
 
void declare_data_vector (const std::vector< std::string > &name, const VectorType vector_type)
 
template<typename number >
void add_data_vector (const Vector< number > &vec, const std::string &name)
 
template<typename number >
void add_data_vector (const Vector< number > &vec, const std::vector< std::string > &names)
 
void build_patches (const unsigned int n_subdivisions=0)
 
void finish_parameter_value ()
 
std::size_t memory_consumption () const
 
- Public Member Functions inherited from DataOutInterface< dim+1 >
 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 char *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
 

Static Public Member Functions

static ::ExceptionBaseExcVectorNotDeclared (std::string arg1)
 
static ::ExceptionBaseExcDataNotCleared ()
 
static ::ExceptionBaseExcDataAlreadyAdded ()
 
static ::ExceptionBaseExcNameAlreadyUsed (std::string arg1)
 
- Static Public Member Functions inherited from DataOutInterface< dim+1 >
static void declare_parameters (ParameterHandler &prm)
 

Private Member Functions

virtual const std::vector< ::DataOutBase::Patch< dim+1, dim+1 > > & get_patches () const
 
virtual std::vector< std::string > get_dataset_names () const
 

Private Attributes

double parameter
 
double parameter_step
 
SmartPointer< const DoFHandlerType, DataOutStack< dim, spacedim, DoFHandlerType > > dof_handler
 
std::vector< ::DataOutBase::Patch< dim+1, dim+1 > > patches
 
std::vector< DataVectordof_data
 
std::vector< DataVectorcell_data
 

Additional Inherited Members

- Protected Member Functions inherited from DataOutInterface< dim+1 >
virtual std::vector< std::tuple< unsigned int, unsigned int, std::string > > get_vector_data_ranges () const
 
void validate_dataset_names () const
 
- Protected Attributes inherited from DataOutInterface< dim+1 >
unsigned int default_subdivisions
 

Detailed Description

template<int dim, int spacedim = dim, typename DoFHandlerType = DoFHandler<dim,spacedim>>
class DataOutStack< dim, spacedim, DoFHandlerType >

This class is used to stack the output from several computations into one output file by stacking the data sets in another co-ordinate direction orthogonal to the space directions. The most common use is to stack the results of several time steps into one space-time output file, or for example to connect the results of solutions of a parameter dependent equation for several parameter value together into one. The interface is mostly modelled after the DataOut class, see there for some more documentation.

We will explain the concept for a time dependent problem, but instead of the time any parameter can be substituted. In our example, a solution of an equation is computed for each discrete time level. This is then added to an object of the present class and after all time levels are added, a space- time plot will be written in any of the output formats supported by the base class. Upon output, the (spatial) solution on each time level is extended into the time direction by writing it twice, once for the time level itself and once for a time equal to the time level minus a given time step. These two copies are connected, to form a space-time slab, with constant values in time.

Due to the piecewise constant output in time, the written solution will in general be discontinuous at discrete time levels, but the output is still sufficient in most cases. More sophisticated interpolations in time may be added in the future.

Example of Use

The following little example shall illustrate the different steps of use of this class. It is assumed that the finite element used is composed of two components, u and v, that the solution vector is named solution and that a vector error is computed which contains an error indicator for each spatial cell.

Note that unlike for the DataOut class it is necessary to first declare data vectors and the names of the components before first use. This is because on all time levels the same data should be present to produce reasonable time-space output. The output is generated with two subdivisions in each space and time direction, which is suitable for quadratic finite elements in space, for example.

DataOutStack<dim> data_out_stack;
// first declare the vectors
// to be used later
std::vector<std::string> solution_names;
solution_names.emplace_back ("u");
solution_names.emplace_back ("v");
data_out_stack.declare_data_vector (solution_names,
data_out_stack.declare_data_vector ("error",
// now do computations
for (double parameter=0; ...)
{
... // compute something
// now for output
data_out_stack.new_parameter_value (parameter,
delta_parameter);
data_out_stack.attach_dof_handler (dof_handler);
data_out_stack.add_data_vector (solution, solution_names);
data_out_stack.add_data_vector (error, "error");
data_out_stack.build_patches (2);
data_out_stack.finish_parameter_value ();
};
Author
Wolfgang Bangerth, 1999

Definition at line 109 of file data_out_stack.h.

Member Enumeration Documentation

◆ VectorType

template<int dim, int spacedim = dim, typename DoFHandlerType = DoFHandler<dim,spacedim>>
enum DataOutStack::VectorType

Data type declaring the two types of vectors which are used in this class.

Enumerator
cell_vector 

The data describes one value for each cell.

dof_vector 

The data describes one value for each DoF.

Definition at line 116 of file data_out_stack.h.

Constructor & Destructor Documentation

◆ ~DataOutStack()

template<int dim, int spacedim = dim, typename DoFHandlerType = DoFHandler<dim,spacedim>>
virtual DataOutStack< dim, spacedim, DoFHandlerType >::~DataOutStack ( )
virtualdefault

Destructor. Only declared to make it virtual.

Member Function Documentation

◆ new_parameter_value()

template<int dim, int spacedim, typename DoFHandlerType >
void DataOutStack< dim, spacedim, DoFHandlerType >::new_parameter_value ( const double  parameter_value,
const double  parameter_step 
)

Start the next set of data for a specific parameter value. The argument parameter_step denotes the interval (in backward direction, counted from parameter_value) with which the output will be extended in parameter direction, i.e. orthogonal to the space directions.

Definition at line 45 of file data_out_stack.cc.

◆ attach_dof_handler()

template<int dim, int spacedim, typename DoFHandlerType >
void DataOutStack< dim, spacedim, DoFHandlerType >::attach_dof_handler ( const DoFHandlerType &  dof_handler)

Attach the DoF handler for the grid and data associated with the parameter previously set by new_parameter_value.

This has to happen before adding data vectors for the present parameter value.

Definition at line 68 of file data_out_stack.cc.

◆ declare_data_vector() [1/2]

template<int dim, int spacedim, typename DoFHandlerType >
void DataOutStack< dim, spacedim, DoFHandlerType >::declare_data_vector ( const std::string &  name,
const VectorType  vector_type 
)

Declare a data vector. The vector_type argument determines whether the data vector will be considered as DoF or cell data.

This version may be called if the finite element presently used by the DoFHandler (and previously attached to this object) has only one component and therefore only one name needs to be given.

Definition at line 79 of file data_out_stack.cc.

◆ declare_data_vector() [2/2]

template<int dim, int spacedim, typename DoFHandlerType >
void DataOutStack< dim, spacedim, DoFHandlerType >::declare_data_vector ( const std::vector< std::string > &  name,
const VectorType  vector_type 
)

Declare a data vector. The vector_type argument determines whether the data vector will be considered as DoF or cell data.

This version must be called if the finite element presently used by the DoFHandler (and previously attached to this object) has more than one component and therefore more than one name needs to be given. However, you can also call this function with a std::vector<std::string> containing only one element if the finite element has only one component.

Definition at line 89 of file data_out_stack.cc.

◆ add_data_vector() [1/2]

template<int dim, int spacedim, typename DoFHandlerType >
template<typename number >
void DataOutStack< dim, spacedim, DoFHandlerType >::add_data_vector ( const Vector< number > &  vec,
const std::string &  name 
)

Add a data vector for the presently set value of the parameter.

This version may be called if the finite element presently used by the DoFHandler (and previously attached to this object) has only one component and therefore only one name needs to be given.

If vec is a vector with multiple components this function will generate distinct names for all components by appending an underscore and the number of each component to name

The data vector must have been registered using the declare_data_vector function before actually using it the first time.

Note that a copy of this vector is stored until finish_parameter_value is called the next time, so if you are short of memory you may want to call this function only after all computations involving large matrices are already done.

Definition at line 130 of file data_out_stack.cc.

◆ add_data_vector() [2/2]

template<int dim, int spacedim, typename DoFHandlerType >
template<typename number >
void DataOutStack< dim, spacedim, DoFHandlerType >::add_data_vector ( const Vector< number > &  vec,
const std::vector< std::string > &  names 
)

Add a data vector for the presently set value of the parameter.

This version must be called if the finite element presently used by the DoFHandler (and previously attached to this object) has more than one component and therefore more than one name needs to be given. However, you can also call this function with a std::vector<std::string> containing only one element if the finite element has only one component.

The data vector must have been registered using the declare_data_vector function before actually using it the first time.

Note that a copy of this vector is stored until finish_parameter_value is called the next time, so if you are short of memory you may want to call this function only after all computations involving large matrices are already done.

Definition at line 163 of file data_out_stack.cc.

◆ build_patches()

template<int dim, int spacedim, typename DoFHandlerType >
void DataOutStack< dim, spacedim, DoFHandlerType >::build_patches ( const unsigned int  n_subdivisions = 0)

This is the central function of this class since it builds the list of patches to be written by the low-level functions of the base class. A patch is, in essence, some intermediate representation of the data on each cell of a triangulation and DoFHandler object that can then be used to write files in some format that is readable by visualization programs.

You can find an overview of the use of this function in the general documentation of this class. An example is also provided in the documentation of this class's base class DataOut_DoFData.

Parameters
n_subdivisionsSee DataOut::build_patches() for an extensive description of this parameter. The number of subdivisions is always one in the direction of the time-like parameter used by this class.

Definition at line 231 of file data_out_stack.cc.

◆ finish_parameter_value()

template<int dim, int spacedim, typename DoFHandlerType >
void DataOutStack< dim, spacedim, DoFHandlerType >::finish_parameter_value ( )

Release all data that is no more needed once build_patches was called and all other transactions for a given parameter value are done.

Counterpart of new_parameter_value.

Definition at line 416 of file data_out_stack.cc.

◆ memory_consumption()

template<int dim, int spacedim, typename DoFHandlerType >
std::size_t DataOutStack< dim, spacedim, DoFHandlerType >::memory_consumption ( ) const

Determine an estimate for the memory consumption (in bytes) of this object.

Definition at line 433 of file data_out_stack.cc.

◆ get_patches()

template<int dim, int spacedim, typename DoFHandlerType >
const std::vector<::DataOutBase::Patch< dim+1, dim+1 > > & DataOutStack< dim, spacedim, DoFHandlerType >::get_patches ( ) const
privatevirtual

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

Implements DataOutInterface< dim+1 >.

Definition at line 448 of file data_out_stack.cc.

◆ get_dataset_names()

template<int dim, int spacedim, typename DoFHandlerType >
std::vector< std::string > DataOutStack< dim, spacedim, DoFHandlerType >::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< dim+1 >.

Definition at line 456 of file data_out_stack.cc.

Member Data Documentation

◆ parameter

template<int dim, int spacedim = dim, typename DoFHandlerType = DoFHandler<dim,spacedim>>
double DataOutStack< dim, spacedim, DoFHandlerType >::parameter
private

Present parameter value.

Definition at line 285 of file data_out_stack.h.

◆ parameter_step

template<int dim, int spacedim = dim, typename DoFHandlerType = DoFHandler<dim,spacedim>>
double DataOutStack< dim, spacedim, DoFHandlerType >::parameter_step
private

Present parameter step, i.e. length of the parameter interval to be written next.

Definition at line 291 of file data_out_stack.h.

◆ dof_handler

template<int dim, int spacedim = dim, typename DoFHandlerType = DoFHandler<dim,spacedim>>
SmartPointer<const DoFHandlerType,DataOutStack<dim,spacedim,DoFHandlerType> > DataOutStack< dim, spacedim, DoFHandlerType >::dof_handler
private

DoF handler to be used for the data corresponding to the present parameter value.

Definition at line 297 of file data_out_stack.h.

◆ patches

template<int dim, int spacedim = dim, typename DoFHandlerType = DoFHandler<dim,spacedim>>
std::vector< ::DataOutBase::Patch<dim+1,dim+1> > DataOutStack< dim, spacedim, DoFHandlerType >::patches
private

List of patches of all past and present parameter value data sets.

Definition at line 302 of file data_out_stack.h.

◆ dof_data

template<int dim, int spacedim = dim, typename DoFHandlerType = DoFHandler<dim,spacedim>>
std::vector<DataVector> DataOutStack< dim, spacedim, DoFHandlerType >::dof_data
private

List of DoF data vectors.

Definition at line 330 of file data_out_stack.h.

◆ cell_data

template<int dim, int spacedim = dim, typename DoFHandlerType = DoFHandler<dim,spacedim>>
std::vector<DataVector> DataOutStack< dim, spacedim, DoFHandlerType >::cell_data
private

List of cell data vectors.

Definition at line 335 of file data_out_stack.h.


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