]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Add ways to declare the parameters of output formats once and for all.
authorcvs <cvs@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 7 Oct 1999 15:56:28 +0000 (15:56 +0000)
committercvs <cvs@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 7 Oct 1999 15:56:28 +0000 (15:56 +0000)
git-svn-id: https://svn.dealii.org/trunk@1748 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/include/base/data_out_base.h
deal.II/base/source/data_out_base.all_dimensions.cc
deal.II/base/source/data_out_base.cc

index 363b609c8c6dbae0ee090b0d14304b22b1cb77a3..79718a8539d28740c62631155a5d32abfd70111a 100644 (file)
@@ -5,6 +5,7 @@
 /*----------------------------   data_out_base.h     ---------------------------*/
 
 
+#include <base/forward-declarations.h>
 #include <base/point.h>
 #include <lac/fullmatrix.h>
 #include <grid/geometry_info.h>
@@ -331,6 +332,24 @@ class DataOutBase
                                          * Constructor.
                                          */
        UcdFlags (const bool write_preamble = true);
+
+                                        /**
+                                         * Declare all flags with name
+                                         * and type as offered by this
+                                         * class, for use in input files.
+                                         */
+       static void declare_parameters (ParameterHandler &prm);
+
+                                        /**
+                                         * Read the parameters declared in
+                                         * #declare_parameters# and set the
+                                         * flags for this output format
+                                         * accordingly.
+                                         *
+                                         * The flags thus obtained overwrite
+                                         * all previous contents of this object.
+                                         */
+       void parse_parameters (ParameterHandler &prm);
     };
 
                                     /**
@@ -350,6 +369,25 @@ class DataOutBase
                                          * #private# as well).
                                          */
        int dummy;
+
+      public:
+                                        /**
+                                         * Declare all flags with name
+                                         * and type as offered by this
+                                         * class, for use in input files.
+                                         */
+       static void declare_parameters (ParameterHandler &prm);
+
+                                        /**
+                                         * Read the parameters declared in
+                                         * #declare_parameters# and set the
+                                         * flags for this output format
+                                         * accordingly.
+                                         *
+                                         * The flags thus obtained overwrite
+                                         * all previous contents of this object.
+                                         */
+       void parse_parameters (ParameterHandler &prm);
     };
 
                                     /**
@@ -369,6 +407,25 @@ class DataOutBase
                                          * #private# as well).
                                          */
        int dummy;
+
+      public:
+                                        /**
+                                         * Declare all flags with name
+                                         * and type as offered by this
+                                         * class, for use in input files.
+                                         */
+       static void declare_parameters (ParameterHandler &prm);
+
+                                        /**
+                                         * Read the parameters declared in
+                                         * #declare_parameters# and set the
+                                         * flags for this output format
+                                         * accordingly.
+                                         *
+                                         * The flags thus obtained overwrite
+                                         * all previous contents of this object.
+                                         */
+       void parse_parameters (ParameterHandler &prm);
     };
 
     
@@ -606,6 +663,28 @@ class DataOutBase
                  const bool          draw_cells    = true,
                  const bool          shade_cells   = true,
                  const ColorFunction color_function= &default_color_function);
+
+                                        /**
+                                         * Declare all flags with name
+                                         * and type as offered by this
+                                         * class, for use in input files.
+                                         *
+                                         * For coloring, only the color
+                                         * functions declared in this
+                                         * class are offered.
+                                         */
+       static void declare_parameters (ParameterHandler &prm);
+
+                                        /**
+                                         * Read the parameters declared in
+                                         * #declare_parameters# and set the
+                                         * flags for this output format
+                                         * accordingly.
+                                         *
+                                         * The flags thus obtained overwrite
+                                         * all previous contents of this object.
+                                         */
+       void parse_parameters (ParameterHandler &prm);
     };
 
                                     /**
@@ -625,6 +704,25 @@ class DataOutBase
                                          * #private# as well).
                                          */
        int dummy;
+
+      public:
+                                        /**
+                                         * Declare all flags with name
+                                         * and type as offered by this
+                                         * class, for use in input files.
+                                         */
+       static void declare_parameters (ParameterHandler &prm);
+
+                                        /**
+                                         * Read the parameters declared in
+                                         * #declare_parameters# and set the
+                                         * flags for this output format
+                                         * accordingly.
+                                         *
+                                         * The flags thus obtained overwrite
+                                         * all previous contents of this object.
+                                         */
+       void parse_parameters (ParameterHandler &prm);
     };
 
                                     /**
@@ -966,6 +1064,44 @@ class DataOutInterface : private DataOutBase
                                      */
     static string get_output_format_names ();
 
+                                    /**
+                                     * Declare parameters for all output
+                                     * formats by declaring subsections
+                                     * within the parameter file for each
+                                     * output format and call the
+                                     * respective #declare_parameters#
+                                     * functions of the flag classes for
+                                     * each output format.
+                                     *
+                                     * Some of the declared subsections
+                                     * may not contain entries, if the
+                                     * respective format does not
+                                     * export any flags.
+                                     *
+                                     * Note that the top-level parameters
+                                     * denoting the number of subdivisions
+                                     * per patch and the output format
+                                     * are not declared, since they are
+                                     * only passed to virtual functions
+                                     * and are not stored inside objects
+                                     * of this type. You have to
+                                     * declare them yourself.
+                                     */
+    static void declare_parameters (ParameterHandler &prm);
+
+                                    /**
+                                     * Read the parameters declared in
+                                     * #declare_parameters# and set the
+                                     * flags for the output formats
+                                     * accordingly.
+                                     *
+                                     * The flags thus obtained overwrite
+                                     * all previous contents of the flag
+                                     * objects as default-constructed or
+                                     * set by the #set_flags# function.
+                                     */
+    void parse_parameters (ParameterHandler &prm);
+    
                                     /**
                                      * Exception
                                      */
index 926338d5e2cdd46630586bbf3acce356280333eb..85107ef6ce3eccf8259083920f69811ee4a60be1 100644 (file)
@@ -2,7 +2,7 @@
 
 
 #include <base/data_out_base.h>
-
+#include <base/parameter_handler.h>
 
 
 DataOutBase::UcdFlags::UcdFlags (const bool write_preamble) :
@@ -10,6 +10,45 @@ DataOutBase::UcdFlags::UcdFlags (const bool write_preamble) :
 {};
 
 
+
+void DataOutBase::UcdFlags::declare_parameters (ParameterHandler &prm)
+{
+  prm.declare_entry ("Write preamble", "true", Patterns::Bool());
+};
+
+
+
+void DataOutBase::UcdFlags::parse_parameters (ParameterHandler &prm)
+{
+  write_preamble = prm.get_bool ("Write preamble");
+};
+
+
+
+void DataOutBase::GnuplotFlags::declare_parameters (ParameterHandler &/*prm*/)
+{
+};
+
+
+
+void DataOutBase::GnuplotFlags::parse_parameters (ParameterHandler &/*prm*/)
+{
+};
+
+
+
+void DataOutBase::PovrayFlags::declare_parameters (ParameterHandler &/*prm*/)
+{
+};
+
+
+
+void DataOutBase::PovrayFlags::parse_parameters (ParameterHandler &/*prm*/)
+{
+};
+
+
+
 DataOutBase::EpsFlags::EpsFlags (const unsigned int  height_vector,
                                 const unsigned int  color_vector,
                                 const SizeType      size_type,
@@ -147,4 +186,66 @@ bool DataOutBase::EpsCell2d::operator < (const EpsCell2d &e) const
 
 
 
+void DataOutBase::EpsFlags::declare_parameters (ParameterHandler &prm)
+{
+  prm.declare_entry ("Index of vector for height", "0",
+                    Patterns::Integer());
+  prm.declare_entry ("Index of vector for color", "0",
+                    Patterns::Integer());
+  prm.declare_entry ("Scale to width or height", "width",
+                    Patterns::Selection ("width|height"));
+  prm.declare_entry ("Size (width or height) in eps units", "300",
+                    Patterns::Integer());
+  prm.declare_entry ("Line widths in eps units", "0.5",
+                    Patterns::Double());
+  prm.declare_entry ("Azimut angle", "60",
+                    Patterns::Double());
+  prm.declare_entry ("Turn angle", "30",
+                    Patterns::Double());
+  prm.declare_entry ("Scaling for z-axis", "1",
+                    Patterns::Double ());
+  prm.declare_entry ("Draw mesh lines", "true",
+                    Patterns::Bool());
+  prm.declare_entry ("Fill interior of cells", "true",
+                    Patterns::Bool());
+  prm.declare_entry ("Color shading of interior of cells", "true",
+                    Patterns::Bool());
+  prm.declare_entry ("Color function", "default",
+                    Patterns::Selection ("default|grey scale"));
+};
+
 
+
+void DataOutBase::EpsFlags::parse_parameters (ParameterHandler &prm)
+{
+  height_vector = prm.get_integer ("Index of vector for height");
+  color_vector  = prm.get_integer ("Index of vector for color");
+  if (prm.get ("Scale to width or height") == "width")
+    size_type   = width;
+  else
+    size_type   = height;
+  size          = prm.get_integer ("Size (width or height) in eps units");
+  line_width    = prm.get_double ("Line widths in eps units");
+  azimut_angle  = prm.get_double ("Azimut angle");
+  turn_angle    = prm.get_double ("Turn angle");
+  z_scaling     = prm.get_double ("Scaling for z-axis");
+  draw_mesh     = prm.get_bool ("Draw mesh lines");
+  draw_cells    = prm.get_bool ("Fill interior of cells");
+  shade_cells   = prm.get_bool ("Color shading of interior of cells");
+  if (prm.get("Color function") == "default")
+    color_function = &default_color_function;
+  else
+    color_function = &grey_scale_color_function;
+};
+
+
+
+void DataOutBase::GmvFlags::declare_parameters (ParameterHandler &/*prm*/)
+{
+};
+
+
+
+void DataOutBase::GmvFlags::parse_parameters (ParameterHandler &/*prm*/)
+{
+};
index ab403d4b574aeff43d7da9b5157afdad15af6c97..13f8058e2a2a0c9f612cc83248527c2b8582d968 100644 (file)
@@ -2,6 +2,7 @@
 
 
 #include <base/data_out_base.h>
+#include <base/parameter_handler.h>
 #include <iomanip>
 #include <ctime>
 #include <cmath>
@@ -1562,6 +1563,58 @@ string DataOutInterface<dim>::get_output_format_names () {
 
 
 
+template <int dim>
+void DataOutInterface<dim>::declare_parameters (ParameterHandler &prm) 
+{
+  prm.enter_subsection ("UCD output parameters");
+  UcdFlags::declare_parameters (prm);
+  prm.leave_subsection();
+  
+  prm.enter_subsection ("Gnuplot output parameters");
+  GnuplotFlags::declare_parameters (prm);
+  prm.leave_subsection();
+
+  prm.enter_subsection ("Povray output parameters");
+  PovrayFlags::declare_parameters (prm);
+  prm.leave_subsection();
+
+  prm.enter_subsection ("Eps output parameters");
+  EpsFlags::declare_parameters (prm);
+  prm.leave_subsection();
+
+  prm.enter_subsection ("Gmv output parameters");
+  GmvFlags::declare_parameters (prm);
+  prm.leave_subsection();
+};
+
+
+
+template <int dim>
+void DataOutInterface<dim>::parse_parameters (ParameterHandler &prm) 
+{
+  prm.enter_subsection ("UCD output parameters");
+  ucd_flags.parse_parameters (prm);
+  prm.leave_subsection();
+  
+  prm.enter_subsection ("Gnuplot output parameters");
+  gnuplot_flags.parse_parameters (prm);
+  prm.leave_subsection();
+
+  prm.enter_subsection ("Povray output parameters");
+  povray_flags.parse_parameters (prm);
+  prm.leave_subsection();
+
+  prm.enter_subsection ("Eps output parameters");
+  eps_flags.parse_parameters (prm);
+  prm.leave_subsection();
+
+  prm.enter_subsection ("Gmv output parameters");
+  gmv_flags.parse_parameters (prm);
+  prm.leave_subsection();
+};
+
+
+
 
 
   

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.