]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Convert two tests to a new interface. 4271/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Mon, 17 Apr 2017 01:54:16 +0000 (19:54 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Mon, 17 Apr 2017 01:54:16 +0000 (19:54 -0600)
tests/numerics/point_value_history_02.cc
tests/numerics/point_value_history_03.cc

index a1640518ea29f66e71b67c4d85e52deb65ee88e5..1ab27f3b075f8db9a653c51e8f50e66558c5ad5b 100644 (file)
@@ -58,23 +58,12 @@ template <int dim>
 class Postprocess : public DataPostprocessor<dim>
 {
 public:
-
-  void compute_derived_quantities_vector (
-    const std::vector< Vector< double > > &,
-    const std::vector< std::vector< Tensor< 1, dim > > > &,
-    const std::vector< std::vector< Tensor< 2, dim > > > &,
-    const std::vector< Point< dim > > &,
-    const std::vector< Point< dim > > &,
-    std::vector< Vector< double > > &
-  ) const;
+  void evaluate_vector_field (const DataPostprocessorInputs::Vector<dim> &inputs,
+                              std::vector<Vector<double> >               &computed_quantities) const;
 
   std::vector<std::string> get_names () const;
   UpdateFlags              get_needed_update_flags () const;
   unsigned int             n_output_variables () const;
-  // The following function is not required
-  // by the point_value_history class.
-  //std::vector<DataComponentInterpretation::DataComponentInterpretation>
-  //                  get_data_component_interpretation () const;
 };
 
 template <int dim>
@@ -106,28 +95,23 @@ Postprocess<dim>::n_output_variables () const
 
 template <int dim>
 void
-Postprocess<dim>::compute_derived_quantities_vector (
-  const std::vector< Vector< double > >                  &solution_values,
-  const std::vector< std::vector< Tensor< 1, dim > > >   &solution_gradients,
-  const std::vector< std::vector< Tensor< 2, dim > > >   &solution_hessians,
-  const std::vector< Point< dim > >                     & /* normals */,
-  const std::vector< Point< dim > >                     & /* locations */,
-  std::vector< Vector< double > >                        &computed_quantities
-) const
+Postprocess<dim>::evaluate_vector_field (const DataPostprocessorInputs::Vector<dim> &inputs,
+                                         std::vector<Vector<double> >               &computed_quantities) const
 {
-  Assert(computed_quantities.size() == solution_values.size(),
-         ExcDimensionMismatch (computed_quantities.size(), solution_values.size()));
+  Assert(computed_quantities.size() == inputs.solution_values.size(),
+         ExcDimensionMismatch (computed_quantities.size(), inputs.solution_values.size()));
 
   for (unsigned int i=0; i<computed_quantities.size(); i++)
     {
       Assert(computed_quantities[i].size() == 4,
              ExcDimensionMismatch (computed_quantities[i].size(), 3));
-      Assert(solution_values[i].size() == dim + 1, ExcDimensionMismatch (solution_values[i].size(), dim + 1));
+      Assert(inputs.solution_values[i].size() == dim + 1,
+             ExcDimensionMismatch (inputs.solution_values[i].size(), dim + 1));
 
-      computed_quantities[i](0) = solution_gradients[i][0].norm(); // norm of x gradient
-      computed_quantities[i](1) = solution_hessians[i][1].norm(); // norm of y hessian
-      computed_quantities[i](2) = solution_gradients[i][0].norm() + solution_hessians[i][1].norm(); // norm of y hessian
-      computed_quantities[i](3) = solution_values[i].l2_norm();
+      computed_quantities[i](0) = inputs.solution_gradients[i][0].norm(); // norm of x gradient
+      computed_quantities[i](1) = inputs.solution_hessians[i][1].norm(); // norm of y hessian
+      computed_quantities[i](2) = inputs.solution_gradients[i][0].norm() + inputs.solution_hessians[i][1].norm(); // norm of y hessian
+      computed_quantities[i](3) = inputs.solution_values[i].l2_norm();
     }
 }
 
index 6ac37d247f9cf54120cdd6d1d5bd3af2f6f32193..0fc692db6511dbce9dccf01e1f05df3dd7e4d091 100644 (file)
@@ -58,23 +58,12 @@ template <int dim>
 class Postprocess : public DataPostprocessor<dim>
 {
 public:
-
-  void compute_derived_quantities_scalar (
-    const std::vector< double > &,
-    const std::vector< Tensor< 1, dim > > &,
-    const std::vector< Tensor< 2, dim > > &,
-    const std::vector< Point< dim > > &,
-    const std::vector< Point< dim > > &,
-    std::vector< Vector< double > > &
-  ) const;
+  void evaluate_scalar_field (const DataPostprocessorInputs::Scalar<dim> &inputs,
+                              std::vector<Vector<double> >               &computed_quantities) const;
 
   std::vector<std::string> get_names () const;
   UpdateFlags              get_needed_update_flags () const;
   unsigned int             n_output_variables () const;
-  // The following function is not required
-  // by the point_value_history class.
-  //std::vector<DataComponentInterpretation::DataComponentInterpretation>
-  //                  get_data_component_interpretation () const;
 };
 
 template <int dim>
@@ -104,25 +93,19 @@ Postprocess<dim>::n_output_variables () const
 
 template <int dim>
 void
-Postprocess<dim>::compute_derived_quantities_scalar (
-  const std::vector< double >                  &solution_values,
-  const std::vector< Tensor< 1, dim > >   &solution_gradients,
-  const std::vector< Tensor< 2, dim > >   &solution_hessians,
-  const std::vector< Point< dim > >                     & /* normals */,
-  const std::vector< Point< dim > >                     & /* locations */,
-  std::vector< Vector< double > >                        &computed_quantities
-) const
+Postprocess<dim>::evaluate_scalar_field (const DataPostprocessorInputs::Scalar<dim> &inputs,
+                                         std::vector<Vector<double> >               &computed_quantities) const
 {
-  Assert(computed_quantities.size() == solution_values.size(),
-         ExcDimensionMismatch (computed_quantities.size(), solution_values.size()));
+  Assert(computed_quantities.size() == inputs.solution_values.size(),
+         ExcDimensionMismatch (computed_quantities.size(), inputs.solution_values.size()));
 
   for (unsigned int i=0; i<computed_quantities.size(); i++)
     {
       Assert(computed_quantities[i].size() == 2,
              ExcDimensionMismatch (computed_quantities[i].size(), 2));
 
-      computed_quantities[i](0) = solution_gradients[i][0]; // norm of x gradient
-      computed_quantities[i](1) = solution_hessians[i][0].norm(); // norm of x hessian
+      computed_quantities[i](0) = inputs.solution_gradients[i][0]; // norm of x gradient
+      computed_quantities[i](1) = inputs.solution_hessians[i][0].norm(); // norm of x hessian
     }
 }
 

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.