deal.II version GIT relicensing-6842-g793a97d2aa 2026-10-02 14:00: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
scratch_data.cc
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) 2019 - 2026 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
14
15#include <memory>
16
18
19namespace MeshWorker
20{
21 template <int dim, int spacedim>
23 const Mapping<dim, spacedim> &mapping,
25 const Quadrature<dim> &quadrature,
26 const UpdateFlags &update_flags,
27 const Quadrature<dim - 1> &face_quadrature,
28 const UpdateFlags &face_update_flags)
29 : mapping(&mapping)
30 , fe(&fe)
31 , cell_quadrature(quadrature)
32 , face_quadrature(face_quadrature)
33 , hp_capability_enabled(false)
34 , cell_update_flags(update_flags)
35 , neighbor_cell_update_flags(update_flags)
36 , face_update_flags(face_update_flags)
37 , neighbor_face_update_flags(face_update_flags)
38 , local_dof_indices(fe.n_dofs_per_cell())
39 , neighbor_dof_indices(fe.n_dofs_per_cell())
40 {}
41
42
43
44 template <int dim, int spacedim>
46 const Mapping<dim, spacedim> &mapping,
48 const Quadrature<dim> &quadrature,
49 const UpdateFlags &update_flags,
50 const UpdateFlags &neighbor_update_flags,
51 const Quadrature<dim - 1> &face_quadrature,
52 const UpdateFlags &face_update_flags,
53 const UpdateFlags &neighbor_face_update_flags)
54 : mapping(&mapping)
55 , fe(&fe)
56 , cell_quadrature(quadrature)
57 , face_quadrature(face_quadrature)
58 , hp_capability_enabled(false)
59 , cell_update_flags(update_flags)
60 , neighbor_cell_update_flags(neighbor_update_flags)
61 , face_update_flags(face_update_flags)
62 , neighbor_face_update_flags(neighbor_face_update_flags)
63 , local_dof_indices(fe.n_dofs_per_cell())
64 , neighbor_dof_indices(fe.n_dofs_per_cell())
65 {}
66
67
68
69 template <int dim, int spacedim>
72 const Quadrature<dim> &quadrature,
73 const UpdateFlags &update_flags,
74 const Quadrature<dim - 1> &face_quadrature,
75 const UpdateFlags &face_update_flags)
77 fe.reference_cell().template get_default_linear_mapping<spacedim>(),
78 fe,
79 quadrature,
80 update_flags,
81 face_quadrature,
82 face_update_flags)
83 {}
84
85
86
87 template <int dim, int spacedim>
90 const Quadrature<dim> &quadrature,
91 const UpdateFlags &update_flags,
92 const UpdateFlags &neighbor_update_flags,
93 const Quadrature<dim - 1> &face_quadrature,
94 const UpdateFlags &face_update_flags,
95 const UpdateFlags &neighbor_face_update_flags)
97 fe.reference_cell().template get_default_linear_mapping<spacedim>(),
98 fe,
99 quadrature,
100 update_flags,
101 neighbor_update_flags,
102 face_quadrature,
103 face_update_flags,
104 neighbor_face_update_flags)
105 {}
106
107
108
109 template <int dim, int spacedim>
111 const hp::MappingCollection<dim, spacedim> &mapping_collection,
112 const hp::FECollection<dim, spacedim> &fe_collection,
113 const hp::QCollection<dim> &cell_quadrature_collection,
114 const UpdateFlags &cell_update_flags,
115 const hp::QCollection<dim - 1> &face_quadrature_collection,
116 const UpdateFlags &face_update_flags)
117 : mapping_collection(&mapping_collection)
118 , fe_collection(&fe_collection)
119 , cell_quadrature_collection(cell_quadrature_collection)
120 , face_quadrature_collection(face_quadrature_collection)
121 , hp_capability_enabled(true)
122 , cell_update_flags(cell_update_flags)
123 , neighbor_cell_update_flags(cell_update_flags)
124 , face_update_flags(face_update_flags)
125 , neighbor_face_update_flags(face_update_flags)
126 {
127 local_dof_indices.reserve(fe_collection.max_dofs_per_cell());
128 neighbor_dof_indices.reserve(fe_collection.max_dofs_per_cell());
129 }
130
131
132
133 template <int dim, int spacedim>
135 const hp::MappingCollection<dim, spacedim> &mapping_collection,
136 const hp::FECollection<dim, spacedim> &fe_collection,
137 const hp::QCollection<dim> &cell_quadrature_collection,
138 const UpdateFlags &cell_update_flags,
139 const UpdateFlags &neighbor_cell_update_flags,
140 const hp::QCollection<dim - 1> &face_quadrature_collection,
141 const UpdateFlags &face_update_flags,
142 const UpdateFlags &neighbor_face_update_flags)
143 : mapping_collection(&mapping_collection)
144 , fe_collection(&fe_collection)
145 , cell_quadrature_collection(cell_quadrature_collection)
146 , face_quadrature_collection(face_quadrature_collection)
147 , hp_capability_enabled(true)
148 , cell_update_flags(cell_update_flags)
149 , neighbor_cell_update_flags(neighbor_cell_update_flags)
150 , face_update_flags(face_update_flags)
151 , neighbor_face_update_flags(neighbor_face_update_flags)
152 {
153 local_dof_indices.reserve(fe_collection.max_dofs_per_cell());
154 neighbor_dof_indices.reserve(fe_collection.max_dofs_per_cell());
155 }
156
157
158
159 template <int dim, int spacedim>
161 const hp::FECollection<dim, spacedim> &fe_collection,
162 const hp::QCollection<dim> &cell_quadrature_collection,
163 const UpdateFlags &cell_update_flags,
164 const hp::QCollection<dim - 1> &face_quadrature_collection,
165 const UpdateFlags &face_update_flags)
166 : ScratchData(fe_collection.get_reference_cell_default_linear_mapping(),
167 fe_collection,
168 cell_quadrature_collection,
169 cell_update_flags,
170 face_quadrature_collection,
171 face_update_flags)
172 {}
173
174
175
176 template <int dim, int spacedim>
178 const hp::FECollection<dim, spacedim> &fe_collection,
179 const hp::QCollection<dim> &cell_quadrature_collection,
180 const UpdateFlags &cell_update_flags,
181 const UpdateFlags &neighbor_cell_update_flags,
182 const hp::QCollection<dim - 1> &face_quadrature_collection,
183 const UpdateFlags &face_update_flags,
184 const UpdateFlags &neighbor_face_update_flags)
185 : ScratchData(fe_collection.get_reference_cell_default_linear_mapping(),
186 fe_collection,
187 cell_quadrature_collection,
188 cell_update_flags,
189 neighbor_cell_update_flags,
190 face_quadrature_collection,
191 face_update_flags,
192 neighbor_face_update_flags)
193 {}
194
195
196
197 template <int dim, int spacedim>
199 const ScratchData<dim, spacedim> &scratch)
200 : mapping(scratch.mapping)
201 , fe(scratch.fe)
202 , cell_quadrature(scratch.cell_quadrature)
203 , face_quadrature(scratch.face_quadrature)
204 , mapping_collection(scratch.mapping_collection)
205 , fe_collection(scratch.fe_collection)
206 , cell_quadrature_collection(scratch.cell_quadrature_collection)
207 , face_quadrature_collection(scratch.face_quadrature_collection)
208 , hp_capability_enabled(scratch.hp_capability_enabled)
209 , cell_update_flags(scratch.cell_update_flags)
210 , neighbor_cell_update_flags(scratch.neighbor_cell_update_flags)
211 , face_update_flags(scratch.face_update_flags)
212 , neighbor_face_update_flags(scratch.neighbor_face_update_flags)
213 , local_dof_indices(scratch.local_dof_indices)
214 , neighbor_dof_indices(scratch.neighbor_dof_indices)
215 , user_data_storage(scratch.user_data_storage)
216 , internal_data_storage(scratch.internal_data_storage)
217 {}
218
219
220
221 template <int dim, int spacedim>
225 {
226 if (hp_capability_enabled == false)
227 {
228 if (!fe_values)
229 fe_values = std::make_unique<FEValues<dim, spacedim>>(
230 *mapping, *fe, cell_quadrature, cell_update_flags);
231
232 fe_values->reinit(cell);
233 local_dof_indices.resize(fe_values->dofs_per_cell);
234 cell->get_dof_indices(local_dof_indices);
235 current_fe_values = fe_values.get();
236 return *fe_values;
237 }
238 else
239 {
240 if (!hp_fe_values)
241 hp_fe_values = std::make_unique<hp::FEValues<dim, spacedim>>(
242 *mapping_collection,
243 *fe_collection,
244 cell_quadrature_collection,
245 cell_update_flags);
246
247 hp_fe_values->reinit(cell);
248 const auto &fe_values = hp_fe_values->get_present_fe_values();
249
251 (*fe_collection)[cell->active_fe_index()].n_dofs_per_cell(),
252 fe_values.dofs_per_cell);
253 local_dof_indices.resize(fe_values.dofs_per_cell);
254 cell->get_dof_indices(local_dof_indices);
255
256 current_fe_values = &fe_values;
257 return fe_values;
258 }
259 }
260
261
262
263 template <int dim, int spacedim>
267 const unsigned int face_no)
268 {
269 if (hp_capability_enabled == false)
270 {
271 if (!fe_face_values)
272 fe_face_values = std::make_unique<FEFaceValues<dim, spacedim>>(
273 *mapping, *fe, face_quadrature, face_update_flags);
274
275 fe_face_values->reinit(cell, face_no);
276 local_dof_indices.resize(fe->n_dofs_per_cell());
277 cell->get_dof_indices(local_dof_indices);
278 current_fe_values = fe_face_values.get();
279 return *fe_face_values;
280 }
281 else
282 {
283 return reinit(cell, cell, face_no);
284 }
285 }
286
287
288
289 template <int dim, int spacedim>
294 &neighbor_cell,
295 const unsigned int face_no)
296 {
297 Assert(hp_capability_enabled, ExcOnlyAvailableWithHP());
298
299 if (!hp_fe_face_values)
300 hp_fe_face_values = std::make_unique<hp::FEFaceValues<dim, spacedim>>(
301 *mapping_collection,
302 *fe_collection,
303 face_quadrature_collection,
304 face_update_flags);
305
306 if (neighbor_cell == cell)
307 {
308 hp_fe_face_values->reinit(cell, face_no);
309 }
310 else
311 {
312 // When we want to ensure some agreement between the cell face and its
313 // neighbor on the quadrature order and mapping to use on this face,
314 // then we defer to the dominance of one FE over another. This should
315 // ensure that the optimal integration order and mapping order are
316 // selected for this situation.
317 unsigned int dominated_fe_index = fe_collection->find_dominated_fe(
318 {cell->active_fe_index(), neighbor_cell->active_fe_index()});
319
320 // TODO: find_dominated_fe returns invalid_fe_index when no dominated FE
321 // has been found. We want to pass this value to FEFaceValues, but it
322 // expects an invalid_unsigned_int in this case. We need to match the
323 // interfaces in the future.
324 if (dominated_fe_index == numbers::invalid_fe_index)
325 dominated_fe_index = numbers::invalid_unsigned_int;
326
327 hp_fe_face_values->reinit(cell,
328 face_no,
329 dominated_fe_index,
330 dominated_fe_index);
331 }
332
333 const auto &fe_face_values = hp_fe_face_values->get_present_fe_values();
334 const auto &fe = (*fe_collection)[cell->active_fe_index()];
335
336 local_dof_indices.resize(fe.n_dofs_per_cell());
337 cell->get_dof_indices(local_dof_indices);
338
339 current_fe_values = &fe_face_values;
340 return fe_face_values;
341 }
342
343
344
345 template <int dim, int spacedim>
349 const unsigned int face_no,
350 const unsigned int subface_no)
351 {
352 if (subface_no != numbers::invalid_unsigned_int)
353 {
354 if (hp_capability_enabled == false)
355 {
356 if (!fe_subface_values)
357 fe_subface_values =
358 std::make_unique<FESubfaceValues<dim, spacedim>>(
359 *mapping, *fe, face_quadrature, face_update_flags);
360 fe_subface_values->reinit(cell, face_no, subface_no);
361 local_dof_indices.resize(fe->n_dofs_per_cell());
362 cell->get_dof_indices(local_dof_indices);
363
364 current_fe_values = fe_subface_values.get();
365 return *fe_subface_values;
366 }
367 else
368 {
369 return reinit(cell, cell, face_no, subface_no);
370 }
371 }
372 else
373 return reinit(cell, face_no);
374 }
375
376
377
378 template <int dim, int spacedim>
383 &neighbor_cell,
384 const unsigned int face_no,
385 const unsigned int subface_no)
386 {
387 Assert(hp_capability_enabled, ExcOnlyAvailableWithHP());
388
389 if (subface_no != numbers::invalid_unsigned_int)
390 {
391 if (!hp_fe_subface_values)
392 hp_fe_subface_values =
393 std::make_unique<hp::FESubfaceValues<dim, spacedim>>(
394 *mapping_collection,
395 *fe_collection,
396 face_quadrature_collection,
397 face_update_flags);
398
399 if (neighbor_cell == cell)
400 {
401 hp_fe_subface_values->reinit(cell, face_no, subface_no);
402 }
403 else
404 {
405 // When we want to ensure some agreement between the cell face and
406 // its neighbor on the quadrature order and mapping to use on this
407 // face, then we defer to the dominance of one FE over another. This
408 // should ensure that the optimal integration order and mapping
409 // order are selected for this situation.
410 unsigned int dominated_fe_index = fe_collection->find_dominated_fe(
411 {cell->active_fe_index(), neighbor_cell->active_fe_index()});
412
413 // TODO: find_dominated_fe returns invalid_fe_index when no
414 // dominated FE has been found. We want to pass this value to
415 // FEFaceValues, but it expects an invalid_unsigned_int in this
416 // case. We need to match the interfaces in the future.
417 if (dominated_fe_index == numbers::invalid_fe_index)
418 dominated_fe_index = numbers::invalid_unsigned_int;
419
420 hp_fe_subface_values->reinit(cell,
421 face_no,
422 subface_no,
423 dominated_fe_index,
424 dominated_fe_index);
425 }
426
427 const auto &fe_subface_values =
428 hp_fe_subface_values->get_present_fe_values();
429 const auto &fe = (*fe_collection)[cell->active_fe_index()];
430
431 local_dof_indices.resize(fe.n_dofs_per_cell());
432 cell->get_dof_indices(local_dof_indices);
433
434 current_fe_values = &fe_subface_values;
435 return fe_subface_values;
436 }
437 else
438 {
439 return reinit(cell, neighbor_cell, face_no);
440 }
441 }
442
443
444
445 template <int dim, int spacedim>
449 const unsigned int face_no,
451 &cell_neighbor,
452 const unsigned int face_no_neighbor)
453 {
454 return reinit(cell,
455 face_no,
457 cell_neighbor,
458 face_no_neighbor,
460 }
461
462
463
464 template <int dim, int spacedim>
468 const unsigned int face_no,
469 const unsigned int sub_face_no,
471 &cell_neighbor,
472 const unsigned int face_no_neighbor,
473 const unsigned int sub_face_no_neighbor)
474 {
475 if (hp_capability_enabled == false)
476 {
477 if (!interface_fe_values)
478 interface_fe_values =
479 std::make_unique<FEInterfaceValues<dim, spacedim>>(
480 *mapping, *fe, face_quadrature, face_update_flags);
481
482 interface_fe_values->reinit(cell,
483 face_no,
484 sub_face_no,
485 cell_neighbor,
486 face_no_neighbor,
487 sub_face_no_neighbor);
488 }
489 else
490 {
491 if (!interface_fe_values)
492 interface_fe_values =
493 std::make_unique<FEInterfaceValues<dim, spacedim>>(
494 *mapping_collection,
495 *fe_collection,
496 face_quadrature_collection,
497 face_update_flags);
498
499 // When we want to ensure some agreement between the cell face and
500 // its neighbor on the quadrature order and mapping to use on this
501 // face, then we defer to the dominance of one FE over another. This
502 // should ensure that the optimal integration order and mapping
503 // order are selected for this situation.
504 unsigned int dominated_fe_index = fe_collection->find_dominated_fe(
505 {cell->active_fe_index(), cell_neighbor->active_fe_index()});
506
507 // TODO: find_dominated_fe returns invalid_fe_index when no dominated FE
508 // has been found. We want to pass this value to FEFaceValues, but it
509 // expects an invalid_unsigned_int in this case. We need to match the
510 // interfaces in the future.
511 if (dominated_fe_index == numbers::invalid_fe_index)
512 dominated_fe_index = numbers::invalid_unsigned_int;
513
514 interface_fe_values->reinit(cell,
515 face_no,
516 sub_face_no,
517 cell_neighbor,
518 face_no_neighbor,
519 sub_face_no_neighbor,
520 dominated_fe_index,
521 dominated_fe_index);
522 }
523
524 current_fe_values = &interface_fe_values->get_fe_face_values(0);
525 current_neighbor_fe_values = &interface_fe_values->get_fe_face_values(1);
526
527 local_dof_indices = interface_fe_values->get_interface_dof_indices();
528 return *interface_fe_values;
529 }
530
531
532
533 template <int dim, int spacedim>
537 {
538 if (hp_capability_enabled == false)
539 {
540 if (!neighbor_fe_values)
541 neighbor_fe_values = std::make_unique<FEValues<dim, spacedim>>(
542 *mapping, *fe, cell_quadrature, neighbor_cell_update_flags);
543
544 neighbor_fe_values->reinit(cell);
545 cell->get_dof_indices(neighbor_dof_indices);
546 current_neighbor_fe_values = neighbor_fe_values.get();
547 return *neighbor_fe_values;
548 }
549 else
550 {
551 if (!neighbor_hp_fe_values)
552 neighbor_hp_fe_values = std::make_unique<hp::FEValues<dim, spacedim>>(
553 *mapping_collection,
554 *fe_collection,
555 cell_quadrature_collection,
556 neighbor_cell_update_flags);
557
558 neighbor_hp_fe_values->reinit(cell);
559 const auto &neighbor_fe_values =
560 neighbor_hp_fe_values->get_present_fe_values();
561
563 (*fe_collection)[cell->active_fe_index()].n_dofs_per_cell(),
564 neighbor_fe_values.dofs_per_cell);
565 neighbor_dof_indices.resize(neighbor_fe_values.dofs_per_cell);
566 cell->get_dof_indices(neighbor_dof_indices);
567
568 current_neighbor_fe_values = &neighbor_fe_values;
569 return neighbor_fe_values;
570 }
571 }
572
573
574
575 template <int dim, int spacedim>
579 const unsigned int face_no)
580 {
581 if (hp_capability_enabled == false)
582 {
583 if (!neighbor_fe_face_values)
584 neighbor_fe_face_values =
585 std::make_unique<FEFaceValues<dim, spacedim>>(
586 *mapping, *fe, face_quadrature, neighbor_face_update_flags);
587 neighbor_fe_face_values->reinit(cell, face_no);
588 cell->get_dof_indices(neighbor_dof_indices);
589 current_neighbor_fe_values = neighbor_fe_face_values.get();
590 return *neighbor_fe_face_values;
591 }
592 else
593 {
594 return reinit_neighbor(cell, cell, face_no);
595 }
596 }
597
598
599
600 template <int dim, int spacedim>
605 &neighbor_cell,
606 const unsigned int face_no)
607 {
608 Assert(hp_capability_enabled, ExcOnlyAvailableWithHP());
609
610 if (!neighbor_hp_fe_face_values)
611 neighbor_hp_fe_face_values =
612 std::make_unique<hp::FEFaceValues<dim, spacedim>>(
613 *mapping_collection,
614 *fe_collection,
615 face_quadrature_collection,
616 neighbor_face_update_flags);
617
618 if (neighbor_cell == cell)
619 {
620 neighbor_hp_fe_face_values->reinit(neighbor_cell, face_no);
621 }
622 else
623 {
624 // When we want to ensure some agreement between the cell face and its
625 // neighbor on the quadrature order and mapping to use on this face,
626 // then we defer to the dominance of one FE over another. This should
627 // ensure that the optimal integration order and mapping order are
628 // selected for this situation.
629 unsigned int dominated_fe_index = fe_collection->find_dominated_fe(
630 {cell->active_fe_index(), neighbor_cell->active_fe_index()});
631
632 // TODO: find_dominated_fe returns invalid_fe_index when no dominated FE
633 // has been found. We want to pass this value to FEFaceValues, but it
634 // expects an invalid_unsigned_int in this case. We need to match the
635 // interfaces in the future.
636 if (dominated_fe_index == numbers::invalid_fe_index)
637 dominated_fe_index = numbers::invalid_unsigned_int;
638
639 neighbor_hp_fe_face_values->reinit(neighbor_cell,
640 face_no,
641 dominated_fe_index,
642 dominated_fe_index);
643 }
644
645 const auto &neighbor_fe_face_values =
646 neighbor_hp_fe_face_values->get_present_fe_values();
647 const auto &neighbor_fe =
648 (*fe_collection)[neighbor_cell->active_fe_index()];
649
650 neighbor_dof_indices.resize(neighbor_fe.n_dofs_per_cell());
651 neighbor_cell->get_dof_indices(neighbor_dof_indices);
652
653 current_neighbor_fe_values = &neighbor_fe_face_values;
654 return neighbor_fe_face_values;
655 }
656
657
658
659 template <int dim, int spacedim>
663 const unsigned int face_no,
664 const unsigned int subface_no)
665 {
666 if (subface_no != numbers::invalid_unsigned_int)
667 {
668 if (hp_capability_enabled == false)
669 {
670 if (!neighbor_fe_subface_values)
671 neighbor_fe_subface_values =
672 std::make_unique<FESubfaceValues<dim, spacedim>>(
673 *mapping, *fe, face_quadrature, neighbor_face_update_flags);
674 neighbor_fe_subface_values->reinit(cell, face_no, subface_no);
675 cell->get_dof_indices(neighbor_dof_indices);
676 current_neighbor_fe_values = neighbor_fe_subface_values.get();
677 return *neighbor_fe_subface_values;
678 }
679 else
680 {
681 return reinit_neighbor(cell, cell, face_no, subface_no);
682 }
683 }
684 else
685 return reinit_neighbor(cell, face_no);
686 }
687
688
689
690 template <int dim, int spacedim>
695 &neighbor_cell,
696 const unsigned int face_no,
697 const unsigned int subface_no)
698 {
699 Assert(hp_capability_enabled, ExcOnlyAvailableWithHP());
700
701 if (subface_no != numbers::invalid_unsigned_int)
702 {
703 if (!neighbor_hp_fe_subface_values)
704 neighbor_hp_fe_subface_values =
705 std::make_unique<hp::FESubfaceValues<dim, spacedim>>(
706 *mapping_collection,
707 *fe_collection,
708 face_quadrature_collection,
709 neighbor_face_update_flags);
710
711 if (neighbor_cell == cell)
712 {
713 neighbor_hp_fe_subface_values->reinit(neighbor_cell,
714 face_no,
715 subface_no);
716 }
717 else
718 {
719 // When we want to ensure some agreement between the cell face and
720 // its neighbor on the quadrature order and mapping to use on this
721 // face, then we defer to the dominance of one FE over another. This
722 // should ensure that the optimal integration order and mapping
723 // order are selected for this situation.
724 unsigned int dominated_fe_index = fe_collection->find_dominated_fe(
725 {cell->active_fe_index(), neighbor_cell->active_fe_index()});
726
727 // TODO: find_dominated_fe returns invalid_fe_index when no
728 // dominated FE has been found. We want to pass this value to
729 // FEFaceValues, but it expects an invalid_unsigned_int in this
730 // case. We need to match the interfaces in the future.
731 if (dominated_fe_index == numbers::invalid_fe_index)
732 dominated_fe_index = numbers::invalid_unsigned_int;
733
734 neighbor_hp_fe_subface_values->reinit(neighbor_cell,
735 face_no,
736 subface_no,
737 dominated_fe_index,
738 dominated_fe_index);
739 }
740
741 const auto &neighbor_fe_subface_values =
742 neighbor_hp_fe_subface_values->get_present_fe_values();
743 const auto &neighbor_fe =
744 (*fe_collection)[neighbor_cell->active_fe_index()];
745
746 neighbor_dof_indices.resize(neighbor_fe.n_dofs_per_cell());
747 neighbor_cell->get_dof_indices(neighbor_dof_indices);
748
749 current_neighbor_fe_values = &neighbor_fe_subface_values;
750 return neighbor_fe_subface_values;
751 }
752 else
753 {
754 return reinit_neighbor(cell, neighbor_cell, face_no);
755 }
756 }
757
758
759
760 template <int dim, int spacedim>
763 {
764 Assert(current_fe_values != nullptr,
765 ExcMessage("You have to initialize the cache using one of the "
766 "reinit functions first!"));
767 return *current_fe_values;
768 }
769
770
771
772 template <int dim, int spacedim>
775 {
776 Assert(interface_fe_values != nullptr,
777 ExcMessage("You have to initialize the cache using one of the "
778 "reinit functions first!"));
779 return *interface_fe_values;
780 }
781
782
783
784 template <int dim, int spacedim>
787 {
788 Assert(current_neighbor_fe_values != nullptr,
789 ExcMessage("You have to initialize the cache using one of the "
790 "reinit functions first!"));
791 return *current_neighbor_fe_values;
792 }
793
794
795
796 template <int dim, int spacedim>
797 const std::vector<Point<spacedim>> &
799 {
800 return get_current_fe_values().get_quadrature_points();
801 }
802
803
804
805 template <int dim, int spacedim>
806 const std::vector<double> &
808 {
809 return get_current_fe_values().get_JxW_values();
810 }
811
812
813
814 template <int dim, int spacedim>
815 const std::vector<double> &
817 {
818 return get_current_neighbor_fe_values().get_JxW_values();
819 }
820
821
822
823 template <int dim, int spacedim>
824 const std::vector<Tensor<1, spacedim>> &
826 {
827 return get_current_fe_values().get_normal_vectors();
828 }
829
830
831
832 template <int dim, int spacedim>
833 const std::vector<Tensor<1, spacedim>> &
835 {
836 return get_current_neighbor_fe_values().get_normal_vectors();
837 }
838
839
840
841 template <int dim, int spacedim>
842 const std::vector<types::global_dof_index> &
844 {
845 return local_dof_indices;
846 }
847
848
849
850 template <int dim, int spacedim>
851 unsigned int
853 {
854 return local_dof_indices.size();
855 }
856
857
858
859 template <int dim, int spacedim>
860 const std::vector<types::global_dof_index> &
862 {
863 return neighbor_dof_indices;
864 }
865
866
867
868 template <int dim, int spacedim>
869 unsigned int
871 {
872 return neighbor_dof_indices.size();
873 }
874
875
876
877 template <int dim, int spacedim>
880 {
881 return user_data_storage;
882 }
883
884
885
886 template <int dim, int spacedim>
887 const GeneralDataStorage &
889 {
890 return user_data_storage;
891 }
892
893
894
895 template <int dim, int spacedim>
898 {
899 Assert(hp_capability_enabled == false, ExcOnlyAvailableWithoutHP());
900 Assert(mapping, ExcNotInitialized());
901 return *mapping;
902 }
903
904
905
906 template <int dim, int spacedim>
909 {
910 Assert(hp_capability_enabled == false, ExcOnlyAvailableWithoutHP());
912 return *fe;
913 }
914
915
916
917 template <int dim, int spacedim>
918 const Quadrature<dim> &
920 {
921 Assert(hp_capability_enabled == false, ExcOnlyAvailableWithoutHP());
922 return cell_quadrature;
923 }
924
925
926
927 template <int dim, int spacedim>
928 const Quadrature<dim - 1> &
930 {
931 Assert(hp_capability_enabled == false, ExcOnlyAvailableWithoutHP());
932 return face_quadrature;
933 }
934
935
936
937 template <int dim, int spacedim>
940 {
941 Assert(hp_capability_enabled == true, ExcOnlyAvailableWithHP());
942 Assert(mapping_collection, ExcNotInitialized());
943 return *mapping_collection;
944 }
945
946
947
948 template <int dim, int spacedim>
951 {
952 Assert(hp_capability_enabled == true, ExcOnlyAvailableWithHP());
953 Assert(fe_collection, ExcNotInitialized());
954 return *fe_collection;
955 }
956
957
958
959 template <int dim, int spacedim>
962 {
963 Assert(hp_capability_enabled == true, ExcOnlyAvailableWithHP());
964 return cell_quadrature_collection;
965 }
966
967
968
969 template <int dim, int spacedim>
970 const hp::QCollection<dim - 1> &
972 {
973 Assert(hp_capability_enabled == true, ExcOnlyAvailableWithHP());
974 return face_quadrature_collection;
975 }
976
977
978
979 template <int dim, int spacedim>
980 bool
982 {
983 return hp_capability_enabled;
984 }
985
986
987
988 template <int dim, int spacedim>
991 {
992 return cell_update_flags;
993 }
994
995
996
997 template <int dim, int spacedim>
1000 {
1001 return neighbor_cell_update_flags;
1002 }
1003
1004
1005
1006 template <int dim, int spacedim>
1009 {
1010 return face_update_flags;
1011 }
1012
1013
1014
1015 template <int dim, int spacedim>
1018 {
1019 return neighbor_face_update_flags;
1020 }
1021
1022} // namespace MeshWorker
1023
1024// Explicit instantiations
1025namespace MeshWorker
1026{
1027#include "meshworker/scratch_data.inst"
1028}
void reinit(const Triangulation< dim, spacedim > &tria)
void reinit(const TriaIterator< DoFCellAccessor< dim, spacedim, level_dof_access > > &cell, const unsigned int face_no)
void reinit(const CellIteratorType &cell, const unsigned int face_no, const unsigned int sub_face_no, const CellNeighborIteratorType &cell_neighbor, const unsigned int face_no_neighbor, const unsigned int sub_face_no_neighbor, const unsigned int q_index=numbers::invalid_unsigned_int, const unsigned int mapping_index=numbers::invalid_unsigned_int, const unsigned int fe_index=numbers::invalid_unsigned_int, const unsigned int fe_index_neighbor=numbers::invalid_unsigned_int)
void reinit(const TriaIterator< DoFCellAccessor< dim, spacedim, level_dof_access > > &cell)
Abstract base class for mapping classes.
Definition mapping.h:318
bool has_hp_capabilities() const
const hp::MappingCollection< dim, spacedim > & get_mapping_collection() const
const FEValuesBase< dim, spacedim > & get_current_fe_values() const
GeneralDataStorage & get_general_data_storage()
const Quadrature< dim - 1 > & get_face_quadrature() const
const std::vector< Tensor< 1, spacedim > > & get_neighbor_normal_vectors()
unsigned int n_dofs_per_cell() const
unsigned int n_neighbor_dofs_per_cell() const
const std::vector< double > & get_JxW_values() const
const Mapping< dim, spacedim > & get_mapping() const
const std::vector< double > & get_neighbor_JxW_values() const
ObserverPointer< const hp::FECollection< dim, spacedim > > fe_collection
const FiniteElement< dim, spacedim > & get_fe() const
const hp::QCollection< dim > & get_cell_quadrature_collection() const
std::vector< types::global_dof_index > neighbor_dof_indices
const std::vector< types::global_dof_index > & get_neighbor_dof_indices() const
UpdateFlags get_face_update_flags() const
UpdateFlags get_neighbor_cell_update_flags() const
const hp::FECollection< dim, spacedim > & get_fe_collection() const
const std::vector< Tensor< 1, spacedim > > & get_normal_vectors() const
const FEValues< dim, spacedim > & reinit_neighbor(const typename DoFHandler< dim, spacedim >::active_cell_iterator &cell)
std::vector< types::global_dof_index > local_dof_indices
const std::vector< Point< spacedim > > & get_quadrature_points() const
const FEValuesBase< dim, spacedim > & get_current_neighbor_fe_values() const
const std::vector< types::global_dof_index > & get_local_dof_indices() const
const FEInterfaceValues< dim, spacedim > & get_current_interface_fe_values() const
UpdateFlags get_cell_update_flags() const
const Quadrature< dim > & get_cell_quadrature() const
const hp::QCollection< dim - 1 > & get_face_quadrature_collection() const
ScratchData(const Mapping< dim, spacedim > &mapping, const FiniteElement< dim, spacedim > &fe, const Quadrature< dim > &quadrature, const UpdateFlags &update_flags, const Quadrature< dim - 1 > &face_quadrature=Quadrature< dim - 1 >(), const UpdateFlags &face_update_flags=update_default)
const FEValues< dim, spacedim > & reinit(const typename DoFHandler< dim, spacedim >::active_cell_iterator &cell)
UpdateFlags get_neighbor_face_update_flags() const
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:38
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:39
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
static ::ExceptionBase & ExcNotInitialized()
static ::ExceptionBase & ExcMessage(std::string arg1)
typename ActiveSelector::active_cell_iterator active_cell_iterator
UpdateFlags
const Mapping< dim, spacedim > & get_default_linear_mapping(const Triangulation< dim, spacedim > &triangulation)
Definition mapping.cc:314
constexpr unsigned int invalid_unsigned_int
Definition types.h:228
constexpr types::fe_index invalid_fe_index
Definition types.h:250