]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Port over skeleton MathGL grid_out interface.
authoryoung <young@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 28 Mar 2013 20:28:32 +0000 (20:28 +0000)
committeryoung <young@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 28 Mar 2013 20:28:32 +0000 (20:28 +0000)
git-svn-id: https://svn.dealii.org/trunk@29106 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/grid/grid_out.h
deal.II/source/grid/grid_out.cc
deal.II/source/grid/grid_out.inst.in

index 31229dedd5220736e2b1deb55cd6ae931549fc4a..77710625060559096aaec79d302007e3a8cdcab0 100644 (file)
@@ -693,6 +693,29 @@ namespace GridOutFlags
 //    void parse_parameters (ParameterHandler &param);
   };
 
+  /**
+   * Flags for grid output in MathGL format.
+   *
+   * @ingroup output
+   */
+  struct MathGL
+  {
+    /**
+     * Constructor.
+     */
+    MathGL ();
+
+    /**
+     * Declare parameters in ParameterHandler.
+     */
+    static void declare_parameters (ParameterHandler &param);
+
+    /**
+     * Parse parameters of ParameterHandler.
+     */
+    void parse_parameters (ParameterHandler &param);
+  };
+
 }
 
 
@@ -798,8 +821,9 @@ public:
     /// write() calls write_msh()
     msh,
     /// write() calls write_svg()
-    svg
-    /// write() calls write_svg()
+    svg,
+    /// write() calls write_mathgl()
+    mathgl
   };
 
   /**
@@ -1022,6 +1046,15 @@ public:
   void write_svg (const Triangulation<2,2> &tria,
                   std::ostream            &out) const;
 
+  /**
+   * Write triangulation in MathGL format.
+   *
+   * Not implemented for the codimension one case.
+   */
+  template <int dim>
+  void write_mathgl (const Triangulation<dim> &tria,
+                    std::ostream             &out) const;
+
   /**
    * Write grid to @p out according to the given data format. This
    * function simply calls the appropriate <tt>write_*</tt> function.
@@ -1087,6 +1120,11 @@ public:
    */
   void set_flags (const GridOutFlags::Svg &flags);
 
+  /**
+   * Set flags for MathGL output
+   */
+  void set_flags (const GridOutFlags::MathGL &flags);
+
   /**
    * Provide a function which tells us which
    * suffix with a given output format
@@ -1219,6 +1257,11 @@ private:
    */
   GridOutFlags::Svg svg_flags;
 
+  /**
+   * Flags for OpenDX output.
+   */
+  GridOutFlags::MathGL mathgl_flags;
+
   /**
    * Write the grid information about faces to @p out. Only those
    * faces are printed which are on the boundary and which have a
index 4cfa7acd4534459aa7dff0d5cbdc464d9e46a152..7bdb461df3e512d25de310020931ecce8e3367d8 100644 (file)
@@ -364,6 +364,14 @@ namespace GridOutFlags
     draw_legend(draw_legend)
   {}
 
+  MathGL::MathGL ()
+  {}
+
+  void MathGL::declare_parameters (ParameterHandler &param)
+  {}
+
+  void MathGL::parse_parameters (ParameterHandler &param)
+  {}
 
 }  // end namespace GridOutFlags
 
@@ -429,13 +437,17 @@ void GridOut::set_flags (const GridOutFlags::XFig &flags)
 }
 
 
-
 void GridOut::set_flags (const GridOutFlags::Svg &flags)
 {
   svg_flags = flags;
 }
 
 
+void GridOut::set_flags (const GridOutFlags::MathGL &flags)
+{
+  mathgl_flags = flags;
+}
+
 std::string
 GridOut::default_suffix (const OutputFormat output_format)
 {
@@ -457,6 +469,8 @@ GridOut::default_suffix (const OutputFormat output_format)
       return ".msh";
     case svg:
       return ".svg";
+    case mathgl:
+      return ".mathgl";
     default:
       Assert (false, ExcNotImplemented());
       return "";
@@ -500,6 +514,9 @@ GridOut::parse_output_format (const std::string &format_name)
   if (format_name == "svg")
     return svg;
 
+  if (format_name == "mathgl")
+    return mathgl;
+
   AssertThrow (false, ExcInvalidState ());
   // return something weird
   return OutputFormat(-1);
@@ -509,7 +526,7 @@ GridOut::parse_output_format (const std::string &format_name)
 
 std::string GridOut::get_output_format_names ()
 {
-  return "none|dx|gnuplot|eps|ucd|xfig|msh|svg";
+  return "none|dx|gnuplot|eps|ucd|xfig|msh|svg|mathgl";
 }
 
 
@@ -545,6 +562,10 @@ GridOut::declare_parameters(ParameterHandler &param)
   param.enter_subsection("XFig");
   GridOutFlags::XFig::declare_parameters(param);
   param.leave_subsection();
+
+  param.enter_subsection("MathGl");
+  GridOutFlags::MathGL::declare_parameters(param);
+  param.leave_subsection();
 }
 
 
@@ -579,6 +600,10 @@ GridOut::parse_parameters(ParameterHandler &param)
   param.enter_subsection("XFig");
   xfig_flags.parse_parameters(param);
   param.leave_subsection();
+
+  param.enter_subsection("MathGL");
+  mathgl_flags.parse_parameters(param);
+  param.leave_subsection();
 }
 
 
@@ -586,14 +611,15 @@ GridOut::parse_parameters(ParameterHandler &param)
 std::size_t
 GridOut::memory_consumption () const
 {
-  return (sizeof(dx_flags) +
-          sizeof(msh_flags) +
-          sizeof(ucd_flags) +
+  return (sizeof(dx_flags)      +
+          sizeof(msh_flags)     +
+          sizeof(ucd_flags)     +
           sizeof(gnuplot_flags) +
-          sizeof(eps_flags_1) +
-          sizeof(eps_flags_2) +
-          sizeof(eps_flags_3) +
-          sizeof(xfig_flags));
+          sizeof(eps_flags_1)   +
+          sizeof(eps_flags_2)   +
+          sizeof(eps_flags_3)   +
+          sizeof(xfig_flags)    +
+          sizeof(mathgl_flags));
 }
 
 
@@ -1946,6 +1972,21 @@ void GridOut::write_svg(const Triangulation<2,2> &tria, std::ostream &out) const
 
 }
 
+template <>
+void GridOut::write_mathgl (const Triangulation<1> &,
+                           std::ostream           &) const
+{
+  Assert (false, ExcNotImplemented());
+}
+
+
+template <int dim>
+void GridOut::write_mathgl (const Triangulation<dim> &tria,
+                           std::ostream             &out) const
+{
+  Assert (false, ExcNotImplemented());
+}
+
 
 unsigned int GridOut::n_boundary_faces (const Triangulation<1> &) const
 {
@@ -3286,6 +3327,10 @@ void GridOut::write (const Triangulation<dim, spacedim> &tria,
     case svg:
       write_svg (tria, out);
       return;
+
+    case mathgl:
+      write_mathgl (tria, out);
+      return;
     }
 
   Assert (false, ExcInternalError());
index b716edc98025d61eb79046426ba9cfd70486f12c..1a470c9a47eef563dbe091da4cf8ae0825d1bf77 100644 (file)
@@ -18,6 +18,9 @@ for (deal_II_dimension : DIMENSIONS)
     template void GridOut::write_dx
       (const Triangulation<deal_II_dimension>&,
        std::ostream&) const;
+    template void GridOut::write_mathgl
+      (const Triangulation<deal_II_dimension>&,
+       std::ostream&) const;
 #endif
 
     template void GridOut::write_msh

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.