Reference documentation for deal.II version 9.0.0
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 at
12 // the top level of the deal.II distribution.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii_mapping_collection_h
17 #define dealii_mapping_collection_h
18 
19 #include <deal.II/base/config.h>
20 #include <deal.II/base/subscriptor.h>
21 #include <deal.II/fe/mapping_q1.h>
22 #include <deal.II/fe/fe.h>
23 
24 #include <vector>
25 #include <memory>
26 
27 DEAL_II_NAMESPACE_OPEN
28 
29 namespace hp
30 {
53  template <int dim, int spacedim=dim>
54  class MappingCollection : public Subscriptor
55  {
56  public:
61  MappingCollection () = default;
62 
69  explicit MappingCollection (const Mapping<dim,spacedim> &mapping);
70 
74  MappingCollection (const MappingCollection<dim,spacedim> &mapping_collection);
75 
88  void push_back (const Mapping<dim,spacedim> &new_mapping);
89 
97  const Mapping<dim,spacedim> &
98  operator[] (const unsigned int index) const;
99 
103  unsigned int size () const;
104 
109  std::size_t memory_consumption () const;
110 
111  private:
116  std::vector<std::shared_ptr<const Mapping<dim,spacedim> > > mappings;
117  };
118 
119 
136  template <int dim, int spacedim=dim>
138  {
139  public:
144  };
145 
146 
147  /* --------------- inline functions ------------------- */
148 
149  template <int dim, int spacedim>
150  inline
151  unsigned int
153  {
154  return mappings.size();
155  }
156 
157 
158 
159  template <int dim, int spacedim>
160  inline
161  const Mapping<dim,spacedim> &
162  MappingCollection<dim,spacedim>::operator[] (const unsigned int index) const
163  {
164  Assert (index < mappings.size (),
165  ExcIndexRange (index, 0, mappings.size ()));
166  return *mappings[index];
167  }
168 
169 } // namespace hp
170 
171 
172 DEAL_II_NAMESPACE_CLOSE
173 
174 #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:1142
Abstract base class for mapping classes.
Definition: dof_tools.h:46
Definition: hp.h:102
const Mapping< dim, spacedim > & operator[](const unsigned int index) const
std::size_t memory_consumption() const
unsigned int size() const