From 028f6d6ab6d9fa4a19e5888030090c188f1d8a83 Mon Sep 17 00:00:00 2001 From: kanschat Date: Fri, 16 May 2014 09:40:20 +0000 Subject: [PATCH] conversion from NamedData to AnyData and initialization of NamedSelection with AnyData git-svn-id: https://svn.dealii.org/trunk@32920 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/include/deal.II/algorithms/any_data.h | 20 ++++++++++++ deal.II/include/deal.II/base/named_data.h | 8 +++++ deal.II/source/base/CMakeLists.txt | 1 + deal.II/source/base/named_selection.cc | 31 +++++++++++++++++++ 4 files changed, 60 insertions(+) create mode 100644 deal.II/source/base/named_selection.cc diff --git a/deal.II/include/deal.II/algorithms/any_data.h b/deal.II/include/deal.II/algorithms/any_data.h index 4f5550e9e3..000d29e66e 100644 --- a/deal.II/include/deal.II/algorithms/any_data.h +++ b/deal.II/include/deal.II/algorithms/any_data.h @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -38,6 +39,9 @@ class AnyData : public Subscriptor { public: + /// Default constructor for empty object + AnyData(); + /// Number of stored data objects. unsigned int size() const; @@ -125,6 +129,10 @@ class AnyData : /// Find out if object is of a certain type template bool is_type(const unsigned int i) const; + + /// Conversion from old NamedData + template + AnyData(const NamedData&); /// The requested type and the stored type are different DeclException2(ExcTypeMismatch, @@ -141,6 +149,18 @@ class AnyData : }; +AnyData::AnyData() +{} + + +template +AnyData::AnyData(const NamedData& other) +{ + for (unsigned int i=0;i 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 diff --git a/deal.II/source/base/CMakeLists.txt b/deal.II/source/base/CMakeLists.txt index 6745cb7eaf..2041c63052 100644 --- a/deal.II/source/base/CMakeLists.txt +++ b/deal.II/source/base/CMakeLists.txt @@ -38,6 +38,7 @@ SET(_src memory_consumption.cc mpi.cc multithread_info.cc + named_selection.cc parallel.cc parameter_handler.cc parsed_function.cc diff --git a/deal.II/source/base/named_selection.cc b/deal.II/source/base/named_selection.cc new file mode 100644 index 0000000000..59f45decaf --- /dev/null +++ b/deal.II/source/base/named_selection.cc @@ -0,0 +1,31 @@ +// --------------------------------------------------------------------- +// $Id: logstream.cc 31932 2013-12-08 02:15:54Z heister $ +// +// Copyright (C) 1998 - 2013 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 +#include + +DEAL_II_NAMESPACE_OPEN + +void +NamedSelection::initialize(const AnyData &data) +{ + indices.resize(names.size()); + for (unsigned int i=0; i