From: Guido Kanschat Date: Fri, 12 Sep 2014 20:22:37 +0000 (+0200) Subject: Remove NamedData class X-Git-Tag: v8.3.0-rc1~329^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6a70902e82cece208322754ff1936f6b4318c2d1;p=dealii.git Remove NamedData class --- diff --git a/doc/news/changes.h b/doc/news/changes.h index 50c4e72e2c..76fb22e509 100644 --- a/doc/news/changes.h +++ b/doc/news/changes.h @@ -38,13 +38,21 @@ inconvenience this causes.

    +
  1. 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 +
    + (Guido KAnschat, 2015/04/02) +
  2. +
  3. Removed: The CMake configuration does not use the variable DEAL_II_CMAKE_MACROS_RELDIR any more. Instead, the fixed location ${DEAL_II_SHARE_RELDIR}/macros is used unconditionally
    (Matthias Maier, 2015/03/26) - +
  4. +
  5. 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 diff --git a/examples/step-39/step-39.cc b/examples/step-39/step-39.cc index ce4e0e03f1..64fd4a2b6a 100644 --- a/examples/step-39/step-39.cc +++ b/examples/step-39/step-39.cc @@ -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 > assembler; - NamedData* > data; - Vector *rhs = &right_hand_side; - data.add(rhs, "RHS"); + AnyData data; + data.add*>(&right_hand_side, "RHS"); assembler.initialize(data); RHSIntegrator 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* > solution_data; - solution_data.add(&solution, "solution"); + AnyData solution_data; + solution_data.add*>(&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 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 assembler; - NamedData* > out_data; - BlockVector *est = &estimates; - out_data.add(est, "cells"); + AnyData out_data; + out_data.add*>(&estimates, "cells"); assembler.initialize(out_data, false); Estimator 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* > solution_data; - solution_data.add(&solution, "solution"); + AnyData solution_data; + solution_data.add*>(&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 dof_info(dof_handler); MeshWorker::Assembler::CellsAndFaces assembler; - NamedData* > out_data; - BlockVector *est = &errors; - out_data.add(est, "cells"); + AnyData out_data; + out_data.add* >(&errors, "cells"); assembler.initialize(out_data, false); ErrorIntegrator integrator; diff --git a/include/deal.II/algorithms/any_data.h b/include/deal.II/algorithms/any_data.h index 912b24eb4b..69e3d24094 100644 --- a/include/deal.II/algorithms/any_data.h +++ b/include/deal.II/algorithms/any_data.h @@ -19,7 +19,6 @@ #include #include #include -#include #include #include @@ -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 void list (STREAM &os) const; - /// Conversion from old NamedData - template - AnyData(const NamedData &); - /// 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 -inline -AnyData::AnyData(const NamedData &other) -{ - for (unsigned int i=0; i +#include + +#include + +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 names; + + /** + * The index map generated by initialize() and accessed by + * operator(). + */ + std::vector 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 diff --git a/include/deal.II/algorithms/newton.h b/include/deal.II/algorithms/newton.h index e3c3092183..53835d9137 100644 --- a/include/deal.II/algorithms/newton.h +++ b/include/deal.II/algorithms/newton.h @@ -96,11 +96,6 @@ namespace Algorithms */ virtual void operator() (AnyData &out, const AnyData &in); - /** - * @deprecated Use the function using AnyData - */ - virtual void operator() (NamedData &out, const NamedData &in); - virtual void notify(const Event &); /** diff --git a/include/deal.II/algorithms/newton.templates.h b/include/deal.II/algorithms/newton.templates.h index bb5fafa283..1cfb920113 100644 --- a/include/deal.II/algorithms/newton.templates.h +++ b/include/deal.II/algorithms/newton.templates.h @@ -90,13 +90,6 @@ namespace Algorithms } - template - void - Newton::operator() (NamedData &out, const NamedData &in) - { - Operator::operator() (out, in); - } - template void Newton::operator() (AnyData &out, const AnyData &in) @@ -133,13 +126,13 @@ namespace Algorithms if (debug_vectors) { - NamedData out; + AnyData out; VECTOR *p = &u; - out.add(p, "solution"); + out.add(p, "solution"); p = Du; - out.add(p, "update"); + out.add(p, "update"); p = res; - out.add(p, "residual"); + out.add(p, "residual"); *data_out << step; *data_out << out; } @@ -164,13 +157,13 @@ namespace Algorithms if (debug_vectors) { - NamedData out; + AnyData out; VECTOR *p = &u; - out.add(p, "solution"); + out.add(p, "solution"); p = Du; - out.add(p, "update"); + out.add(p, "update"); p = res; - out.add(p, "residual"); + out.add(p, "residual"); *data_out << step; *data_out << out; } diff --git a/include/deal.II/algorithms/operator.h b/include/deal.II/algorithms/operator.h index f4bbf9f9cd..1902dd392b 100644 --- a/include/deal.II/algorithms/operator.h +++ b/include/deal.II/algorithms/operator.h @@ -19,7 +19,6 @@ #include #include -#include #include #include @@ -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 &out, const NamedData &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 &operator<< (unsigned int step); - + void set_step(const unsigned int step); /** * Output all the vectors in AnyData. */ virtual OutputOperator &operator<< (const AnyData &vectors); - /** - * @deprecated Output all the vectors in NamedData. - */ - OutputOperator &operator<< (const NamedData &vectors); protected: unsigned int step; private: @@ -202,15 +170,29 @@ namespace Algorithms }; template - OutputOperator & - OutputOperator::operator<< (unsigned int s) + inline + void + OutputOperator::set_step (const unsigned int s) { step = s; - return *this; } -} + /** + * Set the step number in OutputOperator by shifting an integer value. + * + * @relates OutputOperator + */ + template + inline + OutputOperator & + operator<< (OutputOperator &out, unsigned int step) + { + out.set_step(step); + return out; + } +} + DEAL_II_NAMESPACE_CLOSE #endif diff --git a/include/deal.II/algorithms/operator.templates.h b/include/deal.II/algorithms/operator.templates.h index d7b2809aa9..47659ae8e6 100644 --- a/include/deal.II/algorithms/operator.templates.h +++ b/include/deal.II/algorithms/operator.templates.h @@ -23,86 +23,8 @@ namespace Algorithms { template Operator::Operator() - : silent_compatibility(false), compatibility_flag(false) {} - - template - void - Operator::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 new_out; - for (unsigned int i=0; i(i)) - new_out.add(out.entry(i), out.name(i)); - else if (!silent_compatibility) - deallog << "Cannot convert AnyData argument " << out.name(i) << " to NamedData" - << std::endl; - } - - NamedData new_in; - for (unsigned int i=0; i(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 (in.entry(i)); - new_in.add(p, in.name(i)); - } - else if (in.is_type(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 (in.entry(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 - void - Operator::operator() (NamedData &out, const NamedData &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; ioperator() (new_out, new_in); - compatibility_flag = false; - } - - template OutputOperator::~OutputOperator() {} @@ -151,16 +73,6 @@ namespace Algorithms } return *this; } - - - template - OutputOperator & - OutputOperator::operator<< (const NamedData &vectors) - { - const AnyData newdata = vectors; - (*this) << newdata; - return *this; - } } DEAL_II_NAMESPACE_CLOSE diff --git a/include/deal.II/algorithms/theta_timestepping.templates.h b/include/deal.II/algorithms/theta_timestepping.templates.h index ae13015a9d..8f754f491f 100644 --- a/include/deal.II/algorithms/theta_timestepping.templates.h +++ b/include/deal.II/algorithms/theta_timestepping.templates.h @@ -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 index 5f62dc72e0..0000000000 --- a/include/deal.II/base/named_data.h +++ /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 -#include -#include - -#include -#include - -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 -class NamedData : public Subscriptor -{ -public: - /** - * Standard constructor creating an empty object. - */ - NamedData(); - - /** - * Assignment operator, copying conversible data from another object. - */ - template - NamedData &operator = (const NamedData &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 - void merge(NamedData &); - /** - * 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 - void merge(const NamedData &); -//@} - /** - * \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 - * true. 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 - 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; - - /// Names for the data - std::vector 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 - void initialize(const NamedData &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 names; - /** - * The index map generated by initialize() and accessed by operator(). - */ - std::vector indices; -}; - - -//----------------------------------------------------------------------// - -template -inline -NamedData::NamedData() - : - is_constant(false) -{} - - -template -inline -void -NamedData::add(DATA &v, const std::string &n) -{ - // see operator() below - - // Assert(!is_constant, ExcConstantObject()); - names.push_back(n); - data.push_back(v); -} - - -template -inline -void -NamedData::add(const DATA &v, const std::string &n) -{ - // see operator() below - - // Assert(!is_constant, ExcConstantObject()); - DATA &aux = const_cast(v); - data.push_back(aux); - names.push_back(n); - is_constant = true; -} - - -template -template -inline -void -NamedData::merge(NamedData &other) -{ - // see operator() below - - // Assert(!is_constant, ExcConstantObject()); - - for (unsigned int i=0; i -template -inline -void -NamedData::merge(const NamedData &other) -{ - // see operator() below - - // Assert(!is_constant, ExcConstantObject()); - for (unsigned int i=0; i -template -inline -NamedData & -NamedData::operator= (const NamedData &other) -{ - is_constant = false; - merge(other); - is_constant = other.is_const(); - return *this; -} - - - -template -inline -unsigned int -NamedData::size() const -{ - return data.size(); -} - - -template -inline -bool -NamedData::is_const() const -{ - return is_constant; -} - - -template -inline -DATA & -NamedData::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 -inline -const DATA & -NamedData::operator() (unsigned int i) const -{ - AssertIndexRange(i, size()); - return data[i]; -} - - -template -inline -const DATA & -NamedData::read (unsigned int i) const -{ - AssertIndexRange(i, size()); - return data[i]; -} - - -template -inline -const std::string & -NamedData::name(unsigned int i) const -{ - AssertIndexRange(i, size()); - return names[i]; -} - - -template -inline -unsigned int -NamedData::find (const std::string &name) const -{ - const std::vector::const_iterator - i = std::find(names.begin(), names.end(), name); - if (i == names.end()) - return numbers::invalid_unsigned_int; - return i - names.begin(); -} - - -template -template -inline -void -NamedData::print(OUT &o) const -{ - o << "NamedData:"; - for (unsigned int i=0; i -inline void -NamedSelection::initialize(const NamedData &data) -{ - indices.resize(names.size()); - for (unsigned int i=0; i -#include #include #include #include @@ -26,6 +25,7 @@ #include #include #include +#include DEAL_II_NAMESPACE_OPEN @@ -322,7 +322,7 @@ private: template class MatrixBlockVector : - private NamedData > > + private AnyData { public: /** @@ -335,6 +335,13 @@ public: */ typedef MatrixBlock 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 ptr_type; + /** * Add a new matrix block at the position (row,column) in the block * system. @@ -382,10 +389,10 @@ public: /** * import functions from private base class */ - using NamedData >::subscribe; - using NamedData >::unsubscribe; - using NamedData >::size; - using NamedData >::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 > > &); + 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 > > matrices; + AnyData matrices; /// The matrix from the interior of a level to the refinement edge - NamedData > > matrices_in; + AnyData matrices_in; /// The matrix from the refinement edge to the interior of a level - NamedData > > matrices_out; + AnyData matrices_out; /// The DG flux from a level to the lower level - NamedData > > flux_matrices_down; + AnyData flux_matrices_down; /// The DG flux from the lower level to a level - NamedData > > flux_matrices_up; + AnyData flux_matrices_up; }; @@ -813,8 +820,8 @@ MatrixBlockVector::add( size_type row, size_type column, const std::string &name) { - std_cxx11::shared_ptr p(new value_type(row, column)); - NamedData >::add(p, name); + ptr_type p(new value_type(row, column)); + AnyData::add(p, name); } @@ -850,7 +857,7 @@ template inline const MatrixBlock & MatrixBlockVector::block(size_type i) const { - return *this->read(i); + return *this->read(i); } @@ -858,7 +865,7 @@ template inline MatrixBlock & MatrixBlockVector::block(size_type i) { - return *(*this)(i); + return *this->entry(i); } @@ -866,7 +873,7 @@ template inline MATRIX & MatrixBlockVector::matrix(size_type i) { - return (*this)(i)->matrix; + return this->entry(i)->matrix; } @@ -920,7 +927,7 @@ template inline const MGLevelObject > & MGMatrixBlockVector::block(size_type i) const { - return matrices.read(i); + return *matrices.read* >(i); } @@ -928,7 +935,7 @@ template inline MGLevelObject > & MGMatrixBlockVector::block(size_type i) { - return matrices(i); + return *matrices.entry* >(i); } @@ -936,7 +943,7 @@ template inline const MGLevelObject > & MGMatrixBlockVector::block_in(size_type i) const { - return matrices_in.read(i); + return *matrices_in.read* >(i); } @@ -944,7 +951,7 @@ template inline MGLevelObject > & MGMatrixBlockVector::block_in(size_type i) { - return matrices_in(i); + return *matrices_in.entry* >(i); } @@ -952,7 +959,7 @@ template inline const MGLevelObject > & MGMatrixBlockVector::block_out(size_type i) const { - return matrices_out.read(i); + return *matrices_out.read* >(i); } @@ -960,7 +967,7 @@ template inline MGLevelObject > & MGMatrixBlockVector::block_out(size_type i) { - return matrices_out(i); + return *matrices_out.entry* >(i); } @@ -968,7 +975,7 @@ template inline const MGLevelObject > & MGMatrixBlockVector::block_up(size_type i) const { - return flux_matrices_up.read(i); + return *flux_matrices_up.read* >(i); } @@ -976,7 +983,7 @@ template inline MGLevelObject > & MGMatrixBlockVector::block_up(size_type i) { - return flux_matrices_up(i); + return *flux_matrices_up.entry* >(i); } @@ -984,7 +991,7 @@ template inline const MGLevelObject > & MGMatrixBlockVector::block_down(size_type i) const { - return flux_matrices_down.read(i); + return *flux_matrices_down.read* >(i); } @@ -992,7 +999,7 @@ template inline MGLevelObject > & MGMatrixBlockVector::block_down(size_type i) { - return flux_matrices_down(i); + return *flux_matrices_down.entry* >(i); } @@ -1070,11 +1077,11 @@ MGMatrixBlockVector::reinit_edge_flux(const MGLevelObject inline void -MGMatrixBlockVector::clear_object(NamedData > > &mo) +MGMatrixBlockVector::clear_object(AnyData &mo) { for (size_type i=0; i > &o = mo(i); + MGLevelObject > &o = mo.entry* >(i); for (size_type level = o.min_level(); level <= o.max_level(); ++level) o[level].matrix.clear(); } diff --git a/include/deal.II/meshworker/assembler.h b/include/deal.II/meshworker/assembler.h index 344ba2c864..10a4029a49 100644 --- a/include/deal.II/meshworker/assembler.h +++ b/include/deal.II/meshworker/assembler.h @@ -17,7 +17,6 @@ #ifndef __deal2__mesh_worker_assembler_h #define __deal2__mesh_worker_assembler_h -#include #include #include #include @@ -25,6 +24,7 @@ #include #include #include +#include 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 &residuals); + AnyData &residuals); /** * Initialize the constraints. */ @@ -148,10 +148,9 @@ namespace MeshWorker const std::vector &dof); /** - * The global matrices, stored as a vector of pointers. + * The global vectors, stored as an AnyData container of pointers. */ - NamedData > > residuals; + AnyData residuals; /** * A pointer to the object containing the block structure. @@ -497,7 +496,7 @@ namespace MeshWorker template inline void ResidualLocalBlocksToGlobalBlocks::initialize(const BlockInfo *b, - NamedData &m) + AnyData &m) { block_info = b; residuals = m; diff --git a/include/deal.II/meshworker/functional.h b/include/deal.II/meshworker/functional.h index c210083641..6bd6c6c5b6 100644 --- a/include/deal.II/meshworker/functional.h +++ b/include/deal.II/meshworker/functional.h @@ -17,7 +17,6 @@ #ifndef __deal2__mesh_worker_functional_h #define __deal2__mesh_worker_functional_h -#include #include #include #include @@ -115,13 +114,8 @@ namespace MeshWorker void initialize(AnyData &results, bool separate_faces = true); /** - * @deprecated - */ - void initialize(NamedData*> &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 !face, or else to an * interior or boundary face. @@ -220,22 +214,6 @@ namespace MeshWorker separate_faces = sep; } - template - inline void - CellsAndFaces::initialize(NamedData*> &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 template inline void diff --git a/include/deal.II/meshworker/integration_info.h b/include/deal.II/meshworker/integration_info.h index 98b8e7d604..c8e67c7f63 100644 --- a/include/deal.II/meshworker/integration_info.h +++ b/include/deal.II/meshworker/integration_info.h @@ -317,21 +317,17 @@ namespace MeshWorker const VECTOR &dummy, const BlockInfo *block_info = 0); /** - * @deprecated Use AnyData instead of NamedData. - */ - template - void initialize(const FiniteElement &el, - const Mapping &mapping, - const NamedData &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 void initialize(const FiniteElement &el, const Mapping &mapping, - const NamedData*> &data, + const AnyData &data, + const MGLevelObject &dummy, const BlockInfo *block_info = 0); /** * @name FEValues setup @@ -813,69 +809,43 @@ namespace MeshWorker neighbor.initialize_data(p); } - - template - template - void - IntegrationInfoBox::initialize( - const FiniteElement &el, - const Mapping &mapping, - const NamedData &data, - const BlockInfo *block_info) - { - initialize(el, mapping, block_info); - std_cxx11::shared_ptr > p; - - p = std_cxx11::shared_ptr >(new VectorData (cell_selector)); - p->initialize(data); - cell_data = p; - cell.initialize_data(p); - - p = std_cxx11::shared_ptr >(new VectorData (boundary_selector)); - p->initialize(data); - boundary_data = p; - boundary.initialize_data(p); - - p = std_cxx11::shared_ptr >(new VectorData (face_selector)); - p->initialize(data); - face_data = p; - face.initialize_data(p); - subface.initialize_data(p); - neighbor.initialize_data(p); - } - - template template void IntegrationInfoBox::initialize( const FiniteElement &el, const Mapping &mapping, - const NamedData*> &data, + const AnyData &data, + const MGLevelObject &dummy, const BlockInfo *block_info) { initialize(el, mapping, block_info); std_cxx11::shared_ptr > p; + VectorDataBase *pp; p = std_cxx11::shared_ptr >(new MGVectorData (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 >(new MGVectorData (boundary_selector)); - p->initialize(data); + pp = &*p; + pp->initialize(data); boundary_data = p; boundary.initialize_data(p); p = std_cxx11::shared_ptr >(new MGVectorData (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 template void diff --git a/include/deal.II/meshworker/output.h b/include/deal.II/meshworker/output.h index 683e401999..b5d7f8618c 100644 --- a/include/deal.II/meshworker/output.h +++ b/include/deal.II/meshworker/output.h @@ -18,7 +18,6 @@ #define __deal2__mesh_worker_output_h #include -#include #include #include #include diff --git a/include/deal.II/meshworker/simple.h b/include/deal.II/meshworker/simple.h index 2f33e91b83..063706284d 100644 --- a/include/deal.II/meshworker/simple.h +++ b/include/deal.II/meshworker/simple.h @@ -17,7 +17,6 @@ #ifndef __deal2__mesh_worker_simple_h #define __deal2__mesh_worker_simple_h -#include #include #include #include @@ -63,10 +62,6 @@ namespace MeshWorker */ void initialize(AnyData &results); - /** - * @deprecated Use initialize(AnyData&) instead. - */ - void initialize(NamedData &results); /** * Initialize the constraints. */ @@ -487,13 +482,6 @@ namespace MeshWorker residuals = results; } - template - inline void - ResidualSimple::initialize(NamedData &results) - { - residuals = results; - } - template inline void ResidualSimple::initialize(const ConstraintMatrix &c) diff --git a/include/deal.II/meshworker/vector_selector.h b/include/deal.II/meshworker/vector_selector.h index 125c79f2fe..c805e8af63 100644 --- a/include/deal.II/meshworker/vector_selector.h +++ b/include/deal.II/meshworker/vector_selector.h @@ -16,8 +16,8 @@ #ifndef __deal2__mesh_worker_vector_selector_h #define __deal2__mesh_worker_vector_selector_h -#include #include +#include #include #include #include @@ -81,12 +81,6 @@ namespace MeshWorker */ void initialize(const AnyData &); - /** - * @deprecated Use AnyData instead of NamedData. - */ - template - void initialize(const NamedData &); - /** * Check whether any vector is selected. */ @@ -143,12 +137,6 @@ namespace MeshWorker template void print (STREAM &s, const AnyData &v) const; - /** - * @deprecated Use AnyData instead of NamedData. - */ - template - void print (STREAM &s, const NamedData &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 &); + 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*> &); + 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 - inline void - VectorSelector::initialize(const NamedData &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 - inline void - VectorSelector::print(STREAM &s, const NamedData &v) const - { - s << "values: "; - for (unsigned int i=0; i void - VectorData::initialize(const NamedData &d) + VectorData::initialize(const AnyData &d) { this->data = d; VectorSelector::initialize(d); @@ -182,7 +182,7 @@ namespace MeshWorker template void - MGVectorData::initialize(const NamedData*> &d) + MGVectorData::initialize(const AnyData &d) { this->data = d; VectorSelector::initialize(d); diff --git a/include/deal.II/numerics/dof_output_operator.h b/include/deal.II/numerics/dof_output_operator.h index 1dcb6923b4..eeb51bd37d 100644 --- a/include/deal.II/numerics/dof_output_operator.h +++ b/include/deal.II/numerics/dof_output_operator.h @@ -19,7 +19,6 @@ #include #include -#include #include #include #include diff --git a/source/base/named_selection.cc b/source/base/named_selection.cc index a5495d4ae0..cd85e6c26b 100644 --- a/source/base/named_selection.cc +++ b/source/base/named_selection.cc @@ -13,7 +13,7 @@ // // --------------------------------------------------------------------- -#include +#include #include DEAL_II_NAMESPACE_OPEN diff --git a/tests/algorithms/newton_01.cc b/tests/algorithms/newton_01.cc index f6f3ff26a6..765866531d 100644 --- a/tests/algorithms/newton_01.cc +++ b/tests/algorithms/newton_01.cc @@ -18,7 +18,6 @@ #include #include #include -#include //test computing square root of 2 with newton's method @@ -101,19 +100,18 @@ void test () sq_solver); newton.initialize(output); - NamedData*> in_data; - NamedData*> out_data; + AnyData in_data; + AnyData out_data; Vector solution (1); solution = 10.; - Vector *p = &solution; - out_data.add(p, "solution"); + out_data.add*>(&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*>(0))(0) << std::endl; } diff --git a/tests/algorithms/newton_01_compat.cc b/tests/algorithms/newton_01_compat.cc deleted file mode 100644 index 689f5e1b63..0000000000 --- a/tests/algorithms/newton_01_compat.cc +++ /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 -#include -#include -#include - - -//test computing square root of 2 with newton's method - -using namespace dealii; - -class SquareRoot : public Subscriptor -{ -public: - void start_vector (Vector &start) const; - void residual (NamedData*> &out, - const NamedData*> &in); - void solve (NamedData*> &out, - const NamedData*> &in); -}; - -class SquareRootResidual : public - Algorithms::Operator > -{ - SmartPointer - discretization; -public: - - SquareRootResidual(SquareRoot &problem) - : discretization(&problem) - {} - - virtual void operator ()( - NamedData*> &out, - const NamedData*> &in) - { - discretization->residual(out,in); - } -}; - -class SquareRootSolver : public - Algorithms::Operator > -{ - SmartPointer - solver; -public: - - SquareRootSolver(SquareRoot &problem) - : solver(&problem) - {} - - virtual void operator ()( - NamedData*> &out, - const NamedData*> &in) - { - solver->solve(out,in); - } -}; - -void SquareRoot::residual ( - NamedData*> &out, - const NamedData*> &in) -{ - //residuum = 0 - *out(0) = 0.; - const Vector &x = *in(in.find("Newton iterate")); - *out(0) = x*x - 2.; -} - -void SquareRoot::solve ( - NamedData*> &out, - const NamedData*> &in) -{ - *out(0) = 0; - const Vector &x = *in(in.find("Newton iterate")); - const Vector &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 > output; - - Algorithms::Newton > newton( - sq_residual, - sq_solver); - newton.initialize(output); - - NamedData*> in_data; - NamedData*> out_data; - - Vector solution (1); - solution = 10.; - Vector *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 index 62ce10ad2c..0000000000 --- a/tests/algorithms/newton_01_compat.output +++ /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 index 83db98b0bc..0000000000 --- a/tests/algorithms/operator_compatibility.cc +++ /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 -#include - -using namespace Algorithms; - -class Op1 : public Operator > -{ - public: - virtual void operator() (AnyData& out, const AnyData& in) - { - Vector* u = out.entry*>("u"); - deallog << "u " << (*u)(0) << std::endl; - - const Vector* v = in.entry*>("v"); - deallog << "v " << (*v)(0) << std::endl; - } -}; - -class Op2 : public Operator > -{ - public: - virtual void operator() (NamedData*>& out, - const NamedData*>& in) - { - Vector* u = out(out.find("u")); - deallog << "u " << (*u)(0) << std::endl; - - const Vector * const v = in(in.find("v")); - deallog << "v " << (*v)(0) << std::endl; - } -}; - -void test(Operator >& op) -{ - Vector u(1); - Vector* p = &u; - Vector v(1); - u(0) = 3.; - v(0) = 7.; - - AnyData o1; - o1.add (p, "u"); - AnyData i1; - i1.add (&v, "v"); - - NamedData*> o2; - o2.add (p, "u"); - NamedData*> 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 index 97807d9528..0000000000 --- a/tests/algorithms/operator_compatibility.output +++ /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 index e9c51fe70a..0000000000 --- a/tests/algorithms/theta_01_compat.cc +++ /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 -#include -#include - -#include -#include - -#include - -using namespace dealii; -using namespace Algorithms; - - -class Explicit - : public Operator > -{ -public: - Explicit(const FullMatrix &matrix); - void operator() (NamedData*> &out, - const NamedData*> &in); - - void initialize_timestep_data(const TimestepData &); -private: - const TimestepData *timestep_data; - SmartPointer, Explicit> matrix; - FullMatrix m; -}; - - -class Implicit - : public Operator > -{ -public: - Implicit(const FullMatrix &matrix); - void operator() (NamedData*> &out, - const NamedData*> &in); - - void initialize_timestep_data(const TimestepData &); -private: - const TimestepData *timestep_data; - SmartPointer, Implicit> matrix; - FullMatrix 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 matrix(2); - matrix(0,0) = 0.; - matrix(1,1) = 0.; - matrix(0,1) = numbers::PI; - matrix(1,0) = -numbers::PI; - - OutputOperator > out; - out.initialize_stream(logfile); - - Explicit op_explicit(matrix); - Implicit op_implicit(matrix); - ThetaTimestepping > 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 value(2); - value(0) = 1.; - NamedData*> indata; - NamedData*> outdata; - Vector *p = &value; - outdata.add(p, "value"); - deallog << "Initial: " << value(0) << ' ' << value(1) << std::endl; - solver.notify(Events::initial); - solver.Operator >::operator()(outdata, indata); - deallog << "Result: " << value(0) << ' ' << value(1) - << " Norm " << value.l2_norm() << std::endl; -} - - -Explicit::Explicit(const FullMatrix &M) - : - matrix(&M) -{ - m.reinit(M.m(), M.n()); -} - - -void -Explicit::initialize_timestep_data(const TimestepData &t) -{ - timestep_data = &t; -} - - -void -Explicit::operator() (NamedData*> &out, const NamedData*> &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; inotifications.clear(); - unsigned int i = in.find("Previous iterate"); - m.vmult(*out(0), *in(i)); -} - - -Implicit::Implicit(const FullMatrix &M) - : - matrix(&M) -{ - m.reinit(M.m(), M.n()); -} - - -void -Implicit::initialize_timestep_data(const TimestepData &t) -{ - timestep_data = &t; -} - - -void -Implicit::operator() (NamedData*> &out, const NamedData*> &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; inotifications.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 index 7c4d9ddfc7..0000000000 --- a/tests/algorithms/theta_01_compat.output +++ /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 index 7a68ad3cfa..0000000000 --- a/tests/base/named_data.cc +++ /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 -#include - -#include -#include - -template -void -test_const(const NamedData &data) -{ - NamedData newdata; - newdata.merge(data); - data.print(deallog); - - deallog << "Const should be true: " << (newdata.is_const() ? "true" : "false") << std::endl; -} - -template -void -test_selector(const NamedData &data) -{ - NamedSelection select; - select.add("P1"); - select.add("P6"); - select.add("P5"); - select.add("P3"); - select.initialize(data); - - for (unsigned int i=0; i > data; - deallog << "const" << data.is_const() << std::endl; - std_cxx11::shared_ptr p = std_cxx11::shared_ptr(new double); - data.add(p, "P1"); - p = std_cxx11::shared_ptr(new double); - data.add(p, "P2"); - p = std_cxx11::shared_ptr(new double); - data.add(p, "P3"); - p = std_cxx11::shared_ptr(new double); - data.add(p, "P4"); - p = std_cxx11::shared_ptr(new double); - data.add(p, "P5"); - - for (unsigned int i=0; i &mgdofs) cells.collect_sizes(); faces.collect_sizes(); - NamedData* > out_data; - BlockVector *p = &cells; - out_data.add(p, "cells"); - p = &faces; - out_data.add(p, "faces"); + AnyData out_data; + out_data.add*>(&cells, "cells"); + out_data.add*>(&faces, "faces"); Local local; EmptyInfoBox info_box; diff --git a/tests/integrators/cochain_01.cc b/tests/integrators/cochain_01.cc index e0b1ec868f..7fa8b6a749 100644 --- a/tests/integrators/cochain_01.cc +++ b/tests/integrators/cochain_01.cc @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include @@ -109,8 +109,8 @@ test_cochain(const Triangulation &tr, const FiniteElement &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); diff --git a/tests/integrators/mesh_worker_1d_dg.cc b/tests/integrators/mesh_worker_1d_dg.cc index 61f13f3c9c..e253cc3d04 100644 --- a/tests/integrators/mesh_worker_1d_dg.cc +++ b/tests/integrators/mesh_worker_1d_dg.cc @@ -230,25 +230,22 @@ namespace Advection info_box.add_update_flags(update_flags, true, true, true, true); - NamedData* > solution_data; + AnyData solution_data; - Vector *u = &solution; - - solution_data.add(u, "solution"); + solution_data.add* >(&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..."< dof_info(dof_handler); //deallog<<"\nApparently it DoFInfo was constructed fine!"< > assembler; - NamedData* > data; - Vector *rhs = &residual; - data.add(rhs, "Residual"); + AnyData data; + data.add* >(&residual, "Residual"); assembler.initialize(data); MeshWorker::LoopControl lctrl; diff --git a/tests/multigrid/mg_renumbered_02.cc b/tests/multigrid/mg_renumbered_02.cc index 9bc6e7195b..4b9c9d7145 100644 --- a/tests/multigrid/mg_renumbered_02.cc +++ b/tests/multigrid/mg_renumbered_02.cc @@ -119,7 +119,7 @@ void diff (Vector &diff, const DoFHandler &dof, { diff.reinit (v); const unsigned int dofs_per_cell = dof.get_fe().dofs_per_cell; - std::vector mg_dof_indices(dofs_per_cell); + std::vector mg_dof_indices(dofs_per_cell); const unsigned int n_comp = dof.get_fe().n_components(); for (typename DoFHandler::cell_iterator cell= dof.begin(level); @@ -248,10 +248,10 @@ LaplaceProblem::output_gpl(const DoFHandler &dof, UpdateFlags update_flags = update_quadrature_points | update_values | update_gradients; info_box.add_update_flags(update_flags, true, true, true, true); - NamedData >* > data; - data.add(&v, "mg_vector"); + AnyData data; + data.add >* >(&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 dof_info(dof); diff --git a/tests/multigrid/mg_renumbered_03.cc b/tests/multigrid/mg_renumbered_03.cc index 9a9e0860fd..57e0f2406b 100644 --- a/tests/multigrid/mg_renumbered_03.cc +++ b/tests/multigrid/mg_renumbered_03.cc @@ -233,7 +233,7 @@ private: DoFHandler mg_dof_handler_renumbered; const unsigned int degree; - std::vector > + std::vector > boundary_indices, boundary_indices_renumbered; }; @@ -293,13 +293,13 @@ LaplaceProblem::output_gpl(const DoFHandler &dof, QTrapez<1> trapez; QIterated quadrature(trapez, n_gauss_points); info_box.cell_quadrature = quadrature; - NamedData >* > data; - data.add(&v, "mg_vector"); + AnyData data; + data.add >* >(&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 dof_info(dof); diff --git a/tests/multigrid/step-39-02.cc b/tests/multigrid/step-39-02.cc index f3356e0615..45bf0239e8 100644 --- a/tests/multigrid/step-39-02.cc +++ b/tests/multigrid/step-39-02.cc @@ -18,7 +18,7 @@ #include "../tests.h" #include -#include +#include #include #include #include @@ -358,8 +358,7 @@ namespace Step39 Triangulation triangulation; const MappingQ1 mapping; const FiniteElement &fe; - DoFHandler mg_dof_handler; - DoFHandler &dof_handler; + DoFHandler dof_handler; SparsityPattern sparsity; SparseMatrix 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 dof_info(mg_dof_handler); + MeshWorker::DoFInfo dof_info(dof_handler); MeshWorker::Assembler::MGMatrixSimple > assembler; assembler.initialize(mg_matrix); @@ -479,7 +477,7 @@ namespace Step39 MatrixIntegrator integrator; MeshWorker::integration_loop ( - 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 dof_info(dof_handler); MeshWorker::Assembler::ResidualSimple > assembler; - NamedData* > data; - Vector *rhs = &right_hand_side; - data.add(rhs, "RHS"); + AnyData data; + data.add*>(&right_hand_side, "RHS"); assembler.initialize(data); RHSIntegrator integrator; @@ -525,7 +522,7 @@ namespace Step39 SolverCG > solver(control); MGTransferPrebuilt > mg_transfer; - mg_transfer.build_matrices(mg_dof_handler); + mg_transfer.build_matrices(dof_handler); FullMatrix coarse_matrix; coarse_matrix.copy_from (mg_matrix[0]); @@ -548,7 +545,7 @@ namespace Step39 mg::Matrix > mgup(mg_matrix_dg_up); mg::Matrix > mgedge(mg_matrix_in_out); - Multigrid > mg(mg_dof_handler, mgmatrix, + Multigrid > 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, MGTransferPrebuilt > > - 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* > solution_data; - solution_data.add(&solution, "solution"); + AnyData solution_data; + solution_data.add*>(&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 dof_info(dof_handler); MeshWorker::Assembler::CellsAndFaces assembler; - NamedData* > out_data; - BlockVector *est = &estimates; - out_data.add(est, "cells"); + AnyData out_data; + out_data.add*>(&estimates, "cells"); assembler.initialize(out_data, false); Estimator 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* > solution_data; - solution_data.add(&solution, "solution"); + AnyData solution_data; + solution_data.add*>(&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 dof_info(dof_handler); MeshWorker::Assembler::CellsAndFaces assembler; - NamedData* > out_data; - BlockVector *est = &errors; - out_data.add(est, "cells"); + AnyData out_data; + out_data.add* >(&errors, "cells"); assembler.initialize(out_data, false); ErrorIntegrator integrator; @@ -700,7 +695,7 @@ namespace Step39 setup_system(); deallog << "DoFHandler " << dof_handler.n_dofs() << " dofs, level dofs"; for (unsigned int l=0; l -#include +#include #include #include #include @@ -359,9 +359,8 @@ namespace Step39 Triangulation triangulation; const MappingQ1 mapping; const FiniteElement &fe; - DoFHandler mg_dof_handler; - DoFHandler &dof_handler; - MGConstrainedDoFs mg_constraints; + DoFHandler dof_handler; + MGConstrainedDoFs mg_constraints; SparsityPattern sparsity; SparseMatrix 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 dof_info(mg_dof_handler); + MeshWorker::DoFInfo dof_info(dof_handler); MeshWorker::Assembler::MGMatrixSimple > assembler; assembler.initialize(mg_matrix); @@ -485,7 +483,7 @@ namespace Step39 MatrixIntegrator integrator; MeshWorker::integration_loop ( - 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 dof_info(dof_handler); MeshWorker::Assembler::ResidualSimple > assembler; - NamedData* > data; - Vector *rhs = &right_hand_side; - data.add(rhs, "RHS"); + AnyData data; + data.add*>(&right_hand_side, "RHS"); assembler.initialize(data); RHSIntegrator integrator; @@ -531,7 +528,7 @@ namespace Step39 SolverCG > solver(control); MGTransferPrebuilt > mg_transfer; - mg_transfer.build_matrices(mg_dof_handler); + mg_transfer.build_matrices(dof_handler); FullMatrix coarse_matrix; coarse_matrix.copy_from (mg_matrix[0]); @@ -554,7 +551,7 @@ namespace Step39 mg::Matrix > mgup(mg_matrix_dg_up); mg::Matrix > mgedge(mg_matrix_in_out); - Multigrid > mg(mg_dof_handler, mgmatrix, + Multigrid > 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, MGTransferPrebuilt > > - 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* > solution_data; - solution_data.add(&solution, "solution"); + AnyData solution_data; + solution_data.add*>(&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 dof_info(dof_handler); MeshWorker::Assembler::CellsAndFaces assembler; - NamedData* > out_data; - BlockVector *est = &estimates; - out_data.add(est, "cells"); + AnyData out_data; + out_data.add*>(&estimates, "cells"); assembler.initialize(out_data, false); Estimator 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* > solution_data; - solution_data.add(&solution, "solution"); + AnyData solution_data; + solution_data.add*>(&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 dof_info(dof_handler); MeshWorker::Assembler::CellsAndFaces assembler; - NamedData* > out_data; - BlockVector *est = &errors; - out_data.add(est, "cells"); + AnyData out_data; + out_data.add* >(&errors, "cells"); assembler.initialize(out_data, false); ErrorIntegrator integrator; @@ -706,7 +701,7 @@ namespace Step39 setup_system(); deallog << "DoFHandler " << dof_handler.n_dofs() << " dofs, level dofs"; for (unsigned int l=0; l -#include +#include #include #include #include @@ -364,8 +364,7 @@ namespace Step39 Triangulation triangulation; const MappingQ1 mapping; const FiniteElement &fe; - DoFHandler mg_dof_handler; - DoFHandler &dof_handler; + DoFHandler dof_handler; SparsityPattern sparsity; SparseMatrix 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 dof_info(mg_dof_handler); + MeshWorker::DoFInfo dof_info(dof_handler); MeshWorker::Assembler::MGMatrixSimple > assembler; assembler.initialize(mg_matrix); @@ -485,7 +483,7 @@ namespace Step39 MatrixIntegrator integrator; MeshWorker::integration_loop ( - 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 dof_info(dof_handler); MeshWorker::Assembler::ResidualSimple > assembler; - NamedData* > data; - Vector *rhs = &right_hand_side; - data.add(rhs, "RHS"); + AnyData data; + data.add*>(&right_hand_side, "RHS"); assembler.initialize(data); RHSIntegrator integrator; @@ -531,7 +528,7 @@ namespace Step39 SolverGMRES > solver(control); MGTransferPrebuilt > mg_transfer; - mg_transfer.build_matrices(mg_dof_handler); + mg_transfer.build_matrices(dof_handler); FullMatrix coarse_matrix; coarse_matrix.copy_from (mg_matrix[0]); @@ -554,7 +551,7 @@ namespace Step39 mg::Matrix > mgup(mg_matrix_dg_up); mg::Matrix > mgedge(mg_matrix_in_out); - Multigrid > mg(mg_dof_handler, mgmatrix, + Multigrid > 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, MGTransferPrebuilt > > - 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* > solution_data; - solution_data.add(&solution, "solution"); + AnyData solution_data; + solution_data.add*>(&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 dof_info(dof_handler); MeshWorker::Assembler::CellsAndFaces assembler; - NamedData* > out_data; - BlockVector *est = &estimates; - out_data.add(est, "cells"); + AnyData out_data; + out_data.add*>(&estimates, "cells"); assembler.initialize(out_data, false); Estimator 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* > solution_data; - solution_data.add(&solution, "solution"); + AnyData solution_data; + solution_data.add*>(&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 dof_info(dof_handler); MeshWorker::Assembler::CellsAndFaces assembler; - NamedData* > out_data; - BlockVector *est = &errors; - out_data.add(est, "cells"); + AnyData out_data; + out_data.add* >(&errors, "cells"); assembler.initialize(out_data, false); ErrorIntegrator integrator; @@ -706,7 +701,7 @@ namespace Step39 setup_system(); deallog << "DoFHandler " << dof_handler.n_dofs() << " dofs, level dofs"; for (unsigned int l=0; l -#include +#include #include #include #include @@ -359,8 +359,7 @@ namespace Step39 Triangulation triangulation; const MappingQ1 mapping; const FiniteElement &fe; - DoFHandler mg_dof_handler; - DoFHandler &dof_handler; + DoFHandler dof_handler; SparsityPattern sparsity; SparseMatrix 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 dof_info(mg_dof_handler); + MeshWorker::DoFInfo dof_info(dof_handler); MeshWorker::Assembler::MGMatrixSimple > assembler; assembler.initialize(mg_matrix); @@ -475,7 +473,7 @@ namespace Step39 MatrixIntegrator integrator; MeshWorker::integration_loop ( - 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 dof_info(dof_handler); MeshWorker::Assembler::ResidualSimple > assembler; - NamedData* > data; - Vector *rhs = &right_hand_side; - data.add(rhs, "RHS"); + AnyData data; + data.add*>(&right_hand_side, "RHS"); assembler.initialize(data); RHSIntegrator integrator; @@ -516,7 +513,7 @@ namespace Step39 SolverCG > solver(control); MGTransferPrebuilt > mg_transfer; - mg_transfer.build_matrices(mg_dof_handler); + mg_transfer.build_matrices(dof_handler); FullMatrix coarse_matrix; coarse_matrix.copy_from (mg_matrix[0]); @@ -538,14 +535,14 @@ namespace Step39 mg::Matrix > mgdown(mg_matrix_dg_down); mg::Matrix > mgup(mg_matrix_dg_up); - Multigrid > mg(mg_dof_handler, mgmatrix, + Multigrid > mg(dof_handler, mgmatrix, mg_coarse, mg_transfer, mg_smoother, mg_smoother); mg.set_edge_flux_matrices(mgdown, mgup); PreconditionMG, MGTransferPrebuilt > > - 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* > solution_data; - solution_data.add(&solution, "solution"); + AnyData solution_data; + solution_data.add*>(&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 dof_info(dof_handler); MeshWorker::Assembler::CellsAndFaces assembler; - NamedData* > out_data; - BlockVector *est = &estimates; - out_data.add(est, "cells"); + AnyData out_data; + out_data.add*>(&estimates, "cells"); assembler.initialize(out_data, false); Estimator 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* > solution_data; - solution_data.add(&solution, "solution"); + AnyData solution_data; + solution_data.add*>(&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 dof_info(dof_handler); MeshWorker::Assembler::CellsAndFaces assembler; - NamedData* > out_data; - BlockVector *est = &errors; - out_data.add(est, "cells"); + AnyData out_data; + out_data.add* >(&errors, "cells"); assembler.initialize(out_data, false); ErrorIntegrator integrator; @@ -689,7 +684,7 @@ namespace Step39 setup_system(); deallog << "DoFHandler " << dof_handler.n_dofs() << " dofs, level dofs"; for (unsigned int l=0; l