Classes | |
class | ExcIncompatibleDatasetNames |
class | ExcIncompatibleDimensions |
class | ExcIncompatiblePatchLists |
class | ExcNoPatches |
Public Member Functions | |
void | read (std::istream &in) |
void | merge (const DataOutReader< dim, spacedim > &other) |
Protected Member Functions | |
virtual const std::vector < typename::DataOutBase::Patch < dim, spacedim > > & | get_patches () const |
virtual std::vector< std::string > | get_dataset_names () const |
virtual std::vector < std_cxx1x::tuple< unsigned int, unsigned int, std::string > > | get_vector_data_ranges () const |
Private Attributes | |
std::vector < typename::DataOutBase::Patch < dim, spacedim > > | patches |
std::vector< std::string > | dataset_names |
std::vector< std_cxx1x::tuple < unsigned int, unsigned int, std::string > > | vector_data_ranges |
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.
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.
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.
virtual const std::vector<typename ::DataOutBase::Patch<dim,spacedim> >& DataOutReader< dim, spacedim >::get_patches | ( | ) | const [protected, virtual] |
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 >.
virtual std::vector<std::string> DataOutReader< dim, spacedim >::get_dataset_names | ( | ) | const [protected, virtual] |
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 >.
virtual std::vector<std_cxx1x::tuple<unsigned int, unsigned int, std::string> > DataOutReader< dim, spacedim >::get_vector_data_ranges | ( | ) | const [protected, 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.
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 >.
std::vector<typename ::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.
std::vector<std::string> DataOutReader< dim, spacedim >::dataset_names [private] |
std::vector<std_cxx1x::tuple<unsigned int, unsigned int, std::string> > DataOutReader< dim, spacedim >::vector_data_ranges [private] |
Information about whether certain components of the output field are to be considered vectors.