]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
XFig started
authorguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 15 Oct 2003 19:54:47 +0000 (19:54 +0000)
committerguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 15 Oct 2003 19:54:47 +0000 (19:54 +0000)
git-svn-id: https://svn.dealii.org/trunk@8089 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/grid/grid_out.h
deal.II/deal.II/source/grid/grid_out.all_dimensions.cc
deal.II/deal.II/source/grid/grid_out.cc

index 73ab28059e1a8efad5a678f8d1516d5bb809333f..2b548ac26aadcc2e192049bb2751735f94fe4e4d 100644 (file)
@@ -393,6 +393,54 @@ namespace GridOutFlags
           const double       azimut_angle    = 60,
           const double       turn_angle      = 30);
   };
+                                  /**
+                                   * Flags fog XFig output.
+                                   */
+  struct XFig
+  {
+                                      /**
+                                       * Method for filling cells
+                                       */
+      unsigned int fill_style;
+                                      /**
+                                       * Draw boundary lines.
+                                       */
+      bool draw_boundary;
+                                      /**
+                                       * Change color depending on level.
+                                       */
+      bool level_color;
+                                      /**
+                                       * Code level to depth.
+                                       */
+      bool level_depth;
+                                      /**
+                                       * Additional points for curved
+                                       * boundaries.
+                                       */
+      unsigned int n_boundary_face_points;
+
+                                      /**
+                                       * Scaling of graph. The
+                                       * default is a unit length of
+                                       * one inch.
+                                       */
+      Point<2> scaling;
+                                      /**
+                                       * Offset of the graph. Before
+                                       * scaling, the coordinates are
+                                       * shifted by this
+                                       * value. Default is zero in
+                                       * each direction.
+                                       */
+      Point<2> offset;
+      
+                                      /**
+                                       * Constructor.
+                                       */
+      XFig();
+  };
+  
 }
 
 
@@ -486,7 +534,7 @@ class GridOut
                                      * Declaration of a name for each of the
                                      * different output formats.
                                      */
-    enum OutputFormat { dx, gnuplot, eps, ucd };
+    enum OutputFormat { dx, gnuplot, eps, ucd, xfig };
 
                                     /**
                                      * Write triangulation in OpenDX
@@ -682,7 +730,14 @@ class GridOut
     void write_eps (const Triangulation<1> &tria,
                    std::ostream           &out,
                    const Mapping<1>       *mapping=0);
-    
+
+                                    /**
+                                     * Write XFig-file.
+                                     */
+    template <int dim>
+    void write_xfig (const Triangulation<dim> &tria,
+                   std::ostream             &out,
+                   const Mapping<dim>       *mapping=0);
                                     /**
                                      * Write data and grid to @p{out} according
                                      * to the given data format. This function
@@ -728,6 +783,12 @@ class GridOut
                                      */
     void set_flags (const GridOutFlags::Eps<3> &flags);
 
+                                    /**
+                                     * Set flags for EPS output of a
+                                     * three-dimensional triangulation
+                                     */
+    void set_flags (const GridOutFlags::XFig &flags);
+
                                     /**
                                      * Provide a function which tells us which
                                      * suffix with a given output format
@@ -833,8 +894,12 @@ class GridOut
                                      * function.
                                      */
     GridOutFlags::Eps<3>  eps_flags_3;
-
-
+    
+                                    /**
+                                     * Flags used for XFig output.
+                                     */
+    GridOutFlags::XFig xfig_flags;
+    
                                     /**
                                      * Write the grid information about
                                      * faces to @p{out}. Only those faces
index e801ba27e26d981e347c56b6fd75ebf0ed67193b..b6a842dfac2efe621a37b6a68a35c39217318f9e 100644 (file)
@@ -112,6 +112,16 @@ namespace GridOutFlags
                  azimut_angle (azimut_angle),
                  turn_angle (turn_angle)
   {}
+
+
+  XFig::XFig ()
+                 : fill_style (20), // filled
+    draw_boundary(true),
+    level_color(false),
+    level_depth(true),
+    n_boundary_face_points(0),
+    scaling(1.,1.)
+  {}
 }  // end namespace GridOutFlags
 
 
@@ -158,6 +168,13 @@ void GridOut::set_flags (const GridOutFlags::Eps<3> &flags)
 
 
 
+void GridOut::set_flags (const GridOutFlags::XFig &flags) 
+{
+  xfig_flags = flags;
+}
+
+
+
 std::string
 GridOut::default_suffix (const OutputFormat output_format) 
 {
@@ -173,7 +190,9 @@ GridOut::default_suffix (const OutputFormat output_format)
 
       case eps: 
            return ".eps";
-           
+
+      case xfig:
+           return ".fig";
       default: 
            Assert (false, ExcNotImplemented()); 
            return "";
@@ -197,6 +216,9 @@ GridOut::parse_output_format (const std::string &format_name)
   if (format_name == "eps")
     return eps;
   
+  if (format_name == "xfig")
+    return xfig;
+  
   AssertThrow (false, ExcInvalidState ());
                                   // return something weird
   return OutputFormat(-1);
@@ -206,7 +228,7 @@ GridOut::parse_output_format (const std::string &format_name)
 
 std::string GridOut::get_output_format_names () 
 {
-  return "dx|gnuplot|eps|ucd";
+  return "dx|gnuplot|eps|ucd|xfig";
 }
 
 
@@ -218,5 +240,6 @@ GridOut::memory_consumption () const
          sizeof(gnuplot_flags) +
          sizeof(eps_flags_1) +
          sizeof(eps_flags_2) +
-         sizeof(eps_flags_3));
+         sizeof(eps_flags_3) +
+         sizeof(xfig_flags));
 }
index e32a384d45a97b31896b083923918d32d4c32e8c..79985800d16aa5b0b9b74d399ff4354461ac3c1f 100644 (file)
@@ -367,6 +367,26 @@ void GridOut::write_ucd (const Triangulation<dim> &tria,
 }
 
 
+#if deal_II_dimension != 2
+
+template <int dim>
+void GridOut::write_xfig (const Triangulation<dim> &,
+                         std::ostream             &)
+{
+  Assert (false, ExcNotImplemented());
+}
+
+#else
+
+template <int dim>
+void GridOut::write_xfig (const Triangulation<dim> &,
+                         std::ostream             &)
+{
+  Assert (false, ExcNotImplemented());
+}
+#endif
+
+
 
 #if deal_II_dimension == 1
 

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.