From: wolf Date: Mon, 18 Apr 2005 22:12:42 +0000 (+0000) Subject: Slightly change the format in which we write intermediate format. Add a X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=06eba46523242c49ff4f7b6b48b2825b240e1cff;p=dealii-svn.git Slightly change the format in which we write intermediate format. Add a function by which we can recover the template parameters. git-svn-id: https://svn.dealii.org/trunk@10516 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/base/include/base/data_out_base.h b/deal.II/base/include/base/data_out_base.h index b7caf7dc92..c6e1ee82af 100644 --- a/deal.II/base/include/base/data_out_base.h +++ b/deal.II/base/include/base/data_out_base.h @@ -1534,6 +1534,29 @@ class DataOutBase const Deal_II_IntermediateFlags &flags, std::ostream &out); + + /** + * Given an input stream that contains + * data written by + * write_deal_II_intermediate, determine + * the dim and spacedim + * template parameters with which that + * function was called, and return them + * as a pair of values. + * + * Note that this function eats a number + * of elements at the present position of + * the stream, and therefore alters + * it. In order to read from it using, + * for example, the DataOutReader class, + * you may wish to either reset the + * stream to its previous position, or + * close and reopen it. + */ + static + std::pair + determine_intermediate_format_dimensions (std::istream &input); + /** * Determine an estimate for * the memory consumption (in diff --git a/deal.II/base/source/data_out_base.cc b/deal.II/base/source/data_out_base.cc index 03b5a09625..d3f5262424 100644 --- a/deal.II/base/source/data_out_base.cc +++ b/deal.II/base/source/data_out_base.cc @@ -3950,6 +3950,14 @@ write_deal_II_intermediate (const std::vector > &patches, const Deal_II_IntermediateFlags &/*flags*/, std::ostream &out) { + // first write tokens indicating the + // template parameters. we need this in + // here because we may want to read in data + // again even if we don't know in advance + // the template parameters, see step-19 + out << dim << ' ' << spacedim << std::endl; + + // then write a header out << "[deal.II intermediate format graphics data]" << std::endl << "[written by deal.II version " << DEAL_II_MAJOR << '.' << DEAL_II_MINOR << "]" << std::endl; @@ -3967,6 +3975,20 @@ write_deal_II_intermediate (const std::vector > &patches, +std::pair +DataOutBase:: +determine_intermediate_format_dimensions (std::istream &input) +{ + Assert (input, ExcIO()); + + int dim, spacedim; + input >> dim >> spacedim; + + return std::make_pair (dim, spacedim); +} + + + template void DataOutBase::write_gmv_reorder_data_vectors (const std::vector > &patches,