#define __deal2__grid_out_h
-//TODO:[WB]Reorganize GridOut class. Either templatize GridOut or remove template from EpsFlags
-
#include <base/exceptions.h>
#include <string>
template <int dim> class Triangulation;
template <int dim> class Mapping;
+
+/**
+ * Within this namespace, we define several structures that are used
+ * to describe flags that can be given to grid output routines to
+ * modify the default outfit of the grids written into a file. See the
+ * different subclasses and the documentation of the @ref{GridOut}
+ * class for more details.
+ *
+ * @author Wolfgang Bangerth, 1998, 2001
+ */
+namespace GridOutFlags
+{
+ /**
+ * Flags describing the details of
+ * output in UCD format.
+ */
+ struct Ucd
+ {
+ /**
+ * Write a comment at the beginning
+ * of the file stating the date of
+ * creation and some other data.
+ * While this is supported by the
+ * UCD format (and the AVS program),
+ * some other programs get confused
+ * by this, so you can switch it off
+ * this way.
+ *
+ * Default: @p{true}.
+ */
+ bool write_preamble;
+
+ /**
+ * When writing a mesh, write boundary
+ * faces explicitely if their boundary
+ * indicator is not the default
+ * boundary indicator, which is zero.
+ * This is necessary if you later
+ * want to re-read the grid and want
+ * to get the same boundary indicators
+ * for the different parts of the
+ * boundary of the triangulation.
+ *
+ * It is not necessary if you only want
+ * to write the triangulation to
+ * view or print it.
+ *
+ * Default: @p{false}.
+ */
+ bool write_faces;
+
+ /**
+ * Constructor.
+ */
+ Ucd (const bool write_preamble = true,
+ const bool write_faces = false);
+ };
+
+
+ /**
+ * Flags describing the details of
+ * output in GNUPLOT format.
+ */
+ struct Gnuplot
+ {
+ /**
+ * Write the number of each cell into
+ * the output file before starting
+ * with the lines it is composed of,
+ * as a comment. This might be useful
+ * if you want to find out details
+ * about the grid, for example the
+ * position of cells of which you
+ * know the number. It enlarges
+ * the size of the output
+ * significantly, however.
+ *
+ * Default: @p{false}.
+ */
+ bool write_cell_numbers;
+
+ /**
+ * This is the number of
+ * points on a boundary face,
+ * that are ploted
+ * additionally to the
+ * vertices of the face.
+ */
+ unsigned int n_boundary_face_points;
+
+ /**
+ * Constructor.
+ */
+ Gnuplot (const bool write_cell_number = false,
+ const unsigned int n_boundary_face_points = 2);
+ };
+
+ /**
+ * Flags describing the details of
+ * output for encapsulated postscript.
+ * In this structure, the flags common
+ * to all dimensions are listed. Flags
+ * which are specific to one space
+ * dimension only are listed in derived
+ * classes.
+ *
+ * By default, the size of the picture
+ * is scaled such that the width equals
+ * 300 units.
+ */
+ struct EpsFlagsBase
+ {
+ /**
+ * Enum denoting the possibilities
+ * whether the scaling should be done
+ * such that the given @p{size} equals
+ * the width or the height of
+ * the resulting picture.
+ */
+ enum SizeType {
+ width, height
+ };
+
+ /**
+ * See above. Default is @p{width}.
+ */
+ SizeType size_type;
+
+ /**
+ * Width or height of the output
+ * as given in postscript units
+ * This usually is given by the
+ * strange unit 1/72 inch. Whether
+ * this is height or width is
+ * specified by the flag
+ * @p{size_type}.
+ *
+ * Default is 300.
+ */
+ unsigned int size;
+
+ /**
+ * Width of a line in postscript
+ * units. Default is 0.5.
+ */
+ double line_width;
+ /**
+ * Should lines with a set @p{user_flag}
+ * be drawn in a different color?
+ */
+ bool color_lines_on_user_flag;
+
+ /**
+ * This is the number of
+ * points on a boundary face,
+ * that are ploted
+ * additionally to the
+ * vertices of the face.
+ *
+ * This is used if the
+ * mapping used is not the
+ * standard @p{MappingQ1}
+ * mapping.
+ */
+ unsigned int n_boundary_face_points;
+
+ /**
+ * Constructor.
+ */
+ EpsFlagsBase (const SizeType size_type = width,
+ 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);
+ };
+
+
+ /**
+ * Flags describing the details of
+ * output for encapsulated postscript
+ * for all dimensions not explicitely
+ * specialized below. Some flags that
+ * are common to all dimensions are
+ * listed in the base class.
+ *
+ * This class does not actually
+ * exist, we only here declare the
+ * general template and declare
+ * explicit specializations below.
+ */
+ template <int dim>
+ struct Eps
+ {};
+
+ /**
+ * Flags specific to the output of
+ * grids in one space dimensions.
+ */
+ template <>
+ struct Eps<1> : public EpsFlagsBase
+ {
+ /**
+ * Constructor.
+ */
+ Eps (const SizeType size_type = width,
+ 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);
+ };
+
+
+ /**
+ * Flags specific to the output of
+ * grids in two space dimensions.
+ */
+ template <>
+ struct Eps<2> : public EpsFlagsBase
+ {
+ /**
+ * Constructor.
+ */
+ Eps (const SizeType size_type = width,
+ 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);
+ };
+
+ /**
+ * Flags specific to the output of
+ * grids in three space dimensions.
+ */
+ template <>
+ struct Eps<3> : public EpsFlagsBase
+ {
+ /**
+ * Angle of the line origin-viewer
+ * against the z-axis in degrees.
+ *
+ * Default is the Gnuplot-default
+ * of 60.
+ */
+ double azimut_angle;
+
+ /**
+ * Angle by which the viewers
+ * position projected onto the
+ * x-y-plane is rotated around
+ * the z-axis, in positive sense
+ * when viewed from above. The
+ * unit are degrees, and zero
+ * equals a position above or below
+ * the negative y-axis.
+ *
+ * Default is the Gnuplot-default
+ * of 30.
+ */
+ double turn_angle;
+
+ /**
+ * Constructor.
+ */
+ Eps (const SizeType size_type = width,
+ 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 double azimut_angle = 60,
+ const double turn_angle = 30);
+ };
+};
+
+
+
/**
* 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
* output format supported which it may then pass on to the respective output
* function.
*
- * Rather, we have chosen to let each object of this class @ref{GridOut} have a
- * set of parameters for each supported output format. These are collected
- * in structures @ref{EpsFlags}, @ref{GnuplotFlags}, etc and you can set your preferred
- * flags like this:
+ * Rather, we have chosen to let each object of this class
+ * @ref{GridOut} have a set of parameters for each supported output
+ * format. These are collected in structures @ref{GridOutFlags::Eps},
+ * @ref{GridOutFlags::Gnuplot}, etc declared in the @ref{GridOutFlags}
+ * namespace, and you can set your preferred flags like this:
* @begin{verbatim}
* GridOut grid_out;
- * GridOut::UcdFlags ucd_flags;
+ * GridOutFlags::Ucd ucd_flags;
* ... // set some fields in ucd_flags
* grid_out.set_flags (ucd_flags);
* ...
* The respective output function then use the so-set flags. By default, they
* are set to reasonable values as described above and in the documentation
* of the different flags structures. Resetting the flags can
- * be done by calling @p{grid_out.set_flags (GridOut::UcdFlags());}, since the
+ * be done by calling @p{grid_out.set_flags (GridOutFlags::Ucd());}, since the
* default constructor of each of the flags structures sets the parameters
* to their initial values.
*
class GridOut
{
public:
-
- /**
- * Flags describing the details of
- * output in UCD format.
- */
- struct UcdFlags
- {
- /**
- * Write a comment at the beginning
- * of the file stating the date of
- * creation and some other data.
- * While this is supported by the
- * UCD format (and the AVS program),
- * some other programs get confused
- * by this, so you can switch it off
- * this way.
- *
- * Default: @p{true}.
- */
- bool write_preamble;
-
- /**
- * When writing a mesh, write boundary
- * faces explicitely if their boundary
- * indicator is not the default
- * boundary indicator, which is zero.
- * This is necessary if you later
- * want to re-read the grid and want
- * to get the same boundary indicators
- * for the different parts of the
- * boundary of the triangulation.
- *
- * It is not necessary if you only want
- * to write the triangulation to
- * view or print it.
- *
- * Default: @p{false}.
- */
- bool write_faces;
-
- /**
- * Constructor.
- */
- UcdFlags (const bool write_preamble = true,
- const bool write_faces = false);
- };
-
-
- /**
- * Flags describing the details of
- * output in GNUPLOT format.
- */
- struct GnuplotFlags
- {
- /**
- * Write the number of each cell into
- * the output file before starting
- * with the lines it is composed of,
- * as a comment. This might be useful
- * if you want to find out details
- * about the grid, for example the
- * position of cells of which you
- * know the number. It enlarges
- * the size of the output
- * significantly, however.
- *
- * Default: @p{false}.
- */
- bool write_cell_numbers;
-
- /**
- * This is the number of
- * points on a boundary face,
- * that are ploted
- * additionally to the
- * vertices of the face.
- */
- unsigned int n_boundary_face_points;
-
- /**
- * Constructor.
- */
- GnuplotFlags (const bool write_cell_number = false,
- const unsigned int n_boundary_face_points = 2);
- };
-
- /**
- * Flags describing the details of
- * output for encapsulated postscript.
- * In this structure, the flags common
- * to all dimensions are listed. Flags
- * which are specific to one space
- * dimension only are listed in derived
- * classes.
- *
- * By default, the size of the picture
- * is scaled such that the width equals
- * 300 units.
- */
- struct EpsFlagsBase
- {
- /**
- * Enum denoting the possibilities
- * whether the scaling should be done
- * such that the given @p{size} equals
- * the width or the height of
- * the resulting picture.
- */
- enum SizeType {
- width, height
- };
-
- /**
- * See above. Default is @p{width}.
- */
- SizeType size_type;
-
- /**
- * Width or height of the output
- * as given in postscript units
- * This usually is given by the
- * strange unit 1/72 inch. Whether
- * this is height or width is
- * specified by the flag
- * @p{size_type}.
- *
- * Default is 300.
- */
- unsigned int size;
-
- /**
- * Width of a line in postscript
- * units. Default is 0.5.
- */
- double line_width;
- /**
- * Should lines with a set @p{user_flag}
- * be drawn in a different color?
- */
- bool color_lines_on_user_flag;
-
- /**
- * This is the number of
- * points on a boundary face,
- * that are ploted
- * additionally to the
- * vertices of the face.
- *
- * This is used if the
- * mapping used is not the
- * standard @p{MappingQ1}
- * mapping.
- */
- unsigned int n_boundary_face_points;
-
- /**
- * Constructor.
- */
- EpsFlagsBase (const SizeType size_type = width,
- 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);
- };
-
-
- /**
- * Flags describing the details of
- * output for encapsulated postscript
- * for all dimensions not explicitely
- * specialized below. Some flags that
- * are common to all dimensions are
- * listed in the base class
- */
- template <int dim>
- struct EpsFlags;
-// : public EpsFlagsBase
-// {
-
-// /**
-// * Constructor.
-// */
-// EpsFlags (const SizeType size_type = width,
-// const unsigned int size = 300,
-// const double line_width = 0.5,
-// bool color_lines_on_user_flag = false,
-// const unsigned int n_boundary_face_points = 2);
-// };
-
-// //#if (__GNUC__==2) && (__GNUC_MINOR__ < 95)
-// // template <>
-
- struct EpsFlags<1> : public EpsFlagsBase
- {
-
- /**
- * Constructor.
- */
- EpsFlags (const SizeType size_type = width,
- const unsigned int size = 300,
- const double line_width = 0.5,
- bool color_lines_on_user_flag = false,
- const unsigned int n_boundary_face_points = 2);
- };
-
-
- struct EpsFlags<2> : public EpsFlagsBase
- {
-
- /**
- * Constructor.
- */
- EpsFlags (const SizeType size_type = width,
- const unsigned int size = 300,
- const double line_width = 0.5,
- bool color_lines_on_user_flag = false,
- const unsigned int n_boundary_face_points = 2);
- };
- /**
- * Flags specific to the output of
- * grids in three space dimensions.
- */
- struct EpsFlags<3> : public EpsFlagsBase
- {
- /**
- * Angle of the line origin-viewer
- * against the z-axis in degrees.
- *
- * Default is the Gnuplot-default
- * of 60.
- */
- double azimut_angle;
-
- /**
- * Angle by which the viewers
- * position projected onto the
- * x-y-plane is rotated around
- * the z-axis, in positive sense
- * when viewed from above. The
- * unit are degrees, and zero
- * equals a position above or below
- * the negative y-axis.
- *
- * Default is the Gnuplot-default
- * of 30.
- */
- double turn_angle;
-
- /**
- * Constructor.
- */
- EpsFlags (const SizeType size_type = width,
- 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 double azimut_angle = 60,
- const double turn_angle = 30);
- };
-
-
-//#else
-//# warning Not implemented for gcc2.95
-//#endif
-
-
/**
* Declaration of a name for each of the
* different output formats.
* flags controlling the output
* can be found in the
* documentation of the
- * @ref{GridOut::GnuplotFlags} class.
+ * @ref{GridOutFlags::Gnuplot} class.
*/
template <int dim>
void write_gnuplot (const Triangulation<dim> &tria,
* only, you can decide through
* additional flags (see below,
* and the documentation of the
- * @ref{GridOut::UcdFlags} class)
+ * @ref{GridOutFlags::Ucd} class)
* whether boundary faces with
* non-zero boundary indicator
* shall be written to the file
* flags controlling the output
* can be found in the
* documentation of the
- * @ref{GridOut::UcdFlags} class.
+ * @ref{GridOut::Ucd} class.
*/
template <int dim>
void write_ucd (const Triangulation<dim> &tria,
* shall fit into is determined
* by the output flags (see
* below, and the documentation
- * of the @ref{GridOut::EpsFlags}
+ * of the @ref{GridOutFlags::Eps}
* class).
*
* The bounding box is close to
* flags controlling the output
* can be found in the
* documentation of the
- * @ref{GridOut::EpsFlags}
+ * @ref{GridOutFlags::Eps}
* class. Especially the
* viewpoint for three
* dimensional grids is of
* Set the flags to be used for output
* in UCD format.
*/
- void set_flags (const UcdFlags &ucd_flags);
+ void set_flags (const GridOutFlags::Ucd &ucd_flags);
/**
* Set the flags to be used for output
* in GNUPLOT format.
*/
- void set_flags (const GnuplotFlags &gnuplot_flags);
+ void set_flags (const GridOutFlags::Gnuplot &gnuplot_flags);
/**
* Set the flags to be used for output
* in 1d EPS output.
*/
- void set_flags (const EpsFlags<1> &eps_flags);
+ void set_flags (const GridOutFlags::Eps<1> &eps_flags);
/**
* Set the flags to be used for output
* in 2d EPS output.
*/
- void set_flags (const EpsFlags<2> &eps_flags);
+ void set_flags (const GridOutFlags::Eps<2> &eps_flags);
/**
* Set the flags to be used for output
* in 3d EPS output.
*/
- void set_flags (const EpsFlags<3> &eps_flags);
+ void set_flags (const GridOutFlags::Eps<3> &eps_flags);
/**
* Provide a function which tells us which
* data. Can be changed by using the
* @p{set_flags} function.
*/
- UcdFlags ucd_flags;
+ GridOutFlags::Ucd ucd_flags;
/**
* Flags to be used upon output of GNUPLOT
* data. Can be changed by using the
* @p{set_flags} function.
*/
- GnuplotFlags gnuplot_flags;
+ GridOutFlags::Gnuplot gnuplot_flags;
/**
* Flags to be used upon output of EPS
* changed by using the @p{set_flags}
* function.
*/
- EpsFlags<1> eps_flags_1;
+ GridOutFlags::Eps<1> eps_flags_1;
/**
* Flags to be used upon output of EPS
* changed by using the @p{set_flags}
* function.
*/
- EpsFlags<2> eps_flags_2;
+ GridOutFlags::Eps<2> eps_flags_2;
/**
* Flags to be used upon output of EPS
* changed by using the @p{set_flags}
* function.
*/
- EpsFlags<3> eps_flags_3;
+ GridOutFlags::Eps<3> eps_flags_3;
/**
#include <grid/grid_out.h>
-GridOut::UcdFlags::UcdFlags (const bool write_preamble,
- const bool write_faces) :
- write_preamble (write_preamble),
- write_faces (write_faces)
-{}
-
-
-GridOut::GnuplotFlags::GnuplotFlags (const bool write_cell_numbers,
- const unsigned int n_boundary_face_points) :
- write_cell_numbers (write_cell_numbers),
- n_boundary_face_points(n_boundary_face_points)
-{}
-
-
-GridOut::EpsFlagsBase::EpsFlagsBase (const SizeType size_type,
- const unsigned int size,
- const double line_width,
- const bool color_lines_on_user_flag,
- const unsigned int n_boundary_face_points) :
- 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)
-{}
-
-
-
-GridOut::EpsFlags<1>::EpsFlags (const SizeType size_type,
- const unsigned int size,
- const double line_width,
- const bool color_lines_on_user_flag,
- const unsigned int n_boundary_face_points):
- EpsFlagsBase(size_type, size, line_width,
- color_lines_on_user_flag,
- n_boundary_face_points)
-{}
-
-
-GridOut::EpsFlags<2>::EpsFlags (const SizeType size_type,
- const unsigned int size,
- const double line_width,
- const bool color_lines_on_user_flag,
- const unsigned int n_boundary_face_points):
- EpsFlagsBase(size_type, size, line_width,
- color_lines_on_user_flag,
- n_boundary_face_points)
-{}
-
-
-GridOut::EpsFlags<3>::EpsFlags (const SizeType size_type,
- const unsigned int size,
- const double line_width,
- const bool color_lines_on_user_flag,
- const unsigned int n_boundary_face_points,
- const double azimut_angle,
- const double turn_angle):
- EpsFlagsBase(size_type, size, line_width,
- color_lines_on_user_flag,
- n_boundary_face_points),
- azimut_angle (azimut_angle),
- turn_angle (turn_angle)
-{}
-
-
-void GridOut::set_flags (const UcdFlags &flags)
+namespace GridOutFlags
+{
+ Ucd::Ucd (const bool write_preamble,
+ const bool write_faces) :
+ write_preamble (write_preamble),
+ write_faces (write_faces)
+ {};
+
+
+
+ Gnuplot::Gnuplot (const bool write_cell_numbers,
+ const unsigned int n_boundary_face_points) :
+ write_cell_numbers (write_cell_numbers),
+ n_boundary_face_points(n_boundary_face_points)
+ {};
+
+
+
+ EpsFlagsBase::EpsFlagsBase (const SizeType size_type,
+ const unsigned int size,
+ const double line_width,
+ const bool color_lines_on_user_flag,
+ const unsigned int n_boundary_face_points) :
+ 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)
+ {};
+
+
+
+ Eps<1>::Eps (const SizeType size_type,
+ const unsigned int size,
+ const double line_width,
+ const bool color_lines_on_user_flag,
+ const unsigned int n_boundary_face_points)
+ :
+ EpsFlagsBase(size_type, size, line_width,
+ color_lines_on_user_flag,
+ n_boundary_face_points)
+ {};
+
+
+
+ Eps<2>::Eps (const SizeType size_type,
+ const unsigned int size,
+ const double line_width,
+ const bool color_lines_on_user_flag,
+ const unsigned int n_boundary_face_points)
+ :
+ EpsFlagsBase(size_type, size, line_width,
+ color_lines_on_user_flag,
+ n_boundary_face_points)
+ {};
+
+
+
+ Eps<3>::Eps (const SizeType size_type,
+ const unsigned int size,
+ const double line_width,
+ const bool color_lines_on_user_flag,
+ const unsigned int n_boundary_face_points,
+ const double azimut_angle,
+ const double turn_angle)
+ :
+ EpsFlagsBase(size_type, size, line_width,
+ color_lines_on_user_flag,
+ n_boundary_face_points),
+ azimut_angle (azimut_angle),
+ turn_angle (turn_angle)
+ {};
+}; // end namespace GridOutFlags
+
+
+
+void GridOut::set_flags (const GridOutFlags::Ucd &flags)
{
ucd_flags = flags;
};
-void GridOut::set_flags (const GnuplotFlags &flags)
+
+void GridOut::set_flags (const GridOutFlags::Gnuplot &flags)
{
gnuplot_flags = flags;
};
-void GridOut::set_flags (const EpsFlags<1> &flags)
+
+void GridOut::set_flags (const GridOutFlags::Eps<1> &flags)
{
eps_flags_1 = flags;
};
-void GridOut::set_flags (const EpsFlags<2> &flags)
+
+void GridOut::set_flags (const GridOutFlags::Eps<2> &flags)
{
eps_flags_2 = flags;
};
-void GridOut::set_flags (const EpsFlags<3> &flags)
+
+void GridOut::set_flags (const GridOutFlags::Eps<3> &flags)
{
eps_flags_3 = flags;
};
-std::string GridOut::default_suffix (const OutputFormat output_format)
+
+std::string
+GridOut::default_suffix (const OutputFormat output_format)
{
switch (output_format)
{
};
+
GridOut::OutputFormat
GridOut::parse_output_format (const std::string &format_name)
{
};
+
std::string GridOut::get_output_format_names ()
{
return "gnuplot|eps|ucd";
};
+
unsigned int
GridOut::memory_consumption () const
{