21 template <
int dim,
int spacedim>
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())
44 template <
int dim,
int spacedim>
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())
69 template <
int dim,
int spacedim>
87 template <
int dim,
int spacedim>
101 neighbor_update_flags,
104 neighbor_face_update_flags)
109 template <
int dim,
int spacedim>
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)
133 template <
int dim,
int spacedim>
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)
159 template <
int dim,
int spacedim>
166 :
ScratchData(fe_collection.get_reference_cell_default_linear_mapping(),
168 cell_quadrature_collection,
170 face_quadrature_collection,
176 template <
int dim,
int spacedim>
185 :
ScratchData(fe_collection.get_reference_cell_default_linear_mapping(),
187 cell_quadrature_collection,
189 neighbor_cell_update_flags,
190 face_quadrature_collection,
192 neighbor_face_update_flags)
197 template <
int dim,
int spacedim>
200 : mapping(scratch.mapping)
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)
221 template <
int dim,
int spacedim>
226 if (hp_capability_enabled ==
false)
229 fe_values = std::make_unique<FEValues<dim, spacedim>>(
230 *mapping, *fe, cell_quadrature, cell_update_flags);
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();
241 hp_fe_values = std::make_unique<hp::FEValues<dim, spacedim>>(
244 cell_quadrature_collection,
247 hp_fe_values->
reinit(cell);
248 const auto &fe_values = hp_fe_values->get_present_fe_values();
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);
256 current_fe_values = &fe_values;
263 template <
int dim,
int spacedim>
267 const unsigned int face_no)
269 if (hp_capability_enabled ==
false)
272 fe_face_values = std::make_unique<FEFaceValues<dim, spacedim>>(
273 *mapping, *fe, face_quadrature, face_update_flags);
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;
283 return reinit(cell, cell, face_no);
289 template <
int dim,
int spacedim>
295 const unsigned int face_no)
297 Assert(hp_capability_enabled, ExcOnlyAvailableWithHP());
299 if (!hp_fe_face_values)
300 hp_fe_face_values = std::make_unique<hp::FEFaceValues<dim, spacedim>>(
303 face_quadrature_collection,
306 if (neighbor_cell == cell)
308 hp_fe_face_values->reinit(cell, face_no);
317 unsigned int dominated_fe_index = fe_collection->find_dominated_fe(
318 {cell->active_fe_index(), neighbor_cell->active_fe_index()});
327 hp_fe_face_values->reinit(cell,
333 const auto &fe_face_values = hp_fe_face_values->get_present_fe_values();
334 const auto &fe = (*fe_collection)[cell->active_fe_index()];
336 local_dof_indices.resize(fe.n_dofs_per_cell());
337 cell->get_dof_indices(local_dof_indices);
339 current_fe_values = &fe_face_values;
340 return fe_face_values;
345 template <
int dim,
int spacedim>
349 const unsigned int face_no,
350 const unsigned int subface_no)
354 if (hp_capability_enabled ==
false)
356 if (!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);
364 current_fe_values = fe_subface_values.get();
365 return *fe_subface_values;
369 return reinit(cell, cell, face_no, subface_no);
373 return reinit(cell, face_no);
378 template <
int dim,
int spacedim>
384 const unsigned int face_no,
385 const unsigned int subface_no)
387 Assert(hp_capability_enabled, ExcOnlyAvailableWithHP());
391 if (!hp_fe_subface_values)
392 hp_fe_subface_values =
393 std::make_unique<hp::FESubfaceValues<dim, spacedim>>(
396 face_quadrature_collection,
399 if (neighbor_cell == cell)
401 hp_fe_subface_values->reinit(cell, face_no, subface_no);
410 unsigned int dominated_fe_index = fe_collection->find_dominated_fe(
411 {cell->active_fe_index(), neighbor_cell->active_fe_index()});
420 hp_fe_subface_values->reinit(cell,
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()];
431 local_dof_indices.resize(fe.n_dofs_per_cell());
432 cell->get_dof_indices(local_dof_indices);
434 current_fe_values = &fe_subface_values;
435 return fe_subface_values;
439 return reinit(cell, neighbor_cell, face_no);
445 template <
int dim,
int spacedim>
449 const unsigned int face_no,
452 const unsigned int face_no_neighbor)
464 template <
int dim,
int spacedim>
468 const unsigned int face_no,
469 const unsigned int sub_face_no,
472 const unsigned int face_no_neighbor,
473 const unsigned int sub_face_no_neighbor)
475 if (hp_capability_enabled ==
false)
477 if (!interface_fe_values)
478 interface_fe_values =
479 std::make_unique<FEInterfaceValues<dim, spacedim>>(
480 *mapping, *fe, face_quadrature, face_update_flags);
482 interface_fe_values->
reinit(cell,
487 sub_face_no_neighbor);
491 if (!interface_fe_values)
492 interface_fe_values =
493 std::make_unique<FEInterfaceValues<dim, spacedim>>(
496 face_quadrature_collection,
504 unsigned int dominated_fe_index = fe_collection->find_dominated_fe(
505 {cell->active_fe_index(), cell_neighbor->active_fe_index()});
514 interface_fe_values->reinit(cell,
519 sub_face_no_neighbor,
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);
527 local_dof_indices = interface_fe_values->get_interface_dof_indices();
528 return *interface_fe_values;
533 template <
int dim,
int spacedim>
538 if (hp_capability_enabled ==
false)
540 if (!neighbor_fe_values)
541 neighbor_fe_values = std::make_unique<FEValues<dim, spacedim>>(
542 *mapping, *fe, cell_quadrature, neighbor_cell_update_flags);
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;
551 if (!neighbor_hp_fe_values)
552 neighbor_hp_fe_values = std::make_unique<hp::FEValues<dim, spacedim>>(
555 cell_quadrature_collection,
556 neighbor_cell_update_flags);
558 neighbor_hp_fe_values->
reinit(cell);
559 const auto &neighbor_fe_values =
560 neighbor_hp_fe_values->get_present_fe_values();
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);
568 current_neighbor_fe_values = &neighbor_fe_values;
569 return neighbor_fe_values;
575 template <
int dim,
int spacedim>
579 const unsigned int face_no)
581 if (hp_capability_enabled ==
false)
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;
594 return reinit_neighbor(cell, cell, face_no);
600 template <
int dim,
int spacedim>
606 const unsigned int face_no)
608 Assert(hp_capability_enabled, ExcOnlyAvailableWithHP());
610 if (!neighbor_hp_fe_face_values)
611 neighbor_hp_fe_face_values =
612 std::make_unique<hp::FEFaceValues<dim, spacedim>>(
615 face_quadrature_collection,
616 neighbor_face_update_flags);
618 if (neighbor_cell == cell)
620 neighbor_hp_fe_face_values->reinit(neighbor_cell, face_no);
629 unsigned int dominated_fe_index = fe_collection->find_dominated_fe(
630 {cell->active_fe_index(), neighbor_cell->active_fe_index()});
639 neighbor_hp_fe_face_values->reinit(neighbor_cell,
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()];
650 neighbor_dof_indices.resize(neighbor_fe.n_dofs_per_cell());
651 neighbor_cell->get_dof_indices(neighbor_dof_indices);
653 current_neighbor_fe_values = &neighbor_fe_face_values;
654 return neighbor_fe_face_values;
659 template <
int dim,
int spacedim>
663 const unsigned int face_no,
664 const unsigned int subface_no)
668 if (hp_capability_enabled ==
false)
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;
681 return reinit_neighbor(cell, cell, face_no, subface_no);
685 return reinit_neighbor(cell, face_no);
690 template <
int dim,
int spacedim>
696 const unsigned int face_no,
697 const unsigned int subface_no)
699 Assert(hp_capability_enabled, ExcOnlyAvailableWithHP());
703 if (!neighbor_hp_fe_subface_values)
704 neighbor_hp_fe_subface_values =
705 std::make_unique<hp::FESubfaceValues<dim, spacedim>>(
708 face_quadrature_collection,
709 neighbor_face_update_flags);
711 if (neighbor_cell == cell)
713 neighbor_hp_fe_subface_values->reinit(neighbor_cell,
724 unsigned int dominated_fe_index = fe_collection->find_dominated_fe(
725 {cell->active_fe_index(), neighbor_cell->active_fe_index()});
734 neighbor_hp_fe_subface_values->reinit(neighbor_cell,
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()];
746 neighbor_dof_indices.resize(neighbor_fe.n_dofs_per_cell());
747 neighbor_cell->get_dof_indices(neighbor_dof_indices);
749 current_neighbor_fe_values = &neighbor_fe_subface_values;
750 return neighbor_fe_subface_values;
754 return reinit_neighbor(cell, neighbor_cell, face_no);
760 template <
int dim,
int spacedim>
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;
772 template <
int dim,
int spacedim>
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;
784 template <
int dim,
int spacedim>
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;
796 template <
int dim,
int spacedim>
797 const std::vector<Point<spacedim>> &
800 return get_current_fe_values().get_quadrature_points();
805 template <
int dim,
int spacedim>
806 const std::vector<double> &
809 return get_current_fe_values().get_JxW_values();
814 template <
int dim,
int spacedim>
815 const std::vector<double> &
818 return get_current_neighbor_fe_values().get_JxW_values();
823 template <
int dim,
int spacedim>
824 const std::vector<Tensor<1, spacedim>> &
827 return get_current_fe_values().get_normal_vectors();
832 template <
int dim,
int spacedim>
833 const std::vector<Tensor<1, spacedim>> &
836 return get_current_neighbor_fe_values().get_normal_vectors();
841 template <
int dim,
int spacedim>
842 const std::vector<types::global_dof_index> &
845 return local_dof_indices;
850 template <
int dim,
int spacedim>
854 return local_dof_indices.size();
859 template <
int dim,
int spacedim>
860 const std::vector<types::global_dof_index> &
863 return neighbor_dof_indices;
868 template <
int dim,
int spacedim>
872 return neighbor_dof_indices.size();
877 template <
int dim,
int spacedim>
881 return user_data_storage;
886 template <
int dim,
int spacedim>
890 return user_data_storage;
895 template <
int dim,
int spacedim>
899 Assert(hp_capability_enabled ==
false, ExcOnlyAvailableWithoutHP());
906 template <
int dim,
int spacedim>
910 Assert(hp_capability_enabled ==
false, ExcOnlyAvailableWithoutHP());
917 template <
int dim,
int spacedim>
921 Assert(hp_capability_enabled ==
false, ExcOnlyAvailableWithoutHP());
922 return cell_quadrature;
927 template <
int dim,
int spacedim>
931 Assert(hp_capability_enabled ==
false, ExcOnlyAvailableWithoutHP());
932 return face_quadrature;
937 template <
int dim,
int spacedim>
941 Assert(hp_capability_enabled ==
true, ExcOnlyAvailableWithHP());
943 return *mapping_collection;
948 template <
int dim,
int spacedim>
952 Assert(hp_capability_enabled ==
true, ExcOnlyAvailableWithHP());
954 return *fe_collection;
959 template <
int dim,
int spacedim>
963 Assert(hp_capability_enabled ==
true, ExcOnlyAvailableWithHP());
964 return cell_quadrature_collection;
969 template <
int dim,
int spacedim>
973 Assert(hp_capability_enabled ==
true, ExcOnlyAvailableWithHP());
974 return face_quadrature_collection;
979 template <
int dim,
int spacedim>
983 return hp_capability_enabled;
988 template <
int dim,
int spacedim>
992 return cell_update_flags;
997 template <
int dim,
int spacedim>
1001 return neighbor_cell_update_flags;
1006 template <
int dim,
int spacedim>
1010 return face_update_flags;
1015 template <
int dim,
int spacedim>
1019 return neighbor_face_update_flags;
1027#include "meshworker/scratch_data.inst"
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.
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
#define DEAL_II_NAMESPACE_CLOSE
#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
const Mapping< dim, spacedim > & get_default_linear_mapping(const Triangulation< dim, spacedim > &triangulation)
constexpr unsigned int invalid_unsigned_int
constexpr types::fe_index invalid_fe_index