From: young Date: Thu, 28 Mar 2013 20:28:32 +0000 (+0000) Subject: Port over skeleton MathGL grid_out interface. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=353c21b86824e9fd73d0afaf8f3dc93b0a367343;p=dealii-svn.git Port over skeleton MathGL grid_out interface. git-svn-id: https://svn.dealii.org/trunk@29106 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/include/deal.II/grid/grid_out.h b/deal.II/include/deal.II/grid/grid_out.h index 31229dedd5..7771062506 100644 --- a/deal.II/include/deal.II/grid/grid_out.h +++ b/deal.II/include/deal.II/grid/grid_out.h @@ -693,6 +693,29 @@ namespace GridOutFlags // void parse_parameters (ParameterHandler ¶m); }; + /** + * Flags for grid output in MathGL format. + * + * @ingroup output + */ + struct MathGL + { + /** + * Constructor. + */ + MathGL (); + + /** + * Declare parameters in ParameterHandler. + */ + static void declare_parameters (ParameterHandler ¶m); + + /** + * Parse parameters of ParameterHandler. + */ + void parse_parameters (ParameterHandler ¶m); + }; + } @@ -798,8 +821,9 @@ public: /// write() calls write_msh() msh, /// write() calls write_svg() - svg - /// write() calls write_svg() + svg, + /// write() calls write_mathgl() + mathgl }; /** @@ -1022,6 +1046,15 @@ public: void write_svg (const Triangulation<2,2> &tria, std::ostream &out) const; + /** + * Write triangulation in MathGL format. + * + * Not implemented for the codimension one case. + */ + template + void write_mathgl (const Triangulation &tria, + std::ostream &out) const; + /** * Write grid to @p out according to the given data format. This * function simply calls the appropriate write_* function. @@ -1087,6 +1120,11 @@ public: */ void set_flags (const GridOutFlags::Svg &flags); + /** + * Set flags for MathGL output + */ + void set_flags (const GridOutFlags::MathGL &flags); + /** * Provide a function which tells us which * suffix with a given output format @@ -1219,6 +1257,11 @@ private: */ GridOutFlags::Svg svg_flags; + /** + * Flags for OpenDX output. + */ + GridOutFlags::MathGL mathgl_flags; + /** * Write the grid information about faces to @p out. Only those * faces are printed which are on the boundary and which have a diff --git a/deal.II/source/grid/grid_out.cc b/deal.II/source/grid/grid_out.cc index 4cfa7acd45..7bdb461df3 100644 --- a/deal.II/source/grid/grid_out.cc +++ b/deal.II/source/grid/grid_out.cc @@ -364,6 +364,14 @@ namespace GridOutFlags draw_legend(draw_legend) {} + MathGL::MathGL () + {} + + void MathGL::declare_parameters (ParameterHandler ¶m) + {} + + void MathGL::parse_parameters (ParameterHandler ¶m) + {} } // end namespace GridOutFlags @@ -429,13 +437,17 @@ void GridOut::set_flags (const GridOutFlags::XFig &flags) } - void GridOut::set_flags (const GridOutFlags::Svg &flags) { svg_flags = flags; } +void GridOut::set_flags (const GridOutFlags::MathGL &flags) +{ + mathgl_flags = flags; +} + std::string GridOut::default_suffix (const OutputFormat output_format) { @@ -457,6 +469,8 @@ GridOut::default_suffix (const OutputFormat output_format) return ".msh"; case svg: return ".svg"; + case mathgl: + return ".mathgl"; default: Assert (false, ExcNotImplemented()); return ""; @@ -500,6 +514,9 @@ GridOut::parse_output_format (const std::string &format_name) if (format_name == "svg") return svg; + if (format_name == "mathgl") + return mathgl; + AssertThrow (false, ExcInvalidState ()); // return something weird return OutputFormat(-1); @@ -509,7 +526,7 @@ GridOut::parse_output_format (const std::string &format_name) std::string GridOut::get_output_format_names () { - return "none|dx|gnuplot|eps|ucd|xfig|msh|svg"; + return "none|dx|gnuplot|eps|ucd|xfig|msh|svg|mathgl"; } @@ -545,6 +562,10 @@ GridOut::declare_parameters(ParameterHandler ¶m) param.enter_subsection("XFig"); GridOutFlags::XFig::declare_parameters(param); param.leave_subsection(); + + param.enter_subsection("MathGl"); + GridOutFlags::MathGL::declare_parameters(param); + param.leave_subsection(); } @@ -579,6 +600,10 @@ GridOut::parse_parameters(ParameterHandler ¶m) param.enter_subsection("XFig"); xfig_flags.parse_parameters(param); param.leave_subsection(); + + param.enter_subsection("MathGL"); + mathgl_flags.parse_parameters(param); + param.leave_subsection(); } @@ -586,14 +611,15 @@ GridOut::parse_parameters(ParameterHandler ¶m) std::size_t GridOut::memory_consumption () const { - return (sizeof(dx_flags) + - sizeof(msh_flags) + - sizeof(ucd_flags) + + return (sizeof(dx_flags) + + sizeof(msh_flags) + + sizeof(ucd_flags) + sizeof(gnuplot_flags) + - sizeof(eps_flags_1) + - sizeof(eps_flags_2) + - sizeof(eps_flags_3) + - sizeof(xfig_flags)); + sizeof(eps_flags_1) + + sizeof(eps_flags_2) + + sizeof(eps_flags_3) + + sizeof(xfig_flags) + + sizeof(mathgl_flags)); } @@ -1946,6 +1972,21 @@ void GridOut::write_svg(const Triangulation<2,2> &tria, std::ostream &out) const } +template <> +void GridOut::write_mathgl (const Triangulation<1> &, + std::ostream &) const +{ + Assert (false, ExcNotImplemented()); +} + + +template +void GridOut::write_mathgl (const Triangulation &tria, + std::ostream &out) const +{ + Assert (false, ExcNotImplemented()); +} + unsigned int GridOut::n_boundary_faces (const Triangulation<1> &) const { @@ -3286,6 +3327,10 @@ void GridOut::write (const Triangulation &tria, case svg: write_svg (tria, out); return; + + case mathgl: + write_mathgl (tria, out); + return; } Assert (false, ExcInternalError()); diff --git a/deal.II/source/grid/grid_out.inst.in b/deal.II/source/grid/grid_out.inst.in index b716edc980..1a470c9a47 100644 --- a/deal.II/source/grid/grid_out.inst.in +++ b/deal.II/source/grid/grid_out.inst.in @@ -18,6 +18,9 @@ for (deal_II_dimension : DIMENSIONS) template void GridOut::write_dx (const Triangulation&, std::ostream&) const; + template void GridOut::write_mathgl + (const Triangulation&, + std::ostream&) const; #endif template void GridOut::write_msh