Reference documentation for deal.II version Git 9deac93 2014-10-24 21:41:49 -0500
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
DataOutStack< dim, spacedim, DH > Class Template Reference

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

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

Classes

struct  DataVector
 

Public Types

enum  VectorType { cell_vector, dof_vector }
 

Public Member Functions

virtual ~DataOutStack ()
 
void new_parameter_value (const double parameter_value, const double parameter_step)
 
void attach_dof_handler (const DH &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 ()
 
void clear ()
 
std::size_t memory_consumption () const
 
 DeclException0 (ExcNoDoFHandlerSelected)
 
 DeclException3 (ExcInvalidVectorSize, int, int, int,<< "The vector has size "<< arg1<< " but the DoFHandler objects says there are "<< arg2<< " degrees of freedom and there are "<< arg3<< " active cells.")
 
 DeclException2 (ExcInvalidCharacter, std::string, size_t,<< "Please use only the characters [a-zA-Z0-9_<>()] for"<< std::endl<< "description strings since some graphics formats will only accept these."<< std::endl<< "The string you gave was <"<< arg1<< ">, the invalid character is <"<< arg1[arg2]<< ">."<< std::endl)
 
 DeclException2 (ExcInvalidNumberOfNames, int, int,<< "You have to give one name per component in your "<< "data vector. The number you gave was "<< arg1<< ", but the number of components is "<< arg2)
 
 DeclException1 (ExcVectorNotDeclared, std::string,<< "The data vector for which the first component has the name "<< arg1<< " has not been declared before.")
 
 DeclException0 (ExcDataNotCleared)
 
 DeclException0 (ExcDataAlreadyAdded)
 
 DeclException1 (ExcNameAlreadyUsed, std::string,<< "You tried to declare a component of a data vector with "<< "the name <"<< arg1<< ">, but that name is already used.")
 
 DeclException1 (ExcInvalidNumberOfSubdivisions, int,<< "The number of subdivisions per patch, "<< arg1<< ", is not valid.")
 
- Public Member Functions inherited from DataOutInterface< dim+1 >
 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 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 DH,
DataOutStack< dim, spacedim,
DH > > 
dof_handler
 
std::vector
< ::DataOutBase::Patch< dim+1,
dim+1 > > 
patches
 
std::vector< DataVectordof_data
 
std::vector< DataVectorcell_data
 

Additional Inherited Members

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

Detailed Description

template<int dim, int spacedim = dim, class DH = DoFHandler<dim,spacedim>>
class DataOutStack< dim, spacedim, DH >

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.push_back ("u");
solution_names.push_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 110 of file data_out_stack.h.

Member Enumeration Documentation

template<int dim, int spacedim = dim, class DH = DoFHandler<dim,spacedim>>
enum DataOutStack::VectorType

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

Definition at line 118 of file data_out_stack.h.

Constructor & Destructor Documentation

template<int dim, int spacedim = dim, class DH = DoFHandler<dim,spacedim>>
virtual DataOutStack< dim, spacedim, DH >::~DataOutStack ( )
virtual

Destructor. Only declared to make it virtual.

Member Function Documentation

template<int dim, int spacedim = dim, class DH = DoFHandler<dim,spacedim>>
void DataOutStack< dim, spacedim, DH >::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.

template<int dim, int spacedim = dim, class DH = DoFHandler<dim,spacedim>>
void DataOutStack< dim, spacedim, DH >::attach_dof_handler ( const DH &  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.

template<int dim, int spacedim = dim, class DH = DoFHandler<dim,spacedim>>
void DataOutStack< dim, spacedim, DH >::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.

template<int dim, int spacedim = dim, class DH = DoFHandler<dim,spacedim>>
void DataOutStack< dim, spacedim, DH >::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.

template<int dim, int spacedim = dim, class DH = DoFHandler<dim,spacedim>>
template<typename number >
void DataOutStack< dim, spacedim, DH >::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.

template<int dim, int spacedim = dim, class DH = DoFHandler<dim,spacedim>>
template<typename number >
void DataOutStack< dim, spacedim, DH >::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.

template<int dim, int spacedim = dim, class DH = DoFHandler<dim,spacedim>>
void DataOutStack< dim, spacedim, DH >::build_patches ( const unsigned int  n_subdivisions = 0)

Actually build the patches for output by the base classes from the data stored in the data vectors and using the previously attached DoFHandler object.

By n_subdivisions you can decide into how many subdivisions (in each space and parameter direction) each patch is divided. This is useful if higher order elements are used. Note however, that the number of subdivisions in parameter direction is always the same as the one is space direction for technical reasons.

template<int dim, int spacedim = dim, class DH = DoFHandler<dim,spacedim>>
void DataOutStack< dim, spacedim, DH >::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.

Couterpart of new_parameter_value.

template<int dim, int spacedim = dim, class DH = DoFHandler<dim,spacedim>>
void DataOutStack< dim, spacedim, DH >::clear ( )

Clear all data presently stored in this object.

template<int dim, int spacedim = dim, class DH = DoFHandler<dim,spacedim>>
std::size_t DataOutStack< dim, spacedim, DH >::memory_consumption ( ) const

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

template<int dim, int spacedim = dim, class DH = DoFHandler<dim,spacedim>>
DataOutStack< dim, spacedim, DH >::DeclException0 ( ExcNoDoFHandlerSelected  )

Exception

template<int dim, int spacedim = dim, class DH = DoFHandler<dim,spacedim>>
DataOutStack< dim, spacedim, DH >::DeclException3 ( ExcInvalidVectorSize  ,
int  ,
int  ,
int  ,
<< "The vector has size "<< arg1<< " but the DoFHandler objects says there are "<< arg2<< " degrees of freedom and there are "<< arg3<< " active cells."   
)

Exception

template<int dim, int spacedim = dim, class DH = DoFHandler<dim,spacedim>>
DataOutStack< dim, spacedim, DH >::DeclException2 ( ExcInvalidCharacter  ,
std::string  ,
size_t   
)

Exception

template<int dim, int spacedim = dim, class DH = DoFHandler<dim,spacedim>>
DataOutStack< dim, spacedim, DH >::DeclException2 ( ExcInvalidNumberOfNames  ,
int  ,
int  ,
<< "You have to give one name per component in your "<< "data vector. The number you gave was "<< arg1<< "  ,
but the number of components is"<<  arg2 
)

Exception

template<int dim, int spacedim = dim, class DH = DoFHandler<dim,spacedim>>
DataOutStack< dim, spacedim, DH >::DeclException1 ( ExcVectorNotDeclared  ,
std::string  ,
<< "The data vector for which the first component has the name "<< arg1<< " has not been declared before."   
)

Exception

template<int dim, int spacedim = dim, class DH = DoFHandler<dim,spacedim>>
DataOutStack< dim, spacedim, DH >::DeclException0 ( ExcDataNotCleared  )

Exception

template<int dim, int spacedim = dim, class DH = DoFHandler<dim,spacedim>>
DataOutStack< dim, spacedim, DH >::DeclException0 ( ExcDataAlreadyAdded  )

Exception

template<int dim, int spacedim = dim, class DH = DoFHandler<dim,spacedim>>
DataOutStack< dim, spacedim, DH >::DeclException1 ( ExcNameAlreadyUsed  ,
std::string   
)

Exception

template<int dim, int spacedim = dim, class DH = DoFHandler<dim,spacedim>>
DataOutStack< dim, spacedim, DH >::DeclException1 ( ExcInvalidNumberOfSubdivisions  ,
int  ,
<< "The number of subdivisions per  patch,
"<< arg1<< "  ,
is not valid."   
)

Exception

template<int dim, int spacedim = dim, class DH = DoFHandler<dim,spacedim>>
virtual const std::vector< ::DataOutBase::Patch<dim+1,dim+1> >& DataOutStack< dim, spacedim, DH >::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 >.

template<int dim, int spacedim = dim, class DH = DoFHandler<dim,spacedim>>
virtual std::vector<std::string> DataOutStack< dim, spacedim, DH >::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 >.

Member Data Documentation

template<int dim, int spacedim = dim, class DH = DoFHandler<dim,spacedim>>
double DataOutStack< dim, spacedim, DH >::parameter
private

Present parameter value.

Definition at line 364 of file data_out_stack.h.

template<int dim, int spacedim = dim, class DH = DoFHandler<dim,spacedim>>
double DataOutStack< dim, spacedim, DH >::parameter_step
private

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

Definition at line 371 of file data_out_stack.h.

template<int dim, int spacedim = dim, class DH = DoFHandler<dim,spacedim>>
SmartPointer<const DH,DataOutStack<dim,spacedim,DH> > DataOutStack< dim, spacedim, DH >::dof_handler
private

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

Definition at line 378 of file data_out_stack.h.

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

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

Definition at line 384 of file data_out_stack.h.

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

List of DoF data vectors.

Definition at line 415 of file data_out_stack.h.

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

List of cell data vectors.

Definition at line 420 of file data_out_stack.h.


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