From b41062b82f62de5da70d90b9b810abf36eb52822 Mon Sep 17 00:00:00 2001 From: wolf Date: Tue, 6 Jul 1999 17:03:40 +0000 Subject: [PATCH] Little bit more on eps-output. git-svn-id: https://svn.dealii.org/trunk@1544 0785d39b-7218-0410-832d-ea1e28bc413d --- .../deal.II/include/numerics/data_out_base.h | 41 +++++++++++++++-- .../deal.II/source/numerics/data_out_base.cc | 46 +++++++++++++------ 2 files changed, 67 insertions(+), 20 deletions(-) diff --git a/deal.II/deal.II/include/numerics/data_out_base.h b/deal.II/deal.II/include/numerics/data_out_base.h index ea9df2677d..6fbbde32bc 100644 --- a/deal.II/deal.II/include/numerics/data_out_base.h +++ b/deal.II/deal.II/include/numerics/data_out_base.h @@ -149,7 +149,7 @@ * * 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 */ diff --git a/deal.II/deal.II/source/numerics/data_out_base.cc b/deal.II/deal.II/source/numerics/data_out_base.cc index ac6c076693..37e3737445 100644 --- a/deal.II/deal.II/source/numerics/data_out_base.cc +++ b/deal.II/deal.II/source/numerics/data_out_base.cc @@ -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 > &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 > &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; -- 2.39.5