]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
improvements with XFig output
authorguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 4 Dec 2003 09:07:13 +0000 (09:07 +0000)
committerguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 4 Dec 2003 09:07:13 +0000 (09:07 +0000)
git-svn-id: https://svn.dealii.org/trunk@8228 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 55de6a790355b63a97cd8271d5b1ba6147b2c9bd..30da52ffbcd523c7d27e21fc05f1bf2e02d3a74c 100644 (file)
@@ -400,24 +400,28 @@ namespace GridOutFlags
   struct XFig
   {
                                       /**
-                                       * Method for filling cells
-                                       */
-      unsigned int fill_style;
-                                      /**
-                                       * Draw boundary lines.
+                                       * Draw boundary lines. Default is true.
                                        */
       bool draw_boundary;
                                       /**
-                                       * Change color depending on level.
+                                       * Change color depending on
+                                       * level. Default is false, therefore,
+                                       * color is coded by material or
+                                       * boundary id.
                                        */
       bool level_color;
                                       /**
-                                       * Code level to depth.
+                                       * Code level to depth. Default is
+                                       * true. If false, color depends on
+                                       * material or boundary id.
+                                       *
+                                       * Depth of the object is 900-level, if
+                                       * this value is true.
                                        */
       bool level_depth;
                                       /**
                                        * Additional points for curved
-                                       * boundaries.
+                                       * boundaries. Default is none.
                                        */
       unsigned int n_boundary_face_points;
 
@@ -435,6 +439,26 @@ namespace GridOutFlags
                                        * each direction.
                                        */
       Point<2> offset;
+                                      /**
+                                       * Style for filling cells. Default is
+                                       * solid fill (20). This value is
+                                       * forwarded unchanged into the
+                                       * corresponding field
+                                       * <tt>fill_style</tt> of the polyline
+                                       * object of XFig.
+                                       */
+      int fill_style;
+                                       /**
+                                       * Style for drawing border lines of
+                                       * polygons. Defaults to solid (0) and
+                                       * is forwarded to XFig.
+                                       */
+      int line_style;
+                                       /**
+                                       * Style for drawing lines at the
+                                       * boundary. Defaults to solid (0).
+                                       */
+      int boundary_style;
       
                                       /**
                                        * Constructor.
@@ -526,7 +550,7 @@ namespace GridOutFlags
  * as usual.
  *
  *
- * @author Wolfgang Bangerth, 1999; postscript format based on an implementation by Stefan Nauber, 1999
+ * @author Wolfgang Bangerth, Guido Kanschat, 1999, 2003; postscript format based on an implementation by Stefan Nauber, 1999
  */
 class GridOut 
 {
@@ -733,7 +757,28 @@ class GridOut
                    const Mapping<1>       *mapping=0);
 
                                     /**
-                                     * Write XFig-file.
+                                     * Write two-dimensional XFig-file.
+                                     *
+                                     * This function writes all grid cells as
+                                     * polygons and optionally boundary
+                                     * lines. Several parameters can be
+                                     * adjusted by the XFigFlags control
+                                     * object.
+                                     *
+                                     * If levels are coded to depth, the
+                                     * complete grid hierarchy is plotted
+                                     * with fine cells before their
+                                     * parents. This way, levels can be
+                                     * switched on and off in xfig by
+                                     * selecting levels.
+                                     *
+                                     * Polygons are either at depth 900-level
+                                     * or at 900+@p material_id, depending on
+                                     * the flag @p level_depth. Accordingly,
+                                     * boundary edges are at depth 800-level
+                                     * or at 800+@p boundary_id. Therefore,
+                                     * boundary edges are alway in front of
+                                     * cells.
                                      */
     template <int dim>
     void write_xfig (const Triangulation<dim> &tria,
index b6a842dfac2efe621a37b6a68a35c39217318f9e..55915f0564aa0997d5dada39ca36ae394c67848b 100644 (file)
@@ -115,12 +115,15 @@ namespace GridOutFlags
 
 
   XFig::XFig ()
-                 : fill_style (20), // filled
+                 :
     draw_boundary(true),
     level_color(false),
     level_depth(true),
     n_boundary_face_points(0),
-    scaling(1.,1.)
+    scaling(1.,1.),
+    fill_style (20),
+    line_style(0),
+    boundary_style(0)
   {}
 }  // end namespace GridOutFlags
 
index ba2f65f997a902809c2fa6ab6e4768d4adf51cd9..4ac4630a5062f81819ef35fc34db98978d121f68 100644 (file)
@@ -408,16 +408,20 @@ void GridOut::write_xfig (const Triangulation<dim>& tria,
 
   for (;cell != end; ++cell)
     {
+       // If depth is not encoded, write finest level only
+       if (!xfig_flags.level_depth && !cell->is_active())
+           continue;
                                       // Code for polygon
-      out << "2 3 "
-                                        // with solid black line thickness 1
-         << " 0 1 0 ";
+      out << "2 3  "
+                                        // with black line thickness 1
+         << xfig_flags.line_style
+         <<" 1 0 ";
                                         // Fill color
       if (xfig_flags.level_color)
        out << cell->level() + 8;
       else
        out << cell->material_id() + 1;
-                                      // Depth, unused, solid fill
+                                      // Depth, unused, fill
       out << ' '
          << (xfig_flags.level_depth
              ? (900-cell->level())
@@ -455,8 +459,9 @@ void GridOut::write_xfig (const Triangulation<dim>& tria,
              {
                                                 // Code for polyline
                out << "2 1 "
-                                                  // with solid line thickness 3
-                   << " 0 3 ";
+                                                  // with line thickness 3
+                   << xfig_flags.boundary_style
+                   << " 3 ";
                out << (1 + (unsigned int) bi);
                                                 // Fill color
                out << " -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.