From: guido Date: Thu, 4 Dec 2003 09:07:13 +0000 (+0000) Subject: improvements with XFig output X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2975a48b0745bd7aef8e4b07a1c947f2542d3d01;p=dealii-svn.git improvements with XFig output git-svn-id: https://svn.dealii.org/trunk@8228 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/include/grid/grid_out.h b/deal.II/deal.II/include/grid/grid_out.h index 55de6a7903..30da52ffbc 100644 --- a/deal.II/deal.II/include/grid/grid_out.h +++ b/deal.II/deal.II/include/grid/grid_out.h @@ -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 + * fill_style 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 void write_xfig (const Triangulation &tria, diff --git a/deal.II/deal.II/source/grid/grid_out.all_dimensions.cc b/deal.II/deal.II/source/grid/grid_out.all_dimensions.cc index b6a842dfac..55915f0564 100644 --- a/deal.II/deal.II/source/grid/grid_out.all_dimensions.cc +++ b/deal.II/deal.II/source/grid/grid_out.all_dimensions.cc @@ -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 diff --git a/deal.II/deal.II/source/grid/grid_out.cc b/deal.II/deal.II/source/grid/grid_out.cc index ba2f65f997..4ac4630a50 100644 --- a/deal.II/deal.II/source/grid/grid_out.cc +++ b/deal.II/deal.II/source/grid/grid_out.cc @@ -408,16 +408,20 @@ void GridOut::write_xfig (const Triangulation& 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& 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 ";