]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Remove NamedData class 725/head
authorGuido Kanschat <dr.guido.kanschat@gmail.com>
Fri, 12 Sep 2014 20:22:37 +0000 (22:22 +0200)
committerGuido Kanschat <dr.guido.kanschat@gmail.com>
Thu, 2 Apr 2015 12:28:01 +0000 (14:28 +0200)
38 files changed:
doc/news/changes.h
examples/step-39/step-39.cc
include/deal.II/algorithms/any_data.h
include/deal.II/algorithms/named_selection.h [new file with mode: 0644]
include/deal.II/algorithms/newton.h
include/deal.II/algorithms/newton.templates.h
include/deal.II/algorithms/operator.h
include/deal.II/algorithms/operator.templates.h
include/deal.II/algorithms/theta_timestepping.templates.h
include/deal.II/base/named_data.h [deleted file]
include/deal.II/lac/matrix_block.h
include/deal.II/meshworker/assembler.h
include/deal.II/meshworker/functional.h
include/deal.II/meshworker/integration_info.h
include/deal.II/meshworker/output.h
include/deal.II/meshworker/simple.h
include/deal.II/meshworker/vector_selector.h
include/deal.II/meshworker/vector_selector.templates.h
include/deal.II/numerics/dof_output_operator.h
source/base/named_selection.cc
tests/algorithms/newton_01.cc
tests/algorithms/newton_01_compat.cc [deleted file]
tests/algorithms/newton_01_compat.output [deleted file]
tests/algorithms/operator_compatibility.cc [deleted file]
tests/algorithms/operator_compatibility.output [deleted file]
tests/algorithms/theta_01_compat.cc [deleted file]
tests/algorithms/theta_01_compat.output [deleted file]
tests/base/named_data.cc [deleted file]
tests/base/named_data.output [deleted file]
tests/integrators/cells_and_faces_01.cc
tests/integrators/cochain_01.cc
tests/integrators/mesh_worker_1d_dg.cc
tests/multigrid/mg_renumbered_02.cc
tests/multigrid/mg_renumbered_03.cc
tests/multigrid/step-39-02.cc
tests/multigrid/step-39-02a.cc
tests/multigrid/step-39-03.cc
tests/multigrid/step-39.cc

index 50c4e72e2cf5d840e598b6fb0f2530b9b52faa4d..76fb22e50967d3f5abe0af4b280bf2c1e4c33bb8 100644 (file)
@@ -38,13 +38,21 @@ inconvenience this causes.
 </p>
 
 <ol>
+  <li>Removed: The class NamedData has been removed after it had been
+  superceded by AnyData a while ago. This affects the use of classes
+  in Algorithms and MeshWorker
+  <br>
+  (Guido KAnschat, 2015/04/02)
+  </li>
+
   <li> Removed: The CMake configuration does not use the variable
   <code>DEAL_II_CMAKE_MACROS_RELDIR</code> any more. Instead, the fixed
   location <code>${DEAL_II_SHARE_RELDIR}/macros</code> is used
   unconditionally
   <br>
   (Matthias Maier, 2015/03/26)
-
+  </li>
+  
   <li> Changed: The TrilinosWrappers::SparseMatrix::clear_row() function used
   to call TrilinosWrappers::SparseMatrix::compress() before doing its work,
   but this is neither efficient nor safe. You will now have to do this
index ce4e0e03f18dfe25e1f2f02f7f68a798bc39c5c7..64fd4a2b6acd8d1f9b4f5e7a35491fa109e4af3b 100644 (file)
@@ -649,13 +649,12 @@ namespace Step39
 
     // Since this assembler allows us to fill several vectors, the interface is
     // a little more complicated as above. The pointers to the vectors have to
-    // be stored in a NamedData object. While this seems to cause two extra
+    // be stored in a AnyData object. While this seems to cause two extra
     // lines of code here, it actually comes handy in more complex
     // applications.
     MeshWorker::Assembler::ResidualSimple<Vector<double> > assembler;
-    NamedData<Vector<double>* > data;
-    Vector<double> *rhs = &right_hand_side;
-    data.add(rhs, "RHS");
+    AnyData data;
+    data.add<Vector<double>*>(&right_hand_side, "RHS");
     assembler.initialize(data);
 
     RHSIntegrator<dim> integrator;
@@ -763,10 +762,10 @@ namespace Step39
     info_box.initialize_gauss_quadrature(n_gauss_points, n_gauss_points+1, n_gauss_points);
 
     // but now we need to notify the info box of the finite element function we
-    // want to evaluate in the quadrature points. First, we create a NamedData
+    // want to evaluate in the quadrature points. First, we create an AnyData
     // object with this vector, which is the solution we just computed.
-    NamedData<Vector<double>* > solution_data;
-    solution_data.add(&solution, "solution");
+    AnyData solution_data;
+    solution_data.add<const Vector<double>*>(&solution, "solution");
 
     // Then, we tell the Meshworker::VectorSelector for cells, that we need
     // the second derivatives of this solution (to compute the
@@ -783,16 +782,15 @@ namespace Step39
     // flags are already adjusted to the values and derivatives we requested
     // above.
     info_box.add_update_flags_boundary(update_quadrature_points);
-    info_box.initialize(fe, mapping, solution_data);
+    info_box.initialize(fe, mapping, solution_data, solution);
 
     MeshWorker::DoFInfo<dim> dof_info(dof_handler);
 
     // The assembler stores one number per cell, but else this is the same as
     // in the computation of the right hand side.
     MeshWorker::Assembler::CellsAndFaces<double> assembler;
-    NamedData<BlockVector<double>* > out_data;
-    BlockVector<double> *est = &estimates;
-    out_data.add(est, "cells");
+    AnyData out_data;
+    out_data.add<BlockVector<double>*>(&estimates, "cells");
     assembler.initialize(out_data, false);
 
     Estimator<dim> integrator;
@@ -831,8 +829,8 @@ namespace Step39
     const unsigned int n_gauss_points = dof_handler.get_fe().tensor_degree()+1;
     info_box.initialize_gauss_quadrature(n_gauss_points, n_gauss_points+1, n_gauss_points);
 
-    NamedData<Vector<double>* > solution_data;
-    solution_data.add(&solution, "solution");
+    AnyData solution_data;
+    solution_data.add<Vector<double>*>(&solution, "solution");
 
     info_box.cell_selector.add("solution", true, true, false);
     info_box.boundary_selector.add("solution", true, false, false);
@@ -840,14 +838,13 @@ namespace Step39
 
     info_box.add_update_flags_cell(update_quadrature_points);
     info_box.add_update_flags_boundary(update_quadrature_points);
-    info_box.initialize(fe, mapping, solution_data);
+    info_box.initialize(fe, mapping, solution_data, solution);
 
     MeshWorker::DoFInfo<dim> dof_info(dof_handler);
 
     MeshWorker::Assembler::CellsAndFaces<double> assembler;
-    NamedData<BlockVector<double>* > out_data;
-    BlockVector<double> *est = &errors;
-    out_data.add(est, "cells");
+    AnyData out_data;
+    out_data.add<BlockVector<double>* >(&errors, "cells");
     assembler.initialize(out_data, false);
 
     ErrorIntegrator<dim> integrator;
index 912b24eb4bf91a955481b4685ba6d87554bca74e..69e3d2409446f22b277a4885ab330f718a731b09 100644 (file)
@@ -19,7 +19,6 @@
 #include <deal.II/base/config.h>
 #include <deal.II/base/exceptions.h>
 #include <deal.II/base/subscriptor.h>
-#include <deal.II/base/named_data.h>
 
 #include <boost/any.hpp>
 #include <vector>
@@ -49,7 +48,7 @@ public:
   void add(type entry, const std::string &name);
 
   /**
-   * @brief Merge the data of another NamedData to the end of this object.
+   * @brief Merge the data of another AnyData to the end of this object.
    */
   void merge(const AnyData &other);
 
@@ -171,10 +170,6 @@ public:
   template <class STREAM>
   void list (STREAM &os) const;
 
-  /// Conversion from old NamedData
-  template <typename type>
-  AnyData(const NamedData<type> &);
-
   /// An entry with this name does not exist in the AnyData object.
   DeclException1(ExcNameNotFound, std::string,
                  << "No entry with the name " << arg1 << " exists.");
@@ -205,15 +200,6 @@ AnyData::AnyData()
 {}
 
 
-template <typename type>
-inline
-AnyData::AnyData(const NamedData<type> &other)
-{
-  for (unsigned int i=0; i<other.size(); ++i)
-    add(other(i), other.name(i));
-}
-
-
 unsigned int
 inline
 AnyData::size () const
diff --git a/include/deal.II/algorithms/named_selection.h b/include/deal.II/algorithms/named_selection.h
new file mode 100644 (file)
index 0000000..514d808
--- /dev/null
@@ -0,0 +1,125 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2000 - 2015 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+#ifndef __deal2__named_selection_h
+#define __deal2__named_selection_h
+
+#include <deal.II/base/config.h>
+#include <deal.II/algorithms/any_data.h>
+
+#include <string>
+
+DEAL_II_NAMESPACE_OPEN
+
+/**
+ * Select data from NamedData corresponding to the attached name.
+ *
+ * Given a list of names to search for (provided by add()), objects of
+ * this
+ * class provide an index list of the selected data.
+ *
+ * @author Guido Kanschat, 2009
+ */
+class NamedSelection
+{
+
+public:
+
+  /**
+   * Add a new name to be searched for in NamedData.
+   *
+   * @note Names will be added to the end of the current list.
+   */
+  void add (const std::string &name);
+
+
+  /**
+   * Create the index vector pointing into the AnyData object.
+   */
+  void initialize(const AnyData &data);
+
+
+  /**
+   * The number of names in this object. This function may be used
+   * whether
+   * initialize() was called before or not.
+   */
+  unsigned int size() const;
+
+
+  /**
+   * Return the corresponding index in the NamedData object supplied
+   * to the
+   * last initialize(). It is an error if initialize() has not been
+   * called
+   * before.
+   *
+   * Indices are in the same order as the calls to add().
+   */
+  unsigned int operator() (unsigned int i) const;
+
+
+private:
+
+  /**
+   * The selected names.
+   */
+  std::vector<std::string> names;
+
+  /**
+   * The index map generated by initialize() and accessed by
+   * operator().
+   */
+  std::vector<unsigned int> indices;
+
+};
+
+
+inline
+unsigned int
+NamedSelection::size() const
+{
+
+  return names.size();
+
+}
+
+
+inline
+void
+NamedSelection::add(const std::string &s)
+{
+
+  names.push_back(s);
+
+}
+
+
+inline
+unsigned int
+NamedSelection::operator() (unsigned int i) const
+{
+
+  Assert (indices.size() == names.size(), ExcNotInitialized());
+
+  AssertIndexRange(i, size());
+
+  return indices[i];
+
+}
+
+DEAL_II_NAMESPACE_CLOSE
+
+#endif
index e3c3092183082dc7a2bbc081b6b60ff1eb2e3083..53835d9137026c1d612a98ec98b4cad42f7ba0f9 100644 (file)
@@ -96,11 +96,6 @@ namespace Algorithms
      */
     virtual void operator() (AnyData &out, const AnyData &in);
 
-    /**
-     * @deprecated Use the function using AnyData
-     */
-    virtual void operator() (NamedData<VECTOR *> &out, const NamedData<VECTOR *> &in);
-
     virtual void notify(const Event &);
 
     /**
index bb5fafa2831250fab657a1cb3a4fad0a3d0020e8..1cfb920113b9d297bb0781133c3c4520cec8d73d 100644 (file)
@@ -90,13 +90,6 @@ namespace Algorithms
   }
 
 
-  template <class VECTOR>
-  void
-  Newton<VECTOR>::operator() (NamedData<VECTOR *> &out, const NamedData<VECTOR *> &in)
-  {
-    Operator<VECTOR>::operator() (out, in);
-  }
-
   template <class VECTOR>
   void
   Newton<VECTOR>::operator() (AnyData &out, const AnyData &in)
@@ -133,13 +126,13 @@ namespace Algorithms
 
     if (debug_vectors)
       {
-        NamedData<VECTOR *> out;
+        AnyData out;
         VECTOR *p = &u;
-        out.add(p, "solution");
+        out.add<const VECTOR *>(p, "solution");
         p = Du;
-        out.add(p, "update");
+        out.add<const VECTOR *>(p, "update");
         p = res;
-        out.add(p, "residual");
+        out.add<const VECTOR *>(p, "residual");
         *data_out << step;
         *data_out << out;
       }
@@ -164,13 +157,13 @@ namespace Algorithms
 
         if (debug_vectors)
           {
-            NamedData<VECTOR *> out;
+            AnyData out;
             VECTOR *p = &u;
-            out.add(p, "solution");
+            out.add<const VECTOR *>(p, "solution");
             p = Du;
-            out.add(p, "update");
+            out.add<const VECTOR *>(p, "update");
             p = res;
-            out.add(p, "residual");
+            out.add<const VECTOR *>(p, "residual");
             *data_out << step;
             *data_out << out;
           }
index f4bbf9f9cdb768fc49423d5dbf732af9ce6b3c38..1902dd392b19aa0de7621e727b157b612ce68983 100644 (file)
@@ -19,7 +19,6 @@
 
 #include <deal.II/base/config.h>
 #include <deal.II/algorithms/any_data.h>
-#include <deal.II/base/named_data.h>
 #include <deal.II/base/event.h>
 
 #include <fstream>
@@ -131,37 +130,11 @@ namespace Algorithms
   {
   public:
     Operator();
-
-    /**
-     * Implementation of the function in the base class in order to do
-     * compatibility conversions between the old and the new interface.
-     */
-    virtual void operator() (AnyData &out, const AnyData &in);
-
-    /**
-     * @deprecated It is in particular this function which should not be used
-     * anymore.
-     *
-     * The actual operation, which is implemented in a derived class.
-     */
-    virtual void operator() (NamedData<VECTOR *> &out, const NamedData<VECTOR *> &in);
-
-    /**
-     * Set this true to avoid compatibility warnings.
-     */
-    bool silent_compatibility;
-
-  private:
-    /**
-     * While we are providing compatibility functions to the old interface,
-     * this variable will ensure there is no endless loop.
-     */
-    bool compatibility_flag;
   };
 
   /**
-   * An unary operator base class, intended to output the vectors in NamedData
-   * in each step of an iteration.
+   * An unary operator base class, intended to output the vectors in
+   * AnyData in each step of an iteration.
    *
    * @author Guido Kanschat, 2010
    */
@@ -184,17 +157,12 @@ namespace Algorithms
     /**
      * Set the current step.
      */
-    OutputOperator<VECTOR> &operator<< (unsigned int step);
-
+    void set_step(const unsigned int step);
     /**
      * Output all the vectors in AnyData.
      */
     virtual OutputOperator<VECTOR> &operator<< (const AnyData &vectors);
 
-    /**
-     * @deprecated Output all the vectors in NamedData.
-     */
-    OutputOperator<VECTOR> &operator<< (const NamedData<VECTOR *> &vectors);
   protected:
     unsigned int step;
   private:
@@ -202,15 +170,29 @@ namespace Algorithms
   };
 
   template <class VECTOR>
-  OutputOperator<VECTOR> &
-  OutputOperator<VECTOR>::operator<< (unsigned int s)
+  inline
+  void
+  OutputOperator<VECTOR>::set_step (const unsigned int s)
   {
     step = s;
-    return *this;
   }
-}
 
 
+  /**
+   * Set the step number in OutputOperator by shifting an integer value.
+   *
+   * @relates OutputOperator
+   */
+  template <class VECTOR>
+  inline
+  OutputOperator<VECTOR> &
+  operator<< (OutputOperator<VECTOR> &out, unsigned int step)
+  {
+    out.set_step(step);
+    return out;
+  }
+}
+
 DEAL_II_NAMESPACE_CLOSE
 
 #endif
index d7b2809aa978d4af8a3758609c00c525284ee15d..47659ae8e6b00ed5f26812776af06ddc2e3dfffa 100644 (file)
@@ -23,86 +23,8 @@ namespace Algorithms
 {
   template <class VECTOR>
   Operator<VECTOR>::Operator()
-    : silent_compatibility(false), compatibility_flag(false)
   {}
 
-
-  template <class VECTOR>
-  void
-  Operator<VECTOR>::operator() (AnyData &out, const AnyData &in)
-  {
-    // Had this function been overloaded in a derived clas, it would
-    // not have been called. Therefore, we have to start the
-    // compatibility engine. But before, we have to avoid an endless loop.
-    Assert(!compatibility_flag, ExcMessage("Compatibility resolution of Operator generates and endless loop\n"
-                                           "Please provide an operator() in a derived class"));
-    compatibility_flag = true;
-
-    NamedData<VECTOR *> new_out;
-    for (unsigned int i=0; i<out.size(); ++i)
-      {
-        if (out.is_type<VECTOR *>(i))
-          new_out.add(out.entry<VECTOR *>(i), out.name(i));
-        else if (!silent_compatibility)
-          deallog << "Cannot convert AnyData argument " << out.name(i) << " to NamedData"
-                  << std::endl;
-      }
-
-    NamedData<VECTOR *> new_in;
-    for (unsigned int i=0; i<in.size(); ++i)
-      {
-        //  deallog << "Convert " << in.name(i) << std::endl;
-        if (in.is_type<VECTOR *>(i))
-          {
-            // This const cast is due to the wrong constness handling
-            // in NamedData. As soon as NamedData is gone, this code
-            // will not be necessary anymore. And deprecating begins
-            // now.
-            VECTOR *p = const_cast<VECTOR *> (in.entry<VECTOR *>(i));
-            new_in.add(p, in.name(i));
-          }
-        else if (in.is_type<const VECTOR *>(i))
-          {
-            // This const cast is due to the wrong constness handling
-            // in NamedData. As soon as NamedData is gone, this code
-            // will not be necessary anymore. And deprecating begins
-            // now.
-            VECTOR *p = const_cast<VECTOR *> (in.entry<const VECTOR *>(i));
-            new_in.add(p, in.name(i));
-          }
-        else if (!silent_compatibility)
-          deallog << "Cannot convert AnyData argument " << in.name(i)
-                  << " to NamedData" << std::endl;
-      }
-    this->operator() (new_out, new_in);
-    compatibility_flag = false;
-  }
-
-
-  template <class VECTOR>
-  void
-  Operator<VECTOR>::operator() (NamedData<VECTOR *> &out, const NamedData<VECTOR *> &in)
-  {
-    // Had this function been overloaded in a derived clas, it would
-    // not have been called. Therefore, we have to start the
-    // compatibility engine. But before, we have to avoid an endless loop.
-    Assert(!compatibility_flag, ExcMessage("Compatibility resolution of Operator generates and endless loop\n"
-                                           "Please provide an operator() in a derived class"));
-    compatibility_flag = true;
-
-    AnyData new_out;
-    for (unsigned int i=0; i<out.size(); ++i)
-      new_out.add(out(i), out.name(i));
-
-    AnyData new_in;
-    for (unsigned int i=0; i<in.size(); ++i)
-      new_in.add(in(i), in.name(i));
-
-    this->operator() (new_out, new_in);
-    compatibility_flag = false;
-  }
-
-
   template <class VECTOR>
   OutputOperator<VECTOR>::~OutputOperator()
   {}
@@ -151,16 +73,6 @@ namespace Algorithms
       }
     return *this;
   }
-
-
-  template <class VECTOR>
-  OutputOperator<VECTOR> &
-  OutputOperator<VECTOR>::operator<< (const NamedData<VECTOR *> &vectors)
-  {
-    const AnyData newdata = vectors;
-    (*this) << newdata;
-    return *this;
-  }
 }
 
 DEAL_II_NAMESPACE_CLOSE
index ae13015a9d6d56e3902359a0c18ac59749bd5a25..8f754f491faf5e570e7ae6f9eb74e79a579acb44 100644 (file)
@@ -102,12 +102,6 @@ namespace Algorithms
     if (output != 0)
       (*output) << 0U << out;
 
-    // Avoid warnings because time and timestep cannot be converted to VECTOR*
-    const bool explicit_silent = op_explicit->silent_compatibility;
-    const bool implicit_silent = op_implicit->silent_compatibility;
-    op_explicit->silent_compatibility = true;
-    op_implicit->silent_compatibility = true;
-
     for (unsigned int count = 1; d_explicit.time < control.final(); ++count)
       {
         const bool step_change = control.advance();
@@ -134,8 +128,6 @@ namespace Algorithms
 
         d_explicit.time = control.now();
       }
-    op_explicit->silent_compatibility = explicit_silent;
-    op_implicit->silent_compatibility = implicit_silent;
     deallog.pop();
   }
 }
diff --git a/include/deal.II/base/named_data.h b/include/deal.II/base/named_data.h
deleted file mode 100644 (file)
index 5f62dc7..0000000
+++ /dev/null
@@ -1,432 +0,0 @@
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 2000 - 2015 by the deal.II authors
-//
-// This file is part of the deal.II library.
-//
-// The deal.II library is free software; you can use it, redistribute
-// it, and/or modify it under the terms of the GNU Lesser General
-// Public License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// The full text of the license can be found in the file LICENSE at
-// the top level of the deal.II distribution.
-//
-// ---------------------------------------------------------------------
-
-#ifndef __deal2__named_data_h
-#define __deal2__named_data_h
-
-#include <deal.II/base/config.h>
-#include <deal.II/base/exceptions.h>
-#include <deal.II/base/subscriptor.h>
-
-#include <vector>
-#include <algorithm>
-
-DEAL_II_NAMESPACE_OPEN
-
-class AnyData;
-
-/**
- * @deprecated The use of this class is deprecated and AnyData should be used
- * instead. It is not only more flexible, the way constness was assured in
- * this class never worked the way it was intended. Therefore, the according
- * checks have been disabled.
- *
- * This class is a collection of DATA objects. Each of the pointers has a name
- * associated, enabling identification by this name rather than the index in
- * the vector only.
- *
- * Note that it is the actual data stored in this object. Therefore, for
- * storing vectors and other large objects, it should be considered to use
- * SmartPointer or boost::shared_ptr for DATA.
- *
- * Objects of this kind have a smart way of treating constness: if a const
- * data object is added or a const NamedData is supplied with merge(), the
- * object will henceforth consider itself as const (#is_constant will be
- * true). Thus, any subsequent modification will be illegal and
- * ExcConstantObject will be raised in debug mode.
- *
- * @author Guido Kanschat, 2007, 2008, 2009
- */
-template <typename DATA>
-class NamedData : public Subscriptor
-{
-public:
-  /**
-   * Standard constructor creating an empty object.
-   */
-  NamedData();
-
-  /**
-   * Assignment operator, copying conversible data from another object.
-   */
-  template <typename DATA2>
-  NamedData<DATA> &operator = (const NamedData<DATA2> &other);
-
-  /**
-   * \name Adding members
-   */
-//@{
-  /**
-   * Add a new data item to the end of the collection.
-   */
-  void add(DATA &v, const std::string &name);
-
-  /**
-   * Add a new constant data item to the end of the collection and make the
-   * collection constant.
-   */
-  void add(const DATA &v, const std::string &name);
-
-  /**
-   * Merge the data of another NamedData to the end of this object.
-   *
-   * If the other object had #is_constant set, so will have this object after
-   * merge.
-   */
-  template <typename DATA2>
-  void merge(NamedData<DATA2> &);
-  /**
-   * Merge the data of another NamedData to the end of this object.
-   *
-   * After this operation, all data in this object will be treated as const.
-   */
-  template <typename DATA2>
-  void merge(const NamedData<DATA2> &);
-//@}
-  /**
-   * \name Accessing and querying contents
-   */
-//@{
-/// Number of stored data objects.
-  unsigned int size() const;
-
-  /**
-   * @brief Access to stored data object by index.
-   *
-   * @note This function throws an exception, if is_const() returns
-   * <tt>true</tt>. In such a case, either cast the NamedData object to a
-   * const reference, or use the function read() instead of this operator.
-   */
-  DATA &operator() (unsigned int i);
-
-/// Read-only access to stored data object by index.
-  const DATA &operator() (unsigned int i) const;
-
-/// Read only access for a non-const object.
-  const DATA &read (unsigned int i) const;
-
-/// Name of object at index.
-  const std::string &name(unsigned int i) const;
-
-/// Find index of a named object
-  unsigned int find(const std::string &name) const;
-
-/// Returns true if this object contains constant data
-  bool is_const () const;
-
-/// List names of stored objects
-  template <class OUT>
-  void print(OUT &o) const;
-//@}
-  /**
-   * Exception indicating that a function expected a vector to have a certain
-   * name, but NamedData had a different name in that position.
-   */
-  DeclException2(ExcNameMismatch, int, std::string,
-                 << "Name at position " << arg1 << " is not equal to " << arg2);
-
-  /**
-   * Exception indicating that read access to stored data was attempted
-   * although the NamedData object contains const data and #is_constant was
-   * true.
-   */
-  DeclException0(ExcConstantObject);
-
-private:
-  /// True if the object is to be treated constant
-  bool is_constant;
-  /// The actual data stored
-  std::vector<DATA> data;
-
-  /// Names for the data
-  std::vector<std::string> names;
-};
-
-
-/**
- * Select data from NamedData corresponding to the attached name.
- *
- * Given a list of names to search for (provided by add()), objects of this
- * class provide an index list of the selected data.
- *
- * @author Guido Kanschat, 2009
- */
-class NamedSelection
-{
-public:
-  /**
-   * Add a new name to be searched for in NamedData.
-   *
-   * @note Names will be added to the end of the current list.
-   */
-  void add (const std::string &name);
-
-  /**
-   * Create the index vector pointing into the NamedData object.
-   */
-  template <typename DATA>
-  void initialize(const NamedData<DATA> &data);
-
-  /**
-   * Create the index vector pointing into the AnyData object.
-   */
-  void initialize(const AnyData &data);
-
-  /**
-   * The number of names in this object. This function may be used whether
-   * initialize() was called before or not.
-   */
-  unsigned int size() const;
-
-  /**
-   * Return the corresponding index in the NamedData object supplied to the
-   * last initialize(). It is an error if initialize() has not been called
-   * before.
-   *
-   * Indices are in the same order as the calls to add().
-   */
-  unsigned int operator() (unsigned int i) const;
-
-private:
-  /**
-   * The selected names.
-   */
-  std::vector<std::string> names;
-  /**
-   * The index map generated by initialize() and accessed by operator().
-   */
-  std::vector<unsigned int> indices;
-};
-
-
-//----------------------------------------------------------------------//
-
-template<typename DATA>
-inline
-NamedData<DATA>::NamedData()
-  :
-  is_constant(false)
-{}
-
-
-template<typename DATA>
-inline
-void
-NamedData<DATA>::add(DATA &v, const std::string &n)
-{
-  // see operator() below
-
-  //  Assert(!is_constant, ExcConstantObject());
-  names.push_back(n);
-  data.push_back(v);
-}
-
-
-template<typename DATA>
-inline
-void
-NamedData<DATA>::add(const DATA &v, const std::string &n)
-{
-  // see operator() below
-
-  //  Assert(!is_constant, ExcConstantObject());
-  DATA &aux = const_cast<DATA &>(v);
-  data.push_back(aux);
-  names.push_back(n);
-  is_constant = true;
-}
-
-
-template<typename DATA>
-template<typename DATA2>
-inline
-void
-NamedData<DATA>::merge(NamedData<DATA2> &other)
-{
-  // see operator() below
-
-  // Assert(!is_constant, ExcConstantObject());
-
-  for (unsigned int i=0; i<other.size(); ++i)
-    {
-      names.push_back(other.name(i));
-      data.push_back(other.read(i));
-    }
-  is_constant = other.is_const();
-}
-
-
-template<typename DATA>
-template<typename DATA2>
-inline
-void
-NamedData<DATA>::merge(const NamedData<DATA2> &other)
-{
-  // see operator() below
-
-  //  Assert(!is_constant, ExcConstantObject());
-  for (unsigned int i=0; i<other.size(); ++i)
-    {
-      names.push_back(other.name(i));
-      data.push_back(other(i));
-    }
-  is_constant = true;
-}
-
-
-
-template<typename DATA>
-template<typename DATA2>
-inline
-NamedData<DATA> &
-NamedData<DATA>::operator= (const NamedData<DATA2> &other)
-{
-  is_constant = false;
-  merge(other);
-  is_constant = other.is_const();
-  return *this;
-}
-
-
-
-template<typename DATA>
-inline
-unsigned int
-NamedData<DATA>::size() const
-{
-  return data.size();
-}
-
-
-template<typename DATA>
-inline
-bool
-NamedData<DATA>::is_const() const
-{
-  return is_constant;
-}
-
-
-template<typename DATA>
-inline
-DATA &
-NamedData<DATA>::operator() (unsigned int i)
-{
-  // Remove this assertion, since is_const() does not really assert
-  // what we would like to. This can only be fixed by using constness
-  // in AnyData.
-
-  //  Assert(!is_constant, ExcConstantObject());
-  AssertIndexRange(i, size());
-  return data[i];
-}
-
-
-template<typename DATA>
-inline
-const DATA &
-NamedData<DATA>::operator() (unsigned int i) const
-{
-  AssertIndexRange(i, size());
-  return data[i];
-}
-
-
-template<typename DATA>
-inline
-const DATA &
-NamedData<DATA>::read (unsigned int i) const
-{
-  AssertIndexRange(i, size());
-  return data[i];
-}
-
-
-template<typename DATA>
-inline
-const std::string &
-NamedData<DATA>::name(unsigned int i) const
-{
-  AssertIndexRange(i, size());
-  return names[i];
-}
-
-
-template<typename DATA>
-inline
-unsigned int
-NamedData<DATA>::find (const std::string &name) const
-{
-  const std::vector<std::string>::const_iterator
-  i = std::find(names.begin(), names.end(), name);
-  if (i == names.end())
-    return numbers::invalid_unsigned_int;
-  return i - names.begin();
-}
-
-
-template<typename DATA>
-template<class OUT>
-inline
-void
-NamedData<DATA>::print(OUT &o) const
-{
-  o << "NamedData:";
-  for (unsigned int i=0; i<size(); ++i)
-    o << ' ' << '\"' << names[i] << '\"';
-  o << std::endl;
-}
-
-
-inline
-void
-NamedSelection::add(const std::string &s)
-{
-  names.push_back(s);
-}
-
-
-template <typename DATA>
-inline void
-NamedSelection::initialize(const NamedData<DATA> &data)
-{
-  indices.resize(names.size());
-  for (unsigned int i=0; i<names.size(); ++i)
-    indices[i] = data.find(names[i]);
-}
-
-
-inline
-unsigned int
-NamedSelection::size() const
-{
-  return names.size();
-}
-
-
-inline
-unsigned int
-NamedSelection::operator() (unsigned int i) const
-{
-  Assert (indices.size() == names.size(), ExcNotInitialized());
-  AssertIndexRange(i, size());
-  return indices[i];
-}
-
-
-DEAL_II_NAMESPACE_CLOSE
-
-
-#endif
index bcb8f87a089f0166c300fd4e20bd1bc6ae1808aa..5f83be762dd5505c2308f65f3f04e103b08abb31 100644 (file)
@@ -17,7 +17,6 @@
 #define __deal2__matrix_block_h
 
 #include <deal.II/base/config.h>
-#include <deal.II/base/named_data.h>
 #include <deal.II/base/smartpointer.h>
 #include <deal.II/base/std_cxx11/shared_ptr.h>
 #include <deal.II/base/memory_consumption.h>
@@ -26,6 +25,7 @@
 #include <deal.II/lac/block_sparsity_pattern.h>
 #include <deal.II/lac/sparse_matrix.h>
 #include <deal.II/lac/full_matrix.h>
+#include <deal.II/algorithms/any_data.h>
 
 
 DEAL_II_NAMESPACE_OPEN
@@ -322,7 +322,7 @@ private:
 template <class MATRIX>
 class MatrixBlockVector
   :
-  private NamedData<std_cxx11::shared_ptr<MatrixBlock<MATRIX> > >
+  private AnyData
 {
 public:
   /**
@@ -335,6 +335,13 @@ public:
    */
   typedef MatrixBlock<MATRIX> value_type;
 
+  /**
+   * The pointer type used for storing the objects. We use a shard
+   * pointer, such that they get deleted automatically when not used
+   * anymore.
+   */
+  typedef std_cxx11::shared_ptr<value_type> ptr_type;
+
   /**
    * Add a new matrix block at the position <tt>(row,column)</tt> in the block
    * system.
@@ -382,10 +389,10 @@ public:
   /**
    * import functions from private base class
    */
-  using NamedData<std_cxx11::shared_ptr<value_type> >::subscribe;
-  using NamedData<std_cxx11::shared_ptr<value_type> >::unsubscribe;
-  using NamedData<std_cxx11::shared_ptr<value_type> >::size;
-  using NamedData<std_cxx11::shared_ptr<value_type> >::name;
+  using AnyData::subscribe;
+  using AnyData::unsubscribe;
+  using AnyData::size;
+  using AnyData::name;
 };
 
 
@@ -531,7 +538,7 @@ public:
   std::size_t memory_consumption () const;
 private:
   /// Clear one of the matrix objects
-  void clear_object(NamedData<MGLevelObject<MatrixBlock<MATRIX> > > &);
+  void clear_object(AnyData &);
 
   /// Flag for storing matrices_in and matrices_out
   const bool edge_matrices;
@@ -540,15 +547,15 @@ private:
   const bool edge_flux_matrices;
 
   /// The level matrices
-  NamedData<MGLevelObject<MatrixBlock<MATRIX> > > matrices;
+  AnyData matrices;
   /// The matrix from the interior of a level to the refinement edge
-  NamedData<MGLevelObject<MatrixBlock<MATRIX> > > matrices_in;
+  AnyData matrices_in;
   /// The matrix from the refinement edge to the interior of a level
-  NamedData<MGLevelObject<MatrixBlock<MATRIX> > > matrices_out;
+  AnyData matrices_out;
   /// The DG flux from a level to the lower level
-  NamedData<MGLevelObject<MatrixBlock<MATRIX> > > flux_matrices_down;
+  AnyData flux_matrices_down;
   /// The DG flux from the lower level to a level
-  NamedData<MGLevelObject<MatrixBlock<MATRIX> > > flux_matrices_up;
+  AnyData flux_matrices_up;
 };
 
 
@@ -813,8 +820,8 @@ MatrixBlockVector<MATRIX>::add(
   size_type row, size_type column,
   const std::string &name)
 {
-  std_cxx11::shared_ptr<value_type> p(new value_type(row, column));
-  NamedData<std_cxx11::shared_ptr<value_type> >::add(p, name);
+  ptr_type p(new value_type(row, column));
+  AnyData::add(p, name);
 }
 
 
@@ -850,7 +857,7 @@ template <class MATRIX>
 inline const MatrixBlock<MATRIX> &
 MatrixBlockVector<MATRIX>::block(size_type i) const
 {
-  return *this->read(i);
+  return *this->read<ptr_type>(i);
 }
 
 
@@ -858,7 +865,7 @@ template <class MATRIX>
 inline MatrixBlock<MATRIX> &
 MatrixBlockVector<MATRIX>::block(size_type i)
 {
-  return *(*this)(i);
+  return *this->entry<ptr_type>(i);
 }
 
 
@@ -866,7 +873,7 @@ template <class MATRIX>
 inline MATRIX &
 MatrixBlockVector<MATRIX>::matrix(size_type i)
 {
-  return (*this)(i)->matrix;
+  return this->entry<ptr_type>(i)->matrix;
 }
 
 
@@ -920,7 +927,7 @@ template <class MATRIX>
 inline const MGLevelObject<MatrixBlock<MATRIX> > &
 MGMatrixBlockVector<MATRIX>::block(size_type i) const
 {
-  return matrices.read(i);
+  return *matrices.read<const MGLevelObject<MATRIX>* >(i);
 }
 
 
@@ -928,7 +935,7 @@ template <class MATRIX>
 inline MGLevelObject<MatrixBlock<MATRIX> > &
 MGMatrixBlockVector<MATRIX>::block(size_type i)
 {
-  return matrices(i);
+  return *matrices.entry<MGLevelObject<MATRIX>* >(i);
 }
 
 
@@ -936,7 +943,7 @@ template <class MATRIX>
 inline const MGLevelObject<MatrixBlock<MATRIX> > &
 MGMatrixBlockVector<MATRIX>::block_in(size_type i) const
 {
-  return matrices_in.read(i);
+  return *matrices_in.read<const MGLevelObject<MATRIX>* >(i);
 }
 
 
@@ -944,7 +951,7 @@ template <class MATRIX>
 inline MGLevelObject<MatrixBlock<MATRIX> > &
 MGMatrixBlockVector<MATRIX>::block_in(size_type i)
 {
-  return matrices_in(i);
+  return *matrices_in.entry<MGLevelObject<MATRIX>* >(i);
 }
 
 
@@ -952,7 +959,7 @@ template <class MATRIX>
 inline const MGLevelObject<MatrixBlock<MATRIX> > &
 MGMatrixBlockVector<MATRIX>::block_out(size_type i) const
 {
-  return matrices_out.read(i);
+  return *matrices_out.read<const MGLevelObject<MATRIX>* >(i);
 }
 
 
@@ -960,7 +967,7 @@ template <class MATRIX>
 inline MGLevelObject<MatrixBlock<MATRIX> > &
 MGMatrixBlockVector<MATRIX>::block_out(size_type i)
 {
-  return matrices_out(i);
+  return *matrices_out.entry<MGLevelObject<MATRIX>* >(i);
 }
 
 
@@ -968,7 +975,7 @@ template <class MATRIX>
 inline const MGLevelObject<MatrixBlock<MATRIX> > &
 MGMatrixBlockVector<MATRIX>::block_up(size_type i) const
 {
-  return flux_matrices_up.read(i);
+  return *flux_matrices_up.read<const MGLevelObject<MATRIX>* >(i);
 }
 
 
@@ -976,7 +983,7 @@ template <class MATRIX>
 inline MGLevelObject<MatrixBlock<MATRIX> > &
 MGMatrixBlockVector<MATRIX>::block_up(size_type i)
 {
-  return flux_matrices_up(i);
+  return *flux_matrices_up.entry<MGLevelObject<MATRIX>* >(i);
 }
 
 
@@ -984,7 +991,7 @@ template <class MATRIX>
 inline const MGLevelObject<MatrixBlock<MATRIX> > &
 MGMatrixBlockVector<MATRIX>::block_down(size_type i) const
 {
-  return flux_matrices_down.read(i);
+  return *flux_matrices_down.read<const MGLevelObject<MATRIX>* >(i);
 }
 
 
@@ -992,7 +999,7 @@ template <class MATRIX>
 inline MGLevelObject<MatrixBlock<MATRIX> > &
 MGMatrixBlockVector<MATRIX>::block_down(size_type i)
 {
-  return flux_matrices_down(i);
+  return *flux_matrices_down.entry<MGLevelObject<MATRIX>* >(i);
 }
 
 
@@ -1070,11 +1077,11 @@ MGMatrixBlockVector<MATRIX>::reinit_edge_flux(const MGLevelObject<BlockSparsityP
 
 template <class MATRIX>
 inline void
-MGMatrixBlockVector<MATRIX>::clear_object(NamedData<MGLevelObject<MatrixBlock<MATRIX> > > &mo)
+MGMatrixBlockVector<MATRIX>::clear_object(AnyData &mo)
 {
   for (size_type i=0; i<mo.size(); ++i)
     {
-      MGLevelObject<MatrixBlock<MATRIX> > &o = mo(i);
+      MGLevelObject<MatrixBlock<MATRIX> > &o = mo.entry<MGLevelObject<MATRIX>* >(i);
       for (size_type level = o.min_level(); level <= o.max_level(); ++level)
         o[level].matrix.clear();
     }
index 344ba2c864a982fbd2b1693e5dd67e5775e6f3a2..10a4029a491e1028ca7d29af95eb7212e1245bb4 100644 (file)
@@ -17,7 +17,6 @@
 #ifndef __deal2__mesh_worker_assembler_h
 #define __deal2__mesh_worker_assembler_h
 
-#include <deal.II/base/named_data.h>
 #include <deal.II/base/smartpointer.h>
 #include <deal.II/base/mg_level_object.h>
 #include <deal.II/lac/block_vector.h>
@@ -25,6 +24,7 @@
 #include <deal.II/meshworker/functional.h>
 #include <deal.II/meshworker/simple.h>
 #include <deal.II/multigrid/mg_constrained_dofs.h>
+#include <deal.II/algorithms/any_data.h>
 
 
 DEAL_II_NAMESPACE_OPEN
@@ -111,7 +111,7 @@ namespace MeshWorker
        * Copy the BlockInfo and the matrix pointers into local variables.
        */
       void initialize(const BlockInfo *block_info,
-                      NamedData<VECTOR *> &residuals);
+                      AnyData &residuals);
       /**
        * Initialize the constraints.
        */
@@ -148,10 +148,9 @@ namespace MeshWorker
                     const std::vector<types::global_dof_index> &dof);
 
       /**
-       * The global matrices, stored as a vector of pointers.
+       * The global vectors, stored as an AnyData container of pointers.
        */
-      NamedData<SmartPointer<VECTOR,
-                ResidualLocalBlocksToGlobalBlocks<VECTOR> > > residuals;
+      AnyData residuals;
 
       /**
        * A pointer to the object containing the block structure.
@@ -497,7 +496,7 @@ namespace MeshWorker
     template <class VECTOR>
     inline void
     ResidualLocalBlocksToGlobalBlocks<VECTOR>::initialize(const BlockInfo *b,
-                                                          NamedData<VECTOR *> &m)
+                                                          AnyData &m)
     {
       block_info = b;
       residuals = m;
index c210083641fedbcdfa8f13646ca922168fd268cc..6bd6c6c5b653a50bd45953661c27975be7041cb0 100644 (file)
@@ -17,7 +17,6 @@
 #ifndef __deal2__mesh_worker_functional_h
 #define __deal2__mesh_worker_functional_h
 
-#include <deal.II/base/named_data.h>
 #include <deal.II/algorithms/any_data.h>
 #include <deal.II/base/smartpointer.h>
 #include <deal.II/base/mg_level_object.h>
@@ -115,13 +114,8 @@ namespace MeshWorker
       void initialize(AnyData &results, bool separate_faces = true);
 
       /**
-       * @deprecated
-       */
-      void initialize(NamedData<BlockVector<number>*> &results,
-                      bool separate_faces = true);
-      /**
-       * Initialize the local data in the DoFInfo object used later for
-       * assembling.
+       * Initialize the local data in the DoFInfo object used later
+       * for assembling.
        *
        * The info object refers to a cell if <code>!face</code>, or else to an
        * interior or boundary face.
@@ -220,22 +214,6 @@ namespace MeshWorker
       separate_faces = sep;
     }
 
-    template <typename number>
-    inline void
-    CellsAndFaces<number>::initialize(NamedData<BlockVector<number>*> &r, bool sep)
-    {
-      Assert(r.name(0) == "cells", AnyData::ExcNameMismatch(0, "cells"));
-      if (sep)
-        {
-          Assert(r.name(1) == "faces", AnyData::ExcNameMismatch(1, "faces"));
-          AssertDimension(r(0)->n_blocks(),r(1)->n_blocks());
-        }
-
-      results = r;
-      separate_faces = sep;
-    }
-
-
     template <typename number>
     template <class DOFINFO>
     inline void
index 98b8e7d60480068a35f8696468b60b1feabc6dbd..c8e67c7f63e771c1cbb3ff87cc89e144e3a59694 100644 (file)
@@ -317,21 +317,17 @@ namespace MeshWorker
                     const VECTOR &dummy,
                     const BlockInfo *block_info = 0);
     /**
-     * @deprecated Use AnyData instead of NamedData.
-     */
-    template <typename VECTOR>
-    void initialize(const FiniteElement<dim, spacedim> &el,
-                    const Mapping<dim, spacedim> &mapping,
-                    const NamedData<VECTOR *> &data,
-                    const BlockInfo *block_info = 0);
-
-    /**
-     * @deprecated Use AnyData instead of NamedData.
+     * Initialize the IntegrationInfo objects contained.
+     *
+     * Before doing so, add update flags necessary to produce the data needed
+     * and also set uninitialized quadrature rules to Gauss formulas, which
+     * integrate polynomial bilinear forms exactly.
      */
     template <typename VECTOR>
     void initialize(const FiniteElement<dim, spacedim> &el,
                     const Mapping<dim, spacedim> &mapping,
-                    const NamedData<MGLevelObject<VECTOR>*> &data,
+                    const AnyData &data,
+                    const MGLevelObject<VECTOR> &dummy,
                     const BlockInfo *block_info = 0);
     /**
      * @name FEValues setup
@@ -813,69 +809,43 @@ namespace MeshWorker
     neighbor.initialize_data(p);
   }
 
-
-  template <int dim, int sdim>
-  template <typename VECTOR>
-  void
-  IntegrationInfoBox<dim,sdim>::initialize(
-    const FiniteElement<dim,sdim> &el,
-    const Mapping<dim,sdim> &mapping,
-    const NamedData<VECTOR *> &data,
-    const BlockInfo *block_info)
-  {
-    initialize(el, mapping, block_info);
-    std_cxx11::shared_ptr<VectorData<VECTOR, dim, sdim> > p;
-
-    p = std_cxx11::shared_ptr<VectorData<VECTOR, dim, sdim> >(new VectorData<VECTOR, dim, sdim> (cell_selector));
-    p->initialize(data);
-    cell_data = p;
-    cell.initialize_data(p);
-
-    p = std_cxx11::shared_ptr<VectorData<VECTOR, dim, sdim> >(new VectorData<VECTOR, dim, sdim> (boundary_selector));
-    p->initialize(data);
-    boundary_data = p;
-    boundary.initialize_data(p);
-
-    p = std_cxx11::shared_ptr<VectorData<VECTOR, dim, sdim> >(new VectorData<VECTOR, dim, sdim> (face_selector));
-    p->initialize(data);
-    face_data = p;
-    face.initialize_data(p);
-    subface.initialize_data(p);
-    neighbor.initialize_data(p);
-  }
-
-
   template <int dim, int sdim>
   template <typename VECTOR>
   void
   IntegrationInfoBox<dim,sdim>::initialize(
     const FiniteElement<dim,sdim> &el,
     const Mapping<dim,sdim> &mapping,
-    const NamedData<MGLevelObject<VECTOR>*> &data,
+    const AnyData &data,
+    const MGLevelObject<VECTOR> &dummy,
     const BlockInfo *block_info)
   {
     initialize(el, mapping, block_info);
     std_cxx11::shared_ptr<MGVectorData<VECTOR, dim, sdim> > p;
+    VectorDataBase<dim,sdim> *pp;
 
     p = std_cxx11::shared_ptr<MGVectorData<VECTOR, dim, sdim> >(new MGVectorData<VECTOR, dim, sdim> (cell_selector));
-    p->initialize(data);
+    // Public member function of parent class was not found without
+    // explicit cast
+    pp = &*p;
+    pp->initialize(data);
     cell_data = p;
     cell.initialize_data(p);
 
     p = std_cxx11::shared_ptr<MGVectorData<VECTOR, dim, sdim> >(new MGVectorData<VECTOR, dim, sdim> (boundary_selector));
-    p->initialize(data);
+    pp = &*p;
+    pp->initialize(data);
     boundary_data = p;
     boundary.initialize_data(p);
 
     p = std_cxx11::shared_ptr<MGVectorData<VECTOR, dim, sdim> >(new MGVectorData<VECTOR, dim, sdim> (face_selector));
-    p->initialize(data);
+    pp = &*p;
+    pp->initialize(data);
     face_data = p;
     face.initialize_data(p);
     subface.initialize_data(p);
     neighbor.initialize_data(p);
   }
 
-
   template <int dim, int sdim>
   template <class DOFINFO>
   void
index 683e401999ed32c859fe9f7fb2404360a7853378..b5d7f8618cc9fca34c0512644f2623a3cabbe768 100644 (file)
@@ -18,7 +18,6 @@
 #define __deal2__mesh_worker_output_h
 
 #include <deal.II/meshworker/dof_info.h>
-#include <deal.II/base/named_data.h>
 #include <deal.II/base/smartpointer.h>
 #include <deal.II/base/utilities.h>
 #include <deal.II/lac/block_vector.h>
index 2f33e91b8346c21c6f76b15b6ae6d650b52171e9..063706284d70156f47277c405f52557f489e77fd 100644 (file)
@@ -17,7 +17,6 @@
 #ifndef __deal2__mesh_worker_simple_h
 #define __deal2__mesh_worker_simple_h
 
-#include <deal.II/base/named_data.h>
 #include <deal.II/algorithms/any_data.h>
 #include <deal.II/base/smartpointer.h>
 #include <deal.II/base/mg_level_object.h>
@@ -63,10 +62,6 @@ namespace MeshWorker
        */
       void initialize(AnyData &results);
 
-      /**
-       * @deprecated Use initialize(AnyData&) instead.
-       */
-      void initialize(NamedData<VECTOR *> &results);
       /**
        * Initialize the constraints.
        */
@@ -487,13 +482,6 @@ namespace MeshWorker
       residuals = results;
     }
 
-    template <class VECTOR>
-    inline void
-    ResidualSimple<VECTOR>::initialize(NamedData<VECTOR *> &results)
-    {
-      residuals = results;
-    }
-
     template <class VECTOR>
     inline void
     ResidualSimple<VECTOR>::initialize(const ConstraintMatrix &c)
index 125c79f2fed1acf4baeb3990877b1b78f7c2c1c0..c805e8af63a415d865ded99097555768814d4ac6 100644 (file)
@@ -16,8 +16,8 @@
 #ifndef __deal2__mesh_worker_vector_selector_h
 #define __deal2__mesh_worker_vector_selector_h
 
-#include <deal.II/base/named_data.h>
 #include <deal.II/algorithms/any_data.h>
+#include <deal.II/algorithms/named_selection.h>
 #include <deal.II/base/tensor.h>
 #include <deal.II/base/smartpointer.h>
 #include <deal.II/base/mg_level_object.h>
@@ -81,12 +81,6 @@ namespace MeshWorker
      */
     void initialize(const AnyData &);
 
-    /**
-     * @deprecated Use AnyData instead of NamedData.
-     */
-    template <class DATA>
-    void initialize(const NamedData<DATA> &);
-
     /**
      * Check whether any vector is selected.
      */
@@ -143,12 +137,6 @@ namespace MeshWorker
     template <class STREAM, typename DATA>
     void print (STREAM &s, const AnyData &v) const;
 
-    /**
-     * @deprecated Use AnyData instead of NamedData.
-     */
-    template <class STREAM, typename DATA>
-    void print (STREAM &s, const NamedData<DATA> &v) const;
-
     /**
      * Print the number of selections to the stream.
      */
@@ -311,9 +299,9 @@ namespace MeshWorker
     VectorData(const VectorSelector &);
 
     /**
-     * @deprecated Use AnyData instead of NamedData.
+     * Initialize with an object of named vectors.
      */
-    void initialize(const NamedData<VECTOR *> &);
+    void initialize(const AnyData &);
 
     /**
      * Initialize with a single vector and cache the indices in the
@@ -377,9 +365,9 @@ namespace MeshWorker
     MGVectorData(const VectorSelector &);
 
     /**
-     * @deprecated Use AnyData instead of NamedData.
+     * Initialize with an object of named vectors
      */
-    void initialize(const NamedData<MGLevelObject<VECTOR>*> &);
+    void initialize(const AnyData &);
 
     /**
      * Initialize with a single vector and cache the indices in the
@@ -434,15 +422,6 @@ namespace MeshWorker
     hessian_selection.initialize(src);
   }
 
-  template <typename DATA>
-  inline void
-  VectorSelector::initialize(const NamedData<DATA> &src)
-  {
-    value_selection.initialize(src);
-    gradient_selection.initialize(src);
-    hessian_selection.initialize(src);
-  }
-
   inline bool
   VectorSelector::empty() const
   {
@@ -543,23 +522,6 @@ namespace MeshWorker
   }
 
 
-  template <class STREAM, typename DATA>
-  inline void
-  VectorSelector::print(STREAM &s, const NamedData<DATA> &v) const
-  {
-    s << "values:   ";
-    for (unsigned int i=0; i<n_values(); ++i)
-      s << " '" << v.name(value_selection(i)) << '\'';
-    s << std::endl << "gradients:";
-    for (unsigned int i=0; i<n_gradients(); ++i)
-      s << " '" << v.name(gradient_selection(i)) << '\'';
-    s << std::endl << "hessians: ";
-    for (unsigned int i=0; i<n_hessians(); ++i)
-      s << " '" << v.name(hessian_selection(i)) << '\'';
-    s << std::endl;
-  }
-
-
   inline
   std::size_t
   VectorSelector::memory_consumption () const
index b1720737286752a16c951d578f18545a8f6a527d..6c45048a9286666e454765242a242a54e83297c0 100644 (file)
@@ -99,7 +99,7 @@ namespace MeshWorker
 
   template <class VECTOR, int dim, int spacedim>
   void
-  VectorData<VECTOR, dim, spacedim>::initialize(const NamedData<VECTOR *> &d)
+  VectorData<VECTOR, dim, spacedim>::initialize(const AnyData &d)
   {
     this->data = d;
     VectorSelector::initialize(d);
@@ -182,7 +182,7 @@ namespace MeshWorker
 
   template <class VECTOR, int dim, int spacedim>
   void
-  MGVectorData<VECTOR, dim, spacedim>::initialize(const NamedData<MGLevelObject<VECTOR>*> &d)
+  MGVectorData<VECTOR, dim, spacedim>::initialize(const AnyData &d)
   {
     this->data = d;
     VectorSelector::initialize(d);
index 1dcb6923b42ad00f9c49a42aa7c70e81f91d3cf8..eeb51bd37dd40251d01455fe9ec9dea8d7451c73 100644 (file)
@@ -19,7 +19,6 @@
 
 #include <deal.II/base/config.h>
 #include <deal.II/base/parameter_handler.h>
-#include <deal.II/base/named_data.h>
 #include <deal.II/algorithms/any_data.h>
 #include <deal.II/base/event.h>
 #include <deal.II/algorithms/operator.h>
index a5495d4ae0e71d2f2973a767b90698b2ba935b07..cd85e6c26b94b9974611946959a356b371a32f3e 100644 (file)
@@ -13,7 +13,7 @@
 //
 // ---------------------------------------------------------------------
 
-#include <deal.II/base/named_data.h>
+#include <deal.II/algorithms/named_selection.h>
 #include <deal.II/algorithms/any_data.h>
 
 DEAL_II_NAMESPACE_OPEN
index f6f3ff26a623693911f4921bcb08da8adb0833ad..765866531daae48cb0115d2e2d909fee391ae915 100644 (file)
@@ -18,7 +18,6 @@
 #include <deal.II/algorithms/operator.h>
 #include <deal.II/algorithms/newton.h>
 #include <deal.II/numerics/vector_tools.h>
-#include <deal.II/base/named_data.h>
 
 
 //test computing square root of 2 with newton's method
@@ -101,19 +100,18 @@ void test ()
     sq_solver);
   newton.initialize(output);
 
-  NamedData<Vector<double>*> in_data;
-  NamedData<Vector<double>*> out_data;
+  AnyData in_data;
+  AnyData out_data;
 
   Vector<double> solution (1);
   solution = 10.;
-  Vector<double> *p = &solution;
-  out_data.add(p, "solution");
+  out_data.add<Vector<double>*>(&solution, "solution");
 
   newton.control.set_reduction(1.e-20);
   newton.control.log_history(true);
   newton.debug_vectors = true;
   newton(out_data, in_data);
-  deallog << " square root " << (*out_data(0))(0) << std::endl;
+  deallog << " square root " << (*out_data.read<Vector<double>*>(0))(0) << std::endl;
 }
 
 
diff --git a/tests/algorithms/newton_01_compat.cc b/tests/algorithms/newton_01_compat.cc
deleted file mode 100644 (file)
index 689f5e1..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 2008 - 2014 by the deal.II authors
-//
-// This file is part of the deal.II library.
-//
-// The deal.II library is free software; you can use it, redistribute
-// it, and/or modify it under the terms of the GNU Lesser General
-// Public License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// The full text of the license can be found in the file LICENSE at
-// the top level of the deal.II distribution.
-//
-// ---------------------------------------------------------------------
-
-
-#include "../tests.h"
-#include <deal.II/algorithms/operator.h>
-#include <deal.II/algorithms/newton.h>
-#include <deal.II/numerics/vector_tools.h>
-#include <deal.II/base/named_data.h>
-
-
-//test computing square root of 2 with newton's method
-
-using namespace dealii;
-
-class SquareRoot : public Subscriptor
-{
-public:
-  void start_vector (Vector<double> &start) const;
-  void residual (NamedData<Vector<double>*> &out,
-                 const NamedData<Vector<double>*> &in);
-  void solve (NamedData<Vector<double>*> &out,
-              const NamedData<Vector<double>*> &in);
-};
-
-class SquareRootResidual : public
-  Algorithms::Operator<Vector<double> >
-{
-  SmartPointer<SquareRoot, SquareRootResidual>
-  discretization;
-public:
-
-  SquareRootResidual(SquareRoot &problem)
-    : discretization(&problem)
-  {}
-
-  virtual void operator ()(
-    NamedData<Vector<double>*> &out,
-    const NamedData<Vector<double>*> &in)
-  {
-    discretization->residual(out,in);
-  }
-};
-
-class SquareRootSolver : public
-  Algorithms::Operator<Vector<double> >
-{
-  SmartPointer<SquareRoot, SquareRootSolver>
-  solver;
-public:
-
-  SquareRootSolver(SquareRoot &problem)
-    : solver(&problem)
-  {}
-
-  virtual void operator ()(
-    NamedData<Vector<double>*> &out,
-    const NamedData<Vector<double>*> &in)
-  {
-    solver->solve(out,in);
-  }
-};
-
-void SquareRoot::residual (
-  NamedData<Vector<double>*> &out,
-  const NamedData<Vector<double>*> &in)
-{
-  //residuum = 0
-  *out(0) = 0.;
-  const Vector<double> &x = *in(in.find("Newton iterate"));
-  *out(0) = x*x - 2.;
-}
-
-void SquareRoot::solve (
-  NamedData<Vector<double>*> &out,
-  const NamedData<Vector<double>*> &in)
-{
-  *out(0) = 0;
-  const Vector<double> &x = *in(in.find("Newton iterate"));
-  const Vector<double> &r = *in(in.find("Newton residual"));
-
-  (*out(0))(0) = 1./2./x(0)* r(0);
-}
-
-
-
-void test ()
-{
-  SquareRoot square_root;
-  SquareRootSolver sq_solver (square_root);
-  SquareRootResidual sq_residual (square_root);
-
-  Algorithms::OutputOperator<Vector<double> > output;
-
-  Algorithms::Newton<Vector<double> > newton(
-    sq_residual,
-    sq_solver);
-  newton.initialize(output);
-
-  NamedData<Vector<double>*> in_data;
-  NamedData<Vector<double>*> out_data;
-
-  Vector<double> solution (1);
-  solution = 10.;
-  Vector<double> *p = &solution;
-  out_data.add(p, "solution");
-
-  newton.control.set_reduction(1.e-20);
-  newton.control.log_history(true);
-  newton.debug_vectors = true;
-  newton(out_data, in_data);
-  deallog << " square root " << (*out_data(0))(0) << std::endl;
-}
-
-
-
-
-int main()
-{
-  std::string logname = "output";
-  std::ofstream logfile(logname.c_str());
-  deallog.attach(logfile);
-  deallog.depth_console(0);
-  deallog.threshold_double(1.e-10);
-
-  test ();
-}
diff --git a/tests/algorithms/newton_01_compat.output b/tests/algorithms/newton_01_compat.output
deleted file mode 100644 (file)
index 62ce10a..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-
-DEAL:Newton::Step 0
-DEAL:Newton::solution 10.0000
-DEAL:Newton::update
-DEAL:Newton::residual 98.0000
-DEAL:Newton::
-DEAL:Newton::Check 0   98.0000
-DEAL:Newton::Starting value 98.0000
-DEAL:Newton::Step 1
-DEAL:Newton::solution 10.0000
-DEAL:Newton::update 4.90000
-DEAL:Newton::residual 98.0000
-DEAL:Newton::
-DEAL:Newton::Check 1   24.0100
-DEAL:Newton::Step 2
-DEAL:Newton::solution 5.10000
-DEAL:Newton::update 2.35392
-DEAL:Newton::residual 24.0100
-DEAL:Newton::
-DEAL:Newton::Check 2   5.54095
-DEAL:Newton::Step 3
-DEAL:Newton::solution 2.74608
-DEAL:Newton::update 1.00888
-DEAL:Newton::residual 5.54095
-DEAL:Newton::
-DEAL:Newton::Check 3   1.01785
-DEAL:Newton::Step 4
-DEAL:Newton::solution 1.73719
-DEAL:Newton::update 0.292957
-DEAL:Newton::residual 1.01785
-DEAL:Newton::
-DEAL:Newton::Check 4   0.0858237
-DEAL:Newton::Step 5
-DEAL:Newton::solution 1.44424
-DEAL:Newton::update 0.0297124
-DEAL:Newton::residual 0.0858237
-DEAL:Newton::
-DEAL:Newton::Check 5   0.000882829
-DEAL:Newton::Step 6
-DEAL:Newton::solution 1.41453
-DEAL:Newton::update 0.000312058
-DEAL:Newton::residual 0.000882829
-DEAL:Newton::
-DEAL:Newton::Check 6   9.73804e-08
-DEAL:Newton::Step 7
-DEAL:Newton::solution 1.41421
-DEAL:Newton::update 3.44292e-08
-DEAL:Newton::residual 9.73804e-08
-DEAL:Newton::
-DEAL:Newton::Check 7   0
-DEAL:Newton::Convergence step 7 value 0
-DEAL:: square root 1.41421
diff --git a/tests/algorithms/operator_compatibility.cc b/tests/algorithms/operator_compatibility.cc
deleted file mode 100644 (file)
index 83db98b..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 2008 - 2014 by the deal.II authors
-//
-// This file is part of the deal.II library.
-//
-// The deal.II library is free software; you can use it, redistribute
-// it, and/or modify it under the terms of the GNU Lesser General
-// Public License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// The full text of the license can be found in the file LICENSE at
-// the top level of the deal.II distribution.
-//
-// ---------------------------------------------------------------------
-
-// Test the compatibility functionality for Operator::operator()
-
-#include "../tests.h"
-#include <deal.II/algorithms/operator.h>
-#include <deal.II/lac/vector.h>
-
-using namespace Algorithms;
-
-class Op1 : public Operator<Vector<double> >
-{
-  public:
-  virtual void operator() (AnyData& out, const AnyData& in)
-  {
-    Vector<double>* u = out.entry<Vector<double>*>("u");
-    deallog << "u " << (*u)(0) << std::endl;
-    
-    const Vector<double>* v = in.entry<Vector<double>*>("v");
-    deallog << "v " << (*v)(0) << std::endl;
-  }
-};
-
-class Op2 : public Operator<Vector<double> >
-{
-  public:
-  virtual void operator() (NamedData<Vector<double>*>& out,
-                          const NamedData<Vector<double>*>& in)
-  {
-    Vector<double>* u = out(out.find("u"));
-    deallog << "u " << (*u)(0) << std::endl;
-    
-    const Vector<double> * const v = in(in.find("v"));
-    deallog << "v " << (*v)(0) << std::endl;
-  }
-};
-
-void test(Operator<Vector<double> >& op)
-{
-  Vector<double> u(1);
-  Vector<double>* p = &u;
-  Vector<double> v(1);
-  u(0) = 3.;
-  v(0) = 7.;
-  
-  AnyData o1;
-  o1.add (p, "u");
-  AnyData i1;
-  i1.add (&v, "v");
-  
-  NamedData<Vector<double>*> o2;
-  o2.add (p, "u");
-  NamedData<Vector<double>*> i2;
-  i2.add (&v, "v");
-  
-  deallog << "Call with AnyData" << std::endl;
-  op(o1, i1);
-  deallog << "Call with NamedData" << std::endl;
-  op(o2, i2);
-}
-
-int main()
-{
-  //  deal_II_exceptions::disable_abort_on_exception();
-  
-  std::ofstream logfile("output");
-  deallog.attach(logfile);
-  deallog.depth_console(0);
-  
-  deallog << "Operator with AnyData" << std::endl;
-  Op1 op1;
-  test(op1);
-  
-  deallog << "Operator with NamedData" << std::endl;
-  Op2 op2;
-  test(op2);
-
-  // deallog << "Operator with NamedData" << std::endl;
-  // Op2 op2;
-  // test(op1);
-}
diff --git a/tests/algorithms/operator_compatibility.output b/tests/algorithms/operator_compatibility.output
deleted file mode 100644 (file)
index 97807d9..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-
-DEAL::Operator with AnyData
-DEAL::Call with AnyData
-DEAL::u 3.00000
-DEAL::v 7.00000
-DEAL::Call with NamedData
-DEAL::u 3.00000
-DEAL::v 7.00000
-DEAL::Operator with NamedData
-DEAL::Call with AnyData
-DEAL::u 3.00000
-DEAL::v 7.00000
-DEAL::Call with NamedData
-DEAL::u 3.00000
-DEAL::v 7.00000
diff --git a/tests/algorithms/theta_01_compat.cc b/tests/algorithms/theta_01_compat.cc
deleted file mode 100644 (file)
index e9c51fe..0000000
+++ /dev/null
@@ -1,165 +0,0 @@
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 2005 - 2015 by the deal.II authors
-//
-// This file is part of the deal.II library.
-//
-// The deal.II library is free software; you can use it, redistribute
-// it, and/or modify it under the terms of the GNU Lesser General
-// Public License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// The full text of the license can be found in the file LICENSE at
-// the top level of the deal.II distribution.
-//
-// ---------------------------------------------------------------------
-
-
-// See documentation of ThetaTimestepping for documentation of this example
-
-#include <deal.II/base/logstream.h>
-#include <deal.II/lac/vector.h>
-#include <deal.II/lac/full_matrix.h>
-
-#include <deal.II/algorithms/operator.h>
-#include <deal.II/algorithms/theta_timestepping.h>
-
-#include <iostream>
-
-using namespace dealii;
-using namespace Algorithms;
-
-
-class Explicit
-  : public Operator<Vector<double> >
-{
-public:
-  Explicit(const FullMatrix<double> &matrix);
-  void operator() (NamedData<Vector<double>*> &out,
-                   const NamedData<Vector<double>*> &in);
-
-  void initialize_timestep_data(const TimestepData &);
-private:
-  const TimestepData *timestep_data;
-  SmartPointer<const FullMatrix<double>, Explicit> matrix;
-  FullMatrix<double> m;
-};
-
-
-class Implicit
-  : public Operator<Vector<double> >
-{
-public:
-  Implicit(const FullMatrix<double> &matrix);
-  void operator() (NamedData<Vector<double>*> &out,
-                   const NamedData<Vector<double>*> &in);
-
-  void initialize_timestep_data(const TimestepData &);
-private:
-  const TimestepData *timestep_data;
-  SmartPointer<const FullMatrix<double>, Implicit> matrix;
-  FullMatrix<double> m;
-};
-
-// End of declarations
-
-int main()
-{
-  std::string logname = "output";
-  std::ofstream logfile(logname.c_str());
-  deallog.attach(logfile);
-  deallog.depth_console(0);
-  deallog.threshold_double(1.e-10);
-
-  FullMatrix<double> matrix(2);
-  matrix(0,0) = 0.;
-  matrix(1,1) = 0.;
-  matrix(0,1) = numbers::PI;
-  matrix(1,0) = -numbers::PI;
-
-  OutputOperator<Vector<double> > out;
-  out.initialize_stream(logfile);
-
-  Explicit op_explicit(matrix);
-  Implicit op_implicit(matrix);
-  ThetaTimestepping<Vector<double> > solver(op_explicit, op_implicit);
-  op_explicit.initialize_timestep_data(solver.explicit_data());
-  op_implicit.initialize_timestep_data(solver.implicit_data());
-  solver.timestep_control().start_step(0.1);
-  //solver.set_output(out);
-
-  Vector<double> value(2);
-  value(0) = 1.;
-  NamedData<Vector<double>*> indata;
-  NamedData<Vector<double>*> outdata;
-  Vector<double> *p = &value;
-  outdata.add(p, "value");
-  deallog << "Initial: " << value(0) << ' ' << value(1) << std::endl;
-  solver.notify(Events::initial);
-  solver.Operator<Vector<double> >::operator()(outdata, indata);
-  deallog << "Result: " << value(0) << ' ' << value(1)
-         << " Norm " << value.l2_norm() << std::endl;
-}
-
-
-Explicit::Explicit(const FullMatrix<double> &M)
-  :
-  matrix(&M)
-{
-  m.reinit(M.m(), M.n());
-}
-
-
-void
-Explicit::initialize_timestep_data(const TimestepData &t)
-{
-  timestep_data = &t;
-}
-
-
-void
-Explicit::operator() (NamedData<Vector<double>*> &out, const NamedData<Vector<double>*> &in)
-{
-  if (this->notifications.test(Events::initial) || this->notifications.test(Events::new_timestep_size))
-    {
-      m.equ(-timestep_data->step, *matrix);
-      for (unsigned int i=0; i<m.m(); ++i)
-        m(i,i) += 1.;
-    }
-  this->notifications.clear();
-  unsigned int i = in.find("Previous iterate");
-  m.vmult(*out(0), *in(i));
-}
-
-
-Implicit::Implicit(const FullMatrix<double> &M)
-  :
-  matrix(&M)
-{
-  m.reinit(M.m(), M.n());
-}
-
-
-void
-Implicit::initialize_timestep_data(const TimestepData &t)
-{
-  timestep_data = &t;
-}
-
-
-void
-Implicit::operator() (NamedData<Vector<double>*> &out, const NamedData<Vector<double>*> &in)
-{
-  if (this->notifications.test(Events::initial) || this->notifications.test(Events::new_timestep_size))
-    {
-      m.equ(timestep_data->step, *matrix);
-      for (unsigned int i=0; i<m.m(); ++i)
-        m(i,i) += 1.;
-      m.gauss_jordan();
-    }
-  this->notifications.clear();
-
-  unsigned int i = in.find("Previous time");
-  m.vmult(*out(0), *in(i));
-}
-
-
diff --git a/tests/algorithms/theta_01_compat.output b/tests/algorithms/theta_01_compat.output
deleted file mode 100644 (file)
index 7c4d9dd..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-
-DEAL::Initial: 1.00000 0
-DEAL:Theta::Time step:0.100000
-DEAL:Theta::Time step:0.200000
-DEAL:Theta::Time step:0.300000
-DEAL:Theta::Time step:0.400000
-DEAL:Theta::Time step:0.500000
-DEAL:Theta::Time step:0.600000
-DEAL:Theta::Time step:0.700000
-DEAL:Theta::Time step:0.800000
-DEAL:Theta::Time step:0.900000
-DEAL:Theta::Time step:1.00000
-DEAL::Result: -0.999676 0.0254599 Norm 1.00000
diff --git a/tests/base/named_data.cc b/tests/base/named_data.cc
deleted file mode 100644 (file)
index 7a68ad3..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 2000 - 2015 by the deal.II authors
-//
-// This file is part of the deal.II library.
-//
-// The deal.II library is free software; you can use it, redistribute
-// it, and/or modify it under the terms of the GNU Lesser General
-// Public License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// The full text of the license can be found in the file LICENSE at
-// the top level of the deal.II distribution.
-//
-// ---------------------------------------------------------------------
-
-
-
-#include "../tests.h"
-#include <deal.II/base/named_data.h>
-#include <deal.II/base/logstream.h>
-
-#include <fstream>
-#include <boost/shared_ptr.hpp>
-
-template<typename DATA>
-void
-test_const(const NamedData<DATA> &data)
-{
-  NamedData<DATA> newdata;
-  newdata.merge(data);
-  data.print(deallog);
-
-  deallog << "Const should be true: " << (newdata.is_const() ? "true" : "false") << std::endl;
-}
-
-template<typename DATA>
-void
-test_selector(const NamedData<DATA> &data)
-{
-  NamedSelection select;
-  select.add("P1");
-  select.add("P6");
-  select.add("P5");
-  select.add("P3");
-  select.initialize(data);
-
-  for (unsigned int i=0; i<select.size(); ++i)
-    {
-      deallog << "Selection " << i << ':';
-      if (select(i) != numbers::invalid_unsigned_int)
-        deallog << data.name(select(i)) << ' ' << *data(select(i));
-      deallog << std::endl;
-    }
-}
-
-void
-test_shared_pointer()
-{
-  NamedData<std_cxx11::shared_ptr<double> > data;
-  deallog << "const" << data.is_const() << std::endl;
-  std_cxx11::shared_ptr<double> p = std_cxx11::shared_ptr<double>(new double);
-  data.add(p, "P1");
-  p = std_cxx11::shared_ptr<double>(new double);
-  data.add(p, "P2");
-  p = std_cxx11::shared_ptr<double>(new double);
-  data.add(p, "P3");
-  p = std_cxx11::shared_ptr<double>(new double);
-  data.add(p, "P4");
-  p = std_cxx11::shared_ptr<double>(new double);
-  data.add(p, "P5");
-
-  for (unsigned int i=0; i<data.size(); ++i)
-    *data(i) = i+0.5;
-
-  test_const(data);
-  test_selector(data);
-}
-
-
-int main ()
-{
-  std::ofstream logfile("output");
-  deallog.attach(logfile);
-  deallog.depth_console(0);
-//  deallog.log_cerr();
-
-  test_shared_pointer();
-}
diff --git a/tests/base/named_data.output b/tests/base/named_data.output
deleted file mode 100644 (file)
index 2576662..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-
-DEAL::const0
-DEAL::NamedData: "P1" "P2" "P3" "P4" "P5"
-DEAL::Const should be true: true
-DEAL::Selection 0:P1 0.500000
-DEAL::Selection 1:
-DEAL::Selection 2:P5 4.50000
-DEAL::Selection 3:P3 2.50000
index 1d7befecaecf0d2ceb4f14c8061fb79bca097f82..1949f8b07ea280fad01e3a0ca6343b453e1d137f 100644 (file)
@@ -99,11 +99,9 @@ test_mesh(DoFHandler<dim> &mgdofs)
   cells.collect_sizes();
   faces.collect_sizes();
 
-  NamedData<BlockVector<double>* > out_data;
-  BlockVector<double> *p = &cells;
-  out_data.add(p, "cells");
-  p = &faces;
-  out_data.add(p, "faces");
+  AnyData out_data;
+  out_data.add<BlockVector<double>*>(&cells, "cells");
+  out_data.add<BlockVector<double>*>(&faces, "faces");
 
   Local<dim> local;
   EmptyInfoBox info_box;
index e0b1ec868fcd4bfe215a3c41c0daf07f26fd7cc0..7fa8b6a749dbe1e18c1b19ac87c142eca42f45f2 100644 (file)
@@ -25,7 +25,7 @@
 #include <deal.II/lac/matrix_block.h>
 #include <deal.II/lac/sparse_matrix.h>
 #include <deal.II/lac/block_sparsity_pattern.h>
-#include <deal.II/lac/compressed_sparsity_pattern.h>
+#include <deal.II/lac/dynamic_sparsity_pattern.h>
 #include <deal.II/lac/solver_cg.h>
 #include <deal.II/lac/precondition.h>
 
@@ -109,8 +109,8 @@ test_cochain(const Triangulation<dim> &tr, const FiniteElement<dim> &fe)
   BlockSparsityPattern sparsity;
   sparsity.reinit(dof.block_info().global().size(),
                   dof.block_info().global().size());
-  BlockCompressedSparsityPattern c_sparsity(dof.block_info().global(),
-                                            dof.block_info().global());
+  BlockDynamicSparsityPattern c_sparsity(dof.block_info().global(),
+                                        dof.block_info().global());
   DoFTools::make_flux_sparsity_pattern(dof, c_sparsity, constraints, false);
   sparsity.copy_from(c_sparsity);
 
index 61f13f3c9c3cd9ab566ff67b8ddbc1b0ea2e7aea..e253cc3d041e9bfbee9967a212022f7f4b1683e8 100644 (file)
@@ -230,25 +230,22 @@ namespace Advection
 
     info_box.add_update_flags(update_flags, true, true, true, true);
 
-    NamedData<Vector<double>* > solution_data;
+    AnyData solution_data;
 
-    Vector<double> *u = &solution;
-
-    solution_data.add(u, "solution");
+    solution_data.add<Vector<double>* >(&solution, "solution");
     info_box.cell_selector.add("solution", true, true, false);
     info_box.boundary_selector.add("solution", true, false, false);
     info_box.face_selector.add("solution", true, false, false);
 
-    info_box.initialize(fe, mapping, solution_data);
+    info_box.initialize(fe, mapping, solution_data, solution);
 
 //deallog<<"\nWe are now going to attend construction of  MeshWorker::DoFInfo..."<<std::endl;
     MeshWorker::DoFInfo<dim> dof_info(dof_handler);
 //deallog<<"\nApparently it DoFInfo was constructed fine!"<<std::endl;
 
     MeshWorker::Assembler::ResidualSimple<Vector<double> > assembler;
-    NamedData<Vector<double>* > data;
-    Vector<double> *rhs = &residual;
-    data.add(rhs, "Residual");
+    AnyData data;
+    data.add<Vector<double>* >(&residual, "Residual");
     assembler.initialize(data);
 
     MeshWorker::LoopControl lctrl;
index 9bc6e7195bf506760ec1e5819bea0cb19ec70144..4b9c9d714595851516e1076089d20458e76bc831 100644 (file)
@@ -119,7 +119,7 @@ void diff (Vector<double> &diff, const DoFHandler<dim> &dof,
 {
   diff.reinit (v);
   const unsigned int dofs_per_cell = dof.get_fe().dofs_per_cell;
-  std::vector<unsigned int> mg_dof_indices(dofs_per_cell);
+  std::vector<types::global_dof_index> mg_dof_indices(dofs_per_cell);
   const unsigned int n_comp = dof.get_fe().n_components();
   for (typename DoFHandler<dim>::cell_iterator
        cell= dof.begin(level);
@@ -248,10 +248,10 @@ LaplaceProblem<dim>::output_gpl(const DoFHandler<dim> &dof,
   UpdateFlags update_flags = update_quadrature_points | update_values | update_gradients;
   info_box.add_update_flags(update_flags, true, true, true, true);
 
-  NamedData<MGLevelObject<Vector<double> >* > data;
-  data.add(&v, "mg_vector");
+  AnyData data;
+  data.add<MGLevelObject<Vector<double> >* >(&v, "mg_vector");
   info_box.cell_selector.add("mg_vector");
-  info_box.initialize(fe, mapping, data);
+  info_box.initialize(fe, mapping, data, v);
 
   MeshWorker::DoFInfo<dim> dof_info(dof);
 
index 9a9e0860fde48c3ce22e06affab7b0bdc110eab8..57e0f2406b318e8700b4e33a6900442fc6d20a39 100644 (file)
@@ -233,7 +233,7 @@ private:
   DoFHandler<dim>    mg_dof_handler_renumbered;
 
   const unsigned int degree;
-  std::vector<std::set<unsigned int> >
+    std::vector<std::set<types::global_dof_index> >
   boundary_indices, boundary_indices_renumbered;
 
 };
@@ -293,13 +293,13 @@ LaplaceProblem<dim>::output_gpl(const DoFHandler<dim> &dof,
   QTrapez<1> trapez;
   QIterated<dim> quadrature(trapez, n_gauss_points);
   info_box.cell_quadrature = quadrature;
-  NamedData<MGLevelObject<Vector<double> >* > data;
-  data.add(&v, "mg_vector");
+  AnyData data;
+  data.add<MGLevelObject<Vector<double> >* >(&v, "mg_vector");
   info_box.cell_selector.add("mg_vector");
   info_box.initialize_update_flags();
   UpdateFlags update_flags = update_quadrature_points | update_values | update_gradients;
   info_box.add_update_flags(update_flags, true, true, true, true);
-  info_box.initialize(fe, mapping, data);
+  info_box.initialize(fe, mapping, data, v);
 
   MeshWorker::DoFInfo<dim> dof_info(dof);
 
index f3356e06152fe81b71ed2601eaaf109410404273..45bf0239e88f7aa5f316bc8c927ab1a4754eafeb 100644 (file)
@@ -18,7 +18,7 @@
 
 #include "../tests.h"
 #include <deal.II/lac/sparse_matrix.h>
-#include <deal.II/lac/compressed_sparsity_pattern.h>
+#include <deal.II/lac/dynamic_sparsity_pattern.h>
 #include <deal.II/lac/solver_cg.h>
 #include <deal.II/lac/precondition.h>
 #include <deal.II/lac/precondition_block.h>
@@ -358,8 +358,7 @@ namespace Step39
     Triangulation<dim>        triangulation;
     const MappingQ1<dim>      mapping;
     const FiniteElement<dim> &fe;
-    DoFHandler<dim>         mg_dof_handler;
-    DoFHandler<dim>          &dof_handler;
+    DoFHandler<dim>           dof_handler;
 
     SparsityPattern      sparsity;
     SparseMatrix<double> matrix;
@@ -382,8 +381,7 @@ namespace Step39
     :
     mapping(),
     fe(fe),
-    mg_dof_handler(triangulation),
-    dof_handler(mg_dof_handler),
+    dof_handler(triangulation),
     estimates(1)
   {
     GridGenerator::hyper_cube_slit(triangulation, -1, 1);
@@ -400,9 +398,9 @@ namespace Step39
     solution.reinit(n_dofs);
     right_hand_side.reinit(n_dofs);
 
-    CompressedSparsityPattern c_sparsity(n_dofs);
-    DoFTools::make_flux_sparsity_pattern(dof_handler, c_sparsity);
-    sparsity.copy_from(c_sparsity);
+    DynamicSparsityPattern dsp(n_dofs);
+    DoFTools::make_flux_sparsity_pattern(dof_handler, dsp);
+    sparsity.copy_from(dsp);
     matrix.reinit(sparsity);
 
     const unsigned int n_levels = triangulation.n_levels();
@@ -420,18 +418,18 @@ namespace Step39
     for (unsigned int level=mg_sparsity.min_level();
          level<=mg_sparsity.max_level(); ++level)
       {
-        CompressedSparsityPattern c_sparsity(mg_dof_handler.n_dofs(level));
-        MGTools::make_flux_sparsity_pattern(mg_dof_handler, c_sparsity, level);
-        mg_sparsity[level].copy_from(c_sparsity);
+        DynamicSparsityPattern dsp(dof_handler.n_dofs(level));
+        MGTools::make_flux_sparsity_pattern(dof_handler, dsp, level);
+        mg_sparsity[level].copy_from(dsp);
         mg_matrix[level].reinit(mg_sparsity[level]);
         mg_matrix_in_out[level].reinit(mg_sparsity[level]);
 
         if (level>0)
           {
-            CompressedSparsityPattern ci_sparsity;
-            ci_sparsity.reinit(mg_dof_handler.n_dofs(level-1), mg_dof_handler.n_dofs(level));
-            MGTools::make_flux_sparsity_pattern_edge(mg_dof_handler, ci_sparsity, level);
-            mg_sparsity_dg_interface[level].copy_from(ci_sparsity);
+            DynamicSparsityPattern dsp;
+            dsp.reinit(dof_handler.n_dofs(level-1), dof_handler.n_dofs(level));
+            MGTools::make_flux_sparsity_pattern_edge(dof_handler, dsp, level);
+            mg_sparsity_dg_interface[level].copy_from(dsp);
             mg_matrix_dg_up[level].reinit(mg_sparsity_dg_interface[level]);
             mg_matrix_dg_down[level].reinit(mg_sparsity_dg_interface[level]);
           }
@@ -470,7 +468,7 @@ namespace Step39
     info_box.add_update_flags_all(update_flags);
     info_box.initialize(fe, mapping);
 
-    MeshWorker::DoFInfo<dim> dof_info(mg_dof_handler);
+    MeshWorker::DoFInfo<dim> dof_info(dof_handler);
 
     MeshWorker::Assembler::MGMatrixSimple<SparseMatrix<double> > assembler;
     assembler.initialize(mg_matrix);
@@ -479,7 +477,7 @@ namespace Step39
 
     MatrixIntegrator<dim> integrator;
     MeshWorker::integration_loop<dim, dim> (
-      mg_dof_handler.begin_mg(), mg_dof_handler.end_mg(),
+      dof_handler.begin_mg(), dof_handler.end_mg(),
       dof_info, info_box,
       integrator, assembler);
 
@@ -502,9 +500,8 @@ namespace Step39
     MeshWorker::DoFInfo<dim> dof_info(dof_handler);
 
     MeshWorker::Assembler::ResidualSimple<Vector<double> > assembler;
-    NamedData<Vector<double>* > data;
-    Vector<double> *rhs = &right_hand_side;
-    data.add(rhs, "RHS");
+    AnyData data;
+    data.add<Vector<double>*>(&right_hand_side, "RHS");
     assembler.initialize(data);
 
     RHSIntegrator<dim> integrator;
@@ -525,7 +522,7 @@ namespace Step39
     SolverCG<Vector<double> > solver(control);
 
     MGTransferPrebuilt<Vector<double> > mg_transfer;
-    mg_transfer.build_matrices(mg_dof_handler);
+    mg_transfer.build_matrices(dof_handler);
 
     FullMatrix<double> coarse_matrix;
     coarse_matrix.copy_from (mg_matrix[0]);
@@ -548,7 +545,7 @@ namespace Step39
     mg::Matrix<Vector<double> > mgup(mg_matrix_dg_up);
     mg::Matrix<Vector<double> > mgedge(mg_matrix_in_out);
 
-    Multigrid<Vector<double> > mg(mg_dof_handler, mgmatrix,
+    Multigrid<Vector<double> > mg(dof_handler, mgmatrix,
                                   mg_coarse, mg_transfer,
                                   mg_smoother, mg_smoother);
     mg.set_edge_flux_matrices(mgdown, mgup);
@@ -556,7 +553,7 @@ namespace Step39
 
     PreconditionMG<dim, Vector<double>,
                    MGTransferPrebuilt<Vector<double> > >
-                   preconditioner(mg_dof_handler, mg, mg_transfer);
+                   preconditioner(dof_handler, mg, mg_transfer);
     solver.solve(matrix, solution, right_hand_side, preconditioner);
   }
 
@@ -578,22 +575,21 @@ namespace Step39
     const unsigned int n_gauss_points = dof_handler.get_fe().tensor_degree()+1;
     info_box.initialize_gauss_quadrature(n_gauss_points, n_gauss_points+1, n_gauss_points);
 
-    NamedData<Vector<double>* > solution_data;
-    solution_data.add(&solution, "solution");
+    AnyData solution_data;
+    solution_data.add<const Vector<double>*>(&solution, "solution");
 
     info_box.cell_selector.add("solution", false, false, true);
     info_box.boundary_selector.add("solution", true, true, false);
     info_box.face_selector.add("solution", true, true, false);
 
     info_box.add_update_flags_boundary(update_quadrature_points);
-    info_box.initialize(fe, mapping, solution_data);
+    info_box.initialize(fe, mapping, solution_data, solution);
 
     MeshWorker::DoFInfo<dim> dof_info(dof_handler);
 
     MeshWorker::Assembler::CellsAndFaces<double> assembler;
-    NamedData<BlockVector<double>* > out_data;
-    BlockVector<double> *est = &estimates;
-    out_data.add(est, "cells");
+    AnyData out_data;
+    out_data.add<BlockVector<double>*>(&estimates, "cells");
     assembler.initialize(out_data, false);
 
     Estimator<dim> integrator;
@@ -623,8 +619,8 @@ namespace Step39
     const unsigned int n_gauss_points = dof_handler.get_fe().tensor_degree()+1;
     info_box.initialize_gauss_quadrature(n_gauss_points, n_gauss_points+1, n_gauss_points);
 
-    NamedData<Vector<double>* > solution_data;
-    solution_data.add(&solution, "solution");
+    AnyData solution_data;
+    solution_data.add<Vector<double>*>(&solution, "solution");
 
     info_box.cell_selector.add("solution", true, true, false);
     info_box.boundary_selector.add("solution", true, false, false);
@@ -632,14 +628,13 @@ namespace Step39
 
     info_box.add_update_flags_cell(update_quadrature_points);
     info_box.add_update_flags_boundary(update_quadrature_points);
-    info_box.initialize(fe, mapping, solution_data);
+    info_box.initialize(fe, mapping, solution_data, solution);
 
     MeshWorker::DoFInfo<dim> dof_info(dof_handler);
 
     MeshWorker::Assembler::CellsAndFaces<double> assembler;
-    NamedData<BlockVector<double>* > out_data;
-    BlockVector<double> *est = &errors;
-    out_data.add(est, "cells");
+    AnyData out_data;
+    out_data.add<BlockVector<double>* >(&errors, "cells");
     assembler.initialize(out_data, false);
 
     ErrorIntegrator<dim> integrator;
@@ -700,7 +695,7 @@ namespace Step39
         setup_system();
         deallog << "DoFHandler " << dof_handler.n_dofs() << " dofs, level dofs";
         for (unsigned int l=0; l<triangulation.n_levels(); ++l)
-          deallog << ' ' << mg_dof_handler.n_dofs(l);
+          deallog << ' ' << dof_handler.n_dofs(l);
         deallog << std::endl;
 
         deallog << "Assemble matrix" << std::endl;
index 1f1a9e0b1e70cdb970c75d0b7778af8dca442753..75fce2a601a2da054b535ceba76047ecfefcbe26 100644 (file)
@@ -18,7 +18,7 @@
 
 #include "../tests.h"
 #include <deal.II/lac/sparse_matrix.h>
-#include <deal.II/lac/compressed_sparsity_pattern.h>
+#include <deal.II/lac/dynamic_sparsity_pattern.h>
 #include <deal.II/lac/solver_cg.h>
 #include <deal.II/lac/precondition.h>
 #include <deal.II/lac/precondition_block.h>
@@ -359,9 +359,8 @@ namespace Step39
     Triangulation<dim>        triangulation;
     const MappingQ1<dim>      mapping;
     const FiniteElement<dim> &fe;
-    DoFHandler<dim>         mg_dof_handler;
-    DoFHandler<dim>          &dof_handler;
-      MGConstrainedDoFs mg_constraints;
+    DoFHandler<dim>         dof_handler;
+    MGConstrainedDoFs mg_constraints;
       
     SparsityPattern      sparsity;
     SparseMatrix<double> matrix;
@@ -384,8 +383,7 @@ namespace Step39
     :
     mapping(),
     fe(fe),
-    mg_dof_handler(triangulation),
-    dof_handler(mg_dof_handler),
+    dof_handler(triangulation),
     estimates(1)
   {
     GridGenerator::hyper_cube_slit(triangulation, -1, 1);
@@ -398,16 +396,16 @@ namespace Step39
   {
     dof_handler.distribute_dofs(fe);
     dof_handler.distribute_mg_dofs(fe);
-    unsigned int n_dofs = dof_handler.n_dofs();
+    types::global_dof_index n_dofs = dof_handler.n_dofs();
     solution.reinit(n_dofs);
     right_hand_side.reinit(n_dofs);
     
     mg_constraints.clear();
     mg_constraints.initialize(dof_handler);
     
-    CompressedSparsityPattern c_sparsity(n_dofs);
-    DoFTools::make_flux_sparsity_pattern(dof_handler, c_sparsity);
-    sparsity.copy_from(c_sparsity);
+    DynamicSparsityPattern dsp(n_dofs);
+    DoFTools::make_flux_sparsity_pattern(dof_handler, dsp);
+    sparsity.copy_from(dsp);
     matrix.reinit(sparsity);
 
     const unsigned int n_levels = triangulation.n_levels();
@@ -425,18 +423,18 @@ namespace Step39
     for (unsigned int level=mg_sparsity.min_level();
          level<=mg_sparsity.max_level(); ++level)
       {
-        CompressedSparsityPattern c_sparsity(mg_dof_handler.n_dofs(level));
-        MGTools::make_flux_sparsity_pattern(mg_dof_handler, c_sparsity, level);
-        mg_sparsity[level].copy_from(c_sparsity);
+        DynamicSparsityPattern dsp(dof_handler.n_dofs(level));
+        MGTools::make_flux_sparsity_pattern(dof_handler, dsp, level);
+        mg_sparsity[level].copy_from(dsp);
         mg_matrix[level].reinit(mg_sparsity[level]);
         mg_matrix_in_out[level].reinit(mg_sparsity[level]);
 
         if (level>0)
           {
-            CompressedSparsityPattern ci_sparsity;
-            ci_sparsity.reinit(mg_dof_handler.n_dofs(level-1), mg_dof_handler.n_dofs(level));
-            MGTools::make_flux_sparsity_pattern_edge(mg_dof_handler, ci_sparsity, level);
-            mg_sparsity_dg_interface[level].copy_from(ci_sparsity);
+            DynamicSparsityPattern dsp;
+            dsp.reinit(dof_handler.n_dofs(level-1), dof_handler.n_dofs(level));
+            MGTools::make_flux_sparsity_pattern_edge(dof_handler, dsp, level);
+            mg_sparsity_dg_interface[level].copy_from(dsp);
             mg_matrix_dg_up[level].reinit(mg_sparsity_dg_interface[level]);
             mg_matrix_dg_down[level].reinit(mg_sparsity_dg_interface[level]);
           }
@@ -475,7 +473,7 @@ namespace Step39
     info_box.add_update_flags_all(update_flags);
     info_box.initialize(fe, mapping);
 
-    MeshWorker::DoFInfo<dim> dof_info(mg_dof_handler);
+    MeshWorker::DoFInfo<dim> dof_info(dof_handler);
 
     MeshWorker::Assembler::MGMatrixSimple<SparseMatrix<double> > assembler;
     assembler.initialize(mg_matrix);
@@ -485,7 +483,7 @@ namespace Step39
 
     MatrixIntegrator<dim> integrator;
     MeshWorker::integration_loop<dim, dim> (
-      mg_dof_handler.begin_mg(), mg_dof_handler.end_mg(),
+      dof_handler.begin_mg(), dof_handler.end_mg(),
       dof_info, info_box,
       integrator, assembler);
 
@@ -508,9 +506,8 @@ namespace Step39
     MeshWorker::DoFInfo<dim> dof_info(dof_handler);
 
     MeshWorker::Assembler::ResidualSimple<Vector<double> > assembler;
-    NamedData<Vector<double>* > data;
-    Vector<double> *rhs = &right_hand_side;
-    data.add(rhs, "RHS");
+    AnyData data;
+    data.add<Vector<double>*>(&right_hand_side, "RHS");
     assembler.initialize(data);
 
     RHSIntegrator<dim> integrator;
@@ -531,7 +528,7 @@ namespace Step39
     SolverCG<Vector<double> > solver(control);
 
     MGTransferPrebuilt<Vector<double> > mg_transfer;
-    mg_transfer.build_matrices(mg_dof_handler);
+    mg_transfer.build_matrices(dof_handler);
 
     FullMatrix<double> coarse_matrix;
     coarse_matrix.copy_from (mg_matrix[0]);
@@ -554,7 +551,7 @@ namespace Step39
     mg::Matrix<Vector<double> > mgup(mg_matrix_dg_up);
     mg::Matrix<Vector<double> > mgedge(mg_matrix_in_out);
 
-    Multigrid<Vector<double> > mg(mg_dof_handler, mgmatrix,
+    Multigrid<Vector<double> > mg(dof_handler, mgmatrix,
                                   mg_coarse, mg_transfer,
                                   mg_smoother, mg_smoother);
     mg.set_edge_flux_matrices(mgdown, mgup);
@@ -562,7 +559,7 @@ namespace Step39
 
     PreconditionMG<dim, Vector<double>,
                    MGTransferPrebuilt<Vector<double> > >
-                   preconditioner(mg_dof_handler, mg, mg_transfer);
+                   preconditioner(dof_handler, mg, mg_transfer);
     solver.solve(matrix, solution, right_hand_side, preconditioner);
   }
 
@@ -584,22 +581,21 @@ namespace Step39
     const unsigned int n_gauss_points = dof_handler.get_fe().tensor_degree()+1;
     info_box.initialize_gauss_quadrature(n_gauss_points, n_gauss_points+1, n_gauss_points);
 
-    NamedData<Vector<double>* > solution_data;
-    solution_data.add(&solution, "solution");
+    AnyData solution_data;
+    solution_data.add<const Vector<double>*>(&solution, "solution");
 
     info_box.cell_selector.add("solution", false, false, true);
     info_box.boundary_selector.add("solution", true, true, false);
     info_box.face_selector.add("solution", true, true, false);
 
     info_box.add_update_flags_boundary(update_quadrature_points);
-    info_box.initialize(fe, mapping, solution_data);
+    info_box.initialize(fe, mapping, solution_data, solution);
 
     MeshWorker::DoFInfo<dim> dof_info(dof_handler);
 
     MeshWorker::Assembler::CellsAndFaces<double> assembler;
-    NamedData<BlockVector<double>* > out_data;
-    BlockVector<double> *est = &estimates;
-    out_data.add(est, "cells");
+    AnyData out_data;
+    out_data.add<BlockVector<double>*>(&estimates, "cells");
     assembler.initialize(out_data, false);
 
     Estimator<dim> integrator;
@@ -629,8 +625,8 @@ namespace Step39
     const unsigned int n_gauss_points = dof_handler.get_fe().tensor_degree()+1;
     info_box.initialize_gauss_quadrature(n_gauss_points, n_gauss_points+1, n_gauss_points);
 
-    NamedData<Vector<double>* > solution_data;
-    solution_data.add(&solution, "solution");
+    AnyData solution_data;
+    solution_data.add<Vector<double>*>(&solution, "solution");
 
     info_box.cell_selector.add("solution", true, true, false);
     info_box.boundary_selector.add("solution", true, false, false);
@@ -638,14 +634,13 @@ namespace Step39
 
     info_box.add_update_flags_cell(update_quadrature_points);
     info_box.add_update_flags_boundary(update_quadrature_points);
-    info_box.initialize(fe, mapping, solution_data);
+    info_box.initialize(fe, mapping, solution_data, solution);
 
     MeshWorker::DoFInfo<dim> dof_info(dof_handler);
 
     MeshWorker::Assembler::CellsAndFaces<double> assembler;
-    NamedData<BlockVector<double>* > out_data;
-    BlockVector<double> *est = &errors;
-    out_data.add(est, "cells");
+    AnyData out_data;
+    out_data.add<BlockVector<double>* >(&errors, "cells");
     assembler.initialize(out_data, false);
 
     ErrorIntegrator<dim> integrator;
@@ -706,7 +701,7 @@ namespace Step39
         setup_system();
         deallog << "DoFHandler " << dof_handler.n_dofs() << " dofs, level dofs";
         for (unsigned int l=0; l<triangulation.n_levels(); ++l)
-          deallog << ' ' << mg_dof_handler.n_dofs(l);
+          deallog << ' ' << dof_handler.n_dofs(l);
         deallog << std::endl;
 
         deallog << "Assemble matrix" << std::endl;
index c98fd1f909a52b14496e725ab98e49fb59ae8182..6984c88ab7601277a55c09262214caec16b3a688 100644 (file)
@@ -23,7 +23,7 @@
 
 #include "../tests.h"
 #include <deal.II/lac/sparse_matrix.h>
-#include <deal.II/lac/compressed_sparsity_pattern.h>
+#include <deal.II/lac/dynamic_sparsity_pattern.h>
 #include <deal.II/lac/solver_cg.h>
 #include <deal.II/lac/solver_gmres.h>
 #include <deal.II/lac/precondition.h>
@@ -364,8 +364,7 @@ namespace Step39
     Triangulation<dim>        triangulation;
     const MappingQ1<dim>      mapping;
     const FiniteElement<dim> &fe;
-    DoFHandler<dim>         mg_dof_handler;
-    DoFHandler<dim>          &dof_handler;
+    DoFHandler<dim>           dof_handler;
 
     SparsityPattern      sparsity;
     SparseMatrix<double> matrix;
@@ -388,8 +387,7 @@ namespace Step39
     :
     mapping(),
     fe(fe),
-    mg_dof_handler(triangulation),
-    dof_handler(mg_dof_handler),
+    dof_handler(triangulation),
     estimates(1)
   {
     GridGenerator::hyper_cube_slit(triangulation, -1, 1);
@@ -406,9 +404,9 @@ namespace Step39
     solution.reinit(n_dofs);
     right_hand_side.reinit(n_dofs);
 
-    CompressedSparsityPattern c_sparsity(n_dofs);
-    DoFTools::make_flux_sparsity_pattern(dof_handler, c_sparsity);
-    sparsity.copy_from(c_sparsity);
+    DynamicSparsityPattern dsp(n_dofs);
+    DoFTools::make_flux_sparsity_pattern(dof_handler, dsp);
+    sparsity.copy_from(dsp);
     matrix.reinit(sparsity);
 
     const unsigned int n_levels = triangulation.n_levels();
@@ -426,18 +424,18 @@ namespace Step39
     for (unsigned int level=mg_sparsity.min_level();
          level<=mg_sparsity.max_level(); ++level)
       {
-        CompressedSparsityPattern c_sparsity(mg_dof_handler.n_dofs(level));
-        MGTools::make_flux_sparsity_pattern(mg_dof_handler, c_sparsity, level);
-        mg_sparsity[level].copy_from(c_sparsity);
+        DynamicSparsityPattern dsp(dof_handler.n_dofs(level));
+        MGTools::make_flux_sparsity_pattern(dof_handler, dsp, level);
+        mg_sparsity[level].copy_from(dsp);
         mg_matrix[level].reinit(mg_sparsity[level]);
         mg_matrix_in_out[level].reinit(mg_sparsity[level]);
 
         if (level>0)
           {
-            CompressedSparsityPattern ci_sparsity;
-            ci_sparsity.reinit(mg_dof_handler.n_dofs(level-1), mg_dof_handler.n_dofs(level));
-            MGTools::make_flux_sparsity_pattern_edge(mg_dof_handler, ci_sparsity, level);
-            mg_sparsity_dg_interface[level].copy_from(ci_sparsity);
+            DynamicSparsityPattern dsp;
+            dsp.reinit(dof_handler.n_dofs(level-1), dof_handler.n_dofs(level));
+            MGTools::make_flux_sparsity_pattern_edge(dof_handler, dsp, level);
+            mg_sparsity_dg_interface[level].copy_from(dsp);
             mg_matrix_dg_up[level].reinit(mg_sparsity_dg_interface[level]);
             mg_matrix_dg_down[level].reinit(mg_sparsity_dg_interface[level]);
           }
@@ -476,7 +474,7 @@ namespace Step39
     info_box.add_update_flags_all(update_flags);
     info_box.initialize(fe, mapping);
 
-    MeshWorker::DoFInfo<dim> dof_info(mg_dof_handler);
+    MeshWorker::DoFInfo<dim> dof_info(dof_handler);
 
     MeshWorker::Assembler::MGMatrixSimple<SparseMatrix<double> > assembler;
     assembler.initialize(mg_matrix);
@@ -485,7 +483,7 @@ namespace Step39
 
     MatrixIntegrator<dim> integrator;
     MeshWorker::integration_loop<dim, dim> (
-      mg_dof_handler.begin_mg(), mg_dof_handler.end_mg(),
+      dof_handler.begin_mg(), dof_handler.end_mg(),
       dof_info, info_box,
       integrator, assembler);
 
@@ -508,9 +506,8 @@ namespace Step39
     MeshWorker::DoFInfo<dim> dof_info(dof_handler);
 
     MeshWorker::Assembler::ResidualSimple<Vector<double> > assembler;
-    NamedData<Vector<double>* > data;
-    Vector<double> *rhs = &right_hand_side;
-    data.add(rhs, "RHS");
+    AnyData data;
+    data.add<Vector<double>*>(&right_hand_side, "RHS");
     assembler.initialize(data);
 
     RHSIntegrator<dim> integrator;
@@ -531,7 +528,7 @@ namespace Step39
     SolverGMRES<Vector<double> > solver(control);
 
     MGTransferPrebuilt<Vector<double> > mg_transfer;
-    mg_transfer.build_matrices(mg_dof_handler);
+    mg_transfer.build_matrices(dof_handler);
 
     FullMatrix<double> coarse_matrix;
     coarse_matrix.copy_from (mg_matrix[0]);
@@ -554,7 +551,7 @@ namespace Step39
     mg::Matrix<Vector<double> > mgup(mg_matrix_dg_up);
     mg::Matrix<Vector<double> > mgedge(mg_matrix_in_out);
 
-    Multigrid<Vector<double> > mg(mg_dof_handler, mgmatrix,
+    Multigrid<Vector<double> > mg(dof_handler, mgmatrix,
                                   mg_coarse, mg_transfer,
                                   mg_smoother, mg_smoother);
     mg.set_edge_flux_matrices(mgdown, mgup);
@@ -562,7 +559,7 @@ namespace Step39
 
     PreconditionMG<dim, Vector<double>,
                    MGTransferPrebuilt<Vector<double> > >
-                   preconditioner(mg_dof_handler, mg, mg_transfer);
+                   preconditioner(dof_handler, mg, mg_transfer);
     solver.solve(matrix, solution, right_hand_side, preconditioner);
   }
 
@@ -584,22 +581,21 @@ namespace Step39
     const unsigned int n_gauss_points = dof_handler.get_fe().tensor_degree()+1;
     info_box.initialize_gauss_quadrature(n_gauss_points, n_gauss_points+1, n_gauss_points);
 
-    NamedData<Vector<double>* > solution_data;
-    solution_data.add(&solution, "solution");
+    AnyData solution_data;
+    solution_data.add<const Vector<double>*>(&solution, "solution");
 
     info_box.cell_selector.add("solution", false, false, true);
     info_box.boundary_selector.add("solution", true, true, false);
     info_box.face_selector.add("solution", true, true, false);
 
     info_box.add_update_flags_boundary(update_quadrature_points);
-    info_box.initialize(fe, mapping, solution_data);
+    info_box.initialize(fe, mapping, solution_data, solution);
 
     MeshWorker::DoFInfo<dim> dof_info(dof_handler);
 
     MeshWorker::Assembler::CellsAndFaces<double> assembler;
-    NamedData<BlockVector<double>* > out_data;
-    BlockVector<double> *est = &estimates;
-    out_data.add(est, "cells");
+    AnyData out_data;
+    out_data.add<BlockVector<double>*>(&estimates, "cells");
     assembler.initialize(out_data, false);
 
     Estimator<dim> integrator;
@@ -629,8 +625,8 @@ namespace Step39
     const unsigned int n_gauss_points = dof_handler.get_fe().tensor_degree()+1;
     info_box.initialize_gauss_quadrature(n_gauss_points, n_gauss_points+1, n_gauss_points);
 
-    NamedData<Vector<double>* > solution_data;
-    solution_data.add(&solution, "solution");
+    AnyData solution_data;
+    solution_data.add<Vector<double>*>(&solution, "solution");
 
     info_box.cell_selector.add("solution", true, true, false);
     info_box.boundary_selector.add("solution", true, false, false);
@@ -638,14 +634,13 @@ namespace Step39
 
     info_box.add_update_flags_cell(update_quadrature_points);
     info_box.add_update_flags_boundary(update_quadrature_points);
-    info_box.initialize(fe, mapping, solution_data);
+    info_box.initialize(fe, mapping, solution_data, solution);
 
     MeshWorker::DoFInfo<dim> dof_info(dof_handler);
 
     MeshWorker::Assembler::CellsAndFaces<double> assembler;
-    NamedData<BlockVector<double>* > out_data;
-    BlockVector<double> *est = &errors;
-    out_data.add(est, "cells");
+    AnyData out_data;
+    out_data.add<BlockVector<double>* >(&errors, "cells");
     assembler.initialize(out_data, false);
 
     ErrorIntegrator<dim> integrator;
@@ -706,7 +701,7 @@ namespace Step39
         setup_system();
         deallog << "DoFHandler " << dof_handler.n_dofs() << " dofs, level dofs";
         for (unsigned int l=0; l<triangulation.n_levels(); ++l)
-          deallog << ' ' << mg_dof_handler.n_dofs(l);
+          deallog << ' ' << dof_handler.n_dofs(l);
         deallog << std::endl;
 
         deallog << "Assemble matrix" << std::endl;
index c9767ec9ac68fbf3ccf1c4c4d0e1204fa2591a2a..4df800a3603a9224f0a628bbf231510f629b68b8 100644 (file)
@@ -19,7 +19,7 @@
 
 #include "../tests.h"
 #include <deal.II/lac/sparse_matrix.h>
-#include <deal.II/lac/compressed_sparsity_pattern.h>
+#include <deal.II/lac/dynamic_sparsity_pattern.h>
 #include <deal.II/lac/solver_cg.h>
 #include <deal.II/lac/precondition.h>
 #include <deal.II/lac/precondition_block.h>
@@ -359,8 +359,7 @@ namespace Step39
     Triangulation<dim>        triangulation;
     const MappingQ1<dim>      mapping;
     const FiniteElement<dim> &fe;
-    DoFHandler<dim>         mg_dof_handler;
-    DoFHandler<dim>          &dof_handler;
+    DoFHandler<dim>           dof_handler;
 
     SparsityPattern      sparsity;
     SparseMatrix<double> matrix;
@@ -382,8 +381,7 @@ namespace Step39
     :
     mapping(),
     fe(fe),
-    mg_dof_handler(triangulation),
-    dof_handler(mg_dof_handler),
+    dof_handler(triangulation),
     estimates(1)
   {
     GridGenerator::hyper_cube_slit(triangulation, -1, 1);
@@ -396,13 +394,13 @@ namespace Step39
   {
     dof_handler.distribute_dofs(fe);
     dof_handler.distribute_mg_dofs(fe);
-    unsigned int n_dofs = dof_handler.n_dofs();
+    types::global_dof_index n_dofs = dof_handler.n_dofs();
     solution.reinit(n_dofs);
     right_hand_side.reinit(n_dofs);
 
-    CompressedSparsityPattern c_sparsity(n_dofs);
-    DoFTools::make_flux_sparsity_pattern(dof_handler, c_sparsity);
-    sparsity.copy_from(c_sparsity);
+    DynamicSparsityPattern dsp(n_dofs);
+    DoFTools::make_flux_sparsity_pattern(dof_handler, dsp);
+    sparsity.copy_from(dsp);
     matrix.reinit(sparsity);
 
     const unsigned int n_levels = triangulation.n_levels();
@@ -418,17 +416,17 @@ namespace Step39
     for (unsigned int level=mg_sparsity.min_level();
          level<=mg_sparsity.max_level(); ++level)
       {
-        CompressedSparsityPattern c_sparsity(mg_dof_handler.n_dofs(level));
-        MGTools::make_flux_sparsity_pattern(mg_dof_handler, c_sparsity, level);
-        mg_sparsity[level].copy_from(c_sparsity);
+        DynamicSparsityPattern dsp(dof_handler.n_dofs(level));
+        MGTools::make_flux_sparsity_pattern(dof_handler, dsp, level);
+        mg_sparsity[level].copy_from(dsp);
         mg_matrix[level].reinit(mg_sparsity[level]);
 
         if (level>0)
           {
-            CompressedSparsityPattern ci_sparsity;
-            ci_sparsity.reinit(mg_dof_handler.n_dofs(level-1), mg_dof_handler.n_dofs(level));
-            MGTools::make_flux_sparsity_pattern_edge(mg_dof_handler, ci_sparsity, level);
-            mg_sparsity_dg_interface[level].copy_from(ci_sparsity);
+            DynamicSparsityPattern dsp;
+            dsp.reinit(dof_handler.n_dofs(level-1), dof_handler.n_dofs(level));
+            MGTools::make_flux_sparsity_pattern_edge(dof_handler, dsp, level);
+            mg_sparsity_dg_interface[level].copy_from(dsp);
             mg_matrix_dg_up[level].reinit(mg_sparsity_dg_interface[level]);
             mg_matrix_dg_down[level].reinit(mg_sparsity_dg_interface[level]);
           }
@@ -467,7 +465,7 @@ namespace Step39
     info_box.add_update_flags_all(update_flags);
     info_box.initialize(fe, mapping);
 
-    MeshWorker::DoFInfo<dim> dof_info(mg_dof_handler);
+    MeshWorker::DoFInfo<dim> dof_info(dof_handler);
 
     MeshWorker::Assembler::MGMatrixSimple<SparseMatrix<double> > assembler;
     assembler.initialize(mg_matrix);
@@ -475,7 +473,7 @@ namespace Step39
 
     MatrixIntegrator<dim> integrator;
     MeshWorker::integration_loop<dim, dim> (
-      mg_dof_handler.begin_mg(), mg_dof_handler.end_mg(),
+      dof_handler.begin_mg(), dof_handler.end_mg(),
       dof_info, info_box,
       integrator, assembler);
   }
@@ -493,9 +491,8 @@ namespace Step39
     MeshWorker::DoFInfo<dim> dof_info(dof_handler);
 
     MeshWorker::Assembler::ResidualSimple<Vector<double> > assembler;
-    NamedData<Vector<double>* > data;
-    Vector<double> *rhs = &right_hand_side;
-    data.add(rhs, "RHS");
+    AnyData data;
+    data.add<Vector<double>*>(&right_hand_side, "RHS");
     assembler.initialize(data);
 
     RHSIntegrator<dim> integrator;
@@ -516,7 +513,7 @@ namespace Step39
     SolverCG<Vector<double> > solver(control);
 
     MGTransferPrebuilt<Vector<double> > mg_transfer;
-    mg_transfer.build_matrices(mg_dof_handler);
+    mg_transfer.build_matrices(dof_handler);
 
     FullMatrix<double> coarse_matrix;
     coarse_matrix.copy_from (mg_matrix[0]);
@@ -538,14 +535,14 @@ namespace Step39
     mg::Matrix<Vector<double> > mgdown(mg_matrix_dg_down);
     mg::Matrix<Vector<double> > mgup(mg_matrix_dg_up);
 
-    Multigrid<Vector<double> > mg(mg_dof_handler, mgmatrix,
+    Multigrid<Vector<double> > mg(dof_handler, mgmatrix,
                                   mg_coarse, mg_transfer,
                                   mg_smoother, mg_smoother);
     mg.set_edge_flux_matrices(mgdown, mgup);
 
     PreconditionMG<dim, Vector<double>,
                    MGTransferPrebuilt<Vector<double> > >
-                   preconditioner(mg_dof_handler, mg, mg_transfer);
+                   preconditioner(dof_handler, mg, mg_transfer);
     solver.solve(matrix, solution, right_hand_side, preconditioner);
   }
 
@@ -567,22 +564,21 @@ namespace Step39
     const unsigned int n_gauss_points = dof_handler.get_fe().tensor_degree()+1;
     info_box.initialize_gauss_quadrature(n_gauss_points, n_gauss_points+1, n_gauss_points);
 
-    NamedData<Vector<double>* > solution_data;
-    solution_data.add(&solution, "solution");
+    AnyData solution_data;
+    solution_data.add<const Vector<double>*>(&solution, "solution");
 
     info_box.cell_selector.add("solution", false, false, true);
     info_box.boundary_selector.add("solution", true, true, false);
     info_box.face_selector.add("solution", true, true, false);
 
     info_box.add_update_flags_boundary(update_quadrature_points);
-    info_box.initialize(fe, mapping, solution_data);
+    info_box.initialize(fe, mapping, solution_data, solution);
 
     MeshWorker::DoFInfo<dim> dof_info(dof_handler);
 
     MeshWorker::Assembler::CellsAndFaces<double> assembler;
-    NamedData<BlockVector<double>* > out_data;
-    BlockVector<double> *est = &estimates;
-    out_data.add(est, "cells");
+    AnyData out_data;
+    out_data.add<BlockVector<double>*>(&estimates, "cells");
     assembler.initialize(out_data, false);
 
     Estimator<dim> integrator;
@@ -612,8 +608,8 @@ namespace Step39
     const unsigned int n_gauss_points = dof_handler.get_fe().tensor_degree()+1;
     info_box.initialize_gauss_quadrature(n_gauss_points, n_gauss_points+1, n_gauss_points);
 
-    NamedData<Vector<double>* > solution_data;
-    solution_data.add(&solution, "solution");
+    AnyData solution_data;
+    solution_data.add<Vector<double>*>(&solution, "solution");
 
     info_box.cell_selector.add("solution", true, true, false);
     info_box.boundary_selector.add("solution", true, false, false);
@@ -621,14 +617,13 @@ namespace Step39
 
     info_box.add_update_flags_cell(update_quadrature_points);
     info_box.add_update_flags_boundary(update_quadrature_points);
-    info_box.initialize(fe, mapping, solution_data);
+    info_box.initialize(fe, mapping, solution_data, solution);
 
     MeshWorker::DoFInfo<dim> dof_info(dof_handler);
 
     MeshWorker::Assembler::CellsAndFaces<double> assembler;
-    NamedData<BlockVector<double>* > out_data;
-    BlockVector<double> *est = &errors;
-    out_data.add(est, "cells");
+    AnyData out_data;
+    out_data.add<BlockVector<double>* >(&errors, "cells");
     assembler.initialize(out_data, false);
 
     ErrorIntegrator<dim> integrator;
@@ -689,7 +684,7 @@ namespace Step39
         setup_system();
         deallog << "DoFHandler " << dof_handler.n_dofs() << " dofs, level dofs";
         for (unsigned int l=0; l<triangulation.n_levels(); ++l)
-          deallog << ' ' << mg_dof_handler.n_dofs(l);
+          deallog << ' ' << dof_handler.n_dofs(l);
         deallog << std::endl;
 
         deallog << "Assemble matrix" << std::endl;

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.