From 9cf628674b8c0ff9a886f9b13e339ebed3cf5184 Mon Sep 17 00:00:00 2001 From: bangerth Date: Fri, 24 May 2013 18:59:19 +0000 Subject: [PATCH] Add complete_index_set(). git-svn-id: https://svn.dealii.org/trunk@29577 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/doc/news/changes.h | 7 +++++++ deal.II/include/deal.II/base/index_set.h | 26 ++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index 2366459758..366a4d3618 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -121,6 +121,13 @@ this function.

Specific improvements

    +
  1. New: The global function complete_index_set() +creates and returns an index set of given size that contains +every single index with this range. +
    +(Wolfgang Bangerth, 2013/05/24) +
  2. +
  3. New: All vector classes now have a static member variable supports_distributed_data that indicates whether the vector class supports data that is distributed across multiple diff --git a/deal.II/include/deal.II/base/index_set.h b/deal.II/include/deal.II/base/index_set.h index c0cf5a1ddd..3fed2dcc20 100644 --- a/deal.II/include/deal.II/base/index_set.h +++ b/deal.II/include/deal.II/base/index_set.h @@ -571,6 +571,32 @@ private: }; +/** + * Create and return an index set of size $N$ that contains every + * single index within this range. In essence, this function + * returns an index set created by + * @code + * IndexSet is (N); + * is.add_range(0, N); + * @endcode + * This function exists so that one can create and initialize + * index sets that are complete in one step, or so one can write + * code like + * @code + * if (my_index_set == complete_index_set(my_index_set.size()) + * ... + * @endcode + * + * @relates IndexSet + */ +inline +IndexSet complete_index_set (const unsigned int N) +{ + IndexSet is (N); + is.add_range(0, N); + return is; +} + /* ------------------ inline functions ------------------ */ inline -- 2.39.5