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
q_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 - 2024 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_q_collection_h
14#define dealii_q_collection_h
15
16#include <deal.II/base/config.h>
17
21
23
24#include <memory>
25#include <vector>
26
28
29namespace hp
30{
42 template <int dim>
43 class QCollection : public Collection<Quadrature<dim>>
44 {
45 public:
50 QCollection() = default;
51
55 template <int dim_in>
57
64 template <int dim_in>
65 explicit QCollection(const Quadrature<dim_in> &quadrature);
66
73 template <class... QTypes>
74 explicit QCollection(const QTypes &...quadrature_objects);
75
100 template <int dim_in>
101 void
102 push_back(const Quadrature<dim_in> &new_quadrature);
103
108 bool
109 operator==(const QCollection<dim> &q_collection) const;
110
117 unsigned int
119
124 };
125
126
127
128 /* --------------- inline functions ------------------- */
129
130 template <int dim>
131 template <int dim_in>
133 {
134 for (unsigned int i = 0; i < other.size(); ++i)
135 push_back(other[i]);
136 }
137
138
139
140 template <int dim>
141 template <class... QTypes>
142 QCollection<dim>::QCollection(const QTypes &...quadrature_objects)
143 {
144 // loop over all of the given arguments and add the quadrature objects to
145 // this collection. Inlining the definition of q_pointers causes internal
146 // compiler errors on GCC 7.1.1 so we define it separately:
147 if (is_base_of_all<Quadrature<dim>, QTypes...>::value)
148 {
149 const auto q_pointers = {
150 (reinterpret_cast<const Quadrature<dim> *>(&quadrature_objects))...};
151 for (const auto p : q_pointers)
152 push_back(*p);
153 }
154 else if (is_base_of_all<Quadrature<1>, QTypes...>::value)
155 {
156 const auto q_pointers = {
157 (reinterpret_cast<const Quadrature<1> *>(&quadrature_objects))...};
158 for (const auto p : q_pointers)
159 push_back(*p);
160 }
161 else
162 {
164 }
165 }
166
167
168
169 template <int dim>
170 inline unsigned int
172 {
173 Assert(this->size() > 0,
174 ExcMessage("You can't call this function for an empty collection"));
175
176 unsigned int max = 0;
177 for (unsigned int i = 0; i < this->size(); ++i)
178 max = std::max(max, this->operator[](i).size());
179
180 return max;
181 }
182
183
184
185 template <int dim>
186 inline bool
188 {
189 const unsigned int n_quadratures = this->size();
190 if (n_quadratures != q_collection.size())
191 return false;
192
193 for (unsigned int i = 0; i < n_quadratures; ++i)
194 if ((this->operator[](i) == q_collection[i]) == false)
195 return false;
196
197 return true;
198 }
199
200
201
202 template <int dim>
203 template <int dim_in>
205 {
206 this->push_back(quadrature);
207 }
208
209
210 template <int dim>
211 template <int dim_in>
212 inline void
214 {
216 std::make_shared<const Quadrature<dim>>(new_quadrature));
217 }
218
219} // namespace hp
220
221
223
224#endif
***mech_lbc_system increment_interpolation_handlers push_back(scale_z_handler)
unsigned int size() const
Definition collection.h:314
bool operator==(const QCollection< dim > &q_collection) const
QCollection(const QTypes &...quadrature_objects)
unsigned int max_n_quadrature_points() const
void push_back(const Quadrature< dim_in > &new_quadrature)
QCollection(const QCollection< dim_in > &other)
QCollection(const Quadrature< dim_in > &quadrature)
QCollection()=default
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:38
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:39
#define DEAL_II_NOT_IMPLEMENTED()
#define DeclException0(Exception0)
#define Assert(cond, exc)
static ::ExceptionBase & ExcNoQuadrature()
static ::ExceptionBase & ExcMessage(std::string arg1)
std::size_t size
Definition mpi.cc:733
Definition hp.h:115
::VectorizedArray< Number, width > max(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)