]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Updating tests for the point_value_history class
authorrapson <rapson@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 7 Aug 2012 21:47:41 +0000 (21:47 +0000)
committerrapson <rapson@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 7 Aug 2012 21:47:41 +0000 (21:47 +0000)
Two new tests have been added, point_value_history_02 tests the added functionality for vector fields.
point_value_history_03 tests the added functionality for scala fields.
point_value_history_01 tests backwards compatibility of the class. Note that the .cc file is unchanged. The output has changed slightly due to the new format of data files and status output, hence cmp/generic is updated.

git-svn-id: https://svn.dealii.org/trunk@25764 0785d39b-7218-0410-832d-ea1e28bc413d

tests/deal.II/point_value_history_01.cc
tests/deal.II/point_value_history_01/cmp/generic
tests/deal.II/point_value_history_02.cc [new file with mode: 0644]
tests/deal.II/point_value_history_02/cmp/generic [new file with mode: 0644]
tests/deal.II/point_value_history_03.cc [new file with mode: 0644]
tests/deal.II/point_value_history_03/cmp/generic [new file with mode: 0644]

index d7c398ea818d5934be3326c50ec4ff49abb2f358..c4c241819c95a11524f16033f10edfe8881d9564 100644 (file)
@@ -83,8 +83,8 @@ void TestPointValueHistory<dim>::run()
     triangulation.refine_global(2); // refine 2 times to make 5 nodes per side
 
     // make a DOF handler, a model solution filled with ones and a flow vector
-    FESystem<dim> finite_element(FE_Q<dim > (1 + 1), dim, FE_Q<dim > (1), 1);
-    DoFHandler <dim > dof_handler(triangulation);
+    //    FESystem<dim> finite_element(FE_Q<dim > (1 + 1), dim, FE_Q<dim > (1), 1); // Already done!
+    //    DoFHandler <dim > dof_handler(triangulation);
     dof_handler.distribute_dofs(finite_element);
     DoFRenumbering::Cuthill_McKee(dof_handler);
 
@@ -187,9 +187,9 @@ void TestPointValueHistory<dim>::run()
 
         std::vector < std::vector <Point <dim> > > selected_locations;
         node_monitor.get_points(selected_locations);
-       // write output to a file
+        // write output to a file
         Vector<double> node_locations = node_monitor.mark_locations();
-       // write output to a file
+        // write output to a file
     }
 
     double delta_t = 0.000001;
@@ -219,39 +219,39 @@ void TestPointValueHistory<dim>::run()
 
     deallog << "Starting data files" << std::endl;
 
-                                    // copy all the data into deallog and
-                                    // delete those files
+                     // copy all the data into deallog and
+                     // delete those files
     const std::string filenames[]
       = { "point_value_history_01/node_00.gpl",
-         "point_value_history_01/node_01.gpl",
-         "point_value_history_01/node_02.gpl",
-         "point_value_history_01/node_03.gpl",
-         "point_value_history_01/node_04.gpl",
-         "point_value_history_01/node_05.gpl",
-         "point_value_history_01/node_indep.gpl",
-         "point_value_history_01/Test_Copy_00.gpl",
-         "point_value_history_01/Test_Copy_indep.gpl",
-         "point_value_history_01/no_dof_indep.gpl" };
+      "point_value_history_01/node_01.gpl",
+      "point_value_history_01/node_02.gpl",
+      "point_value_history_01/node_03.gpl",
+      "point_value_history_01/node_04.gpl",
+      "point_value_history_01/node_05.gpl",
+      "point_value_history_01/node_indep.gpl",
+      "point_value_history_01/Test_Copy_00.gpl",
+      "point_value_history_01/Test_Copy_indep.gpl",
+      "point_value_history_01/no_dof_indep.gpl" };
 
     for (unsigned int i=0; i<sizeof(filenames)/sizeof(filenames[0]); ++i)
-      {
-       deallog << "Copying output file " << filenames[i]
-               << std::endl;
+    {
+        deallog << "Copying output file " << filenames[i]
+            << std::endl;
 
-       std::ifstream in(filenames[i].c_str());
-       AssertThrow (in, ExcIO());
+        std::ifstream in(filenames[i].c_str());
+        AssertThrow (in, ExcIO());
 
-       std::string s;
-       while (in)
-         {
-           std::getline (in, s);
-           deallog << s << std::endl;
-         }
+        std::string s;
+        while (in)
+        {
+            std::getline (in, s);
+            deallog << s << std::endl;
+        }
 
-       std::remove (filenames[i].c_str());
+    std::remove (filenames[i].c_str());
 
-       deallog << std::endl;
-      }
+    deallog << std::endl;
+    }
 }
 
 
index 76e9c6c7e08627f6bd08935154afb23e170d755f..3698fc334d8841dc5d5ab8dd19ee142c35cb60f0 100644 (file)
@@ -3,6 +3,8 @@
 
 Closed: 1
 Cleared: 0
+Triangulation_changed: 0
+Have_dof_handler: 1
 Geometric Data
 # Requested location: 1.0 0.20
 # DoF_index : Support location (for each component)
@@ -12,7 +14,8 @@ Geometric Data
 
 
 Independent value(s): 1 : 1
-Solution: 3 : 1
+Mnemonic: data set size (mask size, n true components) : n data sets
+Solution: 3 (3, 3) : 1
 
 ***end of status output***
 
@@ -20,6 +23,8 @@ Solution: 3 : 1
 
 Closed: 1
 Cleared: 0
+Triangulation_changed: 0
+Have_dof_handler: 1
 Geometric Data
 # Requested location: 0.0 0.0
 # DoF_index : Support location (for each component)
@@ -59,8 +64,9 @@ Geometric Data
 
 
 Independent value(s): 1 : 10
-Post Processed Vector: 18 : 10
-Solution: 18 : 10
+Mnemonic: data set size (mask size, n true components) : n data sets
+Post Processed Vector: 18 (3, 3) : 10
+Solution: 18 (3, 3) : 10
 
 ***end of status output***
 
@@ -68,6 +74,8 @@ Solution: 18 : 10
 
 Closed: 1
 Cleared: 0
+Triangulation_changed: 0
+Have_dof_handler: 0
 Geometric Data
 No points stored currently
 
diff --git a/tests/deal.II/point_value_history_02.cc b/tests/deal.II/point_value_history_02.cc
new file mode 100644 (file)
index 0000000..272c171
--- /dev/null
@@ -0,0 +1,437 @@
+//----------------------------  point_value_history_02.cc  ---------------------------
+//    $Id: point_value_history_02.cc 23710 2011-05-17 04:50:10Z bangerth $
+//    Version: $Name$
+//
+//    Copyright (C) 2009, 2010 by the deal.II authors and Michael Rapson
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  point_value_history_02.cc  ---------------------------
+
+
+
+// ************************************************
+// A test program for the PointValueHistory class
+// Currently this only tests a finite element system
+// with 3 components, on a hyper cube and with Vectors.
+// The testing is done in two dimensions.
+// ************************************************
+
+
+
+#include "../tests.h"
+#include <deal.II/base/quadrature_lib.h>
+
+#include <deal.II/dofs/dof_handler.h>
+#include <deal.II/dofs/dof_accessor.h>
+#include <deal.II/dofs/dof_renumbering.h>
+#include <deal.II/dofs/dof_tools.h>
+
+#include <deal.II/numerics/data_out.h>
+
+#include <deal.II/fe/fe_q.h>
+#include <deal.II/fe/fe_system.h>
+#include <deal.II/fe/fe_values.h>
+
+#include <deal.II/grid/tria.h>
+#include <deal.II/grid/tria_accessor.h>
+#include <deal.II/grid/tria_iterator.h>
+#include <deal.II/grid/grid_generator.h>
+
+#include <deal.II/lac/vector.h>
+#include <deal.II/lac/block_vector.h>
+
+#include <deal.II/numerics/point_value_history.h>
+
+#include <fstream>
+
+using namespace dealii;
+
+
+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;
+     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>
+std::vector<std::string>
+Postprocess<dim>::get_names() const
+{
+   std::vector<std::string> names;
+   names.push_back ("Vector_out");
+   names.push_back ("Vector_out_1");
+   names.push_back ("Vector_out_2");
+   names.push_back ("Scalar_out");
+   return names;
+}
+template <int dim>
+UpdateFlags
+Postprocess<dim>::get_needed_update_flags () const
+{
+   return update_values | update_gradients | update_hessians;
+}
+template <int dim>
+unsigned int
+Postprocess<dim>::n_output_variables () const
+{
+   return 4;
+}
+template <int dim>
+void
+Postprocess<dim>::compute_derived_quantities_vector (
+   const std::vector< Vector< double > >                 & uh,
+   const std::vector< std::vector< Tensor< 1, dim > > >  & duh,
+   const std::vector< std::vector< Tensor< 2, dim > > >  & dduh,
+   const std::vector< Point< dim > >                     & /* normals */,
+   const std::vector< Point< dim > >                     & /* locations */,
+   std::vector< Vector< double > >                       & computed_quantities
+ ) const
+{
+   Assert(computed_quantities.size() == uh.size(), 
+          ExcDimensionMismatch (computed_quantities.size(), uh.size()));
+   for (unsigned int i=0; i<computed_quantities.size(); i++)
+   {
+       Assert(computed_quantities[i].size() == 4, 
+             ExcDimensionMismatch (computed_quantities[i].size(), 3));
+       Assert(uh[i].size() == dim + 1, ExcDimensionMismatch (uh[i].size(), dim + 1));
+       computed_quantities[i](0) = duh[i][0].norm(); // norm of x gradient
+       computed_quantities[i](1) = dduh[i][1].norm(); // norm of y hessian
+       computed_quantities[i](2) = duh[i][0].norm() + dduh[i][1].norm(); // norm of y hessian
+       computed_quantities[i](3) = uh[i].l2_norm();
+   }
+}
+
+
+
+template <int dim>
+class TestPointValueHistory
+{
+public:
+    TestPointValueHistory();
+    void run();
+
+private:
+    void output_results (unsigned int step, Vector <double> solution) const;
+
+    Triangulation <dim> triangulation;
+    FESystem<dim> finite_element;
+    DoFHandler <dim > dof_handler;
+    PointValueHistory <dim> test_copy;
+    std::vector <Point <dim> > postprocessor_locations;
+};
+
+
+
+
+template <int dim>
+TestPointValueHistory<dim>::TestPointValueHistory() :
+finite_element(FE_Q<dim > (1 + 1), dim, FE_Q<dim > (1), 1),
+
+dof_handler(triangulation)
+{ }
+
+
+
+
+template <int dim>
+void TestPointValueHistory<dim>::run()
+{
+    // Make a triangulation
+    GridGenerator::hyper_cube(triangulation, 0, 1);
+    triangulation.refine_global(2); // refine 2 times to make 5 nodes per side
+
+    // make a DOF handler, a model solution filled with ones and a flow vector
+//    FESystem<dim> finite_element(FE_Q<dim > (1 + 1), dim, FE_Q<dim > (1), 1);
+//    DoFHandler <dim > dof_handler(triangulation);
+    dof_handler.distribute_dofs(finite_element);
+    DoFRenumbering::Cuthill_McKee(dof_handler);
+
+    // renumber for components so that same dof indices are used for BlockVectors and normal Vectors
+    std::vector<unsigned int> block_component(dim + 1, 0);
+    block_component[dim] = 1; // component dim = pressure component!
+    DoFRenumbering::component_wise(dof_handler, block_component);
+
+    // Vector
+    Vector <double> solution, post_processed, poles;
+    solution.reinit(dof_handler.n_dofs());
+    post_processed.reinit(dof_handler.n_dofs());
+    poles.reinit(dof_handler.n_dofs());
+    
+//            // BlockVector
+//        std::vector<unsigned int> dofs_per_block(2);
+//        DoFTools::count_dofs_per_block(dof_handler, dofs_per_block, block_component);
+//        const unsigned int n_u = dofs_per_block[0],
+//                n_p = dofs_per_block[1];
+//        BlockVector<double> solution;
+//        solution.reinit(2);
+//        solution.block(0).reinit(n_u);
+//        solution.block(1).reinit(n_p);
+//        solution.collect_sizes();
+// 
+//        BlockVector<double> post_processed;
+//        post_processed.reinit(2);
+//        post_processed.block(0).reinit(n_u);
+//        post_processed.block(1).reinit(n_p);
+//        post_processed.collect_sizes();
+//        BlockVector<double> poles;
+//        poles.reinit(2);
+//        poles.block(0).reinit(n_u);
+//        poles.block(1).reinit(n_p);
+//        poles.collect_sizes();
+
+    // set up a simple linear discrete time system so that time plots vary
+    // over the mesh but can be easily checked. The basic idea is to have each
+    // component of the fe_system to depend on a specific dimension (i.e component 0
+    // depends on dim 0, etc. % dim handles the case where there are more components
+    // than dimensions. The code breaks down at the edges of the mesh and this is
+    // not corrected for. The code used in this test simplified from point_value_history_01.
+    {
+        Quadrature<dim> quadrature_formula(finite_element.get_unit_support_points ());
+        FEValues<dim> fe_values(finite_element, quadrature_formula, update_values | update_quadrature_points); // just need local_dof_indices and quadrature_points
+
+        std::vector<unsigned int> local_dof_indices(finite_element.dofs_per_cell);
+        std::vector<Point<dim> > dof_locations(finite_element.dofs_per_cell);
+
+        typename DoFHandler<dim>::active_cell_iterator cell, endc;
+        cell = dof_handler.begin_active();
+        endc = dof_handler.end();
+        for (; cell != endc; ++cell)
+        {
+            fe_values.reinit(cell); // need to get local_dof_indices
+            cell->get_dof_indices(local_dof_indices);
+            dof_locations = fe_values.get_quadrature_points();
+
+            for (unsigned int dof = 0; dof != finite_element.dofs_per_cell; dof++)
+            {
+                unsigned int dof_component = finite_element.system_to_component_index(dof).first;
+
+                poles(local_dof_indices[dof]) = -dof_locations[dof](dof_component % dim);
+
+                if (dof_component == dim) // components start numbering at 0
+                    poles(local_dof_indices[dof]) = -0.1; // dim+1th component is not handled well by the code above
+
+                solution(local_dof_indices [dof]) = 1; // start all solutions at 1
+            }
+
+        } // loop over all cells
+        poles.add(1.0); // slow down the pole settling time
+        post_processed.add(3.0); // set to starting value.
+//         output_results(10, poles);
+    }
+
+    // Setup monitor node to print variation over time
+    unsigned int n_inputs = 1;
+    PointValueHistory<dim> node_monitor (dof_handler, n_inputs);
+    PointValueHistory<dim> no_dof_handler (n_inputs);
+
+    // check that the assignment operator is valid
+    test_copy = node_monitor;
+    test_copy.add_point(Point<2>(1, 0.2));
+    test_copy.add_field_name("Solution");
+    std::vector < std::vector <Point <dim> > > selected_locations;
+    test_copy.get_support_locations(selected_locations);
+    test_copy.mark_support_locations();
+    test_copy.close();
+    test_copy.start_new_dataset(0.1);
+//    triangulation.refine_global(1); // should mark the triangulation as changed
+    test_copy.evaluate_field("Solution", solution);
+    std::vector <double> input_value(n_inputs, 1);
+    test_copy.push_back_independent(input_value);
+    test_copy.write_gnuplot("point_value_history_02/Test_Copy");
+    test_copy.status(deallog.get_file_stream());
+    test_copy.clear ();
+    // end of assignment operator check
+
+    {
+        node_monitor.add_field_name("Solution");
+        std::vector <std::string> solution_names;
+        solution_names.push_back("X velocity");
+        solution_names.push_back("Y velocity");
+        solution_names.push_back("Z velocity");
+        node_monitor.add_component_names ("Solution", solution_names);
+        node_monitor.add_field_name("Post Processed Vector"); // not sensitive to spaces
+        std::vector <bool> component_mask (3, false);
+        component_mask[2] = true;    
+        node_monitor.add_field_name("Pressure", component_mask);
+        component_mask = std::vector <bool> (3, false);
+        component_mask[1] = true;
+        node_monitor.add_field_name("Req_sol", component_mask);
+        component_mask = std::vector <bool> (4, true);
+        component_mask[3] = false;
+        node_monitor.add_field_name("Vector_out", component_mask);
+        component_mask = std::vector <bool> (4, false);
+        component_mask[3] = true;
+        node_monitor.add_field_name("Scalar_out", component_mask);
+
+        std::vector <std::string> indep_names;
+        indep_names.push_back ("Input");
+        node_monitor.add_independent_names(indep_names);
+
+        // two alternatives here, adding a point at a time or a vector of points
+        // 2d points
+        std::vector <Point < 2 > > point_vector(5, Point < 2 > ());
+        point_vector[0] = Point < 2 > (0, 0); // some of these points will hit a node, others won't
+        point_vector[1] = Point < 2 > (0.25, 0);
+        point_vector[2] = Point < 2 > (0.25, 0.45);
+        point_vector[3] = Point < 2 > (0.45, 0.45);
+        point_vector[4] = Point < 2 > (0.8, 0.8);
+
+        node_monitor.add_points(point_vector);
+        node_monitor.add_point(Point<2>(1, 0.2)); // add a single point
+
+        // MonitorNode requires that the instance is 'closed' before any data is added
+        // this ensures that points are not added once time starts.
+        node_monitor.close();
+        no_dof_handler.close(); // closing still required!
+
+        std::vector < std::vector <Point <dim> > > selected_locations;
+        node_monitor.get_support_locations(selected_locations);
+        Vector<double> node_locations = node_monitor.mark_support_locations();
+        QGauss<dim> postprocess_quadrature (2);
+        node_monitor.get_postprocessor_locations(postprocess_quadrature, postprocessor_locations);
+    }
+
+    double delta_t = 0.000001;
+    double t_max = 0.00001;
+    unsigned int step = 0;
+
+    for (double time = 0; time < t_max; time = time + delta_t)
+    {
+        node_monitor.start_new_dataset(time);
+        no_dof_handler.start_new_dataset(time);
+        // time and input are special, they don't vary over the mesh.
+
+        std::vector <double> input_value(n_inputs, 1); // manufacture an input value
+        node_monitor.push_back_independent(input_value);
+        no_dof_handler.push_back_independent(input_value);
+        node_monitor.evaluate_field("Solution", solution);
+        node_monitor.evaluate_field("Post Processed Vector", post_processed);
+        node_monitor.evaluate_field("Pressure", solution);
+        node_monitor.evaluate_field_at_requested_location("Req_sol", solution);
+
+        Postprocess<dim> postprocessor;
+        QGauss<dim> postprocess_quadrature (2);
+        std::vector<std::string> names;
+        names.push_back ("Vector_out");
+        names.push_back ("Scalar_out");
+        node_monitor.evaluate_field(names, solution, postprocessor, postprocess_quadrature);
+//         output_results (step, solution);
+        step++;
+
+        solution.scale(poles); // decaying exponentials of varying time constants
+        post_processed = solution;
+        post_processed.add(2.0); // simple post processing, giving it a dc offset
+    }
+    triangulation.refine_global(1); // should mark the triangulation as changed
+    node_monitor.write_gnuplot("point_value_history_02/node", postprocessor_locations);
+    no_dof_handler.write_gnuplot("point_value_history_02/no_dof");
+
+    node_monitor.status (deallog.get_file_stream());
+    no_dof_handler.status (deallog.get_file_stream());
+
+    deallog << "Starting data files" << std::endl;
+
+                     // copy all the data into deallog and
+                     // delete those files
+    const std::string filenames[]
+      = { "point_value_history_02/node_00.gpl",
+      "point_value_history_02/node_01.gpl",
+      "point_value_history_02/node_02.gpl",
+      "point_value_history_02/node_03.gpl",
+      "point_value_history_02/node_04.gpl",
+      "point_value_history_02/node_05.gpl",
+      "point_value_history_02/node_indep.gpl",
+      "point_value_history_02/Test_Copy_00.gpl",
+      "point_value_history_02/Test_Copy_indep.gpl",
+      "point_value_history_02/no_dof_indep.gpl" };
+
+    for (unsigned int i=0; i<sizeof(filenames)/sizeof(filenames[0]); ++i)
+    {
+        deallog << "Copying output file " << filenames[i]
+            << std::endl;
+
+        std::ifstream in(filenames[i].c_str());
+        AssertThrow (in, ExcIO());
+
+        std::string s;
+        while (in)
+        {
+            std::getline (in, s);
+            deallog << s << std::endl;
+        }
+
+        std::remove (filenames[i].c_str());
+
+        deallog << std::endl;
+    }
+}
+
+template <int dim>
+void TestPointValueHistory<dim>::output_results (unsigned int step, Vector <double> solution)  const
+{
+    std::vector<std::string> solution_names (dim, "velocity");
+    solution_names.push_back ("pressure");
+
+    std::vector<DataComponentInterpretation::DataComponentInterpretation>
+    data_component_interpretation
+     (dim, DataComponentInterpretation::component_is_part_of_vector);
+    data_component_interpretation
+     .push_back (DataComponentInterpretation::component_is_scalar);
+
+    DataOut<dim> data_out;
+    data_out.attach_dof_handler (dof_handler);
+    data_out.add_data_vector (solution, solution_names,
+                               DataOut<dim>::type_dof_data,
+                               data_component_interpretation);
+    data_out.build_patches (2);
+    std::ostringstream filename;
+    filename << "point_value_history_02/solution-"
+              << Utilities::int_to_string (step, 2)
+              << ".gpl";
+    std::ofstream output (filename.str().c_str());
+    data_out.write_gnuplot (output);
+}
+
+
+
+int main()
+{
+    std::ofstream logfile("point_value_history_02/output");
+    logfile << std::setprecision(2);
+    deallog << std::setprecision(2);
+    deallog.attach(logfile);
+    deallog.depth_console(0);
+    deallog.threshold_double(1.e-10);
+
+    TestPointValueHistory<2> test;
+    test.run();
+}
diff --git a/tests/deal.II/point_value_history_02/cmp/generic b/tests/deal.II/point_value_history_02/cmp/generic
new file mode 100644 (file)
index 0000000..5555f1d
--- /dev/null
@@ -0,0 +1,271 @@
+
+***PointValueHistory status output***
+
+Closed: 1
+Cleared: 0
+Triangulation_changed: 0
+Have_dof_handler: 1
+Geometric Data
+# Requested location: 1.0 0.20
+# DoF_index : Support location (for each component)
+138 : 1.0 0.25
+139 : 1.0 0.25
+181 : 1.0 0.25
+
+
+Independent value(s): 1 : 1
+Mnemonic: data set size (mask size, n true components) : n data sets
+Solution: 3 (3, 3) : 1
+
+***end of status output***
+
+***PointValueHistory status output***
+
+Closed: 1
+Cleared: 0
+Triangulation_changed: 1
+Have_dof_handler: 1
+Geometric Data
+# Requested location: 0.0 0.0
+# DoF_index : Support location (for each component)
+0 : 0.0 0.0
+1 : 0.0 0.0
+162 : 0.0 0.0
+
+# Requested location: 0.25 0.0
+# DoF_index : Support location (for each component)
+8 : 0.25 0.0
+9 : 0.25 0.0
+163 : 0.25 0.0
+
+# Requested location: 0.25 0.45
+# DoF_index : Support location (for each component)
+46 : 0.25 0.50
+47 : 0.25 0.50
+169 : 0.25 0.50
+
+# Requested location: 0.45 0.45
+# DoF_index : Support location (for each component)
+48 : 0.50 0.50
+49 : 0.50 0.50
+170 : 0.50 0.50
+
+# Requested location: 0.80 0.80
+# DoF_index : Support location (for each component)
+96 : 0.75 0.75
+97 : 0.75 0.75
+177 : 0.75 0.75
+
+# Requested location: 1.0 0.20
+# DoF_index : Support location (for each component)
+138 : 1.0 0.25
+139 : 1.0 0.25
+181 : 1.0 0.25
+
+
+Independent value(s): 1 : 10
+Names: <Input> 
+Mnemonic: data set size (mask size, n true components) : n data sets
+Post Processed Vector: 18 (3, 3) : 10
+Pressure: 6 (3, 1) : 10
+Req_sol: 6 (3, 1) : 10
+Scalar_out: 6 (4, 1) : 10
+Solution: 18 (3, 3) : 10
+<X velocity> <Y velocity> <Z velocity> 
+Vector_out: 18 (4, 3) : 10
+
+***end of status output***
+
+***PointValueHistory status output***
+
+Closed: 1
+Cleared: 0
+Triangulation_changed: 0
+Have_dof_handler: 0
+Geometric Data
+No points stored currently
+
+Independent value(s): 1 : 10
+
+***end of status output***
+
+DEAL::Starting data files
+DEAL::Copying output file point_value_history_02/node_00.gpl
+DEAL::# Requested location: 0 0
+DEAL::# DoF_index : Support location (for each component)
+DEAL::# 0 : 0 0
+DEAL::# 1 : 0 0
+DEAL::# 162 : 0 0
+DEAL::# (Original components and locations, may be invalidated by mesh change.)
+DEAL::# Postprocessor location: 0.0528312 0.0528312 (may be approximate)
+DEAL::#
+DEAL::# <Key> <Input> <Post Processed Vector_0> <Post Processed Vector_1> <Post Processed Vector_2> <Pressure_0> <Req_sol_0> <Scalar_out_0> <X velocity> <Y velocity> <Z velocity> <Vector_out_0> <Vector_out_1> <Vector_out_2> 
+DEAL::0 1 3 3 3 1 1 1.73205 1 1 1 0 1.19736e-08 1.19736e-08
+DEAL::1e-06 1 3 3 2.9 0.9 1 1.61377 1 1 0.9 1 1.16159e-08 1
+DEAL::2e-06 1 3 3 2.81 0.81 1 1.50525 1 1 0.81 1.89434 2 3.89434
+DEAL::3e-06 1 3 3 2.729 0.729 1 1.40644 1 1 0.729 2.69139 5.25 7.94139
+DEAL::4e-06 1 3 3 2.6561 0.6561 1 1.31707 1 1 0.6561 3.39968 9.21875 12.6184
+DEAL::5e-06 1 3 3 2.59049 0.59049 1 1.23666 1 1 0.59049 4.0276 13.5352 17.5628
+DEAL::6e-06 1 3 3 2.53144 0.531441 1 1.16468 1 1 0.531441 4.58314 17.9448 22.528
+DEAL::7e-06 1 3 3 2.4783 0.478297 1 1.10053 1 1 0.478297 5.07383 22.2779 27.3517
+DEAL::8e-06 1 3 3 2.43047 0.430467 1 1.04356 1 1 0.430467 5.50663 26.4253 31.9319
+DEAL::9e-06 1 3 3 2.38742 0.38742 1 0.99314 1 1 0.38742 5.88791 30.3212 36.2091
+DEAL::
+DEAL::
+DEAL::Copying output file point_value_history_02/node_01.gpl
+DEAL::# Requested location: 0.25 0
+DEAL::# DoF_index : Support location (for each component)
+DEAL::# 8 : 0.25 0
+DEAL::# 9 : 0.25 0
+DEAL::# 163 : 0.25 0
+DEAL::# (Original components and locations, may be invalidated by mesh change.)
+DEAL::# Postprocessor location: 0.197169 0.0528312 (may be approximate)
+DEAL::#
+DEAL::# <Key> <Input> <Post Processed Vector_0> <Post Processed Vector_1> <Post Processed Vector_2> <Pressure_0> <Req_sol_0> <Scalar_out_0> <X velocity> <Y velocity> <Z velocity> <Vector_out_0> <Vector_out_1> <Vector_out_2> 
+DEAL::0 1 3 3 3 1 1 1.73205 1 1 1 0 9.00988e-09 9.00988e-09
+DEAL::1e-06 1 2.75 3 2.9 0.9 1 1.53351 0.75 1 0.9 1 8.79108e-09 1
+DEAL::2e-06 1 2.5625 3 2.81 0.81 1 1.36981 0.5625 1 0.81 1.60566 2 3.60566
+DEAL::3e-06 1 2.42188 3 2.729 0.729 1 1.23359 0.421875 1 0.729 1.93361 5.25 7.18361
+DEAL::4e-06 1 2.31641 3 2.6561 0.6561 1 1.11938 0.316406 1 0.6561 2.06907 9.21875 11.2878
+DEAL::5e-06 1 2.2373 3 2.59049 0.59049 1 1.02303 0.237305 1 0.59049 2.07397 13.5352 15.6091
+DEAL::6e-06 1 2.17798 3 2.53144 0.531441 1 0.941352 0.177979 1 0.531441 1.99303 17.9448 19.9379
+DEAL::7e-06 1 2.13348 3 2.4783 0.478297 1 0.871889 0.133484 1 0.478297 1.8583 22.2779 24.1362
+DEAL::8e-06 1 2.10011 3 2.43047 0.430467 1 0.812685 0.100113 1 0.430467 1.69247 26.4253 28.1178
+DEAL::9e-06 1 2.07508 3 2.38742 0.38742 1 0.762164 0.0750847 1 0.38742 1.51142 30.3212 31.8326
+DEAL::
+DEAL::
+DEAL::Copying output file point_value_history_02/node_02.gpl
+DEAL::# Requested location: 0.25 0.45
+DEAL::# DoF_index : Support location (for each component)
+DEAL::# 46 : 0.25 0.5
+DEAL::# 47 : 0.25 0.5
+DEAL::# 169 : 0.25 0.5
+DEAL::# (Original components and locations, may be invalidated by mesh change.)
+DEAL::# Postprocessor location: 0.197169 0.447169 (may be approximate)
+DEAL::#
+DEAL::# <Key> <Input> <Post Processed Vector_0> <Post Processed Vector_1> <Post Processed Vector_2> <Pressure_0> <Req_sol_0> <Scalar_out_0> <X velocity> <Y velocity> <Z velocity> <Vector_out_0> <Vector_out_1> <Vector_out_2> 
+DEAL::0 1 3 3 3 1 1 1.73205 1 1 1 8.88178e-16 4.35771e-09 4.35771e-09
+DEAL::1e-06 1 2.75 2.5 2.9 0.9 0.55 1.32671 0.75 0.5 0.9 1 2.51837e-09 1
+DEAL::2e-06 1 2.5625 2.25 2.81 0.81 0.3025 1.07932 0.5625 0.25 0.81 1.60566 2 3.60566
+DEAL::3e-06 1 2.42188 2.125 2.729 0.729 0.165625 0.90924 0.421875 0.125 0.729 1.93361 3.75 5.68361
+DEAL::4e-06 1 2.31641 2.0625 2.6561 0.6561 0.0896875 0.780577 0.316406 0.0625 0.6561 2.06907 4.71875 6.78782
+DEAL::5e-06 1 2.2373 2.03125 2.59049 0.59049 0.0475586 0.677229 0.237305 0.03125 0.59049 2.07397 4.98047 7.05443
+DEAL::6e-06 1 2.17798 2.01562 2.53144 0.531441 0.0242896 0.591391 0.177979 0.015625 0.531441 1.99303 4.76123 6.75426
+DEAL::7e-06 1 2.13348 2.00781 2.4783 0.478297 0.0115738 0.51879 0.133484 0.0078125 0.478297 1.8583 4.2746 6.13289
+DEAL::8e-06 1 2.10011 2.00391 2.43047 0.430467 0.00476261 0.45676 0.100113 0.00390625 0.430467 1.69247 3.67699 5.36946
+DEAL::9e-06 1 2.07508 2.00195 2.38742 0.38742 0.00124056 0.40346 0.0750847 0.00195312 0.38742 1.51142 3.06777 4.57919
+DEAL::
+DEAL::
+DEAL::Copying output file point_value_history_02/node_03.gpl
+DEAL::# Requested location: 0.45 0.45
+DEAL::# DoF_index : Support location (for each component)
+DEAL::# 48 : 0.5 0.5
+DEAL::# 49 : 0.5 0.5
+DEAL::# 170 : 0.5 0.5
+DEAL::# (Original components and locations, may be invalidated by mesh change.)
+DEAL::# Postprocessor location: 0.447169 0.447169 (may be approximate)
+DEAL::#
+DEAL::# <Key> <Input> <Post Processed Vector_0> <Post Processed Vector_1> <Post Processed Vector_2> <Pressure_0> <Req_sol_0> <Scalar_out_0> <X velocity> <Y velocity> <Z velocity> <Vector_out_0> <Vector_out_1> <Vector_out_2> 
+DEAL::0 1 3 3 3 1 1 1.73205 1 1 1 8.88178e-16 4.35771e-09 4.35771e-09
+DEAL::1e-06 1 2.5 2.5 2.9 0.9 0.55 1.19216 0.5 0.5 0.9 1 2.51837e-09 1
+DEAL::2e-06 1 2.25 2.25 2.81 0.81 0.3025 0.918101 0.25 0.25 0.81 1.10566 2 3.10566
+DEAL::3e-06 1 2.125 2.125 2.729 0.729 0.165625 0.766829 0.125 0.125 0.729 0.916867 3.75 4.66687
+DEAL::4e-06 1 2.0625 2.0625 2.6561 0.6561 0.0896875 0.668761 0.0625 0.0625 0.6561 0.675079 4.71875 5.39383
+DEAL::5e-06 1 2.03125 2.03125 2.59049 0.59049 0.0475586 0.594518 0.03125 0.03125 0.59049 0.464784 4.98047 5.44525
+DEAL::6e-06 1 2.01562 2.01562 2.53144 0.531441 0.0242896 0.532629 0.015625 0.015625 0.531441 0.305802 4.76123 5.06703
+DEAL::7e-06 1 2.00781 2.00781 2.4783 0.478297 0.0115738 0.478603 0.0078125 0.0078125 0.478297 0.194193 4.2746 4.46879
+DEAL::8e-06 1 2.00391 2.00391 2.43047 0.430467 0.00476261 0.430527 0.00390625 0.00390625 0.430467 0.119462 3.67699 3.79646
+DEAL::9e-06 1 2.00195 2.00195 2.38742 0.38742 0.00124056 0.387426 0.00195312 0.00195312 0.38742 0.0711287 3.06777 3.1389
+DEAL::
+DEAL::
+DEAL::Copying output file point_value_history_02/node_04.gpl
+DEAL::# Requested location: 0.8 0.8
+DEAL::# DoF_index : Support location (for each component)
+DEAL::# 96 : 0.75 0.75
+DEAL::# 97 : 0.75 0.75
+DEAL::# 177 : 0.75 0.75
+DEAL::# (Original components and locations, may be invalidated by mesh change.)
+DEAL::# Postprocessor location: 0.802831 0.802831 (may be approximate)
+DEAL::#
+DEAL::# <Key> <Input> <Post Processed Vector_0> <Post Processed Vector_1> <Post Processed Vector_2> <Pressure_0> <Req_sol_0> <Scalar_out_0> <X velocity> <Y velocity> <Z velocity> <Vector_out_0> <Vector_out_1> <Vector_out_2> 
+DEAL::0 1 3 3 3 1 1 1.73205 1 1 1 0 1.19736e-08 1.19736e-08
+DEAL::1e-06 1 2.25 2.25 2.9 0.9 0.2 0.942205 0.25 0.25 0.9 1 2.64669e-09 1
+DEAL::2e-06 1 2.0625 2.0625 2.81 0.81 0.04 0.811864 0.0625 0.0625 0.81 0.394338 2 2.39434
+DEAL::3e-06 1 2.01562 2.01562 2.729 0.729 0.00875 0.729097 0.015625 0.015625 0.729 0.116627 0.75 0.866627
+DEAL::4e-06 1 2.00391 2.00391 2.6561 0.6561 0.00203125 0.656106 0.00390625 0.00390625 0.6561 0.0314119 0.21875 0.250162
+DEAL::5e-06 1 2.00098 2.00098 2.59049 0.59049 0.000488281 0.59049 0.000976562 0.000976562 0.59049 0.00813489 0.0585937 0.0667286
+DEAL::6e-06 1 2.00024 2.00024 2.53144 0.531441 0.000119629 0.531441 0.000244141 0.000244141 0.531441 0.00206896 0.0151367 0.0172057
+DEAL::7e-06 1 2.00006 2.00006 2.4783 0.478297 2.96021e-05 0.478297 6.10352e-05 6.10352e-05 0.478297 0.000521645 0.00384521 0.00436686
+DEAL::8e-06 1 2.00002 2.00002 2.43047 0.430467 7.36237e-06 0.430467 1.52588e-05 1.52588e-05 0.430467 0.000130962 0.000968933 0.00109989
+DEAL::9e-06 1 2 2 2.38742 0.38742 1.83582e-06 0.38742 3.8147e-06 3.8147e-06 0.38742 3.28093e-05 0.000243187 0.000275996
+DEAL::
+DEAL::
+DEAL::Copying output file point_value_history_02/node_05.gpl
+DEAL::# Requested location: 1 0.2
+DEAL::# DoF_index : Support location (for each component)
+DEAL::# 138 : 1 0.25
+DEAL::# 139 : 1 0.25
+DEAL::# 181 : 1 0.25
+DEAL::# (Original components and locations, may be invalidated by mesh change.)
+DEAL::# Postprocessor location: 0.947169 0.197169 (may be approximate)
+DEAL::#
+DEAL::# <Key> <Input> <Post Processed Vector_0> <Post Processed Vector_1> <Post Processed Vector_2> <Pressure_0> <Req_sol_0> <Scalar_out_0> <X velocity> <Y velocity> <Z velocity> <Vector_out_0> <Vector_out_1> <Vector_out_2> 
+DEAL::0 1 3 3 3 1 1 1.73205 1 1 1 8.88178e-16 4.35771e-09 4.35771e-09
+DEAL::1e-06 1 2 2.75 2.9 0.9 0.8 1.2072 0 0.75 0.9 1 3.606e-09 1
+DEAL::2e-06 1 2 2.5625 2.81 0.81 0.64 1.03515 0 0.5625 0.81 0.105662 2 2.10566
+DEAL::3e-06 1 2 2.42188 2.729 0.729 0.51125 0.893546 0 0.421875 0.729 0.00837341 5.25 5.25837
+DEAL::4e-06 1 2 2.31641 2.6561 0.6561 0.407031 0.775187 0 0.316406 0.6561 0.000161921 9.21875 9.21891
+DEAL::5e-06 1 2 2.2373 2.59049 0.59049 0.322168 0.675465 0 0.237305 0.59049 0.00032239 13.5352 13.5355
+DEAL::6e-06 1 2 2.17798 2.53144 0.531441 0.252659 0.590857 0 0.177979 0.531441 0.000115836 17.9448 17.9449
+DEAL::7e-06 1 2 2.13348 2.4783 0.478297 0.195398 0.518648 0 0.133484 0.478297 3.33639e-05 22.2779 22.2779
+DEAL::8e-06 1 2 2.10011 2.43047 0.430467 0.147964 0.456732 0 0.100113 0.430467 8.89157e-06 26.4253 26.4253
+DEAL::9e-06 1 2 2.07508 2.38742 0.38742 0.108462 0.403457 0 0.0750847 0.38742 2.29172e-06 30.3212 30.3212
+DEAL::
+DEAL::
+DEAL::Copying output file point_value_history_02/node_indep.gpl
+DEAL::# Data independent of mesh location
+DEAL::# <Key> <Input> 
+DEAL::0 1
+DEAL::1e-06 1
+DEAL::2e-06 1
+DEAL::3e-06 1
+DEAL::4e-06 1
+DEAL::5e-06 1
+DEAL::6e-06 1
+DEAL::7e-06 1
+DEAL::8e-06 1
+DEAL::9e-06 1
+DEAL::
+DEAL::
+DEAL::Copying output file point_value_history_02/Test_Copy_00.gpl
+DEAL::# Requested location: 1 0.2
+DEAL::# DoF_index : Support location (for each component)
+DEAL::# 138 : 1 0.25
+DEAL::# 139 : 1 0.25
+DEAL::# 181 : 1 0.25
+DEAL::#
+DEAL::# <Key> <Indep_0> <Solution_0> <Solution_1> <Solution_2> 
+DEAL::0.1 1 1 1 1
+DEAL::
+DEAL::
+DEAL::Copying output file point_value_history_02/Test_Copy_indep.gpl
+DEAL::# Data independent of mesh location
+DEAL::# <Key> <Indep_0> 
+DEAL::0.1 1
+DEAL::
+DEAL::
+DEAL::Copying output file point_value_history_02/no_dof_indep.gpl
+DEAL::# Data independent of mesh location
+DEAL::# <Key> <Indep_0> 
+DEAL::0 1
+DEAL::1e-06 1
+DEAL::2e-06 1
+DEAL::3e-06 1
+DEAL::4e-06 1
+DEAL::5e-06 1
+DEAL::6e-06 1
+DEAL::7e-06 1
+DEAL::8e-06 1
+DEAL::9e-06 1
+DEAL::
+DEAL::
diff --git a/tests/deal.II/point_value_history_03.cc b/tests/deal.II/point_value_history_03.cc
new file mode 100644 (file)
index 0000000..040dcda
--- /dev/null
@@ -0,0 +1,391 @@
+//----------------------------  point_value_history_03.cc  ---------------------------
+//    $Id: point_value_history_03.cc 23710 2011-05-17 04:50:10Z bangerth $
+//    Version: $Name$
+//
+//    Copyright (C) 2009, 2010 by the deal.II authors and Michael Rapson
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  point_value_history_03.cc  ---------------------------
+
+
+
+// ************************************************
+// A test program for the PointValueHistory class
+// Currently this only tests a finite element system
+// with 3 components, on a hyper cube and with Vectors.
+// The testing is done in two dimensions.
+// ************************************************
+
+
+
+#include "../tests.h"
+#include <deal.II/base/quadrature_lib.h>
+
+#include <deal.II/dofs/dof_handler.h>
+#include <deal.II/dofs/dof_accessor.h>
+#include <deal.II/dofs/dof_renumbering.h>
+#include <deal.II/dofs/dof_tools.h>
+
+#include <deal.II/numerics/data_out.h>
+
+#include <deal.II/fe/fe_q.h>
+#include <deal.II/fe/fe_system.h>
+#include <deal.II/fe/fe_values.h>
+
+#include <deal.II/grid/tria.h>
+#include <deal.II/grid/tria_accessor.h>
+#include <deal.II/grid/tria_iterator.h>
+#include <deal.II/grid/grid_generator.h>
+
+#include <deal.II/lac/vector.h>
+#include <deal.II/lac/block_vector.h>
+
+#include <deal.II/numerics/point_value_history.h>
+
+#include <fstream>
+
+using namespace dealii;
+
+
+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;
+      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>
+std::vector<std::string>
+Postprocess<dim>::get_names() const
+{
+   std::vector<std::string> names;
+   names.push_back ("X_gradient");
+   names.push_back ("X_hessian");
+   return names;
+}
+template <int dim>
+UpdateFlags
+Postprocess<dim>::get_needed_update_flags () const
+{
+  return update_values | update_gradients | update_hessians;
+}
+template <int dim>
+unsigned int
+Postprocess<dim>::n_output_variables () const
+{
+   return 2;
+}
+ template <int dim>
+ void
+ Postprocess<dim>::compute_derived_quantities_scalar (
+    const std::vector< double >                 & uh,
+    const std::vector< Tensor< 1, dim > >  & duh,
+    const std::vector< Tensor< 2, dim > >  & dduh,
+    const std::vector< Point< dim > >                     & /* normals */,
+    const std::vector< Point< dim > >                     & /* locations */,
+    std::vector< Vector< double > >                       & computed_quantities
+ ) const
+{
+   Assert(computed_quantities.size() == uh.size(), 
+          ExcDimensionMismatch (computed_quantities.size(), uh.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) = duh[i][0]; // norm of x gradient
+       computed_quantities[i](1) = dduh[i][0].norm(); // norm of x hessian
+   }
+}
+
+
+
+template <int dim>
+class TestPointValueHistory
+{
+public:
+    TestPointValueHistory();
+    void run();
+
+private:
+    void output_results (unsigned int step, Vector <double> solution) const;
+
+    Triangulation <dim> triangulation;
+    FE_Q<dim> finite_element;
+    DoFHandler <dim > dof_handler;
+    PointValueHistory <dim> test_copy;
+    std::vector <Point <dim> > postprocessor_locations;
+};
+
+
+
+
+template <int dim>
+TestPointValueHistory<dim>::TestPointValueHistory() :
+    finite_element(2),
+    dof_handler(triangulation)
+{ }
+
+
+
+
+template <int dim>
+void TestPointValueHistory<dim>::run()
+{
+    // Make a triangulation
+    GridGenerator::hyper_cube(triangulation, 0, 1);
+    triangulation.refine_global(2); // refine 2 times to make 5 nodes per side
+
+    // make a DOF handler, a model solution filled with ones and a flow vector
+//    DoFHandler <dim > dof_handler(triangulation);
+    dof_handler.distribute_dofs(finite_element);
+    DoFRenumbering::Cuthill_McKee(dof_handler);
+
+    // Vector
+    Vector <double> solution, post_processed, poles;
+    solution.reinit(dof_handler.n_dofs());
+    post_processed.reinit(dof_handler.n_dofs());
+    poles.reinit(dof_handler.n_dofs());
+    
+//            // BlockVector
+          // BlockVector not used with scalar fields generally
+
+    // set up a simple linear discrete time system so that time plots vary
+    // over the mesh but can be easily checked. The basic idea is to have each
+    // component of the fe_system to depend on a specific dimension (i.e component 0
+    // depends on dim 0, etc. % dim handles the case where there are more components
+    // than dimensions. The code breaks down at the edges of the mesh and this is
+    // not corrected for. The code used in this test is simplified from point_value_history_01.
+    {
+        Quadrature<dim> quadrature_formula(finite_element.get_unit_support_points ());
+        FEValues<dim> fe_values(finite_element, quadrature_formula, update_values | update_quadrature_points); // just need local_dof_indices and quadrature_points
+
+        std::vector<unsigned int> local_dof_indices(finite_element.dofs_per_cell);
+        std::vector<Point<dim> > dof_locations(finite_element.dofs_per_cell);
+
+        typename DoFHandler<dim>::active_cell_iterator cell, endc;
+        cell = dof_handler.begin_active();
+        endc = dof_handler.end();
+        for (; cell != endc; ++cell)
+        {
+            fe_values.reinit(cell); // need to get local_dof_indices
+            cell->get_dof_indices(local_dof_indices);
+            dof_locations = fe_values.get_quadrature_points();
+
+            for (unsigned int dof = 0; dof != finite_element.dofs_per_cell; dof++)
+            {
+                unsigned int dof_component = finite_element.system_to_component_index(dof).first;
+                // The line above will always evaluate to 1, 
+                // simplifying the remaining lines
+
+                poles(local_dof_indices[dof]) = -dof_locations[dof](dof_component % dim);
+
+                if (dof_component == dim) // components start numbering at 0
+                    poles(local_dof_indices[dof]) = -0.1; // dim+1th component is not handled well by the code above
+
+                solution(local_dof_indices [dof]) = 1; // start all solutions at 1
+            }
+        } // loop over all cells
+        
+        poles.add(1.0); // slow down the pole settling time
+        post_processed.add(3.0); // set to starting value.
+//        output_results(10, poles);
+    }
+
+    // Setup monitor node to print variation over time
+    unsigned int n_inputs = 1;
+    PointValueHistory<dim> node_monitor (dof_handler, n_inputs);
+    PointValueHistory<dim> no_dof_handler (n_inputs);
+
+    // check that the assignment operator is valid
+    test_copy = node_monitor;
+    test_copy.add_point(Point<2>(1, 0.2));
+    test_copy.add_field_name("Solution");
+    std::vector < std::vector <Point <dim> > > selected_locations;
+    test_copy.get_support_locations(selected_locations);
+    test_copy.mark_support_locations();
+    test_copy.close();
+    test_copy.start_new_dataset(0.1);
+    test_copy.evaluate_field("Solution", solution);
+    std::vector <double> input_value(n_inputs, 1);
+    test_copy.push_back_independent(input_value);
+    test_copy.write_gnuplot("point_value_history_03/Test_Copy");
+    test_copy.status(deallog.get_file_stream());
+    test_copy.clear ();
+    // end of assignment operator check
+
+    {
+        node_monitor.add_field_name("Solution");
+        std::vector <std::string> solution_names;
+        solution_names.push_back("Solution");
+        node_monitor.add_component_names ("Solution", solution_names);
+        node_monitor.add_field_name("Post Processed Vector"); // not sensitive to spaces
+        node_monitor.add_field_name("Pressure", 1);
+        std::vector <bool> component_mask (1, true);
+        node_monitor.add_field_name("Req_sol", component_mask);
+        component_mask = std::vector <bool> (2, false);
+        component_mask[0] = true;
+        node_monitor.add_field_name("X_gradient", component_mask);
+        component_mask = std::vector <bool> (2, false);
+        component_mask[1] = true;
+        node_monitor.add_field_name("X_hessian", component_mask);
+        std::vector <std::string> indep_names;
+        indep_names.push_back ("Input");
+        node_monitor.add_independent_names(indep_names);
+
+        // two alternatives here, adding a point at a time or a vector of points
+        // 2d points
+        std::vector <Point < 2 > > point_vector(5, Point < 2 > ());
+        point_vector[0] = Point < 2 > (0, 0); // some of these points will hit a node, others won't
+        point_vector[1] = Point < 2 > (0.25, 0);
+        point_vector[2] = Point < 2 > (0.25, 0.45);
+        point_vector[3] = Point < 2 > (0.45, 0.45);
+        point_vector[4] = Point < 2 > (0.8, 0.8);
+
+        node_monitor.add_points(point_vector);
+        node_monitor.add_point(Point<2>(1, 0.2)); // add a single point
+
+        // MonitorNode requires that the instance is 'closed' before any data is added
+        // this ensures that points are not added once time starts.
+        node_monitor.close();
+        no_dof_handler.close(); // closing still required!
+
+        std::vector < std::vector <Point <dim> > > selected_locations;
+        node_monitor.get_support_locations(selected_locations);
+        Vector<double> node_locations = node_monitor.mark_support_locations();
+        QGauss<dim> postprocess_quadrature (2);
+        node_monitor.get_postprocessor_locations(postprocess_quadrature, postprocessor_locations);
+    }
+
+    double delta_t = 0.000001;
+    double t_max = 0.00001;
+    unsigned int step = 0;
+
+    for (double time = 0; time < t_max; time = time + delta_t)
+    {
+        node_monitor.start_new_dataset(time);
+        no_dof_handler.start_new_dataset(time);
+        // time and input are special, they don't vary over the mesh.
+
+        std::vector <double> input_value(n_inputs, 1); // manufacture an input value
+        node_monitor.push_back_independent(input_value);
+        no_dof_handler.push_back_independent(input_value);
+        node_monitor.evaluate_field("Solution", solution);
+        node_monitor.evaluate_field("Post Processed Vector", post_processed);
+        node_monitor.evaluate_field("Pressure", solution);
+        node_monitor.evaluate_field_at_requested_location("Req_sol", solution);
+
+        Postprocess<dim> postprocessor;
+        QGauss<dim> postprocess_quadrature (2);
+        std::vector<std::string> names;
+        names.push_back ("X_gradient");
+        names.push_back ("X_hessian");
+        node_monitor.evaluate_field(names, solution, postprocessor, postprocess_quadrature);
+
+//        output_results (step, solution);
+        step++;
+
+        solution.scale(poles); // decaying exponentials of varying time constants
+        post_processed = solution;
+        post_processed.add(2.0); // simple post processing, giving it a dc offset
+    }
+    node_monitor.write_gnuplot("point_value_history_03/node", postprocessor_locations);
+    no_dof_handler.write_gnuplot("point_value_history_03/no_dof"); // no point in adding postprocessor_locations
+
+    node_monitor.status (deallog.get_file_stream());
+    no_dof_handler.status (deallog.get_file_stream());
+
+    deallog << "Starting data files" << std::endl;
+
+                     // copy all the data into deallog and
+                     // delete those files
+    const std::string filenames[]
+      = { "point_value_history_03/node_00.gpl",
+      "point_value_history_03/node_01.gpl",
+      "point_value_history_03/node_02.gpl",
+      "point_value_history_03/node_03.gpl",
+      "point_value_history_03/node_04.gpl",
+      "point_value_history_03/node_05.gpl",
+      "point_value_history_03/node_indep.gpl",
+      "point_value_history_03/Test_Copy_00.gpl",
+      "point_value_history_03/Test_Copy_indep.gpl",
+      "point_value_history_03/no_dof_indep.gpl" };
+
+    for (unsigned int i=0; i<sizeof(filenames)/sizeof(filenames[0]); ++i)
+    {
+        deallog << "Copying output file " << filenames[i]
+            << std::endl;
+
+        std::ifstream in(filenames[i].c_str());
+        AssertThrow (in, ExcIO());
+
+        std::string s;
+        while (in)
+        {
+            std::getline (in, s);
+            deallog << s << std::endl;
+        }
+
+        std::remove (filenames[i].c_str());
+
+        deallog << std::endl;
+    }
+}
+
+template <int dim>
+void TestPointValueHistory<dim>::output_results (unsigned int step, Vector <double> solution)  const
+{
+    DataOut<dim> data_out;
+    data_out.attach_dof_handler (dof_handler);
+    data_out.add_data_vector (solution, "solution");
+  
+    data_out.build_patches (2);
+    std::ostringstream filename;
+    filename << "point_value_history_03/solution-"
+              << Utilities::int_to_string (step, 2)
+              << ".gpl";
+    std::ofstream output (filename.str().c_str());
+    data_out.write_gnuplot (output);
+}
+
+
+
+int main()
+{
+    std::ofstream logfile("point_value_history_03/output");
+    logfile << std::setprecision(2);
+    deallog << std::setprecision(2);
+    deallog.attach(logfile);
+    deallog.depth_console(0);
+    deallog.threshold_double(1.e-10);
+
+    TestPointValueHistory<2> test;
+    test.run();
+}
diff --git a/tests/deal.II/point_value_history_03/cmp/generic b/tests/deal.II/point_value_history_03/cmp/generic
new file mode 100644 (file)
index 0000000..7ffc74d
--- /dev/null
@@ -0,0 +1,231 @@
+
+***PointValueHistory status output***
+
+Closed: 1
+Cleared: 0
+Triangulation_changed: 0
+Have_dof_handler: 1
+Geometric Data
+# Requested location: 1.0 0.20
+# DoF_index : Support location (for each component)
+69 : 1.0 0.25
+
+
+Independent value(s): 1 : 1
+Mnemonic: data set size (mask size, n true components) : n data sets
+Solution: 1 (1, 1) : 1
+
+***end of status output***
+
+***PointValueHistory status output***
+
+Closed: 1
+Cleared: 0
+Triangulation_changed: 0
+Have_dof_handler: 1
+Geometric Data
+# Requested location: 0.0 0.0
+# DoF_index : Support location (for each component)
+0 : 0.0 0.0
+
+# Requested location: 0.25 0.0
+# DoF_index : Support location (for each component)
+4 : 0.25 0.0
+
+# Requested location: 0.25 0.45
+# DoF_index : Support location (for each component)
+23 : 0.25 0.50
+
+# Requested location: 0.45 0.45
+# DoF_index : Support location (for each component)
+24 : 0.50 0.50
+
+# Requested location: 0.80 0.80
+# DoF_index : Support location (for each component)
+48 : 0.75 0.75
+
+# Requested location: 1.0 0.20
+# DoF_index : Support location (for each component)
+69 : 1.0 0.25
+
+
+Independent value(s): 1 : 10
+Names: <Input> 
+Mnemonic: data set size (mask size, n true components) : n data sets
+Post Processed Vector: 6 (1, 1) : 10
+Pressure: 6 (1, 1) : 10
+Req_sol: 6 (1, 1) : 10
+Solution: 6 (1, 1) : 10
+<Solution> 
+X_gradient: 6 (2, 1) : 10
+X_hessian: 6 (2, 1) : 10
+
+***end of status output***
+
+***PointValueHistory status output***
+
+Closed: 1
+Cleared: 0
+Triangulation_changed: 0
+Have_dof_handler: 0
+Geometric Data
+No points stored currently
+
+Independent value(s): 1 : 10
+
+***end of status output***
+
+DEAL::Starting data files
+DEAL::Copying output file point_value_history_03/node_00.gpl
+DEAL::# Requested location: 0 0
+DEAL::# DoF_index : Support location (for each component)
+DEAL::# 0 : 0 0
+DEAL::# Postprocessor location: 0.0528312 0.0528312#
+DEAL::# <Key> <Input> <Post Processed Vector_0> <Pressure_0> <Req_sol_0> <Solution> <X_gradient_0> <X_hessian_0> 
+DEAL::0 1 3 1 1 1 0 8.46659e-09
+DEAL::1e-06 1 3 1 1 1 -1 8.35385e-09
+DEAL::2e-06 1 3 1 1 1 -1.89434 2
+DEAL::3e-06 1 3 1 1 1 -2.69139 5.25
+DEAL::4e-06 1 3 1 1 1 -3.39968 9.21875
+DEAL::5e-06 1 3 1 1 1 -4.0276 13.5352
+DEAL::6e-06 1 3 1 1 1 -4.58314 17.9448
+DEAL::7e-06 1 3 1 1 1 -5.07383 22.2779
+DEAL::8e-06 1 3 1 1 1 -5.50663 26.4253
+DEAL::9e-06 1 3 1 1 1 -5.88791 30.3212
+DEAL::
+DEAL::
+DEAL::Copying output file point_value_history_03/node_01.gpl
+DEAL::# Requested location: 0.25 0
+DEAL::# DoF_index : Support location (for each component)
+DEAL::# 4 : 0.25 0
+DEAL::# Postprocessor location: 0.197169 0.0528312#
+DEAL::# <Key> <Input> <Post Processed Vector_0> <Pressure_0> <Req_sol_0> <Solution> <X_gradient_0> <X_hessian_0> 
+DEAL::0 1 3 1 1 1 0 2.19707e-09
+DEAL::1e-06 1 2.75 0.75 0.75 0.75 -1 1.7506e-09
+DEAL::2e-06 1 2.5625 0.5625 0.5625 0.5625 -1.60566 2
+DEAL::3e-06 1 2.42188 0.421875 0.421875 0.421875 -1.93361 5.25
+DEAL::4e-06 1 2.31641 0.316406 0.316406 0.316406 -2.06907 9.21875
+DEAL::5e-06 1 2.2373 0.237305 0.237305 0.237305 -2.07397 13.5352
+DEAL::6e-06 1 2.17798 0.177979 0.177979 0.177979 -1.99303 17.9448
+DEAL::7e-06 1 2.13348 0.133484 0.133484 0.133484 -1.8583 22.2779
+DEAL::8e-06 1 2.10011 0.100113 0.100113 0.100113 -1.69247 26.4253
+DEAL::9e-06 1 2.07508 0.0750847 0.0750847 0.0750847 -1.51142 30.3212
+DEAL::
+DEAL::
+DEAL::Copying output file point_value_history_03/node_02.gpl
+DEAL::# Requested location: 0.25 0.45
+DEAL::# DoF_index : Support location (for each component)
+DEAL::# 23 : 0.25 0.5
+DEAL::# Postprocessor location: 0.197169 0.447169#
+DEAL::# <Key> <Input> <Post Processed Vector_0> <Pressure_0> <Req_sol_0> <Solution> <X_gradient_0> <X_hessian_0> 
+DEAL::0 1 3 1 1 1 -8.88178e-16 3.08136e-09
+DEAL::1e-06 1 2.75 0.75 0.75 0.75 -1 2.4926e-09
+DEAL::2e-06 1 2.5625 0.5625 0.5625 0.5625 -1.60566 2
+DEAL::3e-06 1 2.42188 0.421875 0.421875 0.421875 -1.93361 5.25
+DEAL::4e-06 1 2.31641 0.316406 0.316406 0.316406 -2.06907 9.21875
+DEAL::5e-06 1 2.2373 0.237305 0.237305 0.237305 -2.07397 13.5352
+DEAL::6e-06 1 2.17798 0.177979 0.177979 0.177979 -1.99303 17.9448
+DEAL::7e-06 1 2.13348 0.133484 0.133484 0.133484 -1.8583 22.2779
+DEAL::8e-06 1 2.10011 0.100113 0.100113 0.100113 -1.69247 26.4253
+DEAL::9e-06 1 2.07508 0.0750847 0.0750847 0.0750847 -1.51142 30.3212
+DEAL::
+DEAL::
+DEAL::Copying output file point_value_history_03/node_03.gpl
+DEAL::# Requested location: 0.45 0.45
+DEAL::# DoF_index : Support location (for each component)
+DEAL::# 24 : 0.5 0.5
+DEAL::# Postprocessor location: 0.447169 0.447169#
+DEAL::# <Key> <Input> <Post Processed Vector_0> <Pressure_0> <Req_sol_0> <Solution> <X_gradient_0> <X_hessian_0> 
+DEAL::0 1 3 1 1 1 -8.88178e-16 3.08136e-09
+DEAL::1e-06 1 2.5 0.5 0.55 0.5 -1 1.72237e-09
+DEAL::2e-06 1 2.25 0.25 0.3025 0.25 -1.10566 2
+DEAL::3e-06 1 2.125 0.125 0.165625 0.125 -0.916867 3.75
+DEAL::4e-06 1 2.0625 0.0625 0.0896875 0.0625 -0.675079 4.71875
+DEAL::5e-06 1 2.03125 0.03125 0.0475586 0.03125 -0.464784 4.98047
+DEAL::6e-06 1 2.01562 0.015625 0.0242896 0.015625 -0.305802 4.76123
+DEAL::7e-06 1 2.00781 0.0078125 0.0115738 0.0078125 -0.194193 4.2746
+DEAL::8e-06 1 2.00391 0.00390625 0.00476261 0.00390625 -0.119462 3.67699
+DEAL::9e-06 1 2.00195 0.00195312 0.00124056 0.00195312 -0.0711287 3.06777
+DEAL::
+DEAL::
+DEAL::Copying output file point_value_history_03/node_04.gpl
+DEAL::# Requested location: 0.8 0.8
+DEAL::# DoF_index : Support location (for each component)
+DEAL::# 48 : 0.75 0.75
+DEAL::# Postprocessor location: 0.802831 0.802831#
+DEAL::# <Key> <Input> <Post Processed Vector_0> <Pressure_0> <Req_sol_0> <Solution> <X_gradient_0> <X_hessian_0> 
+DEAL::0 1 3 1 1 1 0 8.46659e-09
+DEAL::1e-06 1 2.25 0.25 0.2 0.25 -1 2.0107e-09
+DEAL::2e-06 1 2.0625 0.0625 0.04 0.0625 -0.394338 2
+DEAL::3e-06 1 2.01562 0.015625 0.00875 0.015625 -0.116627 0.75
+DEAL::4e-06 1 2.00391 0.00390625 0.00203125 0.00390625 -0.0314119 0.21875
+DEAL::5e-06 1 2.00098 0.000976562 0.000488281 0.000976562 -0.00813489 0.0585937
+DEAL::6e-06 1 2.00024 0.000244141 0.000119629 0.000244141 -0.00206896 0.0151367
+DEAL::7e-06 1 2.00006 6.10352e-05 2.96021e-05 6.10352e-05 -0.000521645 0.00384521
+DEAL::8e-06 1 2.00002 1.52588e-05 7.36237e-06 1.52588e-05 -0.000130962 0.000968933
+DEAL::9e-06 1 2 3.8147e-06 1.83582e-06 3.8147e-06 -3.28093e-05 0.000243187
+DEAL::
+DEAL::
+DEAL::Copying output file point_value_history_03/node_05.gpl
+DEAL::# Requested location: 1 0.2
+DEAL::# DoF_index : Support location (for each component)
+DEAL::# 69 : 1 0.25
+DEAL::# Postprocessor location: 0.947169 0.197169#
+DEAL::# <Key> <Input> <Post Processed Vector_0> <Pressure_0> <Req_sol_0> <Solution> <X_gradient_0> <X_hessian_0> 
+DEAL::0 1 3 1 1 1 -8.88178e-16 3.08136e-09
+DEAL::1e-06 1 2 0 0 0 -1 1.84763e-10
+DEAL::2e-06 1 2 0 0 0 -0.105662 2
+DEAL::3e-06 1 2 0 0 0 -0.00837341 0.75
+DEAL::4e-06 1 2 0 0 0 0.000161921 0.21875
+DEAL::5e-06 1 2 0 0 0 0.00032239 0.0585938
+DEAL::6e-06 1 2 0 0 0 0.000115836 0.0151367
+DEAL::7e-06 1 2 0 0 0 3.33639e-05 0.00384521
+DEAL::8e-06 1 2 0 0 0 8.89157e-06 0.000968933
+DEAL::9e-06 1 2 0 0 0 2.29172e-06 0.000243187
+DEAL::
+DEAL::
+DEAL::Copying output file point_value_history_03/node_indep.gpl
+DEAL::# Data independent of mesh location
+DEAL::# <Key> <Input> 
+DEAL::0 1
+DEAL::1e-06 1
+DEAL::2e-06 1
+DEAL::3e-06 1
+DEAL::4e-06 1
+DEAL::5e-06 1
+DEAL::6e-06 1
+DEAL::7e-06 1
+DEAL::8e-06 1
+DEAL::9e-06 1
+DEAL::
+DEAL::
+DEAL::Copying output file point_value_history_03/Test_Copy_00.gpl
+DEAL::# Requested location: 1 0.2
+DEAL::# DoF_index : Support location (for each component)
+DEAL::# 69 : 1 0.25
+DEAL::#
+DEAL::# <Key> <Indep_0> <Solution_0> 
+DEAL::0.1 1 1
+DEAL::
+DEAL::
+DEAL::Copying output file point_value_history_03/Test_Copy_indep.gpl
+DEAL::# Data independent of mesh location
+DEAL::# <Key> <Indep_0> 
+DEAL::0.1 1
+DEAL::
+DEAL::
+DEAL::Copying output file point_value_history_03/no_dof_indep.gpl
+DEAL::# Data independent of mesh location
+DEAL::# <Key> <Indep_0> 
+DEAL::0 1
+DEAL::1e-06 1
+DEAL::2e-06 1
+DEAL::3e-06 1
+DEAL::4e-06 1
+DEAL::5e-06 1
+DEAL::6e-06 1
+DEAL::7e-06 1
+DEAL::8e-06 1
+DEAL::9e-06 1
+DEAL::
+DEAL::

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.