Reference documentation for deal.II version 8.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
mapping_collection.h
1 // ---------------------------------------------------------------------
2 // @f$Id: mapping_collection.h 30036 2013-07-18 16:55:32Z maier @f$
3 //
4 // Copyright (C) 2005 - 2013 by the deal.II authors
5 //
6 // This file is part of the deal.II library.
7 //
8 // The deal.II library is free software; you can use it, redistribute
9 // it, and/or modify it under the terms of the GNU Lesser General
10 // Public License as published by the Free Software Foundation; either
11 // version 2.1 of the License, or (at your option) any later version.
12 // The full text of the license can be found in the file LICENSE at
13 // the top level of the deal.II distribution.
14 //
15 // ---------------------------------------------------------------------
16 
17 #ifndef __deal2__mapping_collection_h
18 #define __deal2__mapping_collection_h
19 
20 #include <deal.II/base/config.h>
21 #include <deal.II/base/subscriptor.h>
22 #include <deal.II/fe/mapping_q1.h>
23 #include <deal.II/fe/fe.h>
24 
25 #include <vector>
26 #include <deal.II/base/std_cxx1x/shared_ptr.h>
27 
28 DEAL_II_NAMESPACE_OPEN
29 
30 namespace hp
31 {
55  template<int dim, int spacedim=dim>
56  class MappingCollection : public Subscriptor
57  {
58  public:
66 
78  explicit MappingCollection (const Mapping<dim,spacedim> &mapping);
79 
83  MappingCollection (const MappingCollection<dim,spacedim> &mapping_collection);
84 
98  void push_back (const Mapping<dim,spacedim> &new_mapping);
99 
112  const Mapping<dim,spacedim> &
113  operator[] (const unsigned int index) const;
114 
120  unsigned int size () const;
121 
127  std::size_t memory_consumption () const;
128 
129  private:
135  std::vector<std_cxx1x::shared_ptr<const Mapping<dim,spacedim> > > mappings;
136  };
137 
138 
146  template<int dim, int spacedim=dim>
148  {
149  private:
161 
162  public:
169  };
170 
171 
172  /* --------------- inline functions ------------------- */
173 
174  template<int dim, int spacedim>
175  inline
176  unsigned int
178  {
179  return mappings.size();
180  }
181 
182 
183 
184  template<int dim, int spacedim>
185  inline
186  const Mapping<dim,spacedim> &
187  MappingCollection<dim,spacedim>::operator[] (const unsigned int index) const
188  {
189  Assert (index < mappings.size (),
190  ExcIndexRange (index, 0, mappings.size ()));
191  return *mappings[index];
192  }
193 
194 } // namespace hp
195 
196 
197 DEAL_II_NAMESPACE_CLOSE
198 
199 #endif
void push_back(const Mapping< dim, spacedim > &new_mapping)
static MappingCollection< dim, spacedim > mapping_collection
std::size_t memory_consumption() const
#define Assert(cond, exc)
Definition: exceptions.h:299
::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
static MappingQ1< dim, spacedim > mapping_q1
const Mapping< dim, spacedim > & operator[](const unsigned int index) const
unsigned int size() const
std::vector< std_cxx1x::shared_ptr< const Mapping< dim, spacedim > > > mappings