]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Little bit more on eps-output.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 6 Jul 1999 17:03:40 +0000 (17:03 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 6 Jul 1999 17:03:40 +0000 (17:03 +0000)
git-svn-id: https://svn.dealii.org/trunk@1544 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/numerics/data_out_base.h
deal.II/deal.II/source/numerics/data_out_base.cc

index ea9df2677deebd24390a3f710cdc15954898746c..6fbbde32bc6b9c276503e02636945ee58c7275db 100644 (file)
  *
  * To be filled in.
  * precision=5; viewpoint=gnuplot default; no border
- *
+ * shade or not; grid or not; grid shaded; data vector
  *
  * \subsection{GMV format}
  *
@@ -339,6 +339,19 @@ class DataOutBase
                                      */
     struct EpsFlags 
     {
+                                        /**
+                                         * This denotes the number of the
+                                         * data vector which shall be used
+                                         * for generating the height
+                                         * information. By default, the
+                                         * first data vector is taken,
+                                         * i.e. #height_value==0#, if
+                                         * there is any data vector. If there
+                                         * is no data vector, no height
+                                         * information is generated.
+                                         */
+       unsigned int height_vector;
+       
                                         /**
                                          * Enum denoting the possibilities
                                          * whether the scaling should be done
@@ -415,16 +428,27 @@ class DataOutBase
                                          * Default is #1.0#.
                                          */
        double z_scaling;
-       
+
+                                        /**
+                                         * Flag the determines whether the
+                                         * lines bounding the cells (or the
+                                         * parts of each patch) are to be
+                                         * plotted.
+                                         *
+                                         * Default: #true#.
+       bool   draw_mesh;
+
                                         /**
                                          * Constructor.
                                          */
-       EpsFlags (const SizeType     size_type    = width,
+       EpsFlags (const unsigned int height_vector = 0,
+                 const SizeType     size_type    = width,
                  const unsigned int size         = 300,
                  const double       line_width   = 0.5,
                  const double       azimut_angle = 60,
                  const double       turn_angle   = 30,
-                 const double       z_scaling    = 1.0);
+                 const double       z_scaling    = 1.0,
+                 const bool         draw_mesh    = true);
     };
 
                                     /**
@@ -527,7 +551,14 @@ class DataOutBase
                    int, int,
                    << "The number of points in this data set is " << arg1
                    << ", but we expected " << arg2 << " in each space direction.");
-
+                                    /**
+                                     * Exception
+                                     */
+    DeclException2 (ExcInvalidHeightVectorNumber,
+                   int, int,
+                   << "The number " << arg1 << " of the vector to be used for "
+                   << "height information is invalid, since there are only "
+                   << arg2 << " data sets.");
                                     /**
                                      * Exception
                                      */
index ac6c0766931ac9ca973e5aaafc8ae68d577f9361..37e373744534614b5625daddfa8ffdd3d1c88d3d 100644 (file)
@@ -23,18 +23,22 @@ DataOutBase::UcdFlags::UcdFlags (const bool write_preamble) :
 {};
 
 
-DataOutBase::EpsFlags::EpsFlags (const SizeType     size_type,
+DataOutBase::EpsFlags::EpsFlags (const unsigned int height_vector,
+                                const SizeType     size_type,
                                 const unsigned int size,
                                 const double       line_width,
                                 const double       azimut_angle,
                                 const double       turn_angle,
-                                const double       z_scaling) :
+                                const double       z_scaling,
+                                const bool         draw_mesh) :
+               height_vector(height_vector),
                size_type(size_type),
                size(size),
                line_width(line_width),
                azimut_angle(azimut_angle),
                turn_angle(turn_angle),
-               z_scaling(z_scaling)
+               z_scaling(z_scaling),
+               draw_mesh(draw_mesh)
 {};
 
 
@@ -784,12 +788,23 @@ void DataOutBase::write_eps (const vector<Patch<dim> > &patches,
                         ((patch->vertices[2] * x_frac) +
                          (patch->vertices[3] * (1-x_frac))) * y_frac1) 
                    };
-                 
+
+                 Assert ((flags.height_vector < patch->data.m()) ||
+                         patch->data.m() == 0,
+                         ExcInvalidHeightVectorNumber (flags.height_vector,
+                                                       patch->data.m()));
                  const double heights[4]
-                   = { patch->data(0,i*(n_subdivisions+1) + j)       * flags.z_scaling,
-                       patch->data(0,(i+1)*(n_subdivisions+1) + j)   * flags.z_scaling,
-                       patch->data(0,(i+1)*(n_subdivisions+1) + j+1) * flags.z_scaling,
-                       patch->data(0,i*(n_subdivisions+1) + j+1)     * flags.z_scaling};
+                   = { patch->data.m() != 0 ?
+                       patch->data(flags.height_vector,i*(n_subdivisions+1) + j)       * flags.z_scaling : 0,
+                       
+                       patch->data.m() != 0 ?
+                       patch->data(flags.height_vector,(i+1)*(n_subdivisions+1) + j)   * flags.z_scaling : 0,
+                       
+                       patch->data.m() != 0 ?
+                       patch->data(flags.height_vector,(i+1)*(n_subdivisions+1) + j+1) * flags.z_scaling : 0,
+                       
+                       patch->data.m() != 0 ?
+                       patch->data(flags.height_vector,i*(n_subdivisions+1) + j+1)     * flags.z_scaling : 0};
                  
 
                                                   // now compute the projection of
@@ -961,13 +976,14 @@ void DataOutBase::write_eps (const vector<Patch<dim> > &patches,
                << (cell->vertices[2]-offset) * scale << " l "
                << (cell->vertices[3]-offset) * scale << " lf"
                << endl;
-       
-           out << "0 sg " 
-               << (cell->vertices[0]-offset) * scale << " m "
-               << (cell->vertices[1]-offset) * scale << " l "
-               << (cell->vertices[2]-offset) * scale << " l "
-               << (cell->vertices[3]-offset) * scale << " lx"
-               << endl;
+
+           if (flags.draw_mesh)
+             out << "0 sg " 
+                 << (cell->vertices[0]-offset) * scale << " m "
+                 << (cell->vertices[1]-offset) * scale << " l "
+                 << (cell->vertices[2]-offset) * scale << " l "
+                 << (cell->vertices[3]-offset) * scale << " lx"
+                 << endl;
          };
        out << "showpage" << endl;
        

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.