deal.II version GIT relicensing-6809-ge913b9bb34 2026-09-25 17:20:01+00:00
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
mapping_collection.h
Go to the documentation of this file.
1// -----------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
4// Copyright (C) 2005 - 2025 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Detailed license information governing the source code and contributions
9// can be found in LICENSE.md and CONTRIBUTING.md at the top level directory.
10//
11// -----------------------------------------------------------------------------
12
13#ifndef dealii_mapping_collection_h
14#define dealii_mapping_collection_h
15
16#include <deal.II/base/config.h>
17
19
20#include <deal.II/fe/fe.h>
21#include <deal.II/fe/mapping.h>
23
25
26#include <memory>
27#include <vector>
28
30
31namespace hp
32{
53 template <int dim, int spacedim = dim>
54 class MappingCollection : public Collection<Mapping<dim, spacedim>>
55 {
56 public:
61 MappingCollection() = default;
62
69 explicit MappingCollection(const Mapping<dim, spacedim> &mapping);
70
77 template <class... MappingTypes>
78 explicit MappingCollection(const MappingTypes &...mappings);
79
84 const MappingCollection<dim, spacedim> &mapping_collection);
85
96 std::is_nothrow_move_constructible_v<
97 std::vector<std::shared_ptr<const Mapping<dim, spacedim>>>>
98 &&std::is_nothrow_move_constructible_v<std::function<
99 unsigned int(const typename hp::MappingCollection<dim, spacedim> &,
100 const unsigned int)>>) = default;
101
105 MappingCollection<dim, spacedim> &
106 operator=(MappingCollection<dim, spacedim> &&) = default; // NOLINT
107
120 void
121 push_back(const Mapping<dim, spacedim> &new_mapping);
122 };
123
124
141 template <int dim, int spacedim = dim>
150
151
152
153 /* --------------- inline functions ------------------- */
154
155 template <int dim, int spacedim>
156 template <class... MappingTypes>
158 const MappingTypes &...mappings)
159 {
160 static_assert(
161 is_base_of_all<Mapping<dim, spacedim>, MappingTypes...>::value,
162 "Not all of the input arguments of this function "
163 "are derived from Mapping<dim, spacedim>!");
164
165 // loop over all of the given arguments and add the mappings to
166 // this collection. Inlining the definition of mapping_pointers causes
167 // internal compiler errors on GCC 7.1.1 so we define it separately:
168 const auto mapping_pointers = {
169 (static_cast<const Mapping<dim, spacedim> *>(&mappings))...};
170 for (const auto p : mapping_pointers)
171 push_back(*p);
172 }
173
174
175
176 template <int dim, int spacedim>
180
181
182#ifndef DOXYGEN
183// Declare the existence of explicit instantiations of the class
184// above. This is not strictly necessary, but tells the compiler to
185// avoid instantiating templates that we know are instantiated in
186// .cc files and so can be referenced without implicit
187// instantiations. In the current case, this also avoids certain
188// warnings issues by clang and newer (LLVM-based) Intel compilers.
189//
190// Unfortunately, this does not seem to work when building modules
191// because the compiler (well, Clang at least) then just doesn't
192// instantiate these classes at all, even though their members are
193// defined and explicitly instantiated in a .cc file.
194# ifndef DEAL_II_BUILDING_CXX20_MODULE
195 extern template struct StaticMappingQ1<1, 1>;
196 extern template struct StaticMappingQ1<1, 2>;
197 extern template struct StaticMappingQ1<1, 3>;
198 extern template struct StaticMappingQ1<2, 2>;
199 extern template struct StaticMappingQ1<2, 3>;
200 extern template struct StaticMappingQ1<3, 3>;
201
202# ifndef _MSC_VER
203 extern template MappingCollection<1, 1>
205 extern template MappingCollection<1, 2>
207 extern template MappingCollection<1, 3>
209 extern template MappingCollection<2, 2>
211 extern template MappingCollection<2, 3>
213 extern template MappingCollection<3, 3>
215# endif
216# endif
217#endif
218
219} // namespace hp
220
221
223
224#endif
Abstract base class for mapping classes.
Definition mapping.h:318
void push_back(const Mapping< dim, spacedim > &new_mapping)
MappingCollection(const MappingTypes &...mappings)
MappingCollection(MappingCollection< dim, spacedim > &&) noexcept(std::is_nothrow_move_constructible_v< std::vector< std::shared_ptr< const Mapping< dim, spacedim > > > > &&std::is_nothrow_move_constructible_v< std::function< unsigned int(const typename hp::MappingCollection< dim, spacedim > &, const unsigned int)> >)=default
MappingCollection()=default
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:38
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:39
Definition hp.h:115
STL namespace.
static MappingCollection< dim, spacedim > mapping_collection