Reference documentation for deal.II version 9.1.0-pre
mapping_collection.cc
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2003 - 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 
17 #include <deal.II/base/memory_consumption.h>
18 
19 #include <deal.II/hp/mapping_collection.h>
20 
21 DEAL_II_NAMESPACE_OPEN
22 
23 
24 namespace hp
25 {
26  template <int dim, int spacedim>
28  const Mapping<dim, spacedim> &mapping)
29  {
30  mappings.push_back(
31  std::shared_ptr<const Mapping<dim, spacedim>>(mapping.clone()));
32  }
33 
34 
35 
36  template <int dim, int spacedim>
38  const MappingCollection<dim, spacedim> &mapping_collection)
39  : Subscriptor()
40  ,
41  // copy the array
42  // of shared
43  // pointers. nothing
44  // bad should
45  // happen -- they
46  // simply all point
47  // to the same
48  // objects, and the
49  // last one to die
50  // will delete the
51  // mappings
52  mappings(mapping_collection.mappings)
53  {}
54 
55 
56 
57  template <int dim, int spacedim>
58  std::size_t
60  {
61  return (sizeof(*this) + MemoryConsumption::memory_consumption(mappings));
62  }
63 
64 
65 
66  template <int dim, int spacedim>
67  void
69  const Mapping<dim, spacedim> &new_mapping)
70  {
71  mappings.push_back(
72  std::shared_ptr<const Mapping<dim, spacedim>>(new_mapping.clone()));
73  }
74 
75  //---------------------------------------------------------------------------
76 
77 
78  namespace
79  {
89  template <int dim, int spacedim>
91  get_static_mapping_q1()
92  {
93  static MappingQ1<dim, spacedim> mapping;
94  return mapping;
95  }
96  } // namespace
97 
98  template <int dim, int spacedim>
101  MappingCollection<dim, spacedim>(get_static_mapping_q1<dim, spacedim>());
102 
103 } // namespace hp
104 
105 
106 
107 // explicit instantiations
108 #include "mapping_collection.inst"
109 
110 
111 DEAL_II_NAMESPACE_CLOSE
void push_back(const Mapping< dim, spacedim > &new_mapping)
MappingCollection()=default
std::vector< std::shared_ptr< const Mapping< dim, spacedim > > > mappings
Abstract base class for mapping classes.
Definition: dof_tools.h:57
Definition: hp.h:102
std::size_t memory_consumption() const
std::enable_if< std::is_fundamental< T >::value, std::size_t >::type memory_consumption(const T &t)
virtual std::unique_ptr< Mapping< dim, spacedim > > clone() const =0