Reference documentation for deal.II version 9.1.0-pre
mapping_collection.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2005 - 2017 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii_mapping_collection_h
17 #define dealii_mapping_collection_h
18 
19 #include <deal.II/base/config.h>
20 
21 #include <deal.II/base/subscriptor.h>
22 
23 #include <deal.II/fe/fe.h>
24 #include <deal.II/fe/mapping_q1.h>
25 
26 #include <memory>
27 #include <vector>
28 
29 DEAL_II_NAMESPACE_OPEN
30 
31 namespace hp
32 {
55  template <int dim, int spacedim = dim>
56  class MappingCollection : public Subscriptor
57  {
58  public:
63  MappingCollection() = default;
64 
71  explicit MappingCollection(const Mapping<dim, spacedim> &mapping);
72 
77  const MappingCollection<dim, spacedim> &mapping_collection);
78 
91  void
92  push_back(const Mapping<dim, spacedim> &new_mapping);
93 
101  const Mapping<dim, spacedim> &operator[](const unsigned int index) const;
102 
106  unsigned int
107  size() const;
108 
113  std::size_t
114  memory_consumption() const;
115 
116  private:
121  std::vector<std::shared_ptr<const Mapping<dim, spacedim>>> mappings;
122  };
123 
124 
141  template <int dim, int spacedim = dim>
143  {
144  public:
149  };
150 
151 
152  /* --------------- inline functions ------------------- */
153 
154  template <int dim, int spacedim>
155  inline unsigned int
157  {
158  return mappings.size();
159  }
160 
161 
162 
163  template <int dim, int spacedim>
165  operator[](const unsigned int index) const
166  {
167  Assert(index < mappings.size(), ExcIndexRange(index, 0, mappings.size()));
168  return *mappings[index];
169  }
170 
171 } // namespace hp
172 
173 
174 DEAL_II_NAMESPACE_CLOSE
175 
176 #endif
void push_back(const Mapping< dim, spacedim > &new_mapping)
static MappingCollection< dim, spacedim > mapping_collection
MappingCollection()=default
static::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
std::vector< std::shared_ptr< const Mapping< dim, spacedim > > > mappings
#define Assert(cond, exc)
Definition: exceptions.h:1227
Abstract base class for mapping classes.
Definition: dof_tools.h:57
Definition: hp.h:102
const Mapping< dim, spacedim > & operator[](const unsigned int index) const
unsigned int size() const
std::size_t memory_consumption() const