]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Remove DataPostprocessor::n_output_variables() because it is redundant.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 14 Dec 2011 14:07:22 +0000 (14:07 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 14 Dec 2011 14:07:22 +0000 (14:07 +0000)
git-svn-id: https://svn.dealii.org/trunk@24824 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/doc/news/changes.h
deal.II/examples/step-29/step-29.cc
deal.II/examples/step-32/step-32.cc
deal.II/examples/step-33/step-33.cc
deal.II/examples/step-47/step-47.cc
deal.II/include/deal.II/numerics/data_postprocessor.h
deal.II/source/numerics/data_out.cc
deal.II/source/numerics/data_postprocessor.cc

index 942679a5601aa5b4efc0406e74ba4595a70ac78c..0ff3d38a6908723bd77b16ff432bdd687a4cdbb7 100644 (file)
@@ -73,6 +73,14 @@ enabled due to a missing include file in file
 <h3>Specific improvements</h3>
 
 <ol>
+<li> 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.
+<br>
+(Wolfgang Bangerth, 2011/12/15)
 
 <li> Improved: Objects of the type LogStream::Prefix can now be used
 as a safe implementation of the push and pop mechanism for log
index bfaf1adca67d03bb1ba9175f29104e4a57168af7..593131e39d3b3dde59856384fa1d4b02e2617a3f 100644 (file)
@@ -422,7 +422,6 @@ namespace Step29
 
       virtual std::vector<std::string> get_names () const;
       virtual UpdateFlags              get_needed_update_flags () const;
-      virtual unsigned int             n_output_variables () const;
   };
 
                                   // The <code>get_names</code>
@@ -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
-                                  // <code>n_output_variables</code>
-                                  // function is used. Since we compute
-                                  // only $|u|$, the correct value to
-                                  // return in our case is just 1:
-  template <int dim>
-  unsigned int
-  ComputeIntensity<dim>::n_output_variables () const
-  {
-    return 1;
-  }
-
 
                                   // The actual prostprocessing happens
                                   // in the following function.  Its
index afbf64cb53a28881e629988047aa02d3b408564b..8fbf94cacb6a7ede89278b743f35d6c811f30ae1 100644 (file)
@@ -3804,8 +3804,6 @@ namespace Step32
 
       virtual std::vector<std::string> get_names () const;
 
-      virtual unsigned int n_output_variables() const;
-
       virtual
       std::vector<DataComponentInterpretation::DataComponentInterpretation>
       get_data_component_interpretation () const;
@@ -3853,14 +3851,6 @@ namespace Step32
   }
 
 
-  template <int dim>
-  unsigned int
-  BoussinesqFlowProblem<dim>::Postprocessor::n_output_variables() const
-  {
-    return get_names().size();
-  }
-
-
   template <int dim>
   std::vector<DataComponentInterpretation::DataComponentInterpretation>
   BoussinesqFlowProblem<dim>::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<n_quadrature_points; ++q)
       {
index ceba990a78a9893b5ea48fc235584d50c2bbf18c..901cd5e6bd2fa65f998be2bd759cd79980c60810 100644 (file)
@@ -725,8 +725,6 @@ namespace Step33
 
          virtual UpdateFlags get_needed_update_flags () const;
 
-         virtual unsigned int n_output_variables() const;
-
        private:
          const bool do_schlieren_plot;
       };
@@ -886,19 +884,6 @@ namespace Step33
   }
 
 
-
-  template <int dim>
-  unsigned int
-  EulerEquations<dim>::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
index 0580e15af93442517170a1b3bff7fe4c8ad7a6b9..af259279732e5ac12570756e79073d8ba2dcfe81 100644 (file)
@@ -908,8 +908,6 @@ namespace Step47
 
       virtual std::vector<std::string> get_names () const;
 
-      virtual unsigned int n_output_variables() const;
-
       virtual
       std::vector<DataComponentInterpretation::DataComponentInterpretation>
       get_data_component_interpretation () const;
@@ -928,14 +926,6 @@ namespace Step47
   }
 
 
-  template <int dim>
-  unsigned int
-  Postprocessor<dim>::n_output_variables() const
-  {
-    return get_names().size();
-  }
-
-
   template <int dim>
   std::vector<DataComponentInterpretation::DataComponentInterpretation>
   Postprocessor<dim>::
@@ -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<n_quadrature_points; ++q)
       {
index ad24cdb50a32b529fe7fae0009e3f52181270f10..8554319922e469ed6359e034acee79f6f9b807e7 100644 (file)
@@ -181,7 +181,7 @@ class DataPostprocessor: public Subscriptor
                                      * Return the vector of strings describing
                                      * the names of the computed quantities.
                                      */
-    virtual std::vector<std::string> get_names () const=0;
+    virtual std::vector<std::string> 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
index bf829e08634dd0fc05180a88d940e99fe0bbc143..7580a57845e48d10cdcffeed8a8ca9998305b5c5 100644 (file)
@@ -126,24 +126,16 @@ DataEntryBase::DataEntryBase (const DataPostprocessor<DH::space_dimension> *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<names.size(); ++i)
     Assert (names[i].find_first_not_of("abcdefghijklmnopqrstuvwxyz"
                                       "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
index c1a56f2a9ef91fde47c722d2952b23065f4c5443..281b84c61b5624735447ff197e253ea3e8c71fdb 100644 (file)
@@ -88,7 +88,7 @@ DataPostprocessor<dim>::get_data_component_interpretation () const
                                   // components are independent scalars
   return
     std::vector<DataComponentInterpretation::DataComponentInterpretation>
-    (n_output_variables(),
+    (get_names().size(),
      DataComponentInterpretation::component_is_scalar);
 }
 

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.