]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Slightly change the format in which we write intermediate format. Add a
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 18 Apr 2005 22:12:42 +0000 (22:12 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 18 Apr 2005 22:12:42 +0000 (22:12 +0000)
function by which we can recover the template parameters.

git-svn-id: https://svn.dealii.org/trunk@10516 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/include/base/data_out_base.h
deal.II/base/source/data_out_base.cc

index b7caf7dc92474b77755f05b429cbba4a99cc0d98..c6e1ee82afb08ad8ff97abb24a695b3f90868965 100644 (file)
@@ -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 <tt>dim</tt> and <tt>spacedim</tt>
+                                      * 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<unsigned int, unsigned int>
+    determine_intermediate_format_dimensions (std::istream &input);
+    
                                     /**
                                      * Determine an estimate for
                                      * the memory consumption (in
index 03b5a0962596bb673e653f268efdacaf2b36be3e..d3f5262424ca6f0b567588a72093980c63c900dc 100644 (file)
@@ -3950,6 +3950,14 @@ write_deal_II_intermediate (const std::vector<Patch<dim,spacedim> > &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<Patch<dim,spacedim> > &patches,
 
 
 
+std::pair<unsigned int, unsigned int>
+DataOutBase::
+determine_intermediate_format_dimensions (std::istream &input)
+{
+  Assert (input, ExcIO());
+          
+  int dim, spacedim;
+  input >> dim >> spacedim;
+
+  return std::make_pair (dim, spacedim);
+}
+
+
+
 template <int dim, int spacedim>
 void
 DataOutBase::write_gmv_reorder_data_vectors (const std::vector<Patch<dim,spacedim> > &patches,

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.