* units. Default is 0.5.
*/
double line_width;
+
/**
- * Should lines with a set @p{user_flag}
- * be drawn in a different color?
+ * Should lines with a set
+ * @p{user_flag} be drawn in a
+ * different color (red)?
*/
bool color_lines_on_user_flag;
*/
unsigned int n_boundary_face_points;
+ /**
+ * Should lines be colored
+ * according to their
+ * refinement level? This
+ * overrides
+ * color_lines_on_user_flag for
+ * all levels except level 0.
+ * Colors are: level 0: black,
+ * other levels: rainbow scale
+ * from blue to red.
+ */
+ bool color_lines_level;
+
/**
* Constructor.
*/
const unsigned int size = 300,
const double line_width = 0.5,
const bool color_lines_on_user_flag = false,
- const unsigned int n_boundary_face_points = 2);
+ const unsigned int n_boundary_face_points = 2,
+ const bool color_lines_level = false);
};
const unsigned int n_boundary_face_points = 2,
const bool write_cell_numbers = false,
const bool write_cell_number_level = true,
- const bool write_vertex_numbers = false);
+ const bool write_vertex_numbers = false,
+ const bool color_lines_level = false);
};
/**
const unsigned int size,
const double line_width,
const bool color_lines_on_user_flag,
- const unsigned int n_boundary_face_points) :
+ const unsigned int n_boundary_face_points,
+ const bool color_lines_level) :
size_type (size_type),
size (size),
line_width (line_width),
color_lines_on_user_flag(color_lines_on_user_flag),
- n_boundary_face_points(n_boundary_face_points)
+ n_boundary_face_points(n_boundary_face_points),
+ color_lines_level(color_lines_level)
{}
const unsigned int n_boundary_face_points,
const bool write_cell_numbers,
const bool write_cell_number_level,
- const bool write_vertex_numbers)
+ const bool write_vertex_numbers,
+ const bool color_lines_level
+ )
:
EpsFlagsBase(size_type, size, line_width,
color_lines_on_user_flag,
- n_boundary_face_points),
+ n_boundary_face_points,
+ color_lines_level),
write_cell_numbers (write_cell_numbers),
write_cell_number_level (write_cell_number_level),
write_vertex_numbers (write_vertex_numbers)
Point<2> first;
Point<2> second;
bool colorize;
- LineEntry(const Point<2>& f, const Point<2>& s, const bool c)
+ unsigned int level;
+ LineEntry (const Point<2> &f,
+ const Point<2> &s,
+ const bool c,
+ const unsigned int l)
:
- first(f), second(s), colorize(c)
+ first(f), second(s),
+ colorize(c), level(l)
{}
};
line->vertex(0)(1)),
Point<2>(line->vertex(1)(0),
line->vertex(1)(1)),
- line->user_flag_set()));
+ line->user_flag_set(),
+ line->level()));
// next if we are to treat
// curved boundaries
const Point<2> p1 (p1_dim(0), p1_dim(1));
line_list.push_back (LineEntry(p0, p1,
- face->user_flag_set()));
+ face->user_flag_set(),
+ face->level() ));
p0=p1;
}
const Point<dim> p1_dim (face->vertex(1));
const Point<2> p1 (p1_dim(0), p1_dim(1));
line_list.push_back (LineEntry(p0, p1,
- face->user_flag_set()));
+ face->user_flag_set(),
+ face->level()));
};
};
};
line->vertex(0) * unit_vector1),
Point<2>(line->vertex(1) * unit_vector2,
line->vertex(1) * unit_vector1),
- line->user_flag_set()));
+ line->user_flag_set(),
+ line->level()));
break;
};
double x_max = x_min;
double y_min = tria.begin_active_line()->vertex(0)(1);
double y_max = y_min;
+ unsigned int max_level = line_list.begin()->level;
for (LineList::const_iterator line=line_list.begin();
line!=line_list.end(); ++line)
y_max = std::max (y_max, line->first(1));
y_max = std::max (y_max, line->second(1));
+
+ max_level = std::max (max_level, line->level);
};
// scale in x-direction such that
<< "/b {0 0 0 setrgbcolor} def" << std::endl
<< "/r {1 0 0 setrgbcolor} def" << std::endl;
+ // calculate colors for level
+ // coloring; level 0 is black,
+ // other levels are blue
+ // ... red
+ double levelscale = 0.66666/std::max(1U,(max_level-1));
+
+ out << "/l { neg "
+ << (max_level)
+ << " add "
+ << levelscale
+ << " mul 1 0.8 sethsbcolor} def" << std::endl;
+
// in 2d, we can also plot cell
// and vertex numbers, but this
// requires a somewhat more
for (LineList::const_iterator line=line_list.begin();
line!=line_list.end(); ++line)
- out << ((line->colorize && eps_flags_base.color_lines_on_user_flag) ? "r " : "b ")
- << (line->first - offset) * scale << " m "
- << (line->second - offset) * scale << " x" << std::endl;
-
+ if (eps_flags_base.color_lines_level && line-> level > 0)
+ // lines colored according to
+ // refinement level,
+ // contributed by Jörg
+ // R. Weimar
+ out << line->level
+ << " l "
+ << (line->first - offset) * scale << " m "
+ << (line->second - offset) * scale << " x" << std::endl;
+ else
+ out << ((line->colorize && eps_flags_base.color_lines_on_user_flag) ? "r " : "b ")
+ << (line->first - offset) * scale << " m "
+ << (line->second - offset) * scale << " x" << std::endl;
+
// finally write the cell numbers
// in 2d, if that is desired
if ((dim == 2) && (eps_flags_2.write_cell_numbers == true))