]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Address a few follow-up issues with the previous patches.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 2 Feb 2014 19:37:02 +0000 (19:37 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 2 Feb 2014 19:37:02 +0000 (19:37 +0000)
git-svn-id: https://svn.dealii.org/trunk@32376 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/examples/step-13/step-13.cc
deal.II/examples/step-14/step-14.cc
deal.II/include/deal.II/base/data_out_base.h
deal.II/source/base/data_out_base.cc
deal.II/source/base/data_out_base.inst.in

index cd1f9525b769b4510208bd8e4f70286673e885d2..189f1f70770ea5992ae9cc8f27b6e84f7cc13c0e 100644 (file)
@@ -1,7 +1,7 @@
 /* ---------------------------------------------------------------------
  * $Id$
  *
- * Copyright (C) 2001 - 2013 by the deal.II authors
+ * Copyright (C) 2001 - 2014 by the deal.II authors
  *
  * This file is part of the deal.II library.
  *
@@ -343,15 +343,14 @@ namespace Step13
     // program we shall generate output (from this we will then also generate
     // the suffix of the filename to which we write).
     //
-    // Regarding the output format, the <code>DataOutInterface</code> class
-    // (which is a base class of <code>DataOut</code> through which we will
-    // access its fields) provides an enumeration field
-    // <code>OutputFormat</code>, which lists names for all supported output
+    // Regarding the output format, the DataOutBase namespace
+    // provides an enumeration field
+    // DataOutBase::OutputFormat which lists names for all supported output
     // formats. At the time of writing of this program, the supported graphics
     // formats are represented by the enum values <code>ucd</code>,
     // <code>gnuplot</code>, <code>povray</code>, <code>eps</code>,
     // <code>gmv</code>, <code>tecplot</code>, <code>tecplot_binary</code>,
-    // <code>dx</code>, and <code>vtk</code>, but this list will certainly
+    // <code>dx</code>, <code>vtk</code>, etc, but this list will certainly
     // grow over time. Now, within various functions of that base class, you
     // can use values of this type to get information about these graphics
     // formats (for example the default suffix used for files of each format),
@@ -372,21 +371,21 @@ namespace Step13
     class SolutionOutput : public EvaluationBase<dim>
     {
     public:
-      SolutionOutput (const std::string                         &output_name_base,
-                      const typename DataOut<dim>::OutputFormat  output_format);
+      SolutionOutput (const std::string               &output_name_base,
+                      const DataOutBase::OutputFormat  output_format);
 
       virtual void operator () (const DoFHandler<dim> &dof_handler,
                                 const Vector<double>  &solution) const;
     private:
-      const std::string                         output_name_base;
-      const typename DataOut<dim>::OutputFormat output_format;
+      const std::string               output_name_base;
+      const DataOutBase::OutputFormat output_format;
     };
 
 
     template <int dim>
     SolutionOutput<dim>::
-    SolutionOutput (const std::string                         &output_name_base,
-                    const typename DataOut<dim>::OutputFormat  output_format)
+    SolutionOutput (const std::string               &output_name_base,
+                    const DataOutBase::OutputFormat  output_format)
       :
       output_name_base (output_name_base),
       output_format (output_format)
@@ -396,7 +395,7 @@ namespace Step13
     // After the description above, the function generating the actual output
     // is now relatively straightforward. The only particularly interesting
     // feature over previous example programs is the use of the
-    // <code>DataOut::default_suffix</code> function, returning the usual
+    // DataOutBase::default_suffix function, returning the usual
     // suffix for files of a given format (e.g. ".eps" for encapsulated
     // postscript files, ".gnuplot" for Gnuplot files), and of the generic
     // <code>DataOut::write</code> function with a second argument, which
@@ -1489,7 +1488,7 @@ namespace Step13
     // Also generate an evaluator which writes out the solution:
     Evaluation::SolutionOutput<dim>
     postprocessor2 (std::string("solution-")+solver_name,
-                    DataOut<dim>::gnuplot);
+                    DataOutBase::gnuplot);
 
     // Take these two evaluation objects and put them in a list...
     std::list<Evaluation::EvaluationBase<dim> *> postprocessor_list;
index 23590f9d8bd5f4a7102dc91a8a5e1e3b6f2e9be2..bcb7d493edd80de2fd906bf000325d44f4b7d50d 100644 (file)
@@ -1,7 +1,7 @@
 /* ---------------------------------------------------------------------
  * $Id$
  *
- * Copyright (C) 2002 - 2013 by the deal.II authors
+ * Copyright (C) 2002 - 2014 by the deal.II authors
  *
  * This file is part of the deal.II library.
  *
@@ -875,7 +875,7 @@ namespace Step14
                << std::ends;
 
       std::ofstream out (filename.str().c_str());
-      data_out.write (out, DataOut<dim>::gnuplot);
+      data_out.write (out, DataOutBase::gnuplot);
     }
 
 
@@ -2399,7 +2399,7 @@ namespace Step14
                << std::ends;
 
       std::ofstream out (filename.str().c_str());
-      data_out.write (out, DataOut<dim>::gnuplot);
+      data_out.write (out, DataOutBase::gnuplot);
     }
 
 
index e78e03d6dbb88d15af6e36909bbe683721fe0067..ea0a249a98553fe4fa12344f4e5c0ab7c0f94277 100644 (file)
@@ -1930,7 +1930,6 @@ namespace DataOutBase
    * 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);
 
@@ -3022,45 +3021,47 @@ public:
 
 /* -------------------- inline functions ------------------- */
 
-inline
-bool
-DataOutBase::EpsFlags::RgbValues::is_grey () const
+namespace DataOutBase
 {
-  return (red == green) && (red == blue);
-}
+  inline
+  bool
+  EpsFlags::RgbValues::is_grey () const
+  {
+    return (red == green) && (red == blue);
+  }
 
 
-/* -------------------- template functions ------------------- */
-
-/**
- * Output operator for an object of type
- * <tt>DataOutBase::Patch</tt>. This operator dumps the intermediate
- * graphics format represented by the patch data structure. It may
- * later be converted into regular formats for a number of graphics
- * programs.
- *
- * @author Wolfgang Bangerth, 2005
- */
-template <int dim, int spacedim>
-std::ostream &
-operator << (std::ostream                           &out,
-             const DataOutBase::Patch<dim,spacedim> &patch);
+  /* -------------------- template functions ------------------- */
 
+  /**
+   * Output operator for an object of type
+   * <tt>DataOutBase::Patch</tt>. This operator dumps the intermediate
+   * graphics format represented by the patch data structure. It may
+   * later be converted into regular formats for a number of graphics
+   * programs.
+   *
+   * @author Wolfgang Bangerth, 2005
+   */
+  template <int dim, int spacedim>
+  std::ostream &
+  operator << (std::ostream                           &out,
+               const Patch<dim,spacedim> &patch);
 
 
-/**
- * Input operator for an object of type
- * <tt>DataOutBase::Patch</tt>. This operator reads the intermediate
- * graphics format represented by the patch data structure, using the
- * format in which it was written using the operator<<.
- *
- * @author Wolfgang Bangerth, 2005
- */
-template <int dim, int spacedim>
-std::istream &
-operator >> (std::istream                     &in,
-             DataOutBase::Patch<dim,spacedim> &patch);
 
+  /**
+   * Input operator for an object of type
+   * <tt>DataOutBase::Patch</tt>. This operator reads the intermediate
+   * graphics format represented by the patch data structure, using the
+   * format in which it was written using the operator<<.
+   *
+   * @author Wolfgang Bangerth, 2005
+   */
+  template <int dim, int spacedim>
+  std::istream &
+  operator >> (std::istream                     &in,
+               Patch<dim,spacedim> &patch);
+}
 
 
 DEAL_II_NAMESPACE_CLOSE
index 01f596c90d332106ce410a40b914cdc9dfe76573..c6294ecfc13109c0063165e9c9681afedbbac545 100644 (file)
@@ -7980,96 +7980,96 @@ DataOutReader<dim,spacedim>::get_vector_data_ranges () const
 
 
 
-
-template <int dim, int spacedim>
-std::ostream &
-operator << (std::ostream                           &out,
-             const DataOutBase::Patch<dim,spacedim> &patch)
+namespace DataOutBase
 {
-  // write a header line
-  out << "[deal.II intermediate Patch<" << dim << ',' << spacedim << ">]"
-      << '\n';
-
-  // then write all the data that is
-  // in this patch
-  for (unsigned int i=0; i<GeometryInfo<dim>::vertices_per_cell; ++i)
-    out << patch.vertices[GeometryInfo<dim>::ucd_to_deal[i]] << ' ';
-  out << '\n';
-
-  for (unsigned int i=0; i<GeometryInfo<dim>::faces_per_cell; ++i)
-    out << patch.neighbors[i] << ' ';
-  out << '\n';
+  template <int dim, int spacedim>
+  std::ostream &
+  operator << (std::ostream                           &out,
+               const Patch<dim,spacedim> &patch)
+  {
+    // write a header line
+    out << "[deal.II intermediate Patch<" << dim << ',' << spacedim << ">]"
+        << '\n';
 
-  out << patch.patch_index << ' ' << patch.n_subdivisions
-      << '\n';
+    // then write all the data that is
+    // in this patch
+    for (unsigned int i=0; i<GeometryInfo<dim>::vertices_per_cell; ++i)
+      out << patch.vertices[GeometryInfo<dim>::ucd_to_deal[i]] << ' ';
+    out << '\n';
 
-  out << patch.points_are_available<<'\n';
+    for (unsigned int i=0; i<GeometryInfo<dim>::faces_per_cell; ++i)
+      out << patch.neighbors[i] << ' ';
+    out << '\n';
 
-  out << patch.data.n_rows() << ' ' << patch.data.n_cols() << '\n';
-  for (unsigned int i=0; i<patch.data.n_rows(); ++i)
-    for (unsigned int j=0; j<patch.data.n_cols(); ++j)
-      out << patch.data[i][j] << ' ';
-  out << '\n';
-  out << '\n';
+    out << patch.patch_index << ' ' << patch.n_subdivisions
+        << '\n';
 
-  return out;
-}
+    out << patch.points_are_available<<'\n';
 
+    out << patch.data.n_rows() << ' ' << patch.data.n_cols() << '\n';
+    for (unsigned int i=0; i<patch.data.n_rows(); ++i)
+      for (unsigned int j=0; j<patch.data.n_cols(); ++j)
+        out << patch.data[i][j] << ' ';
+    out << '\n';
+    out << '\n';
 
+    return out;
+  }
 
-template <int dim, int spacedim>
-std::istream &
-operator >> (std::istream                     &in,
-             DataOutBase::Patch<dim,spacedim> &patch)
-{
-  Assert (in, ExcIO());
 
-  // read a header line and compare
-  // it to what we usually
-  // write. skip all lines that
-  // contain only blanks at the start
+  template <int dim, int spacedim>
+  std::istream &
+  operator >> (std::istream                     &in,
+               Patch<dim,spacedim> &patch)
   {
-    std::string header;
-    do
-      {
-        getline (in, header);
-        while ((header.size() != 0) &&
-               (header[header.size()-1] == ' '))
-          header.erase(header.size()-1);
-      }
-    while ((header == "") && in);
+    Assert (in, ExcIO());
 
-    std::ostringstream s;
-    s << "[deal.II intermediate Patch<" << dim << ',' << spacedim << ">]";
+    // read a header line and compare
+    // it to what we usually
+    // write. skip all lines that
+    // contain only blanks at the start
+    {
+      std::string header;
+      do
+        {
+          getline (in, header);
+          while ((header.size() != 0) &&
+                 (header[header.size()-1] == ' '))
+            header.erase(header.size()-1);
+        }
+      while ((header == "") && in);
 
-    Assert (header == s.str(), ExcUnexpectedInput(s.str(),header));
-  }
+      std::ostringstream s;
+      s << "[deal.II intermediate Patch<" << dim << ',' << spacedim << ">]";
 
+      Assert (header == s.str(), ExcUnexpectedInput(s.str(),header));
+    }
 
-  // then read all the data that is
-  // in this patch
-  for (unsigned int i=0; i<GeometryInfo<dim>::vertices_per_cell; ++i)
-    in >> patch.vertices[GeometryInfo<dim>::ucd_to_deal[i]];
 
-  for (unsigned int i=0; i<GeometryInfo<dim>::faces_per_cell; ++i)
-    in >> patch.neighbors[i];
+    // then read all the data that is
+    // in this patch
+    for (unsigned int i=0; i<GeometryInfo<dim>::vertices_per_cell; ++i)
+      in >> patch.vertices[GeometryInfo<dim>::ucd_to_deal[i]];
 
-  in >> patch.patch_index >> patch.n_subdivisions;
+    for (unsigned int i=0; i<GeometryInfo<dim>::faces_per_cell; ++i)
+      in >> patch.neighbors[i];
 
-  in >> patch.points_are_available;
+    in >> patch.patch_index >> patch.n_subdivisions;
 
-  unsigned int n_rows, n_cols;
-  in >> n_rows >> n_cols;
-  patch.data.reinit (n_rows, n_cols);
-  for (unsigned int i=0; i<patch.data.n_rows(); ++i)
-    for (unsigned int j=0; j<patch.data.n_cols(); ++j)
-      in >> patch.data[i][j];
+    in >> patch.points_are_available;
 
-  Assert (in, ExcIO());
+    unsigned int n_rows, n_cols;
+    in >> n_rows >> n_cols;
+    patch.data.reinit (n_rows, n_cols);
+    for (unsigned int i=0; i<patch.data.n_rows(); ++i)
+      for (unsigned int j=0; j<patch.data.n_cols(); ++j)
+        in >> patch.data[i][j];
 
-  return in;
-}
+    Assert (in, ExcIO());
 
+    return in;
+  }
+}
 
 
 
index 28547f6d1718791f737a21ec165fae3efde191b6..dc4ea5982367ae6987d62f6d2c7aa9094e09af01 100644 (file)
@@ -20,21 +20,24 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension :  SPACE_DIMENSIONS
 #if deal_II_dimension <= deal_II_space_dimension
   template class DataOutInterface<deal_II_dimension, deal_II_space_dimension>;
   template class DataOutReader<deal_II_dimension, deal_II_space_dimension>;
-  template struct DataOutBase::Patch<deal_II_dimension, deal_II_space_dimension>;
+  
+  namespace DataOutBase
+  \{
+  template struct Patch<deal_II_dimension, deal_II_space_dimension>;
 
   template
   std::ostream &
   operator << (std::ostream                           &out,
-               const DataOutBase::Patch<deal_II_dimension, deal_II_space_dimension> &patch);
+               const Patch<deal_II_dimension, deal_II_space_dimension> &patch);
 
   template
   std::istream &
   operator >> (std::istream                     &in,
-               DataOutBase::Patch<deal_II_dimension, deal_II_space_dimension> &patch);
+               Patch<deal_II_dimension, deal_II_space_dimension> &patch);
 
   template
   void
-  DataOutBase::write_vtk (const std::vector<Patch<deal_II_dimension,deal_II_space_dimension> > &patches,
+  write_vtk (const std::vector<Patch<deal_II_dimension,deal_II_space_dimension> > &patches,
                         const std::vector<std::string>          &data_names,
                         const std::vector<std_cxx1x::tuple<unsigned int, unsigned int, std::string> > &vector_data_ranges,
                         const VtkFlags                          &flags,
@@ -42,7 +45,7 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension :  SPACE_DIMENSIONS
 
   template
   void
-  DataOutBase::write_vtu (const std::vector<Patch<deal_II_dimension,deal_II_space_dimension> > &patches,
+  write_vtu (const std::vector<Patch<deal_II_dimension,deal_II_space_dimension> > &patches,
                         const std::vector<std::string>          &data_names,
                         const std::vector<std_cxx1x::tuple<unsigned int, unsigned int, std::string> > &vector_data_ranges,
                         const VtkFlags                          &flags,
@@ -50,7 +53,7 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension :  SPACE_DIMENSIONS
 
   template
   void
-  DataOutBase::write_ucd (const std::vector<Patch<deal_II_dimension,deal_II_space_dimension> > &patches,
+  write_ucd (const std::vector<Patch<deal_II_dimension,deal_II_space_dimension> > &patches,
                         const std::vector<std::string>          &data_names,
                         const std::vector<std_cxx1x::tuple<unsigned int, unsigned int, std::string> > &vector_data_ranges,
                         const UcdFlags                          &flags,
@@ -58,7 +61,7 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension :  SPACE_DIMENSIONS
 
   template
   void
-  DataOutBase::write_dx (const std::vector<Patch<deal_II_dimension,deal_II_space_dimension> > &patches,
+  write_dx (const std::vector<Patch<deal_II_dimension,deal_II_space_dimension> > &patches,
                         const std::vector<std::string>          &data_names,
                         const std::vector<std_cxx1x::tuple<unsigned int, unsigned int, std::string> > &vector_data_ranges,
                         const DXFlags                          &flags,
@@ -66,7 +69,7 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension :  SPACE_DIMENSIONS
 
   template
   void
-  DataOutBase::write_gnuplot (const std::vector<Patch<deal_II_dimension,deal_II_space_dimension> > &patches,
+  write_gnuplot (const std::vector<Patch<deal_II_dimension,deal_II_space_dimension> > &patches,
                         const std::vector<std::string>          &data_names,
                         const std::vector<std_cxx1x::tuple<unsigned int, unsigned int, std::string> > &vector_data_ranges,
                         const GnuplotFlags                          &flags,
@@ -74,7 +77,7 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension :  SPACE_DIMENSIONS
 
   template
   void
-  DataOutBase::write_povray (const std::vector<Patch<deal_II_dimension,deal_II_space_dimension> > &patches,
+  write_povray (const std::vector<Patch<deal_II_dimension,deal_II_space_dimension> > &patches,
                         const std::vector<std::string>          &data_names,
                         const std::vector<std_cxx1x::tuple<unsigned int, unsigned int, std::string> > &vector_data_ranges,
                         const PovrayFlags                          &flags,
@@ -82,7 +85,7 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension :  SPACE_DIMENSIONS
 
   template
   void
-  DataOutBase::write_eps (const std::vector<Patch<deal_II_dimension,deal_II_space_dimension> > &patches,
+  write_eps (const std::vector<Patch<deal_II_dimension,deal_II_space_dimension> > &patches,
                         const std::vector<std::string>          &data_names,
                         const std::vector<std_cxx1x::tuple<unsigned int, unsigned int, std::string> > &vector_data_ranges,
                         const EpsFlags                          &flags,
@@ -90,7 +93,7 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension :  SPACE_DIMENSIONS
 
   template
   void
-  DataOutBase::write_gmv (const std::vector<Patch<deal_II_dimension,deal_II_space_dimension> > &patches,
+  write_gmv (const std::vector<Patch<deal_II_dimension,deal_II_space_dimension> > &patches,
                         const std::vector<std::string>          &data_names,
                         const std::vector<std_cxx1x::tuple<unsigned int, unsigned int, std::string> > &vector_data_ranges,
                         const GmvFlags                          &flags,
@@ -98,7 +101,7 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension :  SPACE_DIMENSIONS
 
   template
   void
-  DataOutBase::write_tecplot (const std::vector<Patch<deal_II_dimension,deal_II_space_dimension> > &patches,
+  write_tecplot (const std::vector<Patch<deal_II_dimension,deal_II_space_dimension> > &patches,
                         const std::vector<std::string>          &data_names,
                         const std::vector<std_cxx1x::tuple<unsigned int, unsigned int, std::string> > &vector_data_ranges,
                         const TecplotFlags                          &flags,
@@ -106,7 +109,7 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension :  SPACE_DIMENSIONS
 
   template
   void
-  DataOutBase::write_tecplot_binary (const std::vector<Patch<deal_II_dimension,deal_II_space_dimension> > &patches,
+  write_tecplot_binary (const std::vector<Patch<deal_II_dimension,deal_II_space_dimension> > &patches,
                         const std::vector<std::string>          &data_names,
                         const std::vector<std_cxx1x::tuple<unsigned int, unsigned int, std::string> > &vector_data_ranges,
                         const TecplotFlags                          &flags,
@@ -115,7 +118,7 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension :  SPACE_DIMENSIONS
 #if deal_II_space_dimension >1
   template
   void
-  DataOutBase::write_svg (const std::vector<Patch<deal_II_dimension,deal_II_space_dimension> > &patches,
+  write_svg (const std::vector<Patch<deal_II_dimension,deal_II_space_dimension> > &patches,
                         const std::vector<std::string>          &data_names,
                         const std::vector<std_cxx1x::tuple<unsigned int, unsigned int, std::string> > &vector_data_ranges,
                         const SvgFlags                          &flags,
@@ -123,10 +126,11 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension :  SPACE_DIMENSIONS
 #endif
   template
   void
-  DataOutBase::write_deal_II_intermediate (const std::vector<Patch<deal_II_dimension,deal_II_space_dimension> > &patches,
+  write_deal_II_intermediate (const std::vector<Patch<deal_II_dimension,deal_II_space_dimension> > &patches,
                         const std::vector<std::string>          &data_names,
                         const std::vector<std_cxx1x::tuple<unsigned int, unsigned int, std::string> > &vector_data_ranges,
                         const Deal_II_IntermediateFlags                          &flags,
                         std::ostream                            &out);
+  \}
 #endif
 }

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.