From 5664d84a75281ed6609d7dd8f539f92f77e7dd73 Mon Sep 17 00:00:00 2001 From: bangerth Date: Wed, 14 Dec 2011 14:07:22 +0000 Subject: [PATCH] Remove DataPostprocessor::n_output_variables() because it is redundant. git-svn-id: https://svn.dealii.org/trunk@24824 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/doc/news/changes.h | 8 +++++++ deal.II/examples/step-29/step-29.cc | 15 ------------- deal.II/examples/step-32/step-32.cc | 11 ---------- deal.II/examples/step-33/step-33.cc | 15 ------------- deal.II/examples/step-47/step-47.cc | 11 ---------- .../deal.II/numerics/data_postprocessor.h | 18 ++------------- deal.II/source/numerics/data_out.cc | 22 ++++++------------- deal.II/source/numerics/data_postprocessor.cc | 2 +- 8 files changed, 18 insertions(+), 84 deletions(-) diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index 942679a560..0ff3d38a69 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -73,6 +73,14 @@ enabled due to a missing include file in file

Specific improvements

    +
  1. Changed: The DataPostprocessor class previously required users of this +class to overload DataPostprocessor::get_names(), +DataPostprocessor::get_data_component_interpretation() +and DataPostprocessor::n_output_variables(). The latter function is redundant +since its output must equal the length of the arrays returned by the +first two of these functions. It has therefore been removed. +
    +(Wolfgang Bangerth, 2011/12/15)
  2. Improved: Objects of the type LogStream::Prefix can now be used as a safe implementation of the push and pop mechanism for log diff --git a/deal.II/examples/step-29/step-29.cc b/deal.II/examples/step-29/step-29.cc index bfaf1adca6..593131e39d 100644 --- a/deal.II/examples/step-29/step-29.cc +++ b/deal.II/examples/step-29/step-29.cc @@ -422,7 +422,6 @@ namespace Step29 virtual std::vector get_names () const; virtual UpdateFlags get_needed_update_flags () const; - virtual unsigned int n_output_variables () const; }; // The get_names @@ -470,20 +469,6 @@ namespace Step29 return update_values; } - // To allow the caller to find out - // how many derived quantities are - // returned by the postprocessor, the - // n_output_variables - // function is used. Since we compute - // only $|u|$, the correct value to - // return in our case is just 1: - template - unsigned int - ComputeIntensity::n_output_variables () const - { - return 1; - } - // The actual prostprocessing happens // in the following function. Its diff --git a/deal.II/examples/step-32/step-32.cc b/deal.II/examples/step-32/step-32.cc index afbf64cb53..8fbf94cacb 100644 --- a/deal.II/examples/step-32/step-32.cc +++ b/deal.II/examples/step-32/step-32.cc @@ -3804,8 +3804,6 @@ namespace Step32 virtual std::vector get_names () const; - virtual unsigned int n_output_variables() const; - virtual std::vector get_data_component_interpretation () const; @@ -3853,14 +3851,6 @@ namespace Step32 } - template - unsigned int - BoussinesqFlowProblem::Postprocessor::n_output_variables() const - { - return get_names().size(); - } - - template std::vector BoussinesqFlowProblem::Postprocessor:: @@ -3921,7 +3911,6 @@ namespace Step32 Assert (duh.size() == n_quadrature_points, ExcInternalError()); Assert (computed_quantities.size() == n_quadrature_points, ExcInternalError()); Assert (uh[0].size() == dim+2, ExcInternalError()); - Assert (computed_quantities[0].size()==n_output_variables(),ExcInternalError()); for (unsigned int q=0; q - unsigned int - EulerEquations::Postprocessor:: - n_output_variables () const - { - if (do_schlieren_plot == true) - return dim+2; - else - return dim+1; - } - - // @sect3{Run time parameter handling} // Our next job is to define a few diff --git a/deal.II/examples/step-47/step-47.cc b/deal.II/examples/step-47/step-47.cc index 0580e15af9..af25927973 100644 --- a/deal.II/examples/step-47/step-47.cc +++ b/deal.II/examples/step-47/step-47.cc @@ -908,8 +908,6 @@ namespace Step47 virtual std::vector get_names () const; - virtual unsigned int n_output_variables() const; - virtual std::vector get_data_component_interpretation () const; @@ -928,14 +926,6 @@ namespace Step47 } - template - unsigned int - Postprocessor::n_output_variables() const - { - return get_names().size(); - } - - template std::vector Postprocessor:: @@ -969,7 +959,6 @@ namespace Step47 const unsigned int n_quadrature_points = uh.size(); Assert (computed_quantities.size() == n_quadrature_points, ExcInternalError()); Assert (uh[0].size() == 2, ExcInternalError()); - Assert (computed_quantities[0].size()==n_output_variables(),ExcInternalError()); for (unsigned int q=0; q get_names () const=0; + virtual std::vector get_names () const = 0; /** * This functions returns @@ -236,21 +236,7 @@ class DataPostprocessor: public Subscriptor * also ask for a update of normals via the * @p update_normal_vectors flag. */ - virtual UpdateFlags get_needed_update_flags () const=0; - - /** - * Number of postprocessed - * variables. Has to match the - * number of entries filled by - * compute_derived_quantities_scalar() - * or - * compute_derived_quantities_vector() - * as well as the size of the - * vector of names returned by - * get_names(). - */ - virtual unsigned int n_output_variables() const=0; - + virtual UpdateFlags get_needed_update_flags () const = 0; }; DEAL_II_NAMESPACE_CLOSE diff --git a/deal.II/source/numerics/data_out.cc b/deal.II/source/numerics/data_out.cc index bf829e0863..7580a57845 100644 --- a/deal.II/source/numerics/data_out.cc +++ b/deal.II/source/numerics/data_out.cc @@ -126,24 +126,16 @@ DataEntryBase::DataEntryBase (const DataPostprocessor *data names(data_postprocessor->get_names()), data_component_interpretation (data_postprocessor->get_data_component_interpretation()), postprocessor(data_postprocessor, typeid(*this).name()), - n_output_variables(data_postprocessor->n_output_variables()) + n_output_variables(names.size()) { - // if there is a post processor, then we - // should have gotten the names from the - // postprocessor. check that the number of - // elements in the names vector is - // correct. otherwise there is nothing for - // us to check - Assert(data_postprocessor->n_output_variables()==names.size(), - ExcDimensionMismatch(data_postprocessor->n_output_variables(), - names.size())); - Assert (names.size() == data_component_interpretation.size(), - ExcDimensionMismatch(data_component_interpretation.size(), - names.size())); - + Assert (data_postprocessor->get_names().size() + == + data_postprocessor->get_data_component_interpretation().size(), + ExcDimensionMismatch (data_postprocessor->get_names().size(), + data_postprocessor->get_data_component_interpretation().size())); + // check that the names use only allowed // characters - // check names for invalid characters for (unsigned int i=0; i::get_data_component_interpretation () const // components are independent scalars return std::vector - (n_output_variables(), + (get_names().size(), DataComponentInterpretation::component_is_scalar); } -- 2.39.5