]> https://gitweb.dealii.org/ - dealii.git/commitdiff
XFig output improved
authorGuido Kanschat <dr.guido.kanschat@gmail.com>
Mon, 28 Feb 2005 00:27:45 +0000 (00:27 +0000)
committerGuido Kanschat <dr.guido.kanschat@gmail.com>
Mon, 28 Feb 2005 00:27:45 +0000 (00:27 +0000)
git-svn-id: https://svn.dealii.org/trunk@9909 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 a5e4519633dec744607ef193b0c40e04bfb9827b..292da0429b291ed5976353c88ccd8deffbe4aa3c 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 by the deal.II authors
+//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -399,7 +399,7 @@ namespace GridOutFlags
           const double       turn_angle      = 30);
   };
                                   /**
-                                   * Flags fog XFig output.
+                                   * Flags for XFig output.
                                    */
   struct XFig
   {
@@ -458,12 +458,29 @@ namespace GridOutFlags
                                        * is forwarded to XFig.
                                        */
       int line_style;
-                                       /**
+      
+                                      /**
+                                       * Thickness of border lines of
+                                       * polygons. Default is 1.
+                                       *
+                                       * Set this to zero to avoid
+                                       * border lines for very fine
+                                       * meshes.
+                                       */
+      int line_thickness;
+      
+                                      /**
                                        * Style for drawing lines at the
                                        * boundary. Defaults to solid (0).
                                        */
       int boundary_style;
       
+                                      /**
+                                       * Thickness of boundary
+                                       * lines. Default is 3.
+                                       */
+      int boundary_thickness;
+      
                                       /**
                                        * Constructor.
                                        */
@@ -475,18 +492,9 @@ namespace GridOutFlags
 
 
 /**
- * This class provides a means to output a triangulation to a file in different
- * formats. Presently provided are functions to write it in GNUPLOT and
- * encapsulated postscript format, as well as in UCD format.
- * There are also function to dispatch to
- * the different output functions based on a parameter given, e.g., through
- * a parameter file, thus making user programs invariant of the number and
- * names of the file formats implemented in this class. The main advantage of
- * this class over the DataOut class is that it does not have to mess around
- * with actual data vectors and that no DoFHandler object is needed to
- * write the pure geometrical information involved here.
- *
- * Available output formats can be found in the functions with names <tt>write_...</tt>
+ * This class provides a means to output a triangulation to a file in
+ * different formats. See the enum GridOut::OutputFormat for a list of formats
+ * and the corresponding output function names.
  *
  * @sect3{Usage}
  * Usage is simple: either you use the direct form
@@ -560,11 +568,29 @@ class GridOut
 {
   public:
                                     /**
-                                     * Declaration of a name for each of the
-                                     * different output formats.
+                                     * Declaration of a name for each
+                                     * of the different output
+                                     * formats. These are used by the
+                                     * generic output function
+                                     * write() to determine the
+                                     * actual output format.
                                      */
-    enum OutputFormat { dx, gnuplot, eps, ucd, xfig };
-
+    enum OutputFormat
+    {
+                                          /// Do nothing in write()
+         none,
+                                          /// write() calls write_dx()
+         dx,
+                                          /// write() calls write_gnuplot()
+         gnuplot,
+                                          /// write() calls write_eps()
+         eps,
+                                          /// write() calls write_ucd()
+         ucd,
+                                          /// write() calls write_xfig()
+         xfig
+    };
+    
                                     /**
                                      * Write triangulation in OpenDX
                                      * format.
index 55915f0564aa0997d5dada39ca36ae394c67848b..fbb04ad77546c7f987f38435938cc3342561b0a3 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 by the deal.II authors
+//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -123,7 +123,9 @@ namespace GridOutFlags
     scaling(1.,1.),
     fill_style (20),
     line_style(0),
-    boundary_style(0)
+    line_thickness(1),
+    boundary_style(0),
+    boundary_thickness(3)
   {}
 }  // end namespace GridOutFlags
 
@@ -183,19 +185,18 @@ GridOut::default_suffix (const OutputFormat output_format)
 {
   switch (output_format) 
     {
+      case none:
+       return "";
       case dx:
         return ".dx";
       case gnuplot: 
-           return ".gnuplot";
-
+       return ".gnuplot";
       case ucd: 
-           return ".inp";
-
+       return ".inp";
       case eps: 
-           return ".eps";
-
+       return ".eps";
       case xfig:
-           return ".fig";
+       return ".fig";
       default: 
            Assert (false, ExcNotImplemented()); 
            return "";
@@ -207,6 +208,9 @@ GridOut::default_suffix (const OutputFormat output_format)
 GridOut::OutputFormat
 GridOut::parse_output_format (const std::string &format_name)
 {
+  if (format_name == "none" || format_name == "false")
+    return none;
+
   if (format_name == "dx")
     return dx;
 
@@ -231,7 +235,7 @@ GridOut::parse_output_format (const std::string &format_name)
 
 std::string GridOut::get_output_format_names () 
 {
-  return "dx|gnuplot|eps|ucd|xfig";
+  return "none|dx|gnuplot|eps|ucd|xfig";
 }
 
 
index 4dfa53779e64d642ea697b252a7d4e1df63b8372..3836744b9b999b97e0d52be13aa253d4c571d43a 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 by the deal.II authors
+//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -396,6 +396,8 @@ void GridOut::write_xfig (const Triangulation<dim>& tria,
       << "A4\n100.00\nSingle" << std::endl
                                     // Background is transparent
       << "-3" << std::endl
+      << "# generated by deal.II GridOut class" << std::endl
+      << "# reduce first number to scale up image" << std::endl
       << "1200 2" << std::endl;
 
                                   // We write all cells and cells on
@@ -413,9 +415,10 @@ void GridOut::write_xfig (const Triangulation<dim>& tria,
            continue;
                                       // Code for polygon
       out << "2 3  "
-                                        // with black line thickness 1
-         << xfig_flags.line_style
-         <<" 1 0 ";
+         << xfig_flags.line_style << ' '
+         << xfig_flags.line_thickness
+                                        // with black line
+         << " 0 ";
                                         // Fill color
       if (xfig_flags.level_color)
        out << cell->level() + 8;
@@ -459,16 +462,17 @@ void GridOut::write_xfig (const Triangulation<dim>& tria,
              {
                                                 // Code for polyline
                out << "2 1 "
-                                                  // with line thickness 3
-                   << xfig_flags.boundary_style
-                   << " 3 ";
-               out << (1 + (unsigned int) bi);
+                                                  // with line style and thickness
+                   << xfig_flags.boundary_style << ' '
+                   << xfig_flags.boundary_thickness << ' '
+                   << (1 + (unsigned int) bi);
                                                 // Fill color
                out << " -1 ";
-                                                // Depth, unused, no fill
+                                                // Depth 100 less than cells
                out << (xfig_flags.level_depth
                        ? (800-cell->level())
-                       : 800+bi)         
+                       : 800+bi)
+                                                  // unused, no fill
                    << " 0 -1 0.0 "
                                                   // some style parameters
                    << " 0 0 -1 0 0 "
@@ -1397,27 +1401,30 @@ void GridOut::write (const Triangulation<dim> &tria,
 {
   switch (output_format)
     {
+      case none:
+       return;
+       
       case dx:
-           write_dx (tria, out);
-           return;
-
+       write_dx (tria, out);
+       return;
+       
       case ucd:
-           write_ucd (tria, out);
-           return;
-
+       write_ucd (tria, out);
+       return;
+       
       case gnuplot:
-           write_gnuplot (tria, out, mapping);
-           return;
-
+       write_gnuplot (tria, out, mapping);
+       return;
+       
       case eps:
-           write_eps (tria, out, mapping);
-           return;
+       write_eps (tria, out, mapping);
+       return;
+       
       case xfig:
-           write_xfig (tria, out, mapping);
-           return;
-   };
-
+       write_xfig (tria, out, mapping);
+       return;
+    }
+  
   Assert (false, ExcInternalError());
 }
 

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.