Debian Codegraph @

include/deal.II/hp/fe_values.h

raw
1 // ------------------------------------------------------------------------
2 //
3 // SPDX-License-Identifier: LGPL-2.1-or-later
4 // Copyright (C) 2004 - 2024 by the deal.II authors
5 //
6 // This file is part of the deal.II library.
7 //
8 // Part of the source code is dual licensed under Apache-2.0 WITH
9 // LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10 // governing the source code and code contributions can be found in
11 // LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12 //
13 // ------------------------------------------------------------------------
14
15 #ifndef dealii_hp_fe_values_h
16 #define dealii_hp_fe_values_h
17
18 #include <deal.II/base/config.h>
19
20 #include <deal.II/dofs/dof_handler.h>
21
22 #include <deal.II/fe/fe.h>
23 #include <deal.II/fe/fe_values.h>
24
25 #include <deal.II/grid/tria.h>
26 #include <deal.II/grid/tria_iterator.h>
27
28 #include <deal.II/hp/fe_collection.h>
29 #include <deal.II/hp/mapping_collection.h>
30 #include <deal.II/hp/q_collection.h>
31
32 #include <memory>
33
34 DEAL_II_NAMESPACE_OPEN
35
36 // Forward declaration
37 #ifndef DOXYGEN
38 template <int dim, int spacedim>
39 class FiniteElement;
40 #endif
41
42
43 namespace hp
44 {
45 /**
46 * Base class for the <tt>hp::FE*Values</tt> classes, storing the data
47 * that is common to them. The main task of this class is to provide a
48 * table where for every combination of finite element, mapping, and
49 * quadrature object from their corresponding collection objects there is
50 * a matching ::FEValues, ::FEFaceValues, or ::FESubfaceValues object.
51 *
52 * To make things more efficient, however, these FE*Values objects are only
53 * created once requested (lazy allocation). Alternatively if desired, this
54 * can be bypassed by computing all objects in advance with the corresponding
55 * precalculate_fe_values() function.
56 *
57 * The first template parameter denotes the space dimension we are in, the
58 * second the dimensionality of the object that we integrate on, i.e. for
59 * usual @p hp::FEValues it is equal to the first one, while for face
60 * integration it is one less. The third template parameter indicates the
61 * type of underlying non-hp-FE*Values base type, i.e. it could either be
62 * ::FEValues, ::FEFaceValues, or ::FESubfaceValues.
63 *
64 * @ingroup hp
65 */
66 template <int dim, int q_dim, typename FEValuesType>
67 class FEValuesBase : public EnableObserverPointer
68 {
69 public:
70 /**
71 * Constructor. Set the fields of this class to the values indicated by
72 * the parameters to the constructor.
73 */
74 FEValuesBase(
75 const MappingCollection<dim, FEValuesType::space_dimension>
76 &mapping_collection,
77 const FECollection<dim, FEValuesType::space_dimension> &fe_collection,
78 const QCollection<q_dim> &q_collection,
79 const UpdateFlags update_flags);
80
81 /**
82 * Like the above function but taking a vector of quadrature collections.
83 * For hp::FEFaceValues, the ith entry of the quadrature collections are
84 * interpreted as the face quadrature rules to be applied the ith face.
85 */
86 FEValuesBase(
87 const MappingCollection<dim, FEValuesType::space_dimension>
88 &mapping_collection,
89 const FECollection<dim, FEValuesType::space_dimension> &fe_collection,
90 const std::vector<QCollection<q_dim>> &q_collection,
91 const UpdateFlags update_flags);
92
93 /**
94 * Constructor. This constructor is equivalent to the other one except
95 * that it makes the object use a $Q_1$ mapping (i.e., an object of type
96 * MappingQ(1)) implicitly.
97 */
98 FEValuesBase(
99 const FECollection<dim, FEValuesType::space_dimension> &fe_collection,
100 const QCollection<q_dim> &q_collection,
101 const UpdateFlags update_flags);
102
103 /**
104 * Like the above function but taking a vector quadrature collections.
105 * For hp::FEFaceValues, the ith entry of the quadrature collections are
106 * interpreted as the face quadrature rules to be applied the ith face.
107 */
108 FEValuesBase(
109 const FECollection<dim, FEValuesType::space_dimension> &fe_collection,
110 const std::vector<QCollection<q_dim>> &q_collection,
111 const UpdateFlags update_flags);
112
113 /**
114 * Copy constructor.
115 */
116 FEValuesBase(const FEValuesBase<dim, q_dim, FEValuesType> &other);
117
118 /**
119 * Copy operator. While objects of this type can be copy-constructed,
120 * they cannot be copied and consequently this operator is disabled.
121 */
122 FEValuesBase &
123 operator=(const FEValuesBase &) = delete;
124
125 /**
126 * For timing purposes it may be useful to create all required FE*Values
127 * objects in advance, rather than computing them on request via lazy
128 * allocation as usual in this class.
129 *
130 * This function precalculates the FE*Values objects corresponding to the
131 * provided parameters: The total of all vector entries corresponding to the
132 * same index describes an FE*Values object similarly to select_fe_values().
133 */
134 void
135 precalculate_fe_values(const std::vector<unsigned int> &fe_indices,
136 const std::vector<unsigned int> &mapping_indices,
137 const std::vector<unsigned int> &q_indices);
138
139 /**
140 * Same as above, geared to the most common use of hp::FEValues objects in
141 * which FE, quadrature and mapping indices are similar on each individual
142 * cell.
143 *
144 * FE*Values objects are created for every FE in the FECollection, with
145 * quadrature and mapping corresponding to the same index from the
146 * QuadratureCollection and MappingCollection, respectively.
147 *
148 * If QuadratureCollection or MappingCollection contains only one object, it
149 * is used for all FE*Values objects.
150 */
151 void
152 precalculate_fe_values();
153
154 /**
155 * Get a reference to the collection of finite element objects used
156 * here.
157 */
158 const FECollection<dim, FEValuesType::space_dimension> &
159 get_fe_collection() const;
160
161 /**
162 * Get a reference to the collection of mapping objects used here.
163 */
164 const MappingCollection<dim, FEValuesType::space_dimension> &
165 get_mapping_collection() const;
166
167 /**
168 * Get a reference to the collection of quadrature objects used here.
169 */
170 const QCollection<q_dim> &
171 get_quadrature_collection() const;
172
173 /**
174 * Get the underlying update flags.
175 */
176 UpdateFlags
177 get_update_flags() const;
178
179 /**
180 * Return a reference to the @p FEValues object selected by the last
181 * call to select_fe_values(). select_fe_values() in turn is called when
182 * you called the @p reinit function of the <tt>hp::FE*Values</tt> class
183 * the last time.
184 */
185 const FEValuesType &
186 get_present_fe_values() const;
187
188 protected:
189 /**
190 * Select a FEValues object suitable for the given FE, quadrature, and
191 * mapping indices. If such an object doesn't yet exist, create one.
192 *
193 * The function returns a writable reference so that derived classes can
194 * also reinit() the selected FEValues object.
195 */
196 FEValuesType &
197 select_fe_values(const unsigned int fe_index,
198 const unsigned int mapping_index,
199 const unsigned int q_index);
200
201 protected:
202 /**
203 * A pointer to the collection of finite elements to be used.
204 */
205 const ObserverPointer<
206 const FECollection<dim, FEValuesType::space_dimension>,
207 FEValuesBase<dim, q_dim, FEValuesType>>
208 fe_collection;
209
210 /**
211 * A pointer to the collection of mappings to be used.
212 */
213 const ObserverPointer<
214 const MappingCollection<dim, FEValuesType::space_dimension>,
215 FEValuesBase<dim, q_dim, FEValuesType>>
216 mapping_collection;
217
218 /**
219 * Copy of the quadrature collection object provided to the constructor.
220 */
221 const QCollection<q_dim> q_collection;
222
223 /**
224 * Vector of quadrature collections. For hp::FEFaceValues, the ith entry of
225 * the quadrature collections are interpreted as the face quadrature rules
226 * to be applied the ith face.
227 *
228 * The variable q_collection collects the first quadrature rule of each
229 * quadrature collection of the vector.
230 */
231 const std::vector<QCollection<q_dim>> q_collections;
232
233 private:
234 /**
235 * A table in which we store pointers to fe_values objects for different
236 * finite element, mapping, and quadrature objects from our collection.
237 * The first index indicates the index of the finite element within the
238 * fe_collection, the second the index of the mapping within the mapping
239 * collection, and the last one the index of the quadrature formula
240 * within the q_collection.
241 *
242 * Initially, all entries have zero pointers, and we will allocate them
243 * lazily as needed in select_fe_values() or precalculate_fe_values().
244 */
245 Table<3, std::unique_ptr<FEValuesType>> fe_values_table;
246
247 /**
248 * Set of indices pointing at the fe_values object selected last time
249 * the select_fe_value() function was called.
250 */
251 TableIndices<3> present_fe_values_index;
252
253 /**
254 * Values of the update flags as given to the constructor.
255 */
256 const UpdateFlags update_flags;
257 };
258
259 } // namespace hp
260
261
262 namespace hp
263 {
264 /**
265 * An hp-equivalent of the ::FEValues class. See the step-27 tutorial
266 * program for examples of use.
267 *
268 * The idea of this class is as follows: when one assembled matrices in the
269 * hp-finite element method, there may be different finite elements on
270 * different cells, and consequently one may also want to use different
271 * quadrature formulas for different cells. On the other hand, the
272 * ::FEValues efficiently handles pre-evaluating whatever information is
273 * necessary for a single finite element and quadrature object. This class
274 * brings these concepts together: it provides a "collection" of ::FEValues
275 * objects.
276 *
277 * Upon construction, one passes not one finite element and quadrature
278 * object (and possible a mapping), but a whole collection of type
279 * hp::FECollection and hp::QCollection. Later on, when one sits on a
280 * concrete cell, one would call the reinit() function for this particular
281 * cell, just as one does for a regular ::FEValues object. The difference is
282 * that this time, the reinit() function looks up the active FE index of
283 * that cell, if necessary creates a ::FEValues object that matches the
284 * finite element and quadrature formulas with that particular index in
285 * their collections, and then re-initializes it for the current cell. The
286 * ::FEValues object that then fits the finite element and quadrature
287 * formula for the current cell can then be accessed using the
288 * get_present_fe_values() function, and one would work with it just like
289 * with any ::FEValues object for non-hp-DoFHandler objects.
290 *
291 * The reinit() functions have additional arguments with default values. If
292 * not specified, the function takes the index into the hp::FECollection,
293 * hp::QCollection, and hp::MappingCollection objects from the
294 * active FE index of the cell, as explained above. However, one can also
295 * select different indices for a current cell. For example, by specifying a
296 * different index into the hp::QCollection class, one does not need to sort
297 * the quadrature objects in the quadrature collection so that they match
298 * one-to-one the order of finite element objects in the FE collection (even
299 * though choosing such an order is certainly convenient).
300 *
301 * Note that ::FEValues objects are created on the fly, i.e. only as they
302 * are needed. This ensures that we do not create objects for every
303 * combination of finite element, quadrature formula and mapping, but only
304 * those that will actually be needed. Alternatively if desired, this
305 * can be bypassed by computing all objects in advance with the corresponding
306 * hp::FEValuesBase::precalculate_fe_values() function.
307 *
308 * This class has not yet been implemented for the use in the codimension
309 * one case (<tt>spacedim != dim </tt>).
310 *
311 * @ingroup hp hpcollection
312 */
313 template <int dim, int spacedim = dim>
314 class FEValues
315 : public hp::FEValuesBase<dim, dim, dealii::FEValues<dim, spacedim>>
316 {
317 public:
318 static constexpr unsigned int dimension = dim;
319
320 static constexpr unsigned int space_dimension = spacedim;
321
322 /**
323 * Constructor. Initialize this object with the given parameters.
324 */
325 FEValues(const MappingCollection<dim, spacedim> &mapping_collection,
326 const FECollection<dim, spacedim> &fe_collection,
327 const QCollection<dim> &q_collection,
328 const UpdateFlags update_flags);
329
330
331 /**
332 * Constructor. This constructor is equivalent to the other one except
333 * that it makes the object use a $Q_1$ mapping (i.e., an object of type
334 * MappingQ(1)) implicitly.
335 */
336 FEValues(const FECollection<dim, spacedim> &fe_collection,
337 const QCollection<dim> &q_collection,
338 const UpdateFlags update_flags);
339
340
341 /**
342 * Reinitialize the object for the given cell.
343 *
344 * After the call, you can get an FEValues object using the
345 * get_present_fe_values() function that corresponds to the present cell.
346 * For this FEValues object, we use the additional arguments described
347 * below to determine which finite element, mapping, and quadrature
348 * formula to use. They are order in such a way that the arguments one may
349 * want to change most frequently come first. The rules for these
350 * arguments are as follows:
351 *
352 * If the @p fe_index argument to this function is left at its default
353 * value, then we use that finite element within the hp::FECollection
354 * passed to the constructor of this class with index given by
355 * <code>cell-@>active_fe_index()</code>. Consequently, the
356 * hp::FECollection argument given to this object should really be the
357 * same as that used in the construction of the DoFHandler associated
358 * with the present cell. On the other hand, if a value is given for this
359 * argument, it overrides the choice of
360 * <code>cell-@>active_fe_index()</code>.
361 *
362 * If the @p q_index argument is left at its default value, then we use
363 * that quadrature formula within the hp::QCollection passed to the
364 * constructor of this class with index given by
365 * <code>cell-@>active_fe_index()</code>, i.e. the same index as that of
366 * the finite element. In this case, there should be a corresponding
367 * quadrature formula for each finite element in the hp::FECollection. As
368 * a special case, if the quadrature collection contains only a single
369 * element (a frequent case if one wants to use the same quadrature object
370 * for all finite elements in an hp-discretization, even if that may not
371 * be the most efficient), then this single quadrature is used unless a
372 * different value for this argument is specified. On the other hand, if a
373 * value is given for this argument, it overrides the choice of
374 * <code>cell-@>active_fe_index()</code> or the choice for the single
375 * quadrature.
376 *
377 * If the @p mapping_index argument is left at its default value, then we
378 * use that mapping object within the hp::MappingCollection passed to the
379 * constructor of this class with index given by
380 * <code>cell-@>active_fe_index()</code>, i.e. the same index as that of
381 * the finite element. As above, if the mapping collection contains only a
382 * single element (a frequent case if one wants to use a $Q_1$ mapping for
383 * all finite elements in an hp-discretization), then this single mapping
384 * is used unless a different value for this argument is specified.
385 */
386 template <bool lda>
387 void
388 reinit(const TriaIterator<DoFCellAccessor<dim, spacedim, lda>> &cell,
389 const unsigned int q_index = numbers::invalid_unsigned_int,
390 const unsigned int mapping_index = numbers::invalid_unsigned_int,
391 const unsigned int fe_index = numbers::invalid_unsigned_int);
392
393 /**
394 * Like the previous function, but for non-DoFHandler iterators. The reason
395 * this function exists is so that one can use hp::FEValues for
396 * Triangulation objects too.
397 *
398 * Since <code>cell-@>active_fe_index()</code> doesn't make sense for
399 * triangulation iterators, this function chooses the zero-th finite
400 * element, mapping, and quadrature object from the relevant constructions
401 * passed to the constructor of this object. The only exception is if you
402 * specify a value different from the default value for any of these last
403 * three arguments.
404 */
405 void
406 reinit(const typename Triangulation<dim, spacedim>::cell_iterator &cell,
407 const unsigned int q_index = numbers::invalid_unsigned_int,
408 const unsigned int mapping_index = numbers::invalid_unsigned_int,
409 const unsigned int fe_index = numbers::invalid_unsigned_int);
410 };
411
412
413
414 /**
415 * This is the equivalent of the hp::FEValues class but for face
416 * integrations, i.e. it is to hp::FEValues what ::FEFaceValues is to
417 * ::FEValues.
418 *
419 * The same comments apply as in the documentation of the hp::FEValues
420 * class. However, it is important to note that it is here more common that
421 * one would want to explicitly specify an index to a particular quadrature
422 * formula in the reinit() functions. This is because the default index
423 * corresponds to the finite element index on the current function. On the
424 * other hand, integration on faces will typically have to happen with a
425 * quadrature formula that is adjusted to the finite elements used on both
426 * sides of a face. If one sorts the elements of the hp::FECollection with
427 * ascending polynomial degree, and matches these finite elements with
428 * corresponding quadrature formulas in the hp::QCollection passed to the
429 * constructor, then the quadrature index passed to the reinit() function
430 * should typically be something like <code>std::max
431 * (cell-@>active_fe_index(), neighbor-@>active_fe_index()</code> to ensure
432 * that a quadrature formula is chosen that is sufficiently accurate for
433 * <em>both</em> finite elements.
434 *
435 * @ingroup hp hpcollection
436 */
437 template <int dim, int spacedim = dim>
438 class FEFaceValues
439 : public hp::FEValuesBase<dim, dim - 1, dealii::FEFaceValues<dim, spacedim>>
440 {
441 public:
442 /**
443 * Constructor. Initialize this object with the given parameters.
444 */
445 FEFaceValues(const hp::MappingCollection<dim, spacedim> &mapping_collection,
446 const hp::FECollection<dim, spacedim> &fe_collection,
447 const hp::QCollection<dim - 1> &q_collection,
448 const UpdateFlags update_flags);
449
450 /**
451 * Like the function above, but taking a vector of collection of quadrature
452 * rules. This allows to assign each face a different quadrature rule: the
453 * ith entry of a collection is used as the face quadrature rule on the ith
454 * face.
455 *
456 * In the case that the collections only contains a single face quadrature,
457 * this quadrature rule is use on all faces.
458 */
459 FEFaceValues(const hp::MappingCollection<dim, spacedim> &mapping_collection,
460 const hp::FECollection<dim, spacedim> &fe_collection,
461 const std::vector<hp::QCollection<dim - 1>> &q_collections,
462 const UpdateFlags update_flags);
463
464
465 /**
466 * Constructor. This constructor is equivalent to the other one except
467 * that it makes the object use a $Q_1$ mapping (i.e., an object of type
468 * MappingQ(1)) implicitly.
469 */
470 FEFaceValues(const hp::FECollection<dim, spacedim> &fe_collection,
471 const hp::QCollection<dim - 1> &q_collection,
472 const UpdateFlags update_flags);
473
474 /**
475 * Like the function above, but taking a vector of collection of quadrature
476 * rules. This allows to assign each face a different quadrature rule: the
477 * ith entry of a collection is used as the face quadrature rule on the ith
478 * face.
479 *
480 * In the case that the collections only contains a single face quadrature,
481 * this quadrature rule is use on all faces.
482 */
483 FEFaceValues(const hp::FECollection<dim, spacedim> &fe_collection,
484 const std::vector<hp::QCollection<dim - 1>> &q_collections,
485 const UpdateFlags update_flags);
486
487 /**
488 * Reinitialize the object for the given cell and face.
489 *
490 * After the call, you can get an FEFaceValues object using the
491 * get_present_fe_values() function that corresponds to the present cell.
492 * For this FEFaceValues object, we use the additional arguments described
493 * below to determine which finite element, mapping, and quadrature
494 * formula to use. They are order in such a way that the arguments one may
495 * want to change most frequently come first. The rules for these
496 * arguments are as follows:
497 *
498 * If the @p fe_index argument to this function is left at its default
499 * value, then we use that finite element within the hp::FECollection
500 * passed to the constructor of this class with index given by
501 * <code>cell-@>active_fe_index()</code>. Consequently, the
502 * hp::FECollection argument given to this object should really be the
503 * same as that used in the construction of the DoFHandler associated
504 * with the present cell. On the other hand, if a value is given for this
505 * argument, it overrides the choice of
506 * <code>cell-@>active_fe_index()</code>. (This may or may not be very
507 * useful: If you are using a specific finite element on the current cell,
508 * why would you want to reinit() an object of the current type with a
509 * *different* finite element?)
510 *
511 * If the @p q_index argument is left at its default value, then we use
512 * that quadrature formula within the hp::QCollection passed to the
513 * constructor of this class with index given by
514 * <code>cell-@>active_fe_index()</code>, i.e. the same index as that of
515 * the finite element. In this case, there should be a corresponding
516 * quadrature formula for each finite element in the hp::FECollection. As
517 * a special case, if the quadrature collection contains only a single
518 * element (a frequent case if one wants to use the same quadrature object
519 * for all finite elements in an hp-discretization, even if that may not
520 * be the most efficient), then this single quadrature is used unless a
521 * different value for this argument is specified. On the other hand, if a
522 * value is given for this argument, it overrides the choice of
523 * <code>cell-@>active_fe_index()</code> or the choice for the single
524 * quadrature.
525 *
526 * If the @p mapping_index argument is left at its default value, then we
527 * use that mapping object within the hp::MappingCollection passed to the
528 * constructor of this class with index given by
529 * <code>cell-@>active_fe_index()</code>, i.e. the same index as that of
530 * the finite element. As above, if the mapping collection contains only a
531 * single element (a frequent case if one wants to use a $Q_1$ mapping for
532 * all finite elements in an hp-discretization), then this single mapping
533 * is used unless a different value for this argument is specified.
534 */
535 template <bool lda>
536 void
537 reinit(const TriaIterator<DoFCellAccessor<dim, spacedim, lda>> &cell,
538 const unsigned int face_no,
539 const unsigned int q_index = numbers::invalid_unsigned_int,
540 const unsigned int mapping_index = numbers::invalid_unsigned_int,
541 const unsigned int fe_index = numbers::invalid_unsigned_int);
542
543 /**
544 * Reinitialize the object for the given cell and face.
545 *
546 * @note @p face must be one of @p cell's face iterators.
547 */
548 template <bool lda>
549 void
550 reinit(const TriaIterator<DoFCellAccessor<dim, spacedim, lda>> &cell,
551 const typename Triangulation<dim, spacedim>::face_iterator &face,
552 const unsigned int q_index = numbers::invalid_unsigned_int,
553 const unsigned int mapping_index = numbers::invalid_unsigned_int,
554 const unsigned int fe_index = numbers::invalid_unsigned_int);
555
556 /**
557 * Like the previous function, but for non-DoFHandler iterators. The reason
558 * this function exists is so that one can use this class for
559 * Triangulation objects too.
560 *
561 * Since <code>cell-@>active_fe_index()</code> doesn't make sense for
562 * triangulation iterators, this function chooses the zero-th finite
563 * element, mapping, and quadrature object from the relevant constructions
564 * passed to the constructor of this object. The only exception is if you
565 * specify a value different from the default value for any of these last
566 * three arguments.
567 */
568 void
569 reinit(const typename Triangulation<dim, spacedim>::cell_iterator &cell,
570 const unsigned int face_no,
571 const unsigned int q_index = numbers::invalid_unsigned_int,
572 const unsigned int mapping_index = numbers::invalid_unsigned_int,
573 const unsigned int fe_index = numbers::invalid_unsigned_int);
574
575 /**
576 * Reinitialize the object for the given cell and face.
577 *
578 * @note @p face must be one of @p cell's face iterators.
579 */
580 void
581 reinit(const typename Triangulation<dim, spacedim>::cell_iterator &cell,
582 const typename Triangulation<dim, spacedim>::face_iterator &face,
583 const unsigned int q_index = numbers::invalid_unsigned_int,
584 const unsigned int mapping_index = numbers::invalid_unsigned_int,
585 const unsigned int fe_index = numbers::invalid_unsigned_int);
586 };
587
588
589
590 /**
591 * This class implements for subfaces what hp::FEFaceValues does for faces.
592 * See there for further documentation.
593 *
594 * @ingroup hp hpcollection
595 */
596 template <int dim, int spacedim = dim>
597 class FESubfaceValues
598 : public hp::
599 FEValuesBase<dim, dim - 1, dealii::FESubfaceValues<dim, spacedim>>
600 {
601 public:
602 /**
603 * Constructor. Initialize this object with the given parameters.
604 */
605 FESubfaceValues(
606 const hp::MappingCollection<dim, spacedim> &mapping_collection,
607 const hp::FECollection<dim, spacedim> &fe_collection,
608 const hp::QCollection<dim - 1> &q_collection,
609 const UpdateFlags update_flags);
610
611
612 /**
613 * Constructor. This constructor is equivalent to the other one except
614 * that it makes the object use a $Q_1$ mapping (i.e., an object of type
615 * MappingQ(1)) implicitly.
616 */
617 FESubfaceValues(const hp::FECollection<dim, spacedim> &fe_collection,
618 const hp::QCollection<dim - 1> &q_collection,
619 const UpdateFlags update_flags);
620
621 /**
622 * Reinitialize the object for the given cell, face, and subface.
623 *
624 * After the call, you can get an FESubfaceValues object using the
625 * get_present_fe_values() function that corresponds to the present cell.
626 * For this FESubfaceValues object, we use the additional arguments
627 * described below to determine which finite element, mapping, and
628 * quadrature formula to use. They are order in such a way that the
629 * arguments one may want to change most frequently come first. The rules
630 * for these arguments are as follows:
631 *
632 * If the @p q_index argument is left at its default value, then we use
633 * that quadrature formula within the hp::QCollection passed to the
634 * constructor of this class with index given by
635 * <code>cell-@>active_fe_index()</code>, i.e. the same index as that of
636 * the finite element. In this case, there should be a corresponding
637 * quadrature formula for each finite element in the hp::FECollection. As
638 * a special case, if the quadrature collection contains only a single
639 * element (a frequent case if one wants to use the same quadrature object
640 * for all finite elements in an hp-discretization, even if that may not
641 * be the most efficient), then this single quadrature is used unless a
642 * different value for this argument is specified. On the other hand, if a
643 * value is given for this argument, it overrides the choice of
644 * <code>cell-@>active_fe_index()</code> or the choice for the single
645 * quadrature.
646 *
647 * If the @p mapping_index argument is left at its default value, then we
648 * use that mapping object within the hp::MappingCollection passed to the
649 * constructor of this class with index given by
650 * <code>cell-@>active_fe_index()</code>, i.e. the same index as that of
651 * the finite element. As above, if the mapping collection contains only a
652 * single element (a frequent case if one wants to use a $Q_1$ mapping for
653 * all finite elements in an hp-discretization), then this single mapping
654 * is used unless a different value for this argument is specified.
655 */
656 template <bool lda>
657 void
658 reinit(const TriaIterator<DoFCellAccessor<dim, spacedim, lda>> &cell,
659 const unsigned int face_no,
660 const unsigned int subface_no,
661 const unsigned int q_index = numbers::invalid_unsigned_int,
662 const unsigned int mapping_index = numbers::invalid_unsigned_int,
663 const unsigned int fe_index = numbers::invalid_unsigned_int);
664
665 /**
666 * Like the previous function, but for non-DoFHandler iterators. The reason
667 * this function exists is so that one can use this class for
668 * Triangulation objects too.
669 *
670 * Since <code>cell-@>active_fe_index()</code> doesn't make sense for
671 * Triangulation iterators, this function chooses the zero-th finite
672 * element, mapping, and quadrature object from the relevant constructions
673 * passed to the constructor of this object. The only exception is if you
674 * specify a value different from the default value for any of these last
675 * three arguments.
676 */
677 void
678 reinit(const typename Triangulation<dim, spacedim>::cell_iterator &cell,
679 const unsigned int face_no,
680 const unsigned int subface_no,
681 const unsigned int q_index = numbers::invalid_unsigned_int,
682 const unsigned int mapping_index = numbers::invalid_unsigned_int,
683 const unsigned int fe_index = numbers::invalid_unsigned_int);
684 };
685
686 } // namespace hp
687
688
689 // -------------- inline and template functions --------------
690
691 namespace hp
692 {
693 template <int dim, int q_dim, typename FEValuesType>
694 inline const FEValuesType &
695 FEValuesBase<dim, q_dim, FEValuesType>::get_present_fe_values() const
696 {
697 Assert(
698 present_fe_values_index != TableIndices<3>(numbers::invalid_unsigned_int,
699 numbers::invalid_unsigned_int,
700 numbers::invalid_unsigned_int),
701 ExcMessage(
702 "The indices of the present FEValues object are all invalid. The reason"
703 " is likely that you have forgotten to call the reinit() function."));
704
705 return *fe_values_table(present_fe_values_index);
706 }
707
708
709
710 template <int dim, int q_dim, typename FEValuesType>
711 inline const FECollection<dim, FEValuesType::space_dimension> &
712 FEValuesBase<dim, q_dim, FEValuesType>::get_fe_collection() const
713 {
714 return *fe_collection;
715 }
716
717
718
719 template <int dim, int q_dim, typename FEValuesType>
720 inline const MappingCollection<dim, FEValuesType::space_dimension> &
721 FEValuesBase<dim, q_dim, FEValuesType>::get_mapping_collection() const
722 {
723 return *mapping_collection;
724 }
725
726
727
728 template <int dim, int q_dim, typename FEValuesType>
729 inline const QCollection<q_dim> &
730 FEValuesBase<dim, q_dim, FEValuesType>::get_quadrature_collection() const
731 {
732 return q_collection;
733 }
734
735
736
737 template <int dim, int q_dim, typename FEValuesType>
738 inline UpdateFlags
739 FEValuesBase<dim, q_dim, FEValuesType>::get_update_flags() const
740 {
741 return update_flags;
742 }
743 } // namespace hp
744
745 DEAL_II_NAMESPACE_CLOSE
746
747 #endif