Reference documentation for deal.II version Git 774052e 2014-09-21 16:04:25 +0200
DataPostprocessor< dim > Class Template Referenceabstract

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

Inheritance diagram for DataPostprocessor< dim >:
[legend]

Public Member Functions

virtual ~DataPostprocessor ()

virtual void compute_derived_quantities_scalar (const std::vector< double > &uh, const std::vector< Tensor< 1, dim > > &duh, const std::vector< Tensor< 2, dim > > &dduh, const std::vector< Point< dim > > &normals, std::vector< Vector< double > > &computed_quantities) const DEAL_II_DEPRECATED

virtual void compute_derived_quantities_scalar (const std::vector< double > &uh, const std::vector< Tensor< 1, dim > > &duh, const std::vector< Tensor< 2, dim > > &dduh, const std::vector< Point< dim > > &normals, const std::vector< Point< dim > > &evaluation_points, std::vector< Vector< double > > &computed_quantities) const

virtual void compute_derived_quantities_vector (const std::vector< Vector< double > > &uh, const std::vector< std::vector< Tensor< 1, dim > > > &duh, const std::vector< std::vector< Tensor< 2, dim > > > &dduh, const std::vector< Point< dim > > &normals, std::vector< Vector< double > > &computed_quantities) const DEAL_II_DEPRECATED

virtual void compute_derived_quantities_vector (const std::vector< Vector< double > > &uh, const std::vector< std::vector< Tensor< 1, dim > > > &duh, const std::vector< std::vector< Tensor< 2, dim > > > &dduh, const std::vector< Point< dim > > &normals, const std::vector< Point< dim > > &evaluation_points, std::vector< Vector< double > > &computed_quantities) const

virtual std::vector< std::string > get_names () const =0

virtual std::vector
< DataComponentInterpretation::DataComponentInterpretation
get_data_component_interpretation () const

virtual UpdateFlags get_needed_update_flags () const =0

Public Member Functions inherited from Subscriptor
Subscriptor ()

Subscriptor (const Subscriptor &)

virtual ~Subscriptor ()

Subscriptoroperator= (const Subscriptor &)

void subscribe (const char *identifier=0) const

void unsubscribe (const char *identifier=0) const

unsigned int n_subscriptions () const

void list_subscribers () const

DeclException3 (ExcInUse, int, char *, std::string &,<< "Object of class "<< arg2<< " is still used by "<< arg1<< " other objects.\n"<< "(Additional information: "<< arg3<< ")\n"<< "Note the entry in the Frequently Asked Questions of "<< "deal.II (linked to from http://www.dealii.org/) for "<< "more information on what this error means.")

DeclException2 (ExcNoSubscriber, char *, char *,<< "No subscriber with identifier \""<< arg2<< "\" did subscribe to this object of class "<< arg1)

template<class Archive >
void serialize (Archive &ar, const unsigned int version)

Detailed Description

template<int dim> class DataPostprocessor< dim >

This class provides an interface to compute derived quantities from a solution that can then be output in graphical formats for visualization, using facilities such as the DataOut class.

For the (graphical) output of a FE solution one frequently wants to include derived quantities, which are calculated from the values of the solution and possibly the first and second derivates of the solution. Examples are the calculation of Mach numbers from velocity and density in supersonic flow computations, or the computation of the magnitude of a complex-valued solution as demonstrated in step-29. Other uses are shown in step-32 and step-33. This class offers the interface to perform such postprocessing. Given the values and derivatives of the solution at those points where we want to generated output, the functions of this class can be overloaded to compute new quantities.

A data vector and an object of a derived class can be given to the DataOut::add_data_vector() function, which will write the derived quantities instead of the provided data to the output file. Note, that the DataPostprocessor has to live until DataOut::build_patches has been called. DataOutFaces and DataOutRotation can be used as well.

In order not to perform needless calculations, DataPostprocessor has to provide information which input data is needed for the calculation of the derived quantities, i.e. whether it needs the values, the first derivative and/or the second derivative of the provided data. DataPostprocessor objects which are used in combination with a DataOutFaces object can also ask for the normal vectors at each point. The information which data is needed has to be provided via the UpdateFlags returned by the virtual function get_needed_update_flags(). It is your responsibility to use only those values which were updated in the calculation of derived quantities. The DataOut object will provide references to the requested data in the call to compute_derived_quantities_scalar() or compute_derived_quantities_vector() (DataOut decides which of the two functions to call depending on whether the finite element in use has only a single, or multiple vector components; note that this is only determined by the number of components in the finite element in use, and not by whether the data computed by a class derived from the current one is scalar or vector valued).

Furthermore, derived classes have to implement the get_names() function, where the number of output variables returned by the latter function has to match the size of the vector returned by the former. Furthermore, this number has to match the number of computed quantities, of course.

Use in simpler cases

Deriving from the current class allows to implement very general postprocessors. For example, in the step-32 program, we implement a postprocessor that takes a solution that consists of velocity, pressure and temperature (dim+2 components) and computes a variety of output quantities, some of which are vector valued and some of which are scalar. On the other hand, in step-29 we implement a postprocessor that only computes the magnitude of a complex number given by a two-component finite element. It seems silly to have to implement four virtual functions for this (compute_derived_quantities_scalar() or compute_derived_quantities_vector(), get_names(), get_update_flags() and get_data_component_interpretation()).

To this end there are two classes DataPostprocessorScalar and DataPostprocessorVector that are meant to be used if the output quantity is either a single scalar or a single vector (here used meaning to have exactly dim components). When using these classes, one only has to write a constructor that passes the name of the output variable and the update flags to the constructor of the base class and overload the function that actually computes the results.

Definition at line 107 of file data_postprocessor.h.

Constructor & Destructor Documentation

template<int dim>
 virtual DataPostprocessor< dim >::~DataPostprocessor ( )
virtual

Virtual desctructor for safety. Does not do anything.

Member Function Documentation

template<int dim>
 virtual void DataPostprocessor< dim >::compute_derived_quantities_scalar ( const std::vector< double > & uh, const std::vector< Tensor< 1, dim > > & duh, const std::vector< Tensor< 2, dim > > & dduh, const std::vector< Point< dim > > & normals, std::vector< Vector< double > > & computed_quantities ) const
virtual
Deprecated:

This function only exists for backward compatibility as this is the interface provided by previous versions of the library. The default implementation of the other function of same name below calls this function by simply dropping the argument that denotes the evaluation points. Since this function might at one point go away, you should overload the other function instead.

template<int dim>
 virtual void DataPostprocessor< dim >::compute_derived_quantities_scalar ( const std::vector< double > & uh, const std::vector< Tensor< 1, dim > > & duh, const std::vector< Tensor< 2, dim > > & dduh, const std::vector< Point< dim > > & normals, const std::vector< Point< dim > > & evaluation_points, std::vector< Vector< double > > & computed_quantities ) const
virtual

This is the main function which actually performs the postprocessing. The last argument is a reference to the postprocessed data which has correct size already and must be filled by this function. uh is a reference to a vector of data values at all points, duh the same for gradients, dduh for second derivatives and normals is a reference to the normal vectors. Note, that the last four references will only contain valid data, if the respective flags are returned by get_needed_update_flags, otherwise those vectors will be in an unspecified state. normals will always be an empty vector when working on cells, not on faces.

This function is called when the original data vector represents scalar data, i.e. the finite element in use has only a single vector component.

template<int dim>
 virtual void DataPostprocessor< dim >::compute_derived_quantities_vector ( const std::vector< Vector< double > > & uh, const std::vector< std::vector< Tensor< 1, dim > > > & duh, const std::vector< std::vector< Tensor< 2, dim > > > & dduh, const std::vector< Point< dim > > & normals, std::vector< Vector< double > > & computed_quantities ) const
virtual
Deprecated:

This function only exists for backward compatibility as this is the interface provided by previous versions of the library. The default implementation of the other function of same name below calls this function by simply dropping the argument that denotes the evaluation points. Since this function might at one point go away, you should overload the other function instead.

template<int dim>
 virtual void DataPostprocessor< dim >::compute_derived_quantities_vector ( const std::vector< Vector< double > > & uh, const std::vector< std::vector< Tensor< 1, dim > > > & duh, const std::vector< std::vector< Tensor< 2, dim > > > & dduh, const std::vector< Point< dim > > & normals, const std::vector< Point< dim > > & evaluation_points, std::vector< Vector< double > > & computed_quantities ) const
virtual

Same as the compute_derived_quantities_scalar() function, but this function is called when the original data vector represents vector data, i.e. the finite element in use has multiple vector components.

template<int dim>
 virtual std::vector DataPostprocessor< dim >::get_names ( ) const
pure virtual

Return the vector of strings describing the names of the computed quantities.

Implemented in DataPostprocessorVector< dim >, and DataPostprocessorScalar< dim >.

template<int dim>
 virtual std::vector DataPostprocessor< dim >::get_data_component_interpretation ( ) const
virtual

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

For example, if one has a finite element for the Stokes equations in 2d, representing components (u,v,p), one would like to indicate that the first two, u and v, represent a logical vector so that later on when we generate graphical output we can hand them off to a visualization program that will automatically know to render them as a vector field, rather than as two separate and independent scalar fields.

The default implementation of this function returns a vector of values DataComponentInterpretation::component_is_scalar, indicating that all output components are independent scalar fields. However, if a derived class produces data that represents vectors, it may return a vector that contains values DataComponentInterpretation::component_is_part_of_vector. In the example above, one would return a vector with components (DataComponentInterpretation::component_is_part_of_vector, DataComponentInterpretation::component_is_part_of_vector, DataComponentInterpretation::component_is_scalar) for (u,v,p).

Reimplemented in DataPostprocessorVector< dim >, and DataPostprocessorScalar< dim >.

template<int dim>
 virtual UpdateFlags DataPostprocessor< dim >::get_needed_update_flags ( ) const
pure virtual

Return, which data has to be provided to compute the derived quantities. This has to be a combination of update_values, update_gradients and update_hessians. If the DataPostprocessor is to be used in combination with DataOutFaces, you may also ask for a update of normals via the update_normal_vectors flag.

Implemented in DataPostprocessorVector< dim >, and DataPostprocessorScalar< dim >.

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